- 新增账号安全页面及支付密码验证组件 - 新增用户类型选择流程及商家资质管理 - 新增订单资质校验逻辑,师傅需满足订单证书要求 - 新增企业资质认证相关数据库表及接口 - 优化用户列表展示,区分个人与商家用户类型
38 行
2.3 KiB
Vue
38 行
2.3 KiB
Vue
<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>
|