function getLabelList() { let siteCustomLabel = { "default": { length: "长", width: "宽", cheek: "边框", color: "颜色", material: "基材", spec: "尺寸", custom: "定制" }, "DLB": { length: "长", width: "宽", cheek: "工艺", color: "颜色", material: "选项", spec: "尺寸", custom: "定制" } }; return siteCustomLabel[wx.getStorageSync('siteP').siteid] || siteCustomLabel.default } function getCustomItems(data, prefix = '') { const _Http = getApp().globalData.http; let labelList = getLabelList(), httpList = []; for (const key in labelList) { const name = key + 'schemeid'; if (data[name]) httpList.push({ sa_sizecustomizedschemeid: data[name], date: Date.now() + 1, label: labelList[key], value: data[prefix + key] || "", key: prefix + key, name }) }; return new Promise((resolve, reject) => { if (!httpList.length) return resolve([]); Promise.all(httpList.map(v => _Http.basic({ "id": "20230707091603", "version": 1, content: v }))).then(res => resolve(res.map((v, i) => { v.data = Object.assign(v.data, httpList[i]) return v }).filter(v => v.msg == '成功').map(v => v.data))) }) } function getCustomText(data, prefix = '') { let labelList = getLabelList(), customText = []; for (const key in labelList) { const name = key + 'schemeid'; if (data[name]) customText.push(`${labelList[key]}:${data[prefix+key]||'定制'}`) }; return customText } module.exports = { getLabelList, getCustomItems, getCustomText }