const { api_leads_info } = require('../../utils/api.js'); const { net } = require('../../utils/net.js'); const util = require('../../utils/util.js'); Page({ data: { loadingFlag: true, current: 1, tabs: ['跟进', '详情', '订单'], id: '', detailData: {} }, onLoad: function (options) { this.setData({ current: util.getStorageSync('leadsdetailCheck') || 0, id: options.id }, () => { this.getData(); }) }, goOrderDetail(e) { const orderId = e.currentTarget.dataset.orderId; wx.navigateTo({ url: `/pages/orderdetail/orderdetail?id=${orderId}` }) }, onReady: function () { wx.setNavigationBarTitle({ title: '客户详情' }) }, // 滑动切换 swiperChange(options) { this.setData({ current: options.detail.current }) }, // 点击切换 slideTab(options) { this.setData({ current: options.currentTarget.dataset.index }) wx.setStorageSync('leadsdetailCheck', options.currentTarget.dataset.index); }, // 获取数据 getData() { let _this = this _this.setData({ loadingFlag: true }) let params = { url: api_leads_info, data: { id: this.data.id } } net.req(params).then((res) => { _this.setData({ detailData: res.data, loadingFlag: false }) }) }, copyWXAction(e) { const { currentWx } = e.currentTarget.dataset; if (currentWx && currentWx.length) { wx.setClipboardData({ data: currentWx, success(res) { } }) } }, tapTelAction(e) { const { tel } = e.currentTarget.dataset; let _this = this; let systemInfo = util.getStorageSync('systemInfo'); if (!systemInfo) { systemInfo = wx.getSystemInfoSync(); if (systemInfo) { wx.setStorageSync('systemInfo', systemInfo); } } let { system } = systemInfo; if (system.toLowerCase().indexOf('ios') !== -1) { wx.makePhoneCall({ phoneNumber: tel, success() { }, fail() { }, complete() { } }); } else { wx.showActionSheet({ itemList: [tel], success(res) { if (res.tapIndex === 0) { wx.makePhoneCall({ phoneNumber: _this.data.phone, success() { }, fail() { }, complete() { } }); } } }) } }, copyNumAction(e) { const { currentNum } = e.currentTarget.dataset; if (currentNum && currentNum.length) { wx.setClipboardData({ data: currentNum, success(res) { } }) } } })