const _Http = getApp().globalData.http, currency = require("../../utils/currency"), CNY = (value, symbol = "¥", precision = 2) => currency(value, { symbol, precision }).format(); Page({ data: { content: {}, searchShow: false }, onLoad(options) { getApp().globalData.Language.getLanguagePackage(this, "客户账户余额明细") if (options.content) { let content = JSON.parse(options.content) content.pageNUmber = 1; content.pageSize = 20; content.where.accountno = content.accountno; delete content.accountno; this.setData({ content }) } this.getList(true) let page = getCurrentPages()[getCurrentPages().length - 2], model = page.selectComponent("#organization"), organization = this.selectComponent("#organization"), { username, isleave } = page.data; organization.setData({ ...model.data }) this.setData({ username, isleave }) }, getList(init = false) { _Http.init(this.data.content, init).then(content => { _Http.basic({ "id": 20231020131504, content }).then(res => { console.log("客户账户余额明细", res) this.selectComponent('#ListBox').automaticSetHei(); this.selectComponent('#ListBox').RefreshToComplete(); if (res.code != '1') return wx.showToast({ title: res.data, icon: "none" }) res.data = res.data.map(v => { v.balance = CNY(v.balance) v.creditquota = CNY(v.creditquota) return v }) this.setData({ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data), "content.pageNumber": res.pageNumber + 1, "content.pageSize": res.pageSize, "content.pageTotal": res.pageTotal, "total": res.total, }) }) }) }, openFiltrate() { this.setData({ showFiltrate: true }) }, handleFilter({ detail }) { if (detail.name == "close") return; if (detail.name == 'reset') { this.selectComponent("#organization").setData({ isleave: 1 }) this.selectComponent("#organization").initDepAndUser() this.setData({ "content.dataid": wx.getStorageSync('userMsg').userid, "content.type": 0, "content.where.isleave": 1, username: wx.getStorageSync('userMsg').name, isleave: 1 }) } else { let active = this.selectComponent("#organization").data.result, isleave = this.selectComponent("#organization").data.isleave; let type = active.userid ? 0 : 1, dataid = type == 0 ? active.userid : active.departmentid this.setData({ "content.dataid": dataid, "content.type": type, "content.where.isleave": isleave, username: active.name }) } this.getList(true); }, enddateChange(e) { if (e.detail.value == this.data.content.enddate) return; this.setData({ "content.enddate": e.detail.value }) this.getList(true) }, changeSearchShow() { this.setData({ searchShow: !this.data.searchShow }) setTimeout(() => { this.selectComponent('#ListBox').automaticSetHei(); if (this.data.searchShow) { if (this.selectComponent("#Yl_Filtrate1").data.show) return this.setData({ focus: true }) } else { this.setData({ focus: false }) } }, 350) }, onSearch() { this.data.content.where.condition = this.data.searchValue; this.getList(true); }, onChange(event) { this.setData({ searchValue: event.detail }) }, onClear() { this.setData({ searchValue: "", "content.where.condition": "" }) this.getList(true); }, toDateil(e) { const { item } = e.currentTarget.dataset; wx.navigateTo({ url: '/salesPanel/customerBlance/Pipeline?sys_enterpriseid=' + item.sys_enterpriseid + '&sa_accountclassid=' + item.sa_accountclassid + '&enddate=' + this.data.content.enddate, }) }, })