|
|
@@ -36,34 +36,6 @@ Page({
|
|
|
idname: options.idname || this.data.idname
|
|
|
});
|
|
|
this.getList()
|
|
|
- getApp().globalData.customizedProduct = (item, custom) => {
|
|
|
- item = getItem(getItem(Object.assign(item, custom)), 'newOldPrice', 'oldprice');
|
|
|
- item.customText = getCustomText(item);
|
|
|
-
|
|
|
- return new Promise((resolve) => {
|
|
|
- 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;
|
|
|
- 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,
|
|
|
- resultList
|
|
|
- })
|
|
|
- resolve(true)
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
onShow() {
|
|
|
this.getCollectCount()
|
|
|
@@ -135,6 +107,34 @@ Page({
|
|
|
item
|
|
|
} = e.target.dataset;
|
|
|
item.pitchOn = false;
|
|
|
+
|
|
|
+ getApp().globalData.customizedProduct = (item, custom) => {
|
|
|
+ item = getItem(getItem(Object.assign(item, custom)), 'newOldPrice', 'oldprice');
|
|
|
+ item.customText = getCustomText(item);
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ 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;
|
|
|
+ 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,
|
|
|
+ resultList
|
|
|
+ })
|
|
|
+ resolve(true)
|
|
|
+ })
|
|
|
+ }
|
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
},
|
|
|
getList(init = false) {
|