feat: 新增平台客服配置及弹窗组件
- 新增客服电话、服务时间、企业微信客服配置项 - 新增客服弹窗组件支持微信在线客服和电话拨打 - 调整核销码为6位数字,修复相关提示文本 - 优化订单服务项目展示逻辑 - 完善抢单大厅加载动画和列表样式
这个提交包含在:
@@ -140,22 +140,60 @@ export default {
|
||||
invoiceTitleDefault: (id) => post('/invoice/titleDefault', { id: id }),
|
||||
invoiceTitleDelete: (id) => post('/invoice/titleDelete', { id: id }),
|
||||
|
||||
/* ---------- 平台客服统一助手(仅读取后端真实配置,杜绝假号码与并发连击) ---------- */
|
||||
/* ---------- 平台客服配置读取与统一助手(仅读取后端真实配置,杜绝假号码与并发连击) ---------- */
|
||||
getCachedServiceConfig: function () {
|
||||
try {
|
||||
const cached = uni.getStorageSync('yjyf_service_config');
|
||||
if (cached && typeof cached === 'object') {
|
||||
return {
|
||||
service_phone: String(cached.service_phone || '').trim(),
|
||||
service_work_time: String(cached.service_work_time || '').trim(),
|
||||
service_corp_id: String(cached.service_corp_id || '').trim(),
|
||||
service_kf_url: String(cached.service_kf_url || '').trim(),
|
||||
};
|
||||
}
|
||||
} catch (e) {}
|
||||
const legacyPhone = String(uni.getStorageSync('yjyf_service_phone') || '').trim();
|
||||
return {
|
||||
service_phone: legacyPhone,
|
||||
service_work_time: '',
|
||||
service_corp_id: '',
|
||||
service_kf_url: '',
|
||||
};
|
||||
},
|
||||
getServiceConfig: async function (force = false) {
|
||||
const cached = this.getCachedServiceConfig();
|
||||
if (!force && (cached.service_phone || cached.service_corp_id || cached.service_kf_url)) {
|
||||
return cached;
|
||||
}
|
||||
try {
|
||||
const res = await get('/home/serviceConfig', {}, { silent: true });
|
||||
if (res && typeof res === 'object') {
|
||||
const cfg = {
|
||||
service_phone: String(res.service_phone || '').trim(),
|
||||
service_work_time: String(res.service_work_time || '').trim(),
|
||||
service_corp_id: String(res.service_corp_id || '').trim(),
|
||||
service_kf_url: String(res.service_kf_url || '').trim(),
|
||||
};
|
||||
uni.setStorageSync('yjyf_service_config', cfg);
|
||||
if (cfg.service_phone) {
|
||||
uni.setStorageSync('yjyf_service_phone', cfg.service_phone);
|
||||
} else {
|
||||
uni.removeStorageSync('yjyf_service_phone');
|
||||
}
|
||||
return cfg;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('获取客服配置失败', e);
|
||||
}
|
||||
return cached;
|
||||
},
|
||||
_contactingService: false,
|
||||
contactService: async function () {
|
||||
if (this._contactingService) return;
|
||||
this._contactingService = true;
|
||||
let phone = '';
|
||||
try {
|
||||
phone = uni.getStorageSync('yjyf_service_phone') || '';
|
||||
if (!phone) {
|
||||
const res = await get('/home/index', {}, { silent: true });
|
||||
if (res && res.service_phone) {
|
||||
phone = String(res.service_phone).trim();
|
||||
uni.setStorageSync('yjyf_service_phone', phone);
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
const cfg = await this.getServiceConfig(true);
|
||||
const phone = cfg.service_phone || '';
|
||||
setTimeout(() => { this._contactingService = false; }, 500);
|
||||
if (phone) {
|
||||
uni.makePhoneCall({ phoneNumber: phone, fail: () => {} });
|
||||
|
||||
在新工单中引用
屏蔽一个用户