| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- 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
- })
- })
- },
- }
- })
|