const _Http = getApp().globalData.http; Component({ options: { addGlobalClass: true }, properties: { disabled: Boolean, detail: Object }, data: { "content": { nocache: true, "pageNumber": 1, pageTotal: 1, total: null, where: { cluetype: '业务员' } }, filter: { show: false, type: ['业务员', '经销商'], //状态项 typeActive: "业务员", } }, methods: { /* 筛选状态选择 */ typeStatus(e) { const { item } = e.currentTarget.dataset; this.setData({ "filter.typeActive": this.data.filter.typeActive == item ? "" : item }) console.log(this.data.filter.typeActive); }, /* 处理筛选 */ handleFilter({ detail }) { const data = this.data.filter; switch (detail) { case 'confirm': this.setData({ 'filter.show': false }); this.getList(this.data.sat_campaignid, true, data); break; case 'reset': this.setData({ 'filter.typeActive': "", }); this.getList(this.data.sat_campaignid, true, this.data.filter) break; case 'close': this.setData({ 'filter.show': false }); break; } }, selectBtn() { this.setData({ 'filter.show': true }) }, /* 获取产品列表 */ getList(id, init = false, data) { let content = this.data.content; content.sat_campaignid = id; if (init) content.pageNumber = 1 if (data) { content.where.cluetype = data.typeActive } _Http.basic({ "id": "20221102102602", content }).then(res => { console.log("活动线索", res) if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }) this.setData({ list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data), "content.pageNumber": res.pageNumber + 1, "content.pageTotal": res.pageTotal, "content.total": res.total, sat_campaignid: id }) }) }, //详情按钮回调 tabbarOnClick({ detail }) { let data = this.data.detail; switch (detail.label) { case "跟进": wx.navigateTo({ url: `/packageA/setclient/modules/trace/add/index?ownertable=sat_campaign&ownerid=${data.sat_campaignid}`, }) break; case "作废": wx.showModal({ title: '提示', content: '是否确认作废该报价单?', complete: ({ confirm }) => { if (confirm) _Http.basic({ "id": 20221020165503, "version": 1, "content": { "sat_campaignids": [this.data.detail.sat_campaignid] } }).then(res => { wx.showToast({ title: res.msg == '成功' ? '已作废报价单' : res.msg, icon: "none" }); if (res.msg == '成功') { setTimeout(() => { getCurrentPages().forEach(v => { if (v.__route__ == 'packageA/offers/index') { v.setData({ list: v.data.list.filter(value => value.sat_campaignid != this.data.detail.sat_campaignid), 'content.total': v.data.content.total - 1 }) } }) wx.navigateBack(); }, 300) } }) } }) break; case "更换负责人": wx.navigateTo({ url: `/pages/group/select?data=${JSON.stringify({ ownertable:"sat_campaign", ownerid:data.sat_campaignid, })}&radio=true&principal=true`, }) break; } }, /* 删除产品 */ handleDelete({ detail }) { _Http.basic({ "id": 20221021145602, "content": { "deletereason": "", "sa_project_itemsids": detail } }).then(res => { console.log("批量删除产品", res); wx.showToast({ title: res.msg == '成功' ? '删除成功!' : res.msg, icon: "none" }) if (res.msg == '成功') this.setData({ list: this.data.list.filter(v => detail.indexOf(v.sa_project_itemsid) == -1) }) }) }, } })