|
@@ -1,6 +1,11 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
let sa_brandid = null,
|
|
|
sys_enterpriseid = null;
|
|
|
+
|
|
|
+import {
|
|
|
+ getLabelList
|
|
|
+} from "../../utils/customItemType";
|
|
|
+
|
|
|
import {
|
|
|
fileList
|
|
|
} from "../../utils/FormatTheAttachment";
|
|
@@ -8,6 +13,7 @@ import currency from "../../utils/currency";
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
+ labelList: getLabelList(),
|
|
|
hidePrice: wx.getStorageSync('hidePrice'),
|
|
|
badge: getApp().globalData.collectCount,
|
|
|
loading: true,
|
|
@@ -16,15 +22,11 @@ Page({
|
|
|
spec: "", //规格
|
|
|
color: "", //颜色
|
|
|
material: "", //材质
|
|
|
- cheek: "", //边框
|
|
|
- dwidth: 0,
|
|
|
- dlength: 0,
|
|
|
+ cheek: "" //边框
|
|
|
},
|
|
|
detail: {
|
|
|
spec: ""
|
|
|
},
|
|
|
- cWidth: null, //宽定制方案
|
|
|
- cLength: null, //长定制方案
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
let data = JSON.parse(options.params);
|
|
@@ -73,47 +75,7 @@ Page({
|
|
|
loading: false
|
|
|
});
|
|
|
//是否定制
|
|
|
- if (init) {
|
|
|
- if (item.iscustomsize == 1) {
|
|
|
- let cWidth = null,
|
|
|
- cLength = null;
|
|
|
- Promise.all([{
|
|
|
- "id": "20230707091603",
|
|
|
- "version": 1,
|
|
|
- "content": {
|
|
|
- "sa_sizecustomizedschemeid": item.lengthschemeid,
|
|
|
- date: Date.now() + 1
|
|
|
- }
|
|
|
- }, {
|
|
|
- "id": "20230707091603",
|
|
|
- "version": 1,
|
|
|
- "content": {
|
|
|
- "sa_sizecustomizedschemeid": item.widthschemeid,
|
|
|
- date: Date.now() + 2
|
|
|
- }
|
|
|
- }].map(v => _Http.basic(v))).then(s => {
|
|
|
- if (s.some(c => c.msg != '成功')) return wx.showToast({
|
|
|
- title: '定制方案获取失败',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- if (item.lengthschemeid) cLength = s[0].data;
|
|
|
- if (item.widthschemeid) cWidth = s[1].data;
|
|
|
- this.setData({
|
|
|
- cWidth,
|
|
|
- cLength,
|
|
|
- "content.dwidth": cWidth.min || 0,
|
|
|
- "content.dlength": cLength.min || 0,
|
|
|
- });
|
|
|
- })
|
|
|
- } else {
|
|
|
- this.setData({
|
|
|
- cWidth: null,
|
|
|
- cLength: null,
|
|
|
- "content.dwidth": 0,
|
|
|
- "content.dlength": 0,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ if (init && item.iscustomsize == 1) this.selectComponent("#customMade").init(item);
|
|
|
})
|
|
|
},
|
|
|
/* 预览媒体 */
|
|
@@ -178,37 +140,7 @@ Page({
|
|
|
content[valuename] = (content[valuename] == value.parm) ? "" : value.parm;
|
|
|
this.getDetail(valuename == "spec")
|
|
|
},
|
|
|
- /* 定制选项 */
|
|
|
- customParameter(e) {
|
|
|
- let {
|
|
|
- value,
|
|
|
- valuename
|
|
|
- } = e.currentTarget.dataset;
|
|
|
- this.data.content[valuename] = value;
|
|
|
- this.setData({
|
|
|
- content: this.data.content
|
|
|
- })
|
|
|
- },
|
|
|
- /* 定制步进器 */
|
|
|
- cahngeStepper(e) {
|
|
|
- const name = e.currentTarget.dataset.name,
|
|
|
- name2 = name == 'cWidth' ? "dwidth" : "dlength",
|
|
|
- content = this.data.content;
|
|
|
- if (e.type == 'plus') {
|
|
|
- content[name2] += 1
|
|
|
- } else if (e.type == 'minus') {
|
|
|
- content[name2] -= 1
|
|
|
- } else {
|
|
|
- const data = this.data[name];
|
|
|
- content[name2] = (e.detail.value - 0).toFixed(data.decimalplaces);
|
|
|
- }
|
|
|
- let item = this.data[name];
|
|
|
- if (content[name2] > item.max) content[name2] = item.max;
|
|
|
- if (content[name2] < item.min) content[name2] = item.min;
|
|
|
- this.setData({
|
|
|
- content
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
clickBut() {
|
|
|
this.data.detail.tradefield.length >= 2 ? wx.showToast({
|
|
|
title: '请选择加入产品领域',
|
|
@@ -264,28 +196,22 @@ Page({
|
|
|
},
|
|
|
handleStorage(index) {
|
|
|
let detail = this.data.detail,
|
|
|
- content = this.data.content;
|
|
|
- if (detail.iscustomsize == 1) {
|
|
|
- if (detail.widthschemeid != 0 && content.dwidth == 0) return wx.showToast({
|
|
|
- title: '请完成定制宽选项',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- if (detail.lengthschemeid != 0 && content.dlength == 0) return wx.showToast({
|
|
|
- title: '请完成定制长选项',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- }
|
|
|
+ custom = {};
|
|
|
+ //是否为定制项
|
|
|
+ if (detail.iscustomsize == 1) custom = this.selectComponent("#customMade").getResult(true);
|
|
|
+ if (typeof custom == boolean) return;
|
|
|
+
|
|
|
+ let content = Object.assign(this.data.content, {
|
|
|
+ sa_brandid,
|
|
|
+ itemid: detail.itemid, //货品id
|
|
|
+ qty: detail.orderminqty, //数量
|
|
|
+ itemno: detail.itemno, //货品编号
|
|
|
+ tradefield: detail.tradefield[index].tradefield,
|
|
|
+ }, custom);
|
|
|
+
|
|
|
_Http.basic({
|
|
|
"id": 20220924095102,
|
|
|
- "content": {
|
|
|
- sa_brandid,
|
|
|
- "itemid": detail.itemid, //货品id
|
|
|
- "qty": detail.orderminqty, //数量
|
|
|
- itemno: detail.itemno, //货品编号
|
|
|
- tradefield: detail.tradefield[index].tradefield,
|
|
|
- width: content.dwidth,
|
|
|
- length: content.dlength
|
|
|
- },
|
|
|
+ content,
|
|
|
}).then(res => {
|
|
|
console.log("加入购物车", res)
|
|
|
wx.showToast({
|