- 插件管理:集成 qcloudsms 腾讯云短信发送插件,配置应用AppID/AppKey、短信签名及各业务模板ID(登录、修改密码、重置密码、支付密码、订单核销通知) - 业务封装:新增 SmsService 统一业务短信服务,实现防刷限流、冷却控制、短信验证码发送与防重放校验,支持完工订单自动下发客户核销码 - 接口层:恢复并升级 Sms 控制器,并在 Auth/MasterAuth/Security 控制器中支持手机验证码登录、找回登录密码及短信验证设置/修改支付密码 - 小程序端:用户端与师傅端登录页、账号安全中心、支付密码组件全面适配短信验证码交互,优化用户找回密码与支付密码安全操作流程 - 部署脚本:优化 deploy_all.py 打包剪枝逻辑,全局过滤深层 .git 目录并规范打包相对路径
225 行
10 KiB
JavaScript
225 行
10 KiB
JavaScript
/**
|
|
* 接口清单(与后端 application/api/controller 一一对应)
|
|
*/
|
|
import { get, post, uploadFile } from './request';
|
|
import config from '@/config/config.js';
|
|
|
|
export default {
|
|
/* ---------- 公共 / 上传 / 字典 ---------- */
|
|
upload: (filePath, category = 'other') => uploadFile(filePath, category),
|
|
areas: (data = {}) => get('/common/areas', data, { silent: true }),
|
|
expressCompanies: () => get('/common/expressCompanies', {}, { silent: true }),
|
|
commonDicts: () => get('/common/dicts', {}, { silent: true }),
|
|
|
|
/* ---------- 鉴权 ---------- */
|
|
login: (data) => post('/auth/login', data, { silent: true }),
|
|
wxLogin: (data) => post('/auth/wxlogin', data, { silent: true }),
|
|
wxPhoneLogin: (data) => post('/auth/wxPhoneLogin', data, { silent: true }),
|
|
profile: () => get('/auth/profile'),
|
|
selectIdentity: (data) => post('/auth/selectIdentity', data),
|
|
securityStatus: () => get('/security/status'),
|
|
sendPasswordSms: () => post('/security/sendPasswordSms', {}),
|
|
sendPaymentPasswordSms: () => post('/security/sendPaymentPasswordSms', {}),
|
|
changeLoginPassword: (data) => post('/security/changeLoginPassword', data),
|
|
sendResetPasswordSms: (data) => post('/auth/sendResetPasswordSms', data),
|
|
resetPasswordBySms: (data) => post('/auth/resetPasswordBySms', data),
|
|
setPaymentPassword: (data) => post('/security/setPaymentPassword', data),
|
|
changePaymentPassword: (data) => post('/security/changePaymentPassword', data),
|
|
submitEnterpriseCert: (data) => post('/security/submitEnterpriseCert', data),
|
|
recognizeEnterpriseLicense: (data) => post('/security/recognizeEnterpriseLicense', data),
|
|
saveAccount: (data) => post('/auth/saveAccount', data),
|
|
|
|
/* ---------- 用户钱包与充值 ---------- */
|
|
userWallet: () => get('/user/wallet'),
|
|
userWalletLogs: (params) => get('/user/walletLogs', params),
|
|
userRecharge: (data) => post('/user/recharge', data),
|
|
userConfirmRecharge: (data) => post('/user/confirmRecharge', data),
|
|
|
|
/* ---------- 首页 / 服务 ---------- */
|
|
home: () => get('/home/index', {}, { silent: true }),
|
|
homeFeed: (data) => get('/home/feed', data, { silent: true }),
|
|
cats: () => get('/home/cats'),
|
|
services: (data, opt) => get('/home/services', data, opt),
|
|
specs: (data) => get('/home/specs', data),
|
|
systemGallery: (data) => get('/home/systemGallery', data),
|
|
serviceDetail: (id) => get('/home/detail', { id: id }),
|
|
calc: (data, opt) => post('/home/calc', data, Object.assign({ silent: true, allowConcurrent: true }, opt || {})),
|
|
masterCount: (data) => get('/home/masterCount', data),
|
|
orderCase: (id) => get('/home/orderCase', { id: id }, { silent: true }),
|
|
agreement: (type, opt) => get('/home/agreement', { type: type }, opt || { silent: true }),
|
|
agreementRead: (data, opt) => post('/home/agreementRead', data, Object.assign({ silent: true, allowConcurrent: true }, opt || {})),
|
|
|
|
/* ---------- 地址 ---------- */
|
|
addressList: () => get('/address/index'),
|
|
addressDetail: (id) => get('/address/detail', { id: id }),
|
|
addressSave: (data) => post('/address/save', data),
|
|
addressDelete: (id) => post('/address/delete', { id: id }),
|
|
addressDefault: (id) => post('/address/setDefault', { id: id }),
|
|
|
|
/* ---------- 订单(用户端) ---------- */
|
|
orderCreate: (data) => post('/order/create', data),
|
|
detectExpress: (data) => get('/order/detectExpress', data),
|
|
orderPay: (data) => post('/order/pay', data),
|
|
orderConfirmPay: (data) => post('/order/confirmPay', data, { silent: true, allowConcurrent: true }),
|
|
orderPaymentResult: (data) => get('/order/paymentResult', data, { silent: true }),
|
|
orderCancel: (data) => post('/order/cancel', data),
|
|
orderDelete: (data) => post('/order/delete', data),
|
|
orderVerify: (data) => post('/order/verify', data),
|
|
orderList: (data) => get('/order/index', data),
|
|
orderDetail: (id) => get('/order/detail', { id: id }),
|
|
orderQuotes: (orderId) => get('/order/quotes', { order_id: orderId }),
|
|
orderChooseQuote: (data) => post('/order/chooseQuote', data),
|
|
orderPayDiff: (data) => post('/order/payDiff', data),
|
|
orderShowcase: (data) => post('/order/showcase', data),
|
|
orderUpdateNote: (data) => post('/order/updateNote', data),
|
|
orderComplaint: (data) => post('/order/complaint', data),
|
|
// 用户售后退款申请(已完成订单,提交后进入平台售后仲裁)
|
|
orderAfterSaleApply: (data) => post('/order/aftersaleapply', data),
|
|
// 我的售后申请记录(含仲裁进度与平台答复)
|
|
orderMyAfterSales: (data) => post('/order/myaftersales', data, { allowConcurrent: true }),
|
|
goodsGallery: (data) => get('/order/goodsGallery', data),
|
|
saveGoodsGallery: (data) => post('/order/saveGoodsGallery', data),
|
|
deleteGoodsGallery: (data) => post('/order/deleteGoodsGallery', data),
|
|
goodsTemplates: (data) => get('/order/goodsTemplates', data),
|
|
saveGoodsTemplate: (data) => post('/order/saveGoodsTemplate', data),
|
|
deleteGoodsTemplate: (data) => post('/order/deleteGoodsTemplate', data),
|
|
remarkTemplates: () => get('/order/remarkTemplates'),
|
|
saveRemarkTemplate: (data) => post('/order/saveRemarkTemplate', data),
|
|
deleteRemarkTemplate: (data) => post('/order/deleteRemarkTemplate', data),
|
|
|
|
/* ---------- 评价 ---------- */
|
|
reviewCreate: (data) => post('/review/create', data),
|
|
reviewList: (masterId) => get('/review/masterList', masterId ? { master_id: masterId } : {}),
|
|
|
|
/* ---------- 优惠券 ---------- */
|
|
couponCenter: () => get('/coupon/center'),
|
|
couponMy: (data, opt) => get('/coupon/my', data, opt),
|
|
couponReceive: (data) => post('/coupon/receive', data),
|
|
|
|
/* ---------- 消息中心 ---------- */
|
|
messageList: (data) => get('/message/index', data),
|
|
messageRead: (data) => post('/message/read', data),
|
|
messageReadAll: (data) => post('/message/readAll', data),
|
|
messageUnread: (data) => get('/message/unread', data, { silent: true }),
|
|
|
|
/* ---------- 发票与抬头中心(个人与商家通用) ---------- */
|
|
invoiceSummary: () => get('/invoice/summary'),
|
|
invoiceOrders: (data) => get('/invoice/orders', data),
|
|
invoiceApply: (data) => post('/invoice/apply', data),
|
|
invoiceRecords: (data) => get('/invoice/records', data),
|
|
invoiceDetail: (id) => get('/invoice/detail', { id: id }),
|
|
invoiceCancel: (id) => post('/invoice/cancel', { id: id }),
|
|
invoiceTitles: () => get('/invoice/titles'),
|
|
invoiceTitleDetail: (id) => get('/invoice/titleDetail', { id: id }),
|
|
invoiceTitleSave: (data) => post('/invoice/titleSave', data),
|
|
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(),
|
|
master_appid: String(cached.master_appid || '').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: '',
|
|
master_appid: '',
|
|
};
|
|
},
|
|
getServiceConfig: async function (force = false) {
|
|
const cached = this.getCachedServiceConfig();
|
|
if (!force && (cached.service_phone || cached.service_corp_id || cached.service_kf_url) && cached.master_appid) {
|
|
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(),
|
|
master_appid: String(res.master_appid || '').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;
|
|
},
|
|
openMasterMiniProgram: async function (path = 'pages/master/hall') {
|
|
let cfg = await this.getServiceConfig();
|
|
if (!cfg.master_appid) {
|
|
cfg = await this.getServiceConfig(true);
|
|
}
|
|
const targetAppId = cfg.master_appid;
|
|
// #ifdef MP-WEIXIN
|
|
if (!targetAppId) {
|
|
uni.showModal({
|
|
title: '优匠优服师傅端',
|
|
content: '后台暂未配置师傅端小程序 AppID,请在微信搜索打开「优匠师傅端」小程序或联系平台管理员在后台系统配置中完善。',
|
|
showCancel: false,
|
|
confirmText: '知道了',
|
|
confirmColor: '#F0710D'
|
|
});
|
|
return;
|
|
}
|
|
uni.navigateToMiniProgram({
|
|
appId: targetAppId,
|
|
path: path,
|
|
fail: (err) => {
|
|
if (err && err.errMsg && err.errMsg.indexOf('cancel') !== -1) return;
|
|
uni.showToast({ title: '打开师傅端小程序失败,请稍后重试', icon: 'none' });
|
|
}
|
|
});
|
|
// #endif
|
|
// #ifndef MP-WEIXIN
|
|
uni.showModal({
|
|
title: '前往优匠优服师傅端',
|
|
content: '请在微信中搜索「优匠优服师傅端」小程序进行师傅实名入驻与接单。',
|
|
showCancel: false,
|
|
confirmText: '知道了',
|
|
confirmColor: '#F0710D'
|
|
});
|
|
// #endif
|
|
},
|
|
_contactingService: false,
|
|
contactService: async function () {
|
|
if (this._contactingService) return;
|
|
this._contactingService = true;
|
|
const cfg = await this.getServiceConfig(true);
|
|
const phone = cfg.service_phone || '';
|
|
setTimeout(() => { this._contactingService = false; }, 500);
|
|
if (phone) {
|
|
uni.makePhoneCall({ phoneNumber: phone, fail: () => {} });
|
|
} else {
|
|
uni.showModal({
|
|
title: '平台在线客服',
|
|
content: '请在微信小程序客服会话中直接留言,或在工单详情中提交售后反馈,客服专员将第一时间跟进处理。',
|
|
showCancel: false,
|
|
confirmText: '知道了',
|
|
confirmColor: '#F0710D'
|
|
});
|
|
}
|
|
}
|
|
};
|