const _Http = getApp().globalData.http, currency = require("../../utils/currency"), CNY = sum => currency(sum, { symbol: "¥", precision: 2 }).format(); Page({ data: { list: [], filtrate: false, colors: { '新建': '#3874f6', '提交': '#67C23A', '审核': '#e6a23c' }, "content": { "nocache": true, "pageNumber": 1, "pageSize": 20, "pageTotal": 1, "where": { "condition": "" } } }, onLoad(options) { this.getList(true); try { let privacyFieldC = wx.getStorageSync('auth').writeOff.forms.list.formcols.map(v => v.title); this.setData({ privacyFieldC }) console.log("privacyFieldC", privacyFieldC) } catch (error) { console.error(error) } }, getList(init = false) { if (init.detail != undefined) init = init.detail; let content = this.data.content; if (init) content.pageNumber = 1; if (content.pageNumber > content.pageTotal) return; _Http.basic({ id: 2025081811145503, content: content }).then(res => { console.log("配件核销申请", res) this.selectComponent('#ListBox').RefreshToComplete(); if (res.msg != '成功') return wx.showToast({ title: res.msg, icon: "none" }) res.data = res.data.map(v => { v.totalamount = CNY(v.totalamount) v.offamount = CNY(v.offamount) return v }) this.setData({ total: res.total, list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data), 'content.pageNumber': res.pageNumber + 1, 'content.pageTotal': res.pageTotal }) }) }, /* 更新列表 */ updateList() { let params = JSON.parse(JSON.stringify(this.data.content)); params.pageSize = (params.pageNumber - 1) * params.pageSize; params.pageNumber = 1; _Http.basic({ "id": 2025081811145503, content: params }).then(res => { console.log("配件核销申请", res) if (res.msg != '成功') return; res.data = res.data.map(v => { v.totalamount = CNY(v.totalamount) v.offamount = CNY(v.offamount) return v }) this.setData({ list: res.data, total: res.total, }) }) }, startSearch({ detail }) { if (detail == this.data.content.where.condition) return; this.data.content.where.condition = detail; this.getList(true); }, createOrder(e) { _Http.basic({ "id": 2025081811143103, "content": { "sa_tpartreimbursementid": 0, "remarks": '', "billdate": e.detail.value, }, }).then(res => { console.log("创建", res) wx.showToast({ title: res.code == 1 ? '创建成功' : res.msg, icon: "none" }) if (res.code == 1) wx.navigateTo({ url: '/packageA/writeOff/detail?id=' + res.data.sa_tpartreimbursementid, }) }) }, /* 取消搜索 */ onClear() { this.data.content.where.condition = ""; this.getList(true); }, openFiltrate() { this.setData({ filtrate: true }) }, /* 处理筛选 */ handleFilter(e) { e.detail.condition = this.data.content.where.condition; e.detail.begindate = e.detail.startdate this.setData({ "content.where": e.detail }) console.log("this.data.content", this.data.content) this.getList(true) }, })