You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
6.4 KiB
Vue

<template>
<view class="page-raw-receipt">
<view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }">
<view class="left">
<u-icon class="icon" name="arrow-left" @click="uni.navigateBack({})" />
</view>
<view class="title">{{ $t('message.ImportPO') }}</view>
<view class="right"></view>
</view>
<view class="content">
<view class="single">
<view class="single-left">
<view>{{ $t('message.container') }}</view>
<u-search :placeholder="$t('message.Commission_tips1')" v-model.trim="containerCode" @search="query" :show-action="false"></u-search>
</view>
<view class="single-right">
<u-button type="primary" @click="query">{{ $t('message.Query') }}</u-button>
</view>
</view>
<view class="library">
<view class="library-left">
<view>{{ $t('message.CommissionedLocation') }}</view>
<jPicker sureColor="#ff0000" style="width: 230rpx" @bindpicker="LocationChoice" showKey="value" valKey="value" :val="wl.value" class="search" :options="Location" />
</view>
</view>
<view class="WPM-total">{{ $t('message.WPM') }} {{ total }} {{ $t('message.WPMtotal') }}</view>
<uni-segmented-control :current="current" :values="items" @click-item="onClickItem" styleType="button" activeColor="#007aff"></uni-segmented-control>
<view v-show="current === 0">
<wyb-table class="table" ref="table" width="100%" show-left-and-right-border :headers="ImportPOReceiveListHeaders" :contents="model.ImportPOReceiveList" :show-vert-border="false"></wyb-table>
</view>
<view v-show="current === 1">
<wyb-table class="table" ref="table" width="100%" show-left-and-right-border :headers="containerListHeaders" :contents="model.containerList" :show-vert-border="false"></wyb-table>
</view>
</view>
<view class="bottom-bar">
<u-row class="button-bar">
<u-col :span="6">
<u-button type="primary" @click="Submit">{{ $t('message.po_Submit') }}</u-button>
</u-col>
<u-col :span="6">
<u-button type="error" @click="uni.navigateBack({})">{{ $t('message.po_Return') }}</u-button>
</u-col>
</u-row>
</view>
</view>
</template>
<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import jPicker from '@/components/J-Picker/jPicker.vue';
import { session } from '@/store/modules/session';
import model from './model';
import LocationDetail from './model.location';
import { ImportPOReceiveListHeaders, containerListHeaders } from './config';
@Component({
components: {
jPicker,
},
})
export default class dnReceiptDom extends BasePage {
model = model;
ImportPOReceiveListHeaders = ImportPOReceiveListHeaders;
containerListHeaders = containerListHeaders;
total = 0;
async onShow() {
await this.queryLoction();
}
onReady() {
this.model.empty();
}
Location: any = [];
wl: any = '';
async queryLoction() {
this.Location = [];
let sendSpot = JSON.parse(uni.getStorageSync('sendSpot') as any);
let content = {
loginName: session.loginName,
sendSpot: sendSpot,
factoryCode: session.factoryCode,
workArea: session.workareaCode,
};
let res: any = await this.model.queryByFactoryCodeAndWorkAreaCode(content);
res.forEach((item: LocationDetail) => {
let pickerName: any = {};
pickerName.label = item.locationCode;
pickerName.value = item.locationCode + '(' + item.sendSpot + ')';
pickerName.sendSpot = item.sendSpot;
this.Location.push(pickerName);
});
this.wl = this.Location[0];
}
LocationChoice(e: any) {
this.wl = e.pickerName;
}
containerCode: any = '';
async query() {
if (!this.containerCode) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
await this.model.ImportPOReceive(this.containerCode);
if (this.model.code == '1') {
uni.showToast({
title: this.$t('message.successful') as any,
duration: 2000,
image: '/static/icons/icon-51.png',
});
}
}
current = 0;
items = [this.$t('message.POPlan'), this.$t('message.WPMInformation')];
onClickItem(e: any) {
if (this.current != e.currentIndex) {
this.current = e.currentIndex;
}
}
async Submit() {
if (!this.containerCode) {
this.customToast(this.$t('message.Commission_tips1') as any);
return;
}
let params = {
wlCode: this.wl.label,
containerCode: this.containerCode,
list: this.model.containerList,
};
await this.model.containerListSubmit(params);
if (this.model.code == '1') {
uni.showToast({
title: this.$t('message.success') as any,
duration: 2000,
image: '/static/icons/icon-51.png',
});
this.model.empty();
this.containerCode = '';
}
}
}
</script>
<style lang="scss" scoped>
.page-raw-receipt {
background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
background-size: 100% 600rpx;
padding: 118rpx 30rpx 162rpx;
min-height: 100%;
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 99;
display: flex;
height: 124rpx;
line-height: 124rpx;
color: #fff;
font-size: 34rpx;
font-weight: 500;
text-align: center;
.title {
flex: 3;
}
.left,
.right {
flex: 1;
}
.icon {
display: flex;
justify-content: center;
align-items: center;
width: 124rpx;
height: 124rpx;
}
}
.content {
width: 100%;
background: white;
border-radius: 15rpx;
padding: 10rpx;
.single {
width: 100%;
height: 100rpx;
display: flex;
.single-left {
width: 80%;
height: 100%;
display: flex;
view {
width: 110rpx;
height: 100%;
line-height: 100rpx;
}
}
.single-right {
button {
margin-top: 15rpx;
width: 150rpx;
height: 70rpx;
}
}
}
.WPM-total {
width: 100%;
padding-top: 10px;
padding-bottom: 10px;
}
}
.bottom-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 99;
background: #ffffff;
box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
padding: 20rpx;
}
}
</style>