|
@@ -102,7 +102,6 @@ Component({
|
|
|
index = this.data.list.findIndex(v => v.itemid == detail.itemid),
|
|
|
data = this.data.list[index],
|
|
|
calculatePrice = data.qty != obj.qty;
|
|
|
-
|
|
|
if (data.qty == obj.qty && data.remarks == obj.remarks && data.needdate == obj.needdate) return;
|
|
|
_Http.basic({
|
|
|
"id": 20221109093602,
|
|
@@ -125,18 +124,19 @@ Component({
|
|
|
};
|
|
|
if (res.msg == '成功' && calculatePrice) {
|
|
|
let page = getCurrentPages()[getCurrentPages().length - 1];
|
|
|
- let amount = page.data.detail.amount - data.amount;
|
|
|
- data.amount = ((data.qty - 0) * (data.price - 0)).toFixed(2);
|
|
|
- amount = amount + (data.amount - 0);
|
|
|
- page.setData({
|
|
|
- "detail.amount": amount
|
|
|
- })
|
|
|
+ if (page) {
|
|
|
+ let amount = page.data.detail.amount - data.amount;
|
|
|
+ data.amount = ((data.qty - 0) * (data.price - 0)).toFixed(2);
|
|
|
+ amount = (amount + (data.amount - 0)).toFixed(2);
|
|
|
+ page.setData({
|
|
|
+ "detail.amount": amount - 0
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
this.setData({
|
|
|
[`list[${index}]`]: data
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
},
|
|
|
/* 删除 */
|
|
|
deleteItem({
|
|
@@ -148,21 +148,26 @@ Component({
|
|
|
content: `是否确认删除“${detail.itemname}”?`,
|
|
|
complete: (res) => {
|
|
|
if (res.confirm) _Http.basic({
|
|
|
- "id": 20221108152102,
|
|
|
+ "id": 20221109093702,
|
|
|
"content": {
|
|
|
- "sa_orderids": [
|
|
|
- detail.sa_orderid
|
|
|
- ],
|
|
|
- "deletereason": "" //删除原因,可选
|
|
|
- },
|
|
|
- "accesstoken": "bde1f111b04ad5fbd8a4b0803e0d6df6"
|
|
|
+ sa_orderid: detail.sa_orderid,
|
|
|
+ "sa_orderitemsids": [
|
|
|
+ detail.sa_orderitemsid
|
|
|
+ ]
|
|
|
+ }
|
|
|
}).then(s => {
|
|
|
if (s.msg != '成功') return wx.showToast({
|
|
|
title: res.msg,
|
|
|
icon: "none"
|
|
|
});
|
|
|
that.setData({
|
|
|
- list: that.data.list.filter(v => v.itemid != detail.itemid)
|
|
|
+ list: that.data.list.filter(v => v.sa_orderitemsid != detail.sa_orderitemsid)
|
|
|
+ });
|
|
|
+ /* 更新金额 */
|
|
|
+ let page = getCurrentPages()[getCurrentPages().length - 1];
|
|
|
+ let amount = (page.data.detail.amount - detail.amount).toFixed(2);
|
|
|
+ if (page) page.setData({
|
|
|
+ "detail.amount": amount - 0
|
|
|
})
|
|
|
})
|
|
|
}
|
|
@@ -216,10 +221,30 @@ Component({
|
|
|
if (s.msg == '成功') setTimeout(() => {
|
|
|
that.getList(that.data.sa_orderid, true);
|
|
|
wx.navigateBack();
|
|
|
+ that.updateThePrice();
|
|
|
}, 300)
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ /* 使用接口更新总价 */
|
|
|
+ updateThePrice() {
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230105101102,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.data.sa_orderid
|
|
|
+ },
|
|
|
+ }).then(res => {
|
|
|
+ console.log("获取列表总价", res)
|
|
|
+ if (res.msg != '成功') return wx.showToast({
|
|
|
+ title: `产品总价更新失败`,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ let page = getCurrentPages()[getCurrentPages().length - 1];
|
|
|
+ if (page) page.setData({
|
|
|
+ "detail.amount": res.data.amount - 0
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|