Commit b35eb5d9 authored by huhaiqing's avatar huhaiqing

修改拆单放入数量

parent c0e8ca35
......@@ -448,32 +448,53 @@ export default {
this.isQuantity = false;
},
async changeProdTitleZh() {
const data = await this.getSelectData("zhId");
this.shopForm.enId = data.id;
const item = this.setShopForm("zhId");
this.shopForm.enId = item.id;
this.shopForm = { ...this.shopForm };
await this.getSelectData(item);
},
async changeProdTitleEn() {
const data = await this.getSelectData("enId");
this.shopForm.zhId = data.id;
const item = this.setShopForm("enId");
this.shopForm.zhId = item.id;
this.shopForm = { ...this.shopForm };
await this.getSelectData(item);
},
async getSelectData(key) {
setShopForm(key) {
let list = [];
list = this.orderItems.filter((item) => item.id == this.shopForm[key]);
this.shopForm.num = this.currRow.num - this.currRow.installNum;
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.putNum = data.num ?? 0;
this.shopForm.quantity = data.quantity ?? 0;
this.shopForm.putQuantity = Decimal.div(
data.quantity ?? 0,
this.shopForm.num
).toFixed(0);
return data;
},
async getSelectData(item) {
await quantitycheck({
seaFreightVolume: data.seaFreightVolume,
clearanceFreightVolume: data.clearanceFreightVolume,
seaFreightVolume: item.seaFreightVolume,
clearanceFreightVolume: item.clearanceFreightVolume,
}).then((res) => {
if (res.data) {
this.isQuantity = true;
......@@ -489,7 +510,6 @@ export default {
delete this.shopRules.putQuantity;
}
});
return data;
},
shopAdd() {
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