const _Http = getApp().globalData.http, MFT = require("../../../../../utils/matchingFeilType"); Page({ data: { ownertable: null, ownerid: null, sys_datafollowupid: null, detail: {}, files: { images: [], viewImages: [], videos: [], viewVideos: [], files: [] }, tabbarList: [{ icon: "icon-bianji", label: "编辑" }, { icon: "icon-shanchu", label: "作废" }] }, onLoad(options) { if (options.data) { this.setData({ ...JSON.parse(options.data) }) this.getDetail(); } }, getDetail() { _Http.basic({ "id": 20221026085601, "content": { "sys_datafollowupid": this.data.sys_datafollowupid } }).then(res => { console.log("跟进详情", res) if (res.msg != '成功') return wx.showToast({ title: res.data, icon: "none" }) this.handleFiles(MFT.fileList(res.data.attinfos)); this.setData({ detail: res.data, briefs: [{ label: "跟进类型", value: res.data.type }, { label: "跟进内容", value: res.data.content }] }) }) }, /* 处理附件 */ handleFiles(list) { let files = this.data.files; list.forEach(v => { switch (v.fileType) { case "video": files.videos.push(v) files.viewVideos.push({ url: v.url, type: "video", poster: v.subfiles[0].url }) break; case "image": files.images.push(v) files.viewImages.push({ url: v.url, type: "image" }) break; default: files.files.push(v) break; } }); this.setData({ files }) }, /* tab 切换回调 */ tabbarOnClick({ detail }) { const item = this.data.detail; switch (detail.label) { case "编辑": wx.navigateTo({ url: `/packageA/setclient/modules/trace/add/index?ownertable=${this.data.ownertable}&ownerid=${this.data.ownerid}&sys_datafollowupid=${item.sys_datafollowupid}` }); break; case "作废": wx.navigateTo({ url: `/packageA/setclient/modules/trace/list/delete?item=${JSON.stringify({ "sys_datafollowupid": item.sys_datafollowupid, "ownertable": this.data.ownertable, "ownerid": this.data.ownerid })}`, }) break; } }, onShareAppMessage() {} })