微信登录修复: - 根因: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)
118 行
5.2 KiB
Vue
118 行
5.2 KiB
Vue
<template>
|
||
<view class="page">
|
||
<view class="card">
|
||
<view class="card-head"><text class="card-title">开票信息</text><text class="card-more" @tap="go('/pages/merchant/apply')">修改 ›</text></view>
|
||
<view class="li"><text class="k">发票抬头</text><text class="v">{{ title || '未设置' }}</text></view>
|
||
<view class="li"><text class="k">税号</text><text class="v">{{ taxNo || '未设置' }}</text></view>
|
||
<view class="li"><text class="k">可开票金额</text><text class="v big">¥{{ available }}</text></view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-title">申请开票</view>
|
||
<view class="fi"><text class="fk">开票金额</text><input class="fv" type="digit" v-model="amount" placeholder="不超过可开票金额" /></view>
|
||
<view class="fi"><text class="fk">发票类型</text>
|
||
<view class="seg">
|
||
<view class="seg-i" :class="{ on: type === 'normal' }" @tap="type = 'normal'">普通发票</view>
|
||
<view class="seg-i" :class="{ on: type === 'special' }" @tap="type = 'special'">专用发票</view>
|
||
</view>
|
||
</view>
|
||
<view class="fi"><text class="fk">接收邮箱</text><input class="fv" v-model="email" placeholder="电子发票接收邮箱" /></view>
|
||
<view class="btn" :class="{ disabled: submitting }" @tap="submit">{{ submitting ? '提交中...' : '提交开票申请' }}</view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-head"><text class="card-title">开票记录</text><text class="card-more">{{ list.length }} 条</text></view>
|
||
<view class="iv" v-for="i in list" :key="i.id">
|
||
<view class="iv-top">
|
||
<text class="iv-type">{{ i.type_text }}</text>
|
||
<text class="iv-amt">¥{{ i.amount }}</text>
|
||
</view>
|
||
<text class="iv-meta">{{ i.title }} · {{ i.time_text }}</text>
|
||
<text class="iv-status">{{ i.status_text }}{{ i.invoice_no ? '(' + i.invoice_no + ')' : '' }}</text>
|
||
</view>
|
||
<view class="empty" v-if="!list.length">暂无开票记录</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref } from 'vue';
|
||
import { onShow } from '@dcloudio/uni-app';
|
||
import api from '@/utils/api.js';
|
||
|
||
const title = ref('');
|
||
const taxNo = ref('');
|
||
const available = ref(0);
|
||
const amount = ref('');
|
||
const email = ref('');
|
||
const type = ref('normal');
|
||
const list = ref([]);
|
||
const submitting = ref(false);
|
||
|
||
function go(url) { uni.navigateTo({ url: url }); }
|
||
|
||
async function load() {
|
||
try {
|
||
const res = await api.merchantInfo();
|
||
if (res.applied) {
|
||
title.value = res.merchant.invoice_title || res.merchant.name;
|
||
taxNo.value = res.merchant.invoice_tax_no;
|
||
available.value = res.merchant.invoiceable;
|
||
}
|
||
} catch (e) {}
|
||
try {
|
||
const res = await api.merchantInvoices();
|
||
list.value = res.list || [];
|
||
} catch (e) {}
|
||
}
|
||
|
||
async function submit() {
|
||
if (submitting.value) return;
|
||
const amt = Number(amount.value);
|
||
if (!amt || amt <= 0) {
|
||
uni.showToast({ title: '请填写开票金额', icon: 'none' });
|
||
return;
|
||
}
|
||
submitting.value = true;
|
||
try {
|
||
await api.merchantInvoice({ amount: amt, type: type.value, email: email.value });
|
||
uni.showToast({ title: '已提交开票申请' });
|
||
amount.value = '';
|
||
load();
|
||
} catch (e) {
|
||
} finally {
|
||
submitting.value = false;
|
||
}
|
||
}
|
||
|
||
onShow(() => load());
|
||
</script>
|
||
|
||
<style scoped>
|
||
.page { min-height: 100vh; background: #F5F6F8; padding: 22rpx 28rpx 60rpx; }
|
||
.card { padding: 24rpx; background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06); }
|
||
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8rpx; }
|
||
.card-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
|
||
.card-more { font-size: 22rpx; color: #9A9A9A; }
|
||
.li { display: flex; justify-content: space-between; padding: 14rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.k { flex-shrink: 0; width: 180rpx; font-size: 26rpx; color: #666; }
|
||
.v { flex: 1; text-align: right; font-size: 26rpx; color: #333; }
|
||
.v.big { font-size: 32rpx; font-weight: 700; color: #F0710D; }
|
||
.fi { display: flex; align-items: center; min-height: 88rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||
.fk { width: 170rpx; font-size: 26rpx; color: #666; }
|
||
.fv { flex: 1; height: 88rpx; font-size: 28rpx; color: #222; }
|
||
.seg { display: flex; }
|
||
.seg-i { padding: 0 24rpx; 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; }
|
||
.btn { height: 88rpx; margin-top: 20rpx; display: flex; align-items: center; justify-content: center; border-radius: 44rpx; color: #fff; font-size: 30rpx; font-weight: 600; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); }
|
||
.btn.disabled { opacity: .7; }
|
||
.iv { padding: 16rpx 0; border-bottom: 1rpx solid #F4F4F4; display: flex; flex-direction: column; }
|
||
.iv:last-of-type { border-bottom: none; }
|
||
.iv-top { display: flex; align-items: baseline; justify-content: space-between; }
|
||
.iv-type { font-size: 26rpx; font-weight: 600; color: #333; }
|
||
.iv-amt { font-size: 30rpx; font-weight: 700; color: #F0710D; }
|
||
.iv-meta { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
|
||
.iv-status { margin-top: 6rpx; font-size: 22rpx; color: #2FA84F; }
|
||
.empty { padding: 40rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||
</style>
|