const _Http = getApp().globalData.http; Page({ data: { tabsActive: 3, //tabs 选中项 sa_projectid: "", tabsList: [{ label: "详细信息", num: 132 }, { label: "阶段任务", num: 132 }, { label: "跟进动态", num: 132 }, { label: "关联客户", num: 132 }, { label: "联系人", num: 132 }], }, onLoad(options) { this.setData({ sa_projectid: options.sa_projectid }); this.getDetail() }, getDetail() { _Http.basic({ "id": 20221021103902, "content": { "sa_projectid": this.data.sa_projectid }, }).then(res => { console.log("项目商机详情", res) if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }); this.setData({ detail: res.data, briefs: [{ label: "项目编号", value: res.data.projectnum }, { label: "项目地址", value: res.data.province + res.data.city + res.data.county + res.data.address }, { label: "项目类型", value: res.data.projecttype }, { label: "负责人", value: res.data.name }, { label: "当前项目阶段", value: res.data.stagename }, { label: "赢率", value: res.data.winrate }, { label: "最近跟进时间", value: res.data.followdate }], list1: [{ label: "项目名称", value: res.data.projectname }, { label: "项目编号", value: res.data.projectnum }, { label: "项目类型", value: res.data.projecttype }, { label: "省市县", value: res.data.province ? res.data.province + res.data.city + res.data.county : '' }, { label: "详细地址", value: res.data.address }, { label: "项目等级", value: res.data.grade }, { label: "当前阶段", value: res.data.stagename }, { label: "项目报备时间", value: res.data.createdate }, { label: "项目规模", value: res.data.scale }, { label: "项目状态", value: res.data.status }, { label: "项目预算", value: res.data.budgetary }, { label: "预计签约金额", value: res.data.signamount_due }, { label: "预计签约月份", value: res.data.signdate_due }, { label: "赢率", value: res.data.winrate }, { label: "负责人", value: res.data.name }], list2: [{ label: "创建人", value: res.data.createby }, { label: "创建时间", value: res.data.createdate }, { label: "最近编辑人", value: res.data.changeby }, { label: "最近编辑时间", value: res.data.changedate }, { label: "最近跟进人", value: res.data.followby }, { label: "最近跟进时间", value: res.data.followdate }, { label: "转手次数", value: res.data.changecount }, { label: "报备人", value: res.data.reportby }, { label: "报备时间", value: res.data.reportdate }, { label: "报备审核通过时间", value: res.data.reportcheckdate }] }) //更新列表赢率 getCurrentPages().forEach(v => { if (v.getList) { let i = v.data.list.findIndex(e => e.sa_projectid == this.data.sa_projectid); if (i != -1) v.setData({ [`list[${i}].winrate`]: parseFloat(res.data.winrate.substring(0, res.data.winrate.length - 1)) }) } }) this.getTags(); this.getGroup(); this.partialRenewal(); }) }, //tabs 切换 tabsChange({ detail }) { this.setData({ tabsActive: detail }); this.partialRenewal(); }, //更新标签 getTags() { this.selectComponent("#Tags").getTags(); }, //更新团队成员 getGroup() { this.selectComponent("#Group").getList(); }, //局部数据更新 tabs partialRenewal(init = false) { const id = this.data.detail.sa_projectid; let model = ''; let name = this.data.tabsList[this.data.tabsActive].label; switch (name) { case "跟进动态": model = "#Trace" break; case "阶段任务": model = '#Task' break; case "关联客户": model = "#Treaty" break; }; if (model) { // 确定好模块ID total = null 是第一次加载 加载数据 // init是新增或修改需要清数据 let Component = this.selectComponent(model); const { total, pageNumber, pageTotal } = Component.data.content; if (total == null || init) { Component.getList(id, init); } else if (pageNumber <= pageTotal) { Component.getList(id, false); } else { //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据 } } }, onReachBottom() { this.partialRenewal(); }, onShareAppMessage() { } })