|
@@ -27,8 +27,7 @@ Page({
|
|
spec: ""
|
|
spec: ""
|
|
},
|
|
},
|
|
privacyFieldC: [],
|
|
privacyFieldC: [],
|
|
- isShowFavorites: false,
|
|
|
|
- UniqueLine: false
|
|
|
|
|
|
+ isShowFavorites: false
|
|
},
|
|
},
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
let data = JSON.parse(options.params);
|
|
let data = JSON.parse(options.params);
|
|
@@ -50,10 +49,9 @@ Page({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
/* 获取详情 */
|
|
/* 获取详情 */
|
|
- getDetail(init = false) {
|
|
|
|
|
|
+ getDetail(reset = false) {
|
|
let content = this.data.content;
|
|
let content = this.data.content;
|
|
if (sys_enterpriseid) content.sys_enterpriseid = sys_enterpriseid;
|
|
if (sys_enterpriseid) content.sys_enterpriseid = sys_enterpriseid;
|
|
- if (this.data.UniqueLine)['spec', 'cheek', 'material', 'color'].forEach(key => content[key] = '')
|
|
|
|
_Http.basic({
|
|
_Http.basic({
|
|
"id": "20221223165503",
|
|
"id": "20221223165503",
|
|
content
|
|
content
|
|
@@ -84,25 +82,17 @@ Page({
|
|
materialRows: res.data.materialRows,
|
|
materialRows: res.data.materialRows,
|
|
colorRows: res.data.colorRows,
|
|
colorRows: res.data.colorRows,
|
|
};
|
|
};
|
|
-
|
|
|
|
let obj = {},
|
|
let obj = {},
|
|
- auto = true,
|
|
|
|
- UniqueLine = true;
|
|
|
|
|
|
+ isRecursion = false;
|
|
res.data.customschemeItems.map(v => v.value).forEach(key => obj[key] = row[key + 'Rows'].filter(v => v.flag))
|
|
res.data.customschemeItems.map(v => v.value).forEach(key => obj[key] = row[key + 'Rows'].filter(v => v.flag))
|
|
for (const key in obj) {
|
|
for (const key in obj) {
|
|
- if (obj[key].length > 1) {
|
|
|
|
- auto = false
|
|
|
|
- UniqueLine = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (auto) {
|
|
|
|
- for (const key in obj) {
|
|
|
|
- if (obj[key].length) content[key] = obj[key][0].parm;
|
|
|
|
|
|
+ if (obj[key].length == 1) {
|
|
|
|
+ content[key] = obj[key][0].parm;
|
|
|
|
+ isRecursion = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- let itemCount = ['specRows', 'cheekRows', 'materialRows', 'colorRows'].filter(v => res.data[v].length).length,
|
|
|
|
|
|
+ let itemCount = res.data.customschemeItems.length,
|
|
selectCount = ['cheek', 'color', 'material', 'spec'].filter(v => content[v].length).length;
|
|
selectCount = ['cheek', 'color', 'material', 'spec'].filter(v => content[v].length).length;
|
|
-
|
|
|
|
this.setData({
|
|
this.setData({
|
|
content,
|
|
content,
|
|
detail: item,
|
|
detail: item,
|
|
@@ -110,9 +100,15 @@ Page({
|
|
customschemeItems: res.data.customschemeItems,
|
|
customschemeItems: res.data.customschemeItems,
|
|
loading: false,
|
|
loading: false,
|
|
itemCount,
|
|
itemCount,
|
|
- selectCount,
|
|
|
|
- UniqueLine
|
|
|
|
|
|
+ selectCount
|
|
});
|
|
});
|
|
|
|
+ if (!reset && isRecursion) {
|
|
|
|
+ wx.showLoading({
|
|
|
|
+ title: '加载中...',
|
|
|
|
+ mask: true
|
|
|
|
+ })
|
|
|
|
+ this.getDetail(true)
|
|
|
|
+ }
|
|
//是否定制
|
|
//是否定制
|
|
if (itemCount == selectCount && item.iscustomsize == 1) {
|
|
if (itemCount == selectCount && item.iscustomsize == 1) {
|
|
this.selectComponent("#customMade").init(item);
|
|
this.selectComponent("#customMade").init(item);
|
|
@@ -182,10 +178,14 @@ Page({
|
|
title: '加载中...',
|
|
title: '加载中...',
|
|
mask: true
|
|
mask: true
|
|
})
|
|
})
|
|
- // UniqueLine
|
|
|
|
- content[valuename] = (content[valuename] == value.parm) ? "" : value.parm;
|
|
|
|
|
|
+ if (content[valuename] == value.parm && this.data.row[valuename + 'Rows'].filter(v => v.flag).length == 1) {
|
|
|
|
+ ['spec', 'cheek', 'material', 'color'].forEach(key => content[key] = '')
|
|
|
|
+ } else {
|
|
|
|
+ content[valuename] = (content[valuename] == value.parm) ? "" : value.parm;
|
|
|
|
+ }
|
|
this.setData({
|
|
this.setData({
|
|
- selectCount: ['cheek', 'color', 'material', 'spec'].filter(v => content[v].length).length
|
|
|
|
|
|
+ selectCount: ['cheek', 'color', 'material', 'spec'].filter(v => content[v].length).length,
|
|
|
|
+ content
|
|
})
|
|
})
|
|
this.getDetail()
|
|
this.getDetail()
|
|
},
|
|
},
|