const _Http = getApp().globalData.http, currency = require("../../../../utils/currency"), CNY = value => currency(value, { symbol: "¥", precision: 2 }).format(); Page({ data: { list: [], content: {}, result: [], resultItem: [] }, onLoad(options) { this.data.content = { ...JSON.parse(options.ids), "pageSize": 20, "where": { "condition": "" } } this.getList(true) getApp().globalData.Language.getLanguagePackage(this, '选择订单明细'); }, getList(init = false) { let content = this.data.content; if (init.detail != undefined) init = init.detail; if (init) { content.pageNumber = 1; content.pageTotal = 1; } if (content.pageNumber > content.pageTotal) return; _Http.basic({ "id": 20231026150004, content }).then(res => { console.log("订单行列表", res) this.selectComponent('#ListBox').RefreshToComplete(); this.selectComponent("#ListBox").setHeight(".total", this); if (res.code != '1') return wx.showToast({ title: res.msg, icon: "none" }) content.pageNumber = res.pageNumber + 1; content.pageTotal = res.pageTotal; let list = res.data.map(v => { v.showmarketprice = CNY(v.marketprice) v.showdefaultprice = CNY(v.defaultprice) v.showdefaultamount = CNY(v.defaultamount) v.showprice = CNY(v.price) v.showamount = CNY(v.amount) return v }) this.setData({ list: res.pageNumber == 1 ? list : this.data.list.concat(list) }) }) }, onChange(e) { const { item } = e.currentTarget.dataset; let index = this.data.result.findIndex(v => v == item.sa_orderitemsid), result = this.data.result, resultItem = this.data.resultItem; if (index == -1) { result.push(item.sa_orderitemsid) resultItem.push(item) } else { result.splice(index, 1) resultItem.splice(index, 1) } this.setData({ result, resultItem }) }, submit() { getApp().globalData.handleSelect && getApp().globalData.handleSelect(this.data.resultItem) }, startSearch({ detail }) { this.data.content.where.condition = detail; this.getList(true) }, onClear() { this.data.content.where.condition = ''; this.getList(true) }, onUnload() { getApp().globalData.handleSelect = null; } })