Commit ceb54b67 authored by 李驰骋's avatar 李驰骋

录入到货单界面添加采购发票字段录入

到货标签打印加入打印字段增加
parent 564ec6e0
......@@ -13,25 +13,41 @@
:clear="false"
:localdata="typeData"
></uni-data-select>
</u-form-item>
<u-form-item prop="supplierNo" class="under" :label="$t('采购发票')">
<input
v-model="daohuoForm.invoiceNo"
type="text"
:placeholder="$t('采购发票')"
>
</u-form-item>
<u-form-item prop="supplierNo" class="under" :label="$t('到货供应商')">
<input
v-model="daohuoForm.supplierNo"
type="text"
disabled
:placeholder="$t('供应商代码')"
v-model="daohuoForm.supplierNo"
type="text"
disabled
:placeholder="$t('供应商代码')"
>
<!-- @confirm="inputCC" -->
</input>
</u-form-item>
<input style="width: 100px;height: 20px" type="text" v-model="input" :focus="isFocus" @focus="focus"
@blur="blur" @confirm="inputCC"/>
<!-- @confirm="inputCC" -->
</u-form>
<!-- 扫码到货按钮 -->
<view class="scan-btn-container">
<u-button
type="primary"
@click="goToScanning"
:disabled="!daohuoForm.warehouse"
style="width: 100%; height: 80rpx; font-size: 32rpx;"
>
{{$t('扫码到货')}}
</u-button>
</view>
<view v-if="goodsList.length > 0">{{$t('到货明细')}}</view>
</view>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList
:item="item"
:idx="index"
......@@ -79,16 +95,16 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
},
],
wxparams: "",
isFocus: false,
input: '',
loading: false,
daohuoForm: {
supplierNo: "",
invoiceNo:"",
warehouse: null
},
rules: {
supplierNo: { required: true,type: 'string', trigger: ['blur'], errorMessage: "11" },
purchaseType: { required: true, type: 'string',trigger: ['blur'], errorMessage: "11" }
supplierNo: { required: true,type: 'string', trigger: ['blur'], errorMessage: "" },
invoiceNo: { required: true,type: 'string', trigger: ['blur'], errorMessage: "" },
purchaseType: { required: true, type: 'string',trigger: ['blur'], errorMessage: "" }
},
}
},
......@@ -97,26 +113,8 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
},
created() {
this.warehouseList()
this.$nextTick(() => {
this.isFocus = true;
});
},
methods: {
focus(){
this.$nextTick(() => {
setTimeout(()=>{
uni.hideKeyboard();
},500);
});
},
blur(){
this.isFocus = false;
this.$nextTick(() => {
setTimeout(()=>{
this.isFocus = true;
},100);
});
},
warehouseList() {
this.$u.api.warehouseList().then(res => {
if(res.success) {
......@@ -130,51 +128,41 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
goBack() {
uni.navigateBack();
},
async inputCC(e){
console.log('asdas', e.detail.value, this.input)
if(e.detail.value && e.detail.value) {
// 2028-330-20250106001-0019-A1010004-5
if(e.detail.value.includes("-")){
const arr = e.detail.value.split("-")
if (arr.length === 6) {
if (arr[0] !== this.daohuoForm.supplierNo && this.daohuoForm.supplierNo) return this.$u.toast(i18n.t('一个到货单无法录入两个供应商订单'))
const data = await this.$u.api.validateArrival({
"materialNo": arr[4],
"purchaseNo": arr[2],
"purchaseSerial": arr[3],
"purchaseType": arr[1]
})
if (!data.success) return this.input = ''
const index = this.goodsList.findIndex(v => v.joinlabel === arr.slice(0, 5).join('-'))
if (index > -1) {
this.goodsList[index]['arrivalQuantity'] = Number(this.goodsList[index]['arrivalQuantity']) + Number(arr[5])
goToScanning() {
if (!this.daohuoForm.warehouse) {
this.$u.toast(i18n.t('请先选择到货仓'));
return;
}
uni.navigateTo({
url: '/pages/dhd/scanning'
});
},
// 接收扫码页面返回的数据
updateGoodsList(newGoodsList) {
if (newGoodsList && newGoodsList.length > 0) {
// 合并新的扫码数据到现有列表
newGoodsList.forEach(newItem => {
const existingIndex = this.goodsList.findIndex(item => item.joinlabel === newItem.joinlabel);
if (existingIndex > -1) {
// 如果已存在,更新数量
this.goodsList[existingIndex].arrivalQuantity = Number(this.goodsList[existingIndex].arrivalQuantity) + Number(newItem.arrivalQuantity);
} else {
const data1 = await this.$u.api
.getforinvmbinfo({
mb001: arr[4]
})
this.goodsList.push({
supplierNo: arr[0],
purchaseType: arr[1],
purchaseNo: arr[2],
purchaseSerial: arr[3],
materialNo: arr[4],
arrivalQuantity: arr[5],
udf07: data1.data['udf07'],
mb002: data1.data['mb002'],
joinlabel: arr.slice(0, 5).join('-')
})
// 如果不存在,添加新项
this.goodsList.push(newItem);
}
});
// 更新供应商信息
if (newGoodsList[0] && newGoodsList[0].supplierNo) {
if (!this.daohuoForm.supplierNo) {
this.daohuoForm.supplierNo = newGoodsList[0].supplierNo;
} else if (this.daohuoForm.supplierNo !== newGoodsList[0].supplierNo) {
this.$u.toast(i18n.t('一个到货单无法录入两个供应商订单'));
return;
}
this.input = ''
this.daohuoForm.supplierNo = arr[0]
} else {
this.input = ''
}
} else {
this.input = ''
}
}
},
},
deleGonds(idx) {
this.goodsList.splice(idx, 1);
},
......@@ -184,14 +172,16 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
this.loading = true;
this.$u.api.confirmArrival({
warehouse: this.daohuoForm.warehouse,
invoiceNo: this.daohuoForm.invoiceNo,
details: this.goodsList.map(v => ({arrivalQuantity: v.arrivalQuantity, materialNo: v.materialNo, purchaseNo: v.purchaseNo, purchaseSerial: v.purchaseSerial, purchaseType: v.purchaseType, supplierNo: v.supplierNo}))
})
.then(res => {
this.loading = false;
if (res.success) {
this.$u.toast(i18n.t('确认成功'));
this.goodsList = []
this.daohuoForm.supplierNo = ''
this.goodsList = [];
this.daohuoForm.supplierNo = '';
this.daohuoForm.invoiceNo='';
} else {
this.$u.toast(res.errorMessage);
}
......@@ -212,6 +202,9 @@ import BottomBtn from "@/components/BottomBtn/index.vue";
margin-bottom: 20rpx;
}
}
.scan-btn-container {
margin: 30rpx 0;
}
.bottomBtn {
position: sticky;
padding: 20rpx;
......
<template>
<view class="page">
<StickyNavBar>
<NavBar :title="$t('扫码到货')"></NavBar>
</StickyNavBar>
<view style="padding: 0 10px;">
<view class="scan-input-container">
<input
style="width: 100%; height: 60px; border: 1px solid #ddd; border-radius: 8px; padding: 0 15px; font-size: 16px;"
type="text"
v-model="input"
:focus="isFocus"
@focus="focus"
@blur="blur"
@confirm="inputCC"
:placeholder="$t('请扫描条码')"
/>
</view>
<view v-if="goodsList.length > 0" class="scan-result-title">{{$t('扫码结果')}}</view>
</view>
<ContentLoadingMore class="cardbox" :list="goodsList">
<view class="cardContent" v-for="(item, index) in goodsList" :key="index">
<scanningList
:item="item"
:idx="index"
@deleGonds="deleGonds"
/>
</view>
</ContentLoadingMore>
<BottomBtn :btnArr="btnArr" @getBtnHandle="getBtnHandle"></BottomBtn>
</view>
</template>
<script>
import i18n from '../../lang/index'
import scanningList from "./scanningList.vue";
import BottomBtn from "@/components/BottomBtn/index.vue";
import StickyNavBar from "@/components/StickyNavBar/index.vue";
import ContentLoadingMore from "@/components/ContentLoadingMore/index.vue";
export default {
components: {
StickyNavBar,
scanningList,
BottomBtn,
ContentLoadingMore,
},
data() {
return {
goodsList: [],
isFocus: false,
input: '',
btnArr: [
{
style: "",
type: "warning",
text: i18n.t('返回'),
way: "goBack",
}
],
}
},
created() {
this.$nextTick(() => {
this.isFocus = true;
});
},
methods: {
focus(){
this.$nextTick(() => {
setTimeout(()=>{
uni.hideKeyboard();
},500);
});
},
blur(){
this.isFocus = false;
this.$nextTick(() => {
setTimeout(()=>{
this.isFocus = true;
},100);
});
},
getBtnHandle(row) {
this[row.way]();
},
goBack() {
uni.navigateBack();
},
// 每次扫码成功后自动同步数据到主页面
async inputCC(e){
if(e.detail.value && e.detail.value) {
if(e.detail.value.includes("-")){
const arr = e.detail.value.split("-")
if (arr.length === 6) {
const data = await this.$u.api.validateArrival({
"materialNo": arr[4],
"purchaseNo": arr[2],
"purchaseSerial": arr[3],
"purchaseType": arr[1]
})
if (!data.success) return this.input = ''
const index = this.goodsList.findIndex(v => v.joinlabel === arr.slice(0, 5).join('-'))
if (index > -1) {
this.goodsList[index]['arrivalQuantity'] = Number(this.goodsList[index]['arrivalQuantity']) + Number(arr[5])
} else {
const data1 = await this.$u.api
.getforinvmbinfo({
mb001: arr[4]
})
this.goodsList.push({
supplierNo: arr[0],
purchaseType: arr[1],
purchaseNo: arr[2],
purchaseSerial: arr[3],
materialNo: arr[4],
arrivalQuantity: arr[5],
udf07: data1.data['udf07'],
mb002: data1.data['mb002'],
joinlabel: arr.slice(0, 5).join('-')
})
}
this.input = ''
// 自动同步到主页面
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage && prevPage.$vm) {
prevPage.$vm.updateGoodsList(this.goodsList);
}
} else {
this.input = ''
}
} else {
this.input = ''
}
}
},
deleGonds(idx) {
this.goodsList.splice(idx, 1);
// 删除后也同步到主页面
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage && prevPage.$vm) {
prevPage.$vm.updateGoodsList(this.goodsList);
}
},
},
};
</script>
<style lang="scss" scoped>
.page {
background: #fff;
}
.scan-input-container {
margin: 20rpx 0;
}
.scan-result-title {
font-size: 32rpx;
font-weight: bold;
margin: 20rpx 0;
color: #333;
}
.cardbox {
border: 1px solid #dadde2;
border-radius: 5px;
background: #f3f3f5;
margin: 0rpx 20rpx;
margin-top: 20rpx;
min-height: calc(100vh - 570rpx);
padding: 0rpx 20rpx;
}
.cardContent {
border-radius: 8px;
background: #fff;
margin-top: 20rpx;
}
/deep/ .u-sticky {
top: 0 !important;
background: #fff;
}
page {
position: relative;
width: 100%;
height: 100%;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment