Commit b35eb5d9 authored by huhaiqing's avatar huhaiqing

修改拆单放入数量

parent c0e8ca35
...@@ -448,32 +448,53 @@ export default { ...@@ -448,32 +448,53 @@ export default {
this.isQuantity = false; this.isQuantity = false;
}, },
async changeProdTitleZh() { async changeProdTitleZh() {
const data = await this.getSelectData("zhId"); const item = this.setShopForm("zhId");
this.shopForm.enId = data.id; this.shopForm.enId = item.id;
this.shopForm = { ...this.shopForm }; this.shopForm = { ...this.shopForm };
await this.getSelectData(item);
}, },
async changeProdTitleEn() { async changeProdTitleEn() {
const data = await this.getSelectData("enId"); const item = this.setShopForm("enId");
this.shopForm.zhId = data.id; this.shopForm.zhId = item.id;
this.shopForm = { ...this.shopForm }; this.shopForm = { ...this.shopForm };
await this.getSelectData(item);
}, },
async getSelectData(key) { setShopForm(key) {
let list = []; let list = [];
list = this.orderItems.filter((item) => item.id == this.shopForm[key]); list = this.orderItems.filter((item) => item.id == this.shopForm[key]);
this.shopForm.num = this.currRow.num - this.currRow.installNum;
const data = list[0]; const data = list[0];
const itemNum = data.num ?? 0;
// 获取拆单项的总num
const total = this.totalSplitNum();
// 订单的剩余
const orderNum = this.currRow.num - this.currRow.installNum;
// 剩余可装
const remainNum = Decimal.sub(orderNum, total).toNumber();
this.shopForm.num = 0;
this.shopForm.putNum = 0;
// 剩余可装大于等于订单项剩余,显示订单剩余
if (remainNum >= itemNum) {
this.shopForm.num = remainNum;
this.shopForm.putNum = itemNum;
}
// 订单剩余小于订单项剩余,显示订单项剩余
if (remainNum < itemNum) {
this.shopForm.num = this.shopForm.putNum = remainNum;
}
this.shopForm.orderItemId = data.orderItemId; this.shopForm.orderItemId = data.orderItemId;
this.shopForm.putNum = data.num ?? 0;
this.shopForm.quantity = data.quantity ?? 0; this.shopForm.quantity = data.quantity ?? 0;
this.shopForm.putQuantity = Decimal.div( this.shopForm.putQuantity = Decimal.div(
data.quantity ?? 0, data.quantity ?? 0,
this.shopForm.num this.shopForm.num
).toFixed(0); ).toFixed(0);
return data;
},
async getSelectData(item) {
await quantitycheck({ await quantitycheck({
seaFreightVolume: data.seaFreightVolume, seaFreightVolume: item.seaFreightVolume,
clearanceFreightVolume: data.clearanceFreightVolume, clearanceFreightVolume: item.clearanceFreightVolume,
}).then((res) => { }).then((res) => {
if (res.data) { if (res.data) {
this.isQuantity = true; this.isQuantity = true;
...@@ -489,7 +510,6 @@ export default { ...@@ -489,7 +510,6 @@ export default {
delete this.shopRules.putQuantity; delete this.shopRules.putQuantity;
} }
}); });
return data;
}, },
shopAdd() { shopAdd() {
this.$refs["shopForm"].validate((valid) => { this.$refs["shopForm"].validate((valid) => {
......
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