|
@@ -35,20 +35,6 @@ Page({
|
|
|
newPrice: options.newprice || "price", //红色价格
|
|
|
});
|
|
|
this.getList();
|
|
|
- getApp().globalData.customizedProduct = (item, custom) => {
|
|
|
- return new Promise((resolve) => {
|
|
|
- item = Object.assign(item, custom)
|
|
|
- item.customText = getCustomText(item);
|
|
|
- let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]);
|
|
|
- if (index != -1) this.data.list[index] = item;
|
|
|
- if (item.pitchOn) this.data.result.push(item[this.data.idname])
|
|
|
- this.setData({
|
|
|
- list: this.data.list,
|
|
|
- result: this.data.result
|
|
|
- })
|
|
|
- resolve(true)
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
getList(init = false) {
|
|
|
//init 用于初始化分页
|
|
@@ -98,8 +84,25 @@ Page({
|
|
|
item
|
|
|
} = e.target.dataset;
|
|
|
item.pitchOn = false;
|
|
|
+ this.bindChangeFun()
|
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
},
|
|
|
+ bindChangeFun(){
|
|
|
+ getApp().globalData.customizedProduct = (item, custom) => {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ item = Object.assign(item, custom)
|
|
|
+ item.customText = getCustomText(item);
|
|
|
+ let index = this.data.list.findIndex(v => v[this.data.idname] == item[this.data.idname]);
|
|
|
+ if (index != -1) this.data.list[index] = item;
|
|
|
+ if (item.pitchOn) this.data.result.push(item[this.data.idname])
|
|
|
+ this.setData({
|
|
|
+ list: this.data.list,
|
|
|
+ result: this.data.result
|
|
|
+ })
|
|
|
+ resolve(true)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
/* 选中 */
|
|
|
changeResult(e) {
|
|
|
let {
|
|
@@ -114,6 +117,7 @@ Page({
|
|
|
if (item.iscustomsize == 1) {
|
|
|
if ((item.widthschemeid && item.width == 0) || (item.lengthschemeid && item.length == 0)) {
|
|
|
item.pitchOn = true;
|
|
|
+ this.bindChangeFun()
|
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
} else {
|
|
|
result.push(id)
|