|
@@ -13,6 +13,7 @@ Page({
|
|
|
showName: "itemname",
|
|
|
newPrice: "price",
|
|
|
oldPrice: "oldprice",
|
|
|
+ resultList: []
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
if (options.params) {
|
|
@@ -107,9 +108,10 @@ Page({
|
|
|
let {
|
|
|
id,
|
|
|
item
|
|
|
- } = e.currentTarget.dataset, result = this.data.result;
|
|
|
+ } = e.currentTarget.dataset, result = this.data.result, resultList = this.data.resultList;
|
|
|
if (this.data.radio) {
|
|
|
result = [id];
|
|
|
+ resultList = [item]
|
|
|
} else {
|
|
|
let isAdd = result.some(v => v == id);
|
|
|
if (!isAdd) {
|
|
@@ -119,25 +121,30 @@ Page({
|
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
} else {
|
|
|
result.push(id)
|
|
|
+ resultList.push(item)
|
|
|
}
|
|
|
} else {
|
|
|
result.push(id)
|
|
|
+ resultList.push(item)
|
|
|
}
|
|
|
} else {
|
|
|
result = result.filter(v => v != id)
|
|
|
+ resultList = resultList.filter(v => v[this.data.idname] != id)
|
|
|
}
|
|
|
}
|
|
|
this.setData({
|
|
|
- result
|
|
|
+ result,
|
|
|
+ resultList
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/* 提交 */
|
|
|
submit() {
|
|
|
let result = this.data.result,
|
|
|
+ resultList = this.data.resultList,
|
|
|
obj = {
|
|
|
result,
|
|
|
- list: result.map(v => this.data.list.find(value => value[this.data.idname] == v)),
|
|
|
+ list: resultList,
|
|
|
value: [result.map(v => {
|
|
|
let data = this.data.list.find(value => value[this.data.idname] == v);
|
|
|
return data ? data[this.data.showName] : ""
|