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.

339 lines
9.7 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class="page-product-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({ delta: 1 })" />
</view>
<view class="title">{{ $t('message.CollectionAndBorrowing') }}</view>
<view class="right"></view>
</view>
<u-form class="form" ref="form" :model="form" label-width="180rpx">
<!-- 领用单 -->
<view class="single">
<view class="single-left">
<view>{{ $t('message.Requisition') }}</view>
<u-search :placeholder="$t('message.collecting')" v-model.trim="form.order3" @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>
<!-- 成品编码 -->
<u-form-item :label="$t('message.product_FGCode')">
<jPicker sureColor="#ff0000" style="width: 260rpx" @bindpicker="materialChoice" showKey="value" valKey="value" :val="wl.value" class="search" :options="model.choiceCodeList" />
</u-form-item>
<!-- 成品描述 -->
<u-form-item :label="$t('message.product_FGDes')">
<u-input :disabled="true" v-model="Some.productDescZh" placeholder="" style="overflow: hidden" />
</u-form-item>
<!-- 数量 -->
<u-form-item :label="$t('message.product_Number')">
<u-input :disabled="true" v-model="Some.qty" placeholder="" />
</u-form-item>
<!-- 源库位 -->
<u-form-item :label="$t('message.SourceLocation')">
<u-input :disabled="true" v-model="Some.originWl" placeholder="" />
</u-form-item>
<!-- 成本中心 -->
<u-form-item :label="$t('message.product_costCenter')">
<u-input v-model="Some.costCenter" placeholder="" :disabled="true" />
</u-form-item>
<!-- 已扫 -->
<u-form-item :label="$t('message.product_Swept')">
<u-input :disabled="true" v-model="Some.actualQty" placeholder="" />
</u-form-item>
<!-- 条码 -->
<u-form-item :label="$t('message.product_BarCode')">
<u-search :placeholder="$t('message.barcode')" v-model.trim="form.barcode" @search="scanning" :show-action="false"></u-search>
</u-form-item>
</u-form>
<view class="bottom-bar">
<u-row class="button-bar">
<u-col :span="3">
<u-button type="primary" @click="bill">{{ $t('message.detailed') }}</u-button>
</u-col>
<u-col :span="3">
<u-button type="primary" @click="scanning">{{ $t('message.scanning') }}</u-button>
</u-col>
<u-col :span="3">
<u-button type="primary" @click="closure">{{ $t('message.closure') }}</u-button>
</u-col>
<u-col :span="3">
<u-button type="error" @click="uni.navigateBack({ delta: 1 })">{{ $t('message.po_Return') }}</u-button>
</u-col>
</u-row>
</view>
</view>
</template>
<script lang="ts">
import { Component, Ref } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import { VForm, VFormRules } from 'vue/types/form';
import model from './model';
import jPicker from '@/components/J-Picker/jPicker.vue';
import { session } from '@/store/modules/session';
interface OptionType {
label: string;
value: string;
}
@Component({
components: {
jPicker,
},
})
export default class ProductCheckReceipt extends BasePage {
@Ref('form') readonly $form!: VForm;
model = model;
//表单
form = {
order3: '',
barcode: '',
};
wl: any = {};
Some: any = {};
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
this.model.orderInInfo.productDescZh = '';
this.model.orderInInfo.productCode = '';
this.model.orderInInfo.qty = '';
this.model.orderInInfo.locCode = '';
this.model.orderInInfo.costCenter = '';
}
//单号查询
async query() {
if (!this.form.order3) {
this.customToast(this.$t('message.Commission_tips1') as string);
return;
}
let param = {
factoryCode: session.factoryCode,
loginName: session.loginName,
order3: this.form.order3,
orderType: 'LY',
page: '1',
rows: '50',
};
await this.model.queryScrapList(param);
if (this.model.code == '1') {
this.customToast(this.$t('message.product_Tip8') as string);
this.wl.value = this.model.choiceCodeList[0].value;
this.Some = this.model.recordsList[0];
}
}
//选择成品编码
materialChoice(e: any) {
this.wl = e.pickerName;
this.model.recordsList.forEach((item: any) => {
if (item.productCode == e.pickerName.value) {
this.Some = item;
}
});
}
//条码扫码
async scanning() {
if (!this.form.order3) {
this.customToast(this.$t('message.scrapForm') as string);
}
if (!this.Some) {
this.customToast(this.$t('message.finishedProduct') as string);
}
if (!this.form.barcode) {
this.customToast(this.$t('message.barcode') as string);
return;
}
if (this.Some.actualQty >= this.Some.qty) {
this.customToast(this.$t('message.barcode') as string);
return;
}
let params = {
factoryCode: session.factoryCode,
loginName: session.loginName,
barcode: this.form.barcode,
productCode: this.wl.value,
locCode: this.Some.originWl,
};
await this.model.getProductCode(params);
if (this.model.code == '1') {
//this.customToast(this.$t('message.product_Tip8') as string);
uni.showToast({
icon: 'success',
title: this.$t('message.product_Tip8') as string,
});
//this.Some.actualQty += 1;
this.onSubmit();
}
}
//确定
async onSubmit() {
const orderlist = [
{
...this.model.orderInInfo,
originWl: this.Some.originWl,
barCode: this.form.barcode,
aimWl: this.Some.aimWl,
type: '0',
orderType: '2',
keepBy: session.loginName as string,
factoryCode: session.factoryCode as string,
order3: this.form.order3,
costCenter: this.Some.costCenter,
},
];
await this.model.onTakeoutConfirm(orderlist);
if (this.model.code == '1') {
uni.showToast({
icon: 'success',
title: this.$t('message.success') as string,
});
}
this.Some = {};
this.wl = {};
// this.form.order3 = '';
this.form.barcode = '';
this.query();
}
//关闭
async closure() {
if (!this.form.order3) {
this.customToast(this.$t('message.Commission_tips1') as string);
return;
}
if (this.Some.actualQty == this.Some.qty) {
//this.customToast(this.$t('message.Commission_tips8') as string);
uni.showModal({
content: this.$t('message.Commission_tips8') as string,
confirmText: this.$t('message.workArea_Confirm') as string,
cancelText: this.$t('message.Cancel') as string,
success: (res: any) => {
if (res.confirm) {
//debugger;
console.log("////111111");
this.model.close(this.form.order3);
if (model.code == '1') {
uni.showToast({
icon: 'success',
title: this.$t('message.success') as string,
});
this.Some = {};
this.Some.fileNo = ' ';
this.wl = {};
this.form.order3 = '';
this.form.barcode = '';
}
} else if (res.cancel) {
return;
}
},
});
return;
}
await this.model.close(this.form.order3);
if (this.model.code == '1') {
uni.showToast({
icon: 'success',
title: this.$t('message.success') as string,
});
// this.Some = {};
// this.Some.fileNo = ' ';
// this.wl = {};
// this.form.order3 = '';
// this.form.barcode = '';
}
}
//查询明细
async bill() {
if (!this.form.order3) {
this.customToast(this.$t('message.Commission_tips1') as string);
return;
}
await this.model.queryDetailed(this.form.order3);
this.toPage(this.page.product.warehouse.wholeCollect.stoOutboundDetail);
}
}
</script>
<style lang="scss" scoped>
.page-product-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: 36rpx;
left: 0;
right: 0;
z-index: 99;
display: flex;
height: 88rpx;
line-height: 88rpx;
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: 88rpx;
height: 88rpx;
}
}
.form {
background-color: #fff;
padding: 40rpx;
border-radius: 10rpx;
box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);
.u-form-item {
padding: 30rpx 0;
line-height: 35rpx;
}
.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;
}
}
}
}
.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;
}
.button-bar {
}
}
</style>