|
@@ -28,7 +28,20 @@ Page({
|
|
|
showName: options.showName || this.data.showName,
|
|
|
newPrice: options.newprice || "price", //红色价格
|
|
|
});
|
|
|
- this.getList()
|
|
|
+ this.getList();
|
|
|
+ getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
|
|
|
+ },
|
|
|
+ customizedProduct(item) {
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ 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 用于初始化分页
|
|
@@ -59,6 +72,8 @@ Page({
|
|
|
value.brandName = value.brand.map(name => name.brandname)
|
|
|
value.tradefields = value.tradefield.map(name => name.tradefield)
|
|
|
value.qty = value.orderminqty;
|
|
|
+ value.width = 0;
|
|
|
+ value.length = 0;
|
|
|
return value;
|
|
|
})
|
|
|
this.setData({
|
|
@@ -70,15 +85,37 @@ Page({
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ customization(e) {
|
|
|
+ let {
|
|
|
+ item
|
|
|
+ } = e.target.dataset;
|
|
|
+ item.pitchOn = false;
|
|
|
+ if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
+ },
|
|
|
/* 选中 */
|
|
|
changeResult(e) {
|
|
|
let {
|
|
|
- id
|
|
|
+ id,
|
|
|
+ item
|
|
|
} = e.currentTarget.dataset, result = this.data.result;
|
|
|
if (this.data.radio) {
|
|
|
result = [id];
|
|
|
} else {
|
|
|
- result.some(v => v == id) ? result = result.filter(v => v != id) : result.push(id)
|
|
|
+ let isAdd = result.some(v => v == id);
|
|
|
+ if (!isAdd) {
|
|
|
+ if (item.iscustomsize == 1) {
|
|
|
+ if ((item.widthschemeid && item.width == 0) || (item.lengthschemeid && item.length == 0)) {
|
|
|
+ item.pitchOn = true;
|
|
|
+ if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
+ } else {
|
|
|
+ result.push(id)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result.push(id)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ result = result.filter(v => v != id)
|
|
|
+ }
|
|
|
}
|
|
|
this.setData({
|
|
|
result
|