微信登录修复: - 根因:manifest.json 的 mp-weixin.appid 为空 → 开发者工具用测试号,code 与服务端 appid 不匹配 - 修复:填入 wx40ca4b02d4d1cb58 - WxLogin 增加错误码语义映射(40029 appid 不一致 / 40125 secret 错 / 45011 频繁 / 40226 风控) - 登录页新增手机号登录兜底通道(微信不可用时业务不被卡住) 商家(企业账号): - 新表 fa_merchant / fa_merchant_order / fa_invoice(纯新增,DB 40→45 表) - Merchant 控制器:apply/info/update/bills/invoices/invoice/bindBatch 入驻含企业信息+营业执照+开票信息+结算方式(预付/月结) 账单按月汇总、开票额度按已付-已开票校验、批量下单按批次归属 - Auth::switchRole 支持 merchant(2001/2002/2003 语义码 + redirect) - Auth::profile 增加 is_merchant / merchant 前端: - 登录页角色扩为 业主/师傅/商家 三类 - pages/merchant/apply 企业入驻;workbench 商家工作台(经营数据+按月账单+近期订单+六宫格) - pages/merchant/batch 批量下单(多地址×多数量)→ 逐单建单支付 → 绑定批次 - pages/merchant/invoice 开票申请与记录 - pages/mine 增加商家入驻/切换商家端入口;角色徽章三态 验证:163 项断言全通过(page_flow 47 + e2e 65 + phase2 27 + phase3 24)
140 行
7.3 KiB
Vue
140 行
7.3 KiB
Vue
<template>
|
||
<view class="page">
|
||
<view class="hero">
|
||
<text class="hero-t">商家入驻</text>
|
||
<text class="hero-s">企业账号可批量下单、按月对账、开具发票</text>
|
||
</view>
|
||
|
||
<view class="status" v-if="info">
|
||
<text class="st-t">当前状态:{{ statusText }}</text>
|
||
<text class="st-m" v-if="info.merchant.audit_msg">审核意见:{{ info.merchant.audit_msg }}</text>
|
||
</view>
|
||
|
||
<view class="card" v-if="canEdit">
|
||
<view class="block-title">企业信息</view>
|
||
<view class="fi"><text class="fk">企业名称</text><input class="fv" v-model="form.name" placeholder="与营业执照一致" /></view>
|
||
<view class="fi"><text class="fk">信用代码</text><input class="fv" v-model="form.license_no" maxlength="18" placeholder="统一社会信用代码" /></view>
|
||
<view class="fi"><text class="fk">法人代表</text><input class="fv" v-model="form.legal_person" placeholder="法人姓名" /></view>
|
||
|
||
<view class="block-title">联系方式</view>
|
||
<view class="fi"><text class="fk">联系人</text><input class="fv" v-model="form.contact" placeholder="对接人姓名" /></view>
|
||
<view class="fi"><text class="fk">联系电话</text><input class="fv" v-model="form.mobile" type="number" maxlength="11" placeholder="手机号" /></view>
|
||
<view class="fi"><text class="fk">经营地址</text><input class="fv" v-model="form.address" placeholder="门店 / 办公地址" /></view>
|
||
|
||
<view class="block-title">开票与结算</view>
|
||
<view class="fi"><text class="fk">发票抬头</text><input class="fv" v-model="form.invoice_title" placeholder="不填默认同企业名称" /></view>
|
||
<view class="fi"><text class="fk">税号</text><input class="fv" v-model="form.invoice_tax_no" placeholder="纳税人识别号" /></view>
|
||
<view class="fi"><text class="fk">结算方式</text>
|
||
<view class="seg">
|
||
<view class="seg-i" :class="{ on: form.settle_type === 'prepay' }" @tap="form.settle_type = 'prepay'">预付</view>
|
||
<view class="seg-i" :class="{ on: form.settle_type === 'monthly' }" @tap="form.settle_type = 'monthly'">月结</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="hint">营业执照照片上传将在正式版接入 chooseMedia(当前以文本占位)</view>
|
||
<view class="submit" :class="{ disabled: submitting }" @tap="submit">{{ submitting ? '提交中...' : '提交审核' }}</view>
|
||
</view>
|
||
|
||
<view class="card" v-else>
|
||
<view class="li"><text class="k">企业名称</text><text class="v">{{ info.merchant.name }}</text></view>
|
||
<view class="li"><text class="k">信用代码</text><text class="v">{{ info.merchant.license_no }}</text></view>
|
||
<view class="li"><text class="k">联系人</text><text class="v">{{ info.merchant.contact }} {{ info.merchant.mobile }}</text></view>
|
||
<view class="li"><text class="k">经营地址</text><text class="v">{{ info.merchant.address }}</text></view>
|
||
<view class="li"><text class="k">累计订单</text><text class="v">{{ info.merchant.order_count }} 单</text></view>
|
||
<view class="li"><text class="k">累计金额</text><text class="v">¥{{ info.merchant.total_amount }}</text></view>
|
||
<view class="go" @tap="goWorkbench">进入商家工作台 ›</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, reactive, computed } from 'vue';
|
||
import { onShow } from '@dcloudio/uni-app';
|
||
import api from '@/utils/api.js';
|
||
import { isLogin, toLogin, getUser } from '@/utils/request.js';
|
||
|
||
const info = ref(null);
|
||
const submitting = ref(false);
|
||
const form = reactive({
|
||
name: '', license_no: '', legal_person: '', contact: '', mobile: '',
|
||
province: '贵州省', city: '遵义市', district: '', address: '',
|
||
invoice_title: '', invoice_tax_no: '', settle_type: 'prepay'
|
||
});
|
||
|
||
const statusText = computed(() => {
|
||
if (!info.value || !info.value.merchant) return '未入驻';
|
||
const s = info.value.merchant.verify_status;
|
||
return { pending: '待审核', pass: '已通过', reject: '未通过' }[s] || s;
|
||
});
|
||
const canEdit = computed(() => !info.value || !info.value.applied || info.value.merchant.verify_status === 'reject');
|
||
|
||
function goWorkbench() { uni.redirectTo({ url: '/pages/merchant/workbench' }); }
|
||
|
||
async function load() {
|
||
if (!isLogin()) { toLogin(); return; }
|
||
const res = await api.merchantInfo();
|
||
info.value = res.applied ? res : null;
|
||
if (res.applied) {
|
||
const m = res.merchant;
|
||
form.name = m.name;
|
||
form.license_no = m.license_no;
|
||
form.legal_person = m.legal_person;
|
||
form.contact = m.contact;
|
||
form.mobile = m.mobile;
|
||
form.address = m.address;
|
||
form.invoice_title = m.invoice_title;
|
||
form.invoice_tax_no = m.invoice_tax_no;
|
||
form.settle_type = m.settle_type;
|
||
} else {
|
||
const u = getUser();
|
||
if (u) form.mobile = u.mobile || '';
|
||
}
|
||
}
|
||
|
||
async function submit() {
|
||
if (submitting.value) return;
|
||
if (!form.name || !form.license_no || !form.contact || !form.mobile) {
|
||
uni.showToast({ title: '请填写企业名称/信用代码/联系人/电话', icon: 'none' });
|
||
return;
|
||
}
|
||
submitting.value = true;
|
||
try {
|
||
await api.merchantApply(form);
|
||
uni.showToast({ title: '已提交,等待审核' });
|
||
load();
|
||
} catch (e) {
|
||
} finally {
|
||
submitting.value = false;
|
||
}
|
||
}
|
||
|
||
onShow(() => load());
|
||
</script>
|
||
|
||
<style scoped>
|
||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 60rpx; }
|
||
.hero { padding: 40rpx 36rpx; background: linear-gradient(160deg,#FFB85C 0%,#F98D25 60%,#ED6F0E 100%); }
|
||
.hero-t { display: block; font-size: 40rpx; font-weight: 700; color: #fff; }
|
||
.hero-s { display: block; margin-top: 10rpx; font-size: 24rpx; color: rgba(255,255,255,.9); }
|
||
.status { margin: 22rpx 28rpx 0; padding: 20rpx 24rpx; background: #FFF7F0; border-radius: 16rpx; display: flex; flex-direction: column; }
|
||
.st-t { font-size: 26rpx; color: #C4580A; font-weight: 600; }
|
||
.st-m { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
|
||
.card { margin: 22rpx 28rpx 0; padding: 22rpx 24rpx; background: #fff; border-radius: 20rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06); }
|
||
.block-title { margin: 18rpx 0 4rpx; font-size: 26rpx; font-weight: 700; color: #1F1F1F; }
|
||
.block-title:first-child { margin-top: 0; }
|
||
.fi { display: flex; align-items: center; min-height: 88rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||
.fk { width: 160rpx; font-size: 26rpx; color: #666; }
|
||
.fv { flex: 1; height: 88rpx; font-size: 28rpx; color: #222; }
|
||
.seg { display: flex; }
|
||
.seg-i { padding: 0 28rpx; line-height: 56rpx; margin-right: 12rpx; border-radius: 28rpx; background: #F5F5F5; font-size: 24rpx; color: #666; }
|
||
.seg-i.on { background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); color: #fff; }
|
||
.hint { margin-top: 16rpx; font-size: 20rpx; color: #BDBDBD; line-height: 30rpx; }
|
||
.submit { height: 92rpx; margin-top: 24rpx; display: flex; align-items: center; justify-content: center; border-radius: 46rpx; color: #fff; font-size: 30rpx; font-weight: 600; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); }
|
||
.submit.disabled { opacity: .7; }
|
||
.li { display: flex; justify-content: space-between; padding: 14rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.k { flex-shrink: 0; width: 150rpx; font-size: 26rpx; color: #666; }
|
||
.v { flex: 1; text-align: right; font-size: 26rpx; color: #333; }
|
||
.go { margin-top: 24rpx; height: 84rpx; display: flex; align-items: center; justify-content: center; border-radius: 42rpx; background: #FFF3E6; color: #E36B0C; font-size: 28rpx; font-weight: 600; }
|
||
</style>
|
||
|