// pages/customer-service/detail/index.js Page({ data: { customerData: null, customerServices: [ { id: 1, managerId: 'PM001', managercompany: '鸡蛋贸易有限公司', managerdepartment: '采购部', organization: '鸡蛋采购组', projectName: '高级采购经理', name: '张三', alias: '张经理', phoneNumber: '13800138001', avatarUrl: '', score: 999, isOnline: true, responsibleArea: '华北区鸡蛋采购', experience: '1-3年', serviceCount: 200, purchaseCount: 15000, profitIncreaseRate: 15, profitFarmCount: 120, skills: ['渠道拓展', '供应商维护', '质量把控', '精准把控市场价格'] }, { id: 2, managerId: 'PM002', managercompany: '鸡蛋贸易有限公司', managerdepartment: '采购部', organization: '全国采购组', projectName: '采购经理', name: '李四', alias: '李经理', phoneNumber: '13900139002', avatarUrl: '', score: 998, isOnline: true, responsibleArea: '全国鸡蛋采购', experience: '2-3年', serviceCount: 200, purchaseCount: 20000, profitIncreaseRate: 18, profitFarmCount: 150, skills: ['精准把控市场价格', '渠道拓展', '供应商维护'] }, { id: 3, managerId: 'PM003', managercompany: '鸡蛋贸易有限公司', managerdepartment: '采购部', organization: '华东采购组', projectName: '采购专员', name: '王五', alias: '王专员', phoneNumber: '13700137003', avatarUrl: '', score: 997, isOnline: false, responsibleArea: '华东区鸡蛋采购', experience: '1-2年', serviceCount: 150, purchaseCount: 12000, profitIncreaseRate: 12, profitFarmCount: 80, skills: ['质量把控', '供应商维护'] }, { id: 4, managerId: 'PM004', managercompany: '鸡蛋贸易有限公司', managerdepartment: '采购部', organization: '华南采购组', projectName: '高级采购经理', name: '赵六', alias: '赵经理', phoneNumber: '13600136004', avatarUrl: '', score: 996, isOnline: true, responsibleArea: '华南区鸡蛋采购', experience: '3-5年', serviceCount: 250, purchaseCount: 25000, profitIncreaseRate: 20, profitFarmCount: 180, skills: ['精准把控市场价格', '渠道拓展', '质量把控', '供应商维护'] } ] }, onLoad: function (options) { // 获取传递过来的客服ID const { id } = options; // 根据ID查找客服数据 const customerData = this.data.customerServices.find(item => item.id === parseInt(id)); if (customerData) { this.setData({ customerData: customerData }); // 设置导航栏标题 wx.setNavigationBarTitle({ title: `${customerData.alias} - 客服详情`, }); } else { // 如果找不到对应ID的客服,显示错误提示 wx.showToast({ title: '未找到客服信息', icon: 'none' }); } }, onShow() { // 更新自定义tabBar状态 if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ selected: -1 // 不选中任何tab }); } }, // 返回上一页 onBack: function () { wx.navigateBack(); }, // 在线沟通 onChat: function () { const { customerData } = this.data; if (customerData) { wx.navigateTo({ url: `/pages/chat/index?id=${customerData.id}&name=${customerData.alias}&phone=${customerData.phoneNumber}` }); } }, // 拨打电话 onCall: function () { const { customerData } = this.data; if (customerData && customerData.phoneNumber) { wx.makePhoneCall({ phoneNumber: customerData.phoneNumber, success: function () { console.log('拨打电话成功'); }, fail: function () { console.log('拨打电话失败'); } }); } }, // 分享功能 onShareAppMessage: function () { const { customerData } = this.data; return { title: `${customerData?.alias || '优秀客服'} - 鸡蛋贸易平台`, path: `/pages/customer-service/detail/index?id=${customerData?.id}`, imageUrl: '' }; } });