Commit 11c9a30b by LJM

add

parent 071e2cc7
......@@ -285,7 +285,7 @@
});
return false;
}
this.request(API.closeBox, 'POST', { wsty_id: this.wsty_id, gross_weight: val }, true).then(res => {
this.request(API.closeBox, 'POST', { wsty_id: this.wsty_id, gross_weight: val, box_sn: this.box_sn }, true).then(res => {
if (res.err_code === 0) {
this.box_sn = '';
this.wsty_id = '';
......
......@@ -89,6 +89,7 @@
<text class="t3 w130">物料名称:</text>
<text class="t4">{{item.goods_title}}</text>
</view>
<!-- 完全理货显示箱号 -->
<view class="row" style="width: 50%;justify-content: flex-end;" v-if="item.tally_status == 3">
<text class="t4" style="text-align: right;color: #197adb;">{{item.box_sn}}</text>
</view>
......@@ -146,11 +147,11 @@
<view class="input-text">
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" v-model="form[index].origin" />
<input class="uni-input" placeholder="选择产地" placeholder-style="color:#000;font-weight: bold;" disabled="" v-model="form[index].origin" />
</template>
<!-- 1未理货2部分理货 -->
<template v-else>
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" />
<input class="uni-input" placeholder="选择产地" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" />
</template>
</view>
</view>
......@@ -168,21 +169,23 @@
<template v-if="image_list.length > 0">
<view class="pic-box" v-for="(v, i) in image_list[index]" :key="i">
<image :src="v" mode="aspectFill" lazy-load="true" @click="previewChange(image_list[index], i)"></image>
<view class="delete row rowCenter verCenter" @click="deletePic(index,i)"><text class="iconfont icon-shanchu"></text></view>
<template v-if="item.tally_status != 3">
<view class="delete row rowCenter verCenter" @click="deletePic(index,i)"><text class="iconfont icon-shanchu"></text></view>
</template>
</view>
</template>
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<view class="default row rowCenter verCenter" v-if="image_list[index].length < 4"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</template>
<!-- 1未理货2部分理货 -->
<template v-else>
<view class="default row rowCenter verCenter" @click="chooseImageChange(index)" v-if="image_list[index].length < 4"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</template>
</view>
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<view class="btn row rowCenter verCenter disabled" @click="cancelTallyDetail(index)">取消理货</view>
</template>
<!-- 1未理货2部分理货 -->
<template v-else>
<view class="btn row rowCenter verCenter" @click="submitTallyDetail(index)">提 交</view>
</template>
......@@ -270,14 +273,18 @@
};
},
watch: {
image_list(arr) {
const allNonEmpty = arr.every(subArr => subArr.length > 0);
if (allNonEmpty) {
arr.forEach((item, index) => {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = item.length > 0 ? item.join(',') : '';
image_list: {
handler(arr) {
arr.forEach((subArr, index) => {
if (subArr.length > 0) {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = subArr.join(',');
} else {
this.form[index].goods_check_pic = '';
}
});
}
},
deep: true // 深度监听
}
},
methods: {
......@@ -621,6 +628,17 @@
if (res.err_code === 0) {
this.box_sn = res.data.box_sn;
this.wsty_id = res.data.wsty_id;
if (this.form.length > 0) {
// 筛选出 tally_status 等于 1 或 2 的数据
var filteredForm = this.form.filter(item => item.tally_status === 1 || item.tally_status === 2);
// 替换 wsty_id
this.form = filteredForm.map(item => {
return { ...item, wsty_id: this.wsty_id, box_sn: this.box_sn };
});
}
} else {
uni.showModal({
title: '',
......@@ -707,13 +725,13 @@
// 使用 map 方法生成表单数组
this.form = res.data.detail.map((item) => ({
tally_status: item.tally_status, //理货状态
tally_num: item.tally_num, // 入库数量
tally_num: item.tally_num === 0 ? '' : item.tally_num, // 入库数量,0 时显示为空
origin: item.origin, // 原产地
net_weight: item.net_weight, // 净重
goods_check_pic: item.goods_check_pic, // 商检的必须上传图片
wstydl_id: item.wstydl_id, // 理货明细ID
erp_order_sn: this.erp_order_sn, // 入仓号
box_sn: item.box_sn,
box_sn: item.tally_status == 3 ? item.box_sn : this.box_sn,
wsty_id: this.wsty_id, // 箱子id
is_goods_check: item.is_goods_check //是否商检
}));
......@@ -744,6 +762,9 @@
* 理货明细提交
*/
submitTallyDetail(index) {
var tally_num = parseInt(this.form[index].tally_num);
var netWeight = parseFloat(this.form[index].net_weight);
if (!this.box_sn) {
uni.showModal({
title: '',
......@@ -752,23 +773,23 @@
});
return false;
}
if (!this.form[index].tally_num) {
if (!tally_num) {
uni.showToast({
title: '入库数量必填',
title: '请填写入库数量',
icon: 'error'
});
return false;
}
if (!this.form[index].origin) {
uni.showToast({
title: '原产地必填',
title: '请填写原产地',
icon: 'error'
});
return false;
}
if (!this.form[index].net_weight) {
if (!netWeight) {
uni.showToast({
title: '净重必填',
title: '请填写净重',
icon: 'error'
});
return false;
......
......@@ -108,11 +108,11 @@
<view class="input-text">
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" v-model="form[index].origin" />
<input class="uni-input" placeholder="选择产地" placeholder-style="color:#000;font-weight: bold;" disabled="" v-model="form[index].origin" />
</template>
<!-- 1未理货2部分理货 -->
<template v-else>
<input class="uni-input" placeholder="输入" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" />
<input class="uni-input" placeholder="选择产地" placeholder-style="color:#000;font-weight: bold;" disabled="" @click="open(index)" v-model="form[index].origin" />
</template>
</view>
</view>
......@@ -130,21 +130,23 @@
<template v-if="image_list.length > 0">
<view class="pic-box" v-for="(v, i) in image_list[index]" :key="i">
<image :src="v" mode="aspectFill" lazy-load="true" @click="previewChange(image_list[index], i)"></image>
<view class="delete row rowCenter verCenter" @click="deletePic(index,i)"><text class="iconfont icon-shanchu"></text></view>
<template v-if="item.tally_status != 3">
<view class="delete row rowCenter verCenter" @click="deletePic(index,i)"><text class="iconfont icon-shanchu"></text></view>
</template>
</view>
</template>
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<view class="default row rowCenter verCenter" v-if="image_list[index].length < 4"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</template>
<!-- 1未理货2部分理货 -->
<template v-else>
<view class="default row rowCenter verCenter" @click="chooseImageChange(index)" v-if="image_list[index].length < 4"><text class="iconfont icon-xingzhuangjiehe"></text></view>
</template>
</view>
<!-- 完全理货 -->
<template v-if="item.tally_status == 3">
<view class="btn row rowCenter verCenter disabled" @click="cancelTallyDetail(index)">取消理货</view>
</template>
<!-- 1未理货2部分理货 -->
<template v-else>
<view class="btn row rowCenter verCenter" @click="submitTallyDetail(index)">提 交</view>
</template>
......@@ -217,19 +219,23 @@
title: '',
gross_weight: '',
index: 0,
item: ['全量', 'DigiKey', 'Rochester', 'TME', 'Chip1stop', 'Mouser'],
item: ['全量', 'DigiKey', 'Rochester', 'TME', 'Chip1stop'],
net_weight_total: 0 //净重合计
};
},
watch: {
image_list(arr) {
const allNonEmpty = arr.every(subArr => subArr.length > 0);
if (allNonEmpty) {
arr.forEach((item, index) => {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = item.length > 0 ? item.join(',') : '';
image_list: {
handler(arr) {
arr.forEach((subArr, index) => {
if (subArr.length > 0) {
// 将数组元素用逗号连接成字符串,并赋值给对应的 form 中的 goods_check_pic 字段
this.form[index].goods_check_pic = subArr.join(',');
} else {
this.form[index].goods_check_pic = '';
}
});
}
},
deep: true // 深度监听
}
},
methods: {
......@@ -362,7 +368,7 @@
if (maxNum > 4) {
uni.hideLoading();
uni.showToast({
title: '图片不超过5张',
title: '图片不超过4张',
icon: 'none'
});
return false;
......@@ -635,7 +641,7 @@
// 使用 map 方法生成表单数组
this.form = res.data.detail.map((item) => ({
tally_status: item.tally_status, //理货状态
tally_num: item.tally_num, // 入库数量
tally_num: item.tally_num === 0 ? '' : item.tally_num, // 入库数量,0 时显示为空
origin: item.origin, // 原产地
net_weight: item.net_weight, // 净重
goods_check_pic: item.goods_check_pic, // 商检的必须上传图片
......@@ -672,6 +678,9 @@
* 理货明细提交
*/
submitTallyDetail(index) {
var tally_num = parseInt(this.form[index].tally_num);
var netWeight = parseFloat(this.form[index].net_weight);
if (!this.box_sn) {
uni.showModal({
title: '',
......@@ -680,24 +689,23 @@
});
return false;
}
if (!this.form[index].tally_num) {
if (!tally_num) {
uni.showToast({
title: '入库数量必填',
title: '请填写入库数量',
icon: 'error'
});
return false;
}
if (!this.form[index].origin) {
uni.showToast({
title: '原产地必填',
title: '请填写原产地',
icon: 'error'
});
return false;
}
if (!this.form[index].net_weight) {
if (!netWeight) {
uni.showToast({
title: '净重必填',
title: '请填写净重',
icon: 'error'
});
return false;
......@@ -721,6 +729,18 @@
setTimeout(() => {
this.getTallyData();
}, 2000);
} else if (res.err_code === 10000) {
uni.showModal({
title: '',
content: res.err_msg,
showCancel: false,
success: (res) => {
if (res.confirm) {
// 用户点击确定按钮后的操作
this.getTallyData();
}
}
});
} else {
uni.showToast({
title: res.err_msg,
......
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 sign in to comment