feat(master): 完善师傅实名认证拦截及提示逻辑

- 移除登录时的草稿状态跳转逻辑
- 新增API接口未登录时返回401错误处理
- 新增实名认证状态判断及提示弹窗
- 优化师傅工作台信息加载逻辑
- 完善接单、报价等操作的实名认证拦截
这个提交包含在:
2026-11-24 09:31:01 +08:00
父节点 45ed55b644
当前提交 734bc03a26
共有 5 个文件被更改,包括 119 次插入 和 41 次删除

查看文件

@@ -54,7 +54,7 @@
<view class="avatar-clip">
<image class="avatar-img" :src="(info && info.avatar) || '/static/icons/avatar-master.svg'" mode="aspectFill" />
</view>
<view class="v-auth-badge">
<view class="v-auth-badge" v-if="verifyStatusMeta.text">
<image class="v-badge-ico" src="/static/icons/v-auth.svg" mode="aspectFit" />
<text class="v-badge-txt">{{ verifyStatusMeta.text }}</text>
</view>
@@ -321,7 +321,12 @@
const masterTitleName = computed(() => {
if (!info.value) return '';
const rn = String(info.value.realname || '').trim();
if (!rn) return '认证师傅';
if (!rn) {
if (info.value.verify_status === 'draft') {
return String(info.value.nickname || '').trim() || '未认证师傅';
}
return '认证师傅';
}
if (rn.indexOf('师傅') > -1) return rn;
return rn.slice(0, 1) + '师傅';
});
@@ -359,6 +364,7 @@
if (status === 'pass') return { text: '已认证', cls: 'is-success' };
if (status === 'pending') return { text: '审核中', cls: 'is-warning' };
if (status === 'reject') return { text: '未通过', cls: 'is-danger' };
if (status === 'draft') return { text: '未认证', cls: 'is-warning' };
return { text: '', cls: '' };
});
@@ -499,40 +505,44 @@
loadError.value = '';
try {
const [infoRes, incomeRes, creditRes] = await Promise.allSettled([
api.masterInfo(),
api.masterIncome(),
api.masterCredit()
]);
const res = await api.masterInfo();
if (seq !== loadSeq) return;
if (infoRes.status === 'fulfilled' && infoRes.value) {
const res = infoRes.value;
if (!res.applied || !res.master) {
uni.redirectTo({ url: '/pages/master/apply' });
return;
if (!res || !res.master) {
if (!info.value) {
loadError.value = '工作台信息加载失败';
}
info.value = res.master;
skills.value = res.skills || [];
certSummary.value = res.cert_summary || null;
} else if (!info.value) {
const reason = infoRes.status === 'rejected' ? infoRes.reason : null;
loadError.value = (reason && (reason.msg || reason.message)) || '网络异常,请稍后重试';
return;
}
if (incomeRes.status === 'fulfilled' && incomeRes.value) {
const inc = incomeRes.value;
todayIncome.value = Number(inc.today_income || 0).toFixed(2);
totalIncome.value = Number(inc.total_income || 0).toFixed(2);
} else if (incomeRes.status === 'rejected') {
console.warn('获取收入统计失败', incomeRes.reason);
}
info.value = res.master;
skills.value = res.skills || [];
certSummary.value = res.cert_summary || null;
if (creditRes.status === 'fulfilled' && creditRes.value) {
credit.value = creditRes.value;
} else if (creditRes.status === 'rejected') {
console.warn('获取信用信息失败', creditRes.reason);
if (!res.applied) {
credit.value = null;
todayIncome.value = '0.00';
totalIncome.value = '0.00';
} else {
const [incomeRes, creditRes] = await Promise.allSettled([
api.masterIncome(),
api.masterCredit()
]);
if (seq !== loadSeq) return;
if (incomeRes.status === 'fulfilled' && incomeRes.value) {
const inc = incomeRes.value;
todayIncome.value = Number(inc.today_income || 0).toFixed(2);
totalIncome.value = Number(inc.total_income || 0).toFixed(2);
} else if (incomeRes.status === 'rejected') {
console.warn('获取收入统计失败', incomeRes.reason);
}
if (creditRes.status === 'fulfilled' && creditRes.value) {
credit.value = creditRes.value;
} else if (creditRes.status === 'rejected') {
console.warn('获取信用信息失败', creditRes.reason);
}
}
if (!servicePhone.value) {
@@ -564,6 +574,24 @@
async function toggleWork() {
if (!info.value || togglingWork.value) return;
if (info.value.verify_status !== 'pass') {
const isPending = info.value.verify_status === 'pending';
const isReject = info.value.verify_status === 'reject';
uni.showModal({
title: isPending ? '实名认证审核中' : (isReject ? '实名认证未通过' : '请先完成实名认证'),
content: isPending
? '您的师傅实名认证正在审核中,审核通过后即可开启听单接单。'
: (isReject ? '您的实名认证未通过,请修改资料并重新提交。' : '完成实名认证后方可开启听单接单,是否立即前往认证?'),
confirmText: isPending ? '查看进度' : (isReject ? '去修改' : '去认证'),
confirmColor: '#F0710D',
success: (res) => {
if (res.confirm) {
uni.navigateTo({ url: '/pages/master/apply' });
}
}
});
return;
}
togglingWork.value = true;
const next = info.value.work_status === 'off' ? 'on' : 'off';
try {