const _Http = getApp().globalData.http; Component({ options: { addGlobalClass: true, }, properties: { update: { type: Function } }, lifetimes: { attached: function () { getApp().globalData.Language.getLanguagePackage(this) this.setData({ dates: this.data.dates.map(v => { v.name = getApp().globalData.Language.getMapText(v.value); v.color = v.value == this.data.content.dateType ? "#3874F6" : ""; return v }), "content.dataid": wx.getStorageSync('userMsg').userid, "content.username": wx.getStorageSync('userMsg').name, }) } }, data: { "content": { dateType: "本年", type: 0, "where": { isleave: "1" } }, detaShow: false, dates: [{ value: "全部" }, { value: "本年" }, { value: "本季" }, { value: "本月" }, { value: "上月" }, { value: "去年" }, ], }, methods: { getList() { let content = this.data.content; const { dataid, type, username, isleave } = getCurrentPages()[getCurrentPages().length - 1].data; content.dataid = dataid; content.type = type; content.username = username; content.where.isleave = isleave; _Http.basic({ "id": 20231015170504, content }).then(res => { console.log("客户数据概况", res) if (res.code != '1') return wx.showToast({ title: res.msg, icon: "none" }) const getMapText = getApp().globalData.Language.getMapText; let list = [{ title: '客户总数', value: res.data.total, tips: getMapText('客户总数:包含医院管理、公海客户数量'), link: true }, { title: '公海客户数', value: res.data.customerpoolqty, tips: '', link: true }, { title: '成交客户数', value: res.data.tradedCustomers, tips: getMapText('成交客户:已成交、多次成交状态的客户数量'), link: true }, { title: '参与项目客户数', value: res.data.participateProject, tips: getMapText('参与项目客户数:参与有下订单的项目的关联客户数'), link: true }, ] try { list = list.concat(res.data.data.map(v => { return { title: v.value, value: v.qty, tips: v.value == '无分类客户' ? getMapText('统计没有客户分类信息的客户数量') : "", link: true } })) } catch (error) { } this.setData({ list, content }) this.onCancel() }) }, showTips(e) { const { tips } = e.currentTarget.dataset; wx.showModal({ content: tips, showCancel: false, confirmText: getApp().globalData.Language.getMapText('确定'), }) }, toDetail(e) { const { item } = e.currentTarget.dataset, content = this.data.content; content.typemx = item.title; wx.navigateTo({ url: '/salesPanel/dataOverview/OverviewAndDetails/Client?content=' + JSON.stringify(content), }) }, openDateType() { this.setData({ detaShow: true }) }, dateOnSelect(event) { const { value } = event.detail; if (this.data.content.dateType == value) return this.onCancel(); this.setData({ "content.dateType": value, dates: this.data.dates.map(item => { item.color = item.value == value ? "#3874F6" : ""; item.loading = item.value == value ? true : false; return item }), }) this.getList(true) }, onCancel() { this.setData({ actionShow: false, detaShow: false, list: this.data.list.map(item => { item.loading = false; return item }), dates: this.data.dates.map(item => { item.loading = false; return item }) }) }, } })