|
@@ -76,26 +76,35 @@ Page({
|
|
obj[name] = custom[key]
|
|
obj[name] = custom[key]
|
|
}
|
|
}
|
|
return new Promise((resolve) => {
|
|
return new Promise((resolve) => {
|
|
- _Http.basic({
|
|
|
|
- "id": 20231121143403,
|
|
|
|
- "content": {
|
|
|
|
- "itemid": item.itemid,
|
|
|
|
- "sa_favoritesid": item.sa_favoritesid,
|
|
|
|
- "favoritesqty": item.favoritesqty,
|
|
|
|
- "qty": item.favoritesqty,
|
|
|
|
- ...obj,
|
|
|
|
- ...custom,
|
|
|
|
- "iscollection": true
|
|
|
|
- },
|
|
|
|
- }).then(res => {
|
|
|
|
- console.log("修改定制", res)
|
|
|
|
- wx.showToast({
|
|
|
|
- title: res.msg != '成功' ? res.msg : '修改成功',
|
|
|
|
- icon: "none"
|
|
|
|
- });
|
|
|
|
- this.getList()
|
|
|
|
- resolve(true)
|
|
|
|
|
|
+ console.log('定制信息', custom)
|
|
|
|
+ let index = this.data.list.findIndex(v => v.sa_favoritesid == item.sa_favoritesid);
|
|
|
|
+ item = Object.assign(item, custom);
|
|
|
|
+ item.customText = getCustomText(item, 'favorites')
|
|
|
|
+ this.setData({
|
|
|
|
+ [`list[${index}]`]: item
|
|
})
|
|
})
|
|
|
|
+ this.computeSum()
|
|
|
|
+ resolve(true)
|
|
|
|
+ /* _Http.basic({
|
|
|
|
+ "id": 20231121143403,
|
|
|
|
+ "content": {
|
|
|
|
+ "itemid": item.itemid,
|
|
|
|
+ "sa_favoritesid": item.sa_favoritesid,
|
|
|
|
+ "favoritesqty": item.favoritesqty,
|
|
|
|
+ "qty": item.favoritesqty,
|
|
|
|
+ ...obj,
|
|
|
|
+ ...custom,
|
|
|
|
+ "iscollection": true
|
|
|
|
+ },
|
|
|
|
+ }).then(res => {
|
|
|
|
+ console.log("修改定制", res)
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: res.msg != '成功' ? res.msg : '修改成功',
|
|
|
|
+ icon: "none"
|
|
|
|
+ });
|
|
|
|
+ this.getList()
|
|
|
|
+ resolve(true)
|
|
|
|
+ }) */
|
|
})
|
|
})
|
|
}
|
|
}
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
@@ -124,7 +133,7 @@ Page({
|
|
this.setData({
|
|
this.setData({
|
|
list: res.data.map(v => {
|
|
list: res.data.map(v => {
|
|
v.showPrice = CNY(v.gradeprice)
|
|
v.showPrice = CNY(v.gradeprice)
|
|
- if (v.iscustomsize) v.customText = getCustomText(v, 'favorites');
|
|
|
|
|
|
+ if (v.iscustomsize) v.customText = ""; //getCustomText(v, 'favorites')
|
|
return v
|
|
return v
|
|
})
|
|
})
|
|
});
|
|
});
|
|
@@ -195,6 +204,12 @@ Page({
|
|
/* 处理生成订单 */
|
|
/* 处理生成订单 */
|
|
handleSubmit(index) {
|
|
handleSubmit(index) {
|
|
let data = this.data.classList[index];
|
|
let data = this.data.classList[index];
|
|
|
|
+ let illegals = data.list.filter(v => v.iscustomsize && v.customText == "").map(v => v.erpitemname);
|
|
|
|
+ if (illegals.length) return wx.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: `${illegals}定制信息有误,请检查!`,
|
|
|
|
+ showCancel: false
|
|
|
|
+ })
|
|
wx.showLoading({
|
|
wx.showLoading({
|
|
title: '生成中...',
|
|
title: '生成中...',
|
|
})
|
|
})
|
|
@@ -260,6 +275,12 @@ Page({
|
|
},
|
|
},
|
|
addToShoppingCart(index) {
|
|
addToShoppingCart(index) {
|
|
let data = this.data.classList[index];
|
|
let data = this.data.classList[index];
|
|
|
|
+ let illegals = data.list.filter(v => v.iscustomsize && v.customText == "").map(v => v.erpitemname);
|
|
|
|
+ if (illegals.length) return wx.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: `${illegals}定制信息有误,请检查!`,
|
|
|
|
+ showCancel: false
|
|
|
|
+ })
|
|
wx.showLoading({
|
|
wx.showLoading({
|
|
title: '处理中...',
|
|
title: '处理中...',
|
|
})
|
|
})
|