|
@@ -39,14 +39,16 @@ Component({
|
|
|
icon: "none"
|
|
icon: "none"
|
|
|
})
|
|
})
|
|
|
res.data = res.data.map(value => {
|
|
res.data = res.data.map(value => {
|
|
|
- if (value.attinfos.length == 0) return value;
|
|
|
|
|
- value.attinfos = file.fileList(value.attinfos)
|
|
|
|
|
- let image = value.attinfos.find(v => v.fileType == "image");
|
|
|
|
|
- value.cover = image ? image.cover : "";
|
|
|
|
|
|
|
+ if (value.attinfos.length != 0) {
|
|
|
|
|
+ value.attinfos = file.fileList(value.attinfos)
|
|
|
|
|
+ let image = value.attinfos.find(v => v.fileType == "image");
|
|
|
|
|
+ value.cover = image ? image.cover : "";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
value.className = value.itemclass.length == 0 ? "暂无类目" : value.itemclass.map(v => v.itemclassname);
|
|
value.className = value.itemclass.length == 0 ? "暂无类目" : value.itemclass.map(v => v.itemclassname);
|
|
|
value.brandName = value.brand.length == 0 ? "暂无品牌" : value.brand.map(v => v.brandname);
|
|
value.brandName = value.brand.length == 0 ? "暂无品牌" : value.brand.map(v => v.brandname);
|
|
|
- value.discountrate = value.discountrate * 100;
|
|
|
|
|
|
|
+ value.discountrate = (value.discountrate * 100).toFixed(2);
|
|
|
|
|
+ value.price = (value.price - 0).toFixed(2);
|
|
|
return value;
|
|
return value;
|
|
|
})
|
|
})
|
|
|
this.setData({
|
|
this.setData({
|
|
@@ -142,15 +144,11 @@ Component({
|
|
|
detail
|
|
detail
|
|
|
}) {
|
|
}) {
|
|
|
let i = queue.findIndex(v => v.sa_quotedprice_itemsid == detail.sa_quotedprice_itemsid);
|
|
let i = queue.findIndex(v => v.sa_quotedprice_itemsid == detail.sa_quotedprice_itemsid);
|
|
|
- if (i == -1) {
|
|
|
|
|
- queue.push(detail)
|
|
|
|
|
- } else {
|
|
|
|
|
- queue[i] = detail;
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ i == -1 ? queue.push(detail) : queue[i] = detail;
|
|
|
clearTimeout(downCounter)
|
|
clearTimeout(downCounter)
|
|
|
downCounter = setTimeout(() => {
|
|
downCounter = setTimeout(() => {
|
|
|
this.changeItem(queue)
|
|
this.changeItem(queue)
|
|
|
- }, 2000);
|
|
|
|
|
|
|
+ }, 0);
|
|
|
},
|
|
},
|
|
|
changeItem(items) {
|
|
changeItem(items) {
|
|
|
console.log("修改", items)
|
|
console.log("修改", items)
|
|
@@ -163,7 +161,26 @@ Component({
|
|
|
}
|
|
}
|
|
|
}, false).then(res => {
|
|
}, false).then(res => {
|
|
|
console.log("批量修改产品清单", res)
|
|
console.log("批量修改产品清单", res)
|
|
|
- // if (res.msg != '成功') console
|
|
|
|
|
|
|
+ queue = [];
|
|
|
|
|
+ let list = this.data.list;
|
|
|
|
|
+ if (res.msg != '成功') {
|
|
|
|
|
+ wx.showToast({
|
|
|
|
|
+ title: res.msg,
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ })
|
|
|
|
|
+ this.setData({
|
|
|
|
|
+ list
|
|
|
|
|
+ })
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ items.forEach(v => {
|
|
|
|
|
+ v.discountrate = (v.discountrate * 100).toFixed(2);
|
|
|
|
|
+ let i = list.findIndex(value => v.sa_quotedprice_itemsid == value.sa_quotedprice_itemsid);
|
|
|
|
|
+ if (i != -1) this.data.list[i] = {
|
|
|
|
|
+ ...list[i],
|
|
|
|
|
+ ...v
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|