feat: 新增账号安全模块及资质校验功能
- 新增账号安全页面及支付密码验证组件 - 新增用户类型选择流程及商家资质管理 - 新增订单资质校验逻辑,师傅需满足订单证书要求 - 新增企业资质认证相关数据库表及接口 - 优化用户列表展示,区分个人与商家用户类型
这个提交包含在:
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<view v-if="visible" class="mask">
|
||||
<view class="panel">
|
||||
<text class="title">请输入支付密码</text>
|
||||
<input v-model="password" class="input" type="number" password maxlength="6" focus placeholder="6位支付密码" />
|
||||
<view class="actions"><button class="cancel" @tap="finish('')">取消</button><button class="confirm" @tap="submit">确认</button></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onBeforeUnmount } from 'vue';
|
||||
import api from '@/utils/api.js';
|
||||
import { beginPaymentSetup } from '@/utils/payment-setup.mjs';
|
||||
const visible = ref(false), password = ref('');
|
||||
let resolvePrompt = null;
|
||||
async function open(options = {}) {
|
||||
const status = await api.securityStatus();
|
||||
if (!status.has_payment_password) {
|
||||
const navigated = await beginPaymentSetup(uni, options.createdOrderId);
|
||||
throw Object.assign(new Error(navigated ? '正在设置支付密码' : '已取消设置支付密码'), {
|
||||
handledToast: navigated, cancelled: !navigated, paymentSetupNavigation: navigated,
|
||||
});
|
||||
}
|
||||
if (resolvePrompt) return '';
|
||||
password.value = ''; visible.value = true;
|
||||
return new Promise(resolve => { resolvePrompt = resolve; });
|
||||
}
|
||||
function finish(value) { visible.value = false; password.value = ''; const resolve = resolvePrompt; resolvePrompt = null; if (resolve) resolve(value); }
|
||||
function submit() { if (!/^\d{6}$/.test(password.value)) { uni.showToast({ title: '请输入6位支付密码', icon: 'none' }); return; } finish(password.value); }
|
||||
onBeforeUnmount(() => finish(''));
|
||||
defineExpose({ open });
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/uni.scss';
|
||||
.mask { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 48rpx; background: rgba(0,0,0,.5); }
|
||||
.panel { width: 100%; padding: 40rpx; border-radius: 20rpx; background: $yjyf-bg-card; }.title { display: block; text-align: center; font-size: 32rpx; font-weight: 600; color: $yjyf-text-main; }.input { margin: 30rpx 0; height: 88rpx; text-align: center; background: $yjyf-bg-page; border-radius: 12rpx; }.actions { display: flex; gap: 20rpx; }.actions button { flex: 1; font-size: 28rpx; }.cancel { color: $yjyf-text-regular; background: $yjyf-bg-page; }.confirm { color: $yjyf-bg-card; background: $yjyf-gradient-primary; }
|
||||
</style>
|
||||
@@ -213,6 +213,11 @@
|
||||
</view>
|
||||
|
||||
<!-- 客户工单特别要求 -->
|
||||
<view class="qualification-row" v-if="o.qual_req">
|
||||
<text>资质要求:{{ o.qual_req }}</text>
|
||||
<text v-if="!o.qualification_allowed" class="qualification-warning">暂无有效认证证书</text>
|
||||
<text v-if="!o.qualification_allowed" class="qualification-link" @tap.stop="goCerts">去上传证书</text>
|
||||
</view>
|
||||
<view class="remark-row" v-if="o.remark">
|
||||
<text class="remark-tag">工单要求</text>
|
||||
<text class="remark-txt">{{ o.remark }}</text>
|
||||
@@ -238,9 +243,10 @@
|
||||
</view>
|
||||
|
||||
<view class="ft-btns">
|
||||
<view v-if="!o.qualification_allowed" class="qualification-disabled"><text class="btn-txt">{{ o.price_type === 'quote' ? '暂不可报价' : '暂不可接单' }}</text></view>
|
||||
<view
|
||||
class="quote-btn clickable-hover"
|
||||
v-if="o.price_type === 'quote'"
|
||||
v-else-if="o.price_type === 'quote'"
|
||||
@tap="goDetail(o)"
|
||||
>
|
||||
<text class="btn-txt">立即报价</text>
|
||||
@@ -570,6 +576,9 @@
|
||||
function goSkills() {
|
||||
uni.navigateTo({ url: '/pages/master/skills' });
|
||||
}
|
||||
function goCerts() {
|
||||
uni.navigateTo({ url: '/pages/master/certs' });
|
||||
}
|
||||
|
||||
function openGrabConfirm(o) {
|
||||
if (info.value && info.value.work_status === 'off') {
|
||||
@@ -889,6 +898,10 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.qualification-row { display: flex; flex-wrap: wrap; gap: 12rpx; margin-top: 16rpx; color: $yjyf-text-regular; font-size: $yjyf-font-sub; }
|
||||
.qualification-warning { color: $yjyf-danger; }
|
||||
.qualification-link { color: $yjyf-primary; }
|
||||
.qualification-disabled { padding: 14rpx 24rpx; border-radius: $yjyf-radius-pill; background: $yjyf-text-disabled; }
|
||||
@import '@/uni.scss';
|
||||
|
||||
.hall-view {
|
||||
|
||||
@@ -227,6 +227,10 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/mine/security')">
|
||||
<view class="mi-left"><image class="mi-ico" src="/static/icons/master/menu-account-security.svg" mode="aspectFit" /><text class="mi-title">账号安全</text></view>
|
||||
<view class="mi-right"><image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" /></view>
|
||||
</view>
|
||||
<view class="menu-item clickable-hover" @tap="openAgreementPicker">
|
||||
<view class="mi-left">
|
||||
<image class="mi-ico" src="/static/icons/master/menu-agreement.svg" mode="aspectFit" />
|
||||
@@ -352,7 +356,7 @@
|
||||
if (rejected > 0) {
|
||||
return { text: `未通过 (${rejected})`, cls: 'is-danger' };
|
||||
}
|
||||
return { text: '认证可接资质要求订单', cls: 'is-warning' };
|
||||
return { text: '上传证书展示专业资质', cls: 'is-warning' };
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<view class="credentials">
|
||||
<view class="credentials-row">
|
||||
<text class="credentials-label">服务技能(师傅填写)</text>
|
||||
<text class="credentials-value">{{ skillText }}</text>
|
||||
</view>
|
||||
<view class="credentials-row">
|
||||
<text class="credentials-label">已认证证书</text>
|
||||
<text class="credentials-value">{{ certText }}</text>
|
||||
</view>
|
||||
<text v-if="canExpand" class="credentials-toggle clickable-hover" @tap.stop="expanded = !expanded">{{ expanded ? '收起' : '查看全部' }}</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
const props = defineProps({
|
||||
skills: { type: Array, default: () => [] },
|
||||
certificates: { type: Array, default: () => [] }
|
||||
});
|
||||
const expanded = ref(false);
|
||||
const canExpand = computed(() => props.skills.length > 3 || props.certificates.length > 3);
|
||||
const display = (items, empty) => items.length ? (expanded.value ? items : items.slice(0, 3)).join('、') : empty;
|
||||
const skillText = computed(() => display(props.skills, '暂无填写'));
|
||||
const certText = computed(() => display(props.certificates, '暂无已认证证书'));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.credentials { margin-top: 20rpx; }
|
||||
.credentials-row { display: flex; align-items: flex-start; margin-top: 10rpx; font-size: $yjyf-font-sub; line-height: 1.5; }
|
||||
.credentials-label { flex-shrink: 0; color: $yjyf-text-secondary; margin-right: 16rpx; }
|
||||
.credentials-value { flex: 1; min-width: 0; color: $yjyf-text-regular; word-break: break-all; }
|
||||
.credentials-toggle { display: block; margin-top: 8rpx; color: $yjyf-primary; font-size: $yjyf-font-sub; }
|
||||
</style>
|
||||
@@ -103,6 +103,10 @@
|
||||
<!-- 核心功能菜单 -->
|
||||
<view class="card-panel">
|
||||
<view class="menu-group">
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/mine/security')">
|
||||
<view class="menu-item-l"><image class="menu-ico" src="/static/icons/menu-account-security.svg" mode="aspectFit" /><text class="menu-txt">账号安全</text></view>
|
||||
<view class="menu-item-r"><image class="arrow-ico" src="/static/icons/arrow-right.svg" mode="aspectFit" /></view>
|
||||
</view>
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/coupon/coupon?tab=center')">
|
||||
<view class="menu-item-l">
|
||||
<image class="menu-ico" src="/static/icons/menu-coupon.svg" mode="aspectFit" />
|
||||
@@ -250,15 +254,7 @@
|
||||
return !!(master.value && master.value.verify_status === 'pass');
|
||||
});
|
||||
|
||||
const roleText = computed(() => {
|
||||
const curRole = currentRole.value;
|
||||
if (curRole === 'master' && master.value && master.value.verify_status === 'pass') {
|
||||
return '认证师傅';
|
||||
}
|
||||
if (master.value && master.value.verify_status === 'pass') return '认证师傅';
|
||||
if (master.value && master.value.verify_status === 'pending') return '师傅审核中';
|
||||
return '个人用户';
|
||||
});
|
||||
const roleText = computed(() => user.value && user.value.user_type === 'merchant' ? '商家用户' : '个人用户');
|
||||
|
||||
const masterCard = computed(() => {
|
||||
const m = master.value;
|
||||
|
||||
在新工单中引用
屏蔽一个用户