const _Http = getApp().globalData.http; Page({ options: { addGlobalClass: true }, data: { showWhere: "所有日期", timeRangeShow: false, sat_orderclueid: 0, detailsData: null, followList: null, isdesc: 1, whereType: { value: "start", list: { "start": "", "end": "" } }, where: { "start": "", "end": "" } }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ sat_orderclueid: options.id }) this.selectDetail(); this.getFollowList(); }, /* 查询详情 */ selectDetail(i = 0) { if (i == 5) return; _Http.basic({ "classname": "saletool.orderclue.web.orderclue", "method": "selectDetail", "content": { "sat_orderclueid": this.data.sat_orderclueid } }).then(res => { if (res.msg != '成功') return this.selectDetail(i + 1); let data = res.data; for (let i in data) { if (data[i] == '') data[i] = '-'; } this.setData({ detailsData: data }) }) }, /* 跟进列表 */ getFollowList(i = 0) { if (i == 5) return; _Http.basic({ "classname": "saletool.orderclue.web.orderclue", "method": "getFollowList", "content": { "sat_orderclueid": this.data.sat_orderclueid, "isdesc": this.data.isdesc, where: this.data.where } }).then(res => { console.log(res) if (res.msg != '成功') return this.getFollowList(i + 1); this.setData({ followList: res.data }) }) }, /* 修改排序方式 */ changeIsdesc() { this.setData({ isdesc: this.data.isdesc == 1 ? 0 : 1 }); this.getFollowList(); }, /* 查看所有日期 */ toSeeAll() { this.setData({ showWhere: "所有日期" }) this.timeRangeClose(); this.getFollowList(); }, /* 打开选择时间 */ openSelectDate() { this.setData({ timeRangeShow: true }) }, /* 关闭时间范围选择 */ timeRangeClose() { this.setData({ timeRangeShow: false, "where": { "start": "", "end": "" } }) }, /* 选择日期类型 */ selectDateType(e) { const { name } = e.target.dataset; this.setData({ "whereType.value": name }) }, /* 得到选择时间 */ getDate({ detail }) { let obj = this.data.whereType; obj.list[obj.value] = detail; this.setData({ whereType: obj }) }, /* 确定时间范围 */ determineScope() { const { list } = this.data.whereType; this.setData({ "where": list, showWhere: list.start + '~' + list.end, timeRangeShow: false }); this.getFollowList(); }, })