|
@@ -44,12 +44,25 @@ Page({
|
|
|
item = getItem(item);
|
|
|
item = getItem(item, 'newOldPrice', 'oldprice');
|
|
|
return new Promise((resolve) => {
|
|
|
- let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]);
|
|
|
+ let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]),
|
|
|
+ resultList = this.data.resultList,
|
|
|
+ result = this.data.result;
|
|
|
if (index != -1) this.data.list[index] = item;
|
|
|
- if (item.pitchOn) this.data.result.push(item[this.data.idname])
|
|
|
+ let i = resultList.findIndex(v => v[this.data.idname] == item[this.data.idname]);
|
|
|
+ if (item.pitchOn) {
|
|
|
+ if (i == -1) {
|
|
|
+ resultList.push(item);
|
|
|
+ result.push(item[this.data.idname])
|
|
|
+ } else {
|
|
|
+ resultList[i] = item;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ resultList[i] = item;
|
|
|
+ }
|
|
|
this.setData({
|
|
|
list: this.data.list,
|
|
|
- result: this.data.result
|
|
|
+ result,
|
|
|
+ resultList
|
|
|
})
|
|
|
resolve(true)
|
|
|
})
|