|
@@ -3,7 +3,11 @@ const _Http = getApp().globalData.http,
|
|
|
file = require("../../../utils/FormatTheAttachment"),
|
|
|
{
|
|
|
getItem
|
|
|
- } = require("./calculatePrice")
|
|
|
+ } = require("./calculatePrice");
|
|
|
+import {
|
|
|
+ getCustomText
|
|
|
+} from "../../../utils/customItemType";
|
|
|
+
|
|
|
Page({
|
|
|
data: {
|
|
|
loading: true,
|
|
@@ -32,7 +36,34 @@ Page({
|
|
|
idname: options.idname || this.data.idname
|
|
|
});
|
|
|
this.getList()
|
|
|
- getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
|
|
|
+ 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()
|
|
@@ -106,33 +137,6 @@ Page({
|
|
|
item.pitchOn = false;
|
|
|
if (item) this.selectComponent("#Custom").onClick(item)
|
|
|
},
|
|
|
- customizedProduct(item) {
|
|
|
- item = getItem(item);
|
|
|
- item = getItem(item, 'newOldPrice', 'oldprice');
|
|
|
- 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)
|
|
|
- })
|
|
|
- },
|
|
|
getList(init = false) {
|
|
|
//init 用于初始化分页
|
|
|
if (init.detail != undefined) init = init.detail;
|
|
@@ -171,6 +175,12 @@ Page({
|
|
|
if (!value.saledqty) value.saledqty = 0;
|
|
|
value.maxQty = value.groupqty == 0 ? "" : value.groupqty - value.saledqty; //有限购 设置最高可订购数量
|
|
|
value.qty = value.orderminqty;
|
|
|
+
|
|
|
+ if (value.iscustomsize) {
|
|
|
+ value.customText = getCustomText(value);
|
|
|
+ value.pitchOn = false;
|
|
|
+ }
|
|
|
+
|
|
|
return value;
|
|
|
})
|
|
|
this.setData({
|