后端(补齐前端已入口但无接口的模块): - Coupon 控制器:center 领券中心 / my 我的券(未使用·已使用·已过期+计数)/ receive 领取 含库存与过期校验、重复领取拦截、领券后自动发消息 - Message 控制器:index 列表(分类筛选)/ read 单条已读 / readAll 全部已读 / unread 角标 支持 user 与 master 两种归属 前端(对应页面,全部接真接口): - pages/address/list 服务地址:列表 / 新增·编辑弹层 / 设为默认 / 删除 - pages/coupon/coupon 领券中心 + 我的券(双 Tab + 状态筛选 + 计数) - pages/message/message 消息中心:分类 / 未读圆点 / 点开自动已读 / 全部已读 / 跳订单 - mine.vue 三个入口(地址·优惠券·消息)由「开发中」改为真实路由 - merchant/workbench 服务地址入口接真实路由 - 首页 TabBar「消息」接入消息中心 - api.js 新增 coupon/message 共 7 个接口 后台登录页(UI 与前端主色调统一): - 左侧橙金渐变品牌区:logo 徽标 + 「优匠优服」立体字 + slogan + 460万+/99.9%/1762万 平台实力 + 保障条 - 右侧白色登录卡:橙色渐变按钮、圆角输入框、错误提示条 - 保留 FastAdmin 全部挂钩(token/验证码/keeplogin/@AdminLoginFormBegin 等 14 项) 验证:5 套用例 178 项断言全通过(47+65+27+24+15),配置自检 8/8
146 行
7.4 KiB
Vue
146 行
7.4 KiB
Vue
<template>
|
||
<view class="page">
|
||
<view class="header">
|
||
<view class="deco"></view>
|
||
<view class="h-top">
|
||
<view class="h-l">
|
||
<text class="h-name">{{ info ? info.name : '商家' }}</text>
|
||
<text class="h-meta">{{ info ? ('结算方式:' + (info.settle_type === 'monthly' ? '月结' : '预付')) : '加载中...' }}</text>
|
||
</view>
|
||
<view class="h-badge">{{ verifyText }}</view>
|
||
</view>
|
||
<view class="stats">
|
||
<view class="stat"><text class="stat-n">{{ info ? info.order_count : 0 }}</text><text class="stat-l">累计订单</text></view>
|
||
<view class="stat"><text class="stat-n">{{ info ? info.total_amount : 0 }}</text><text class="stat-l">累计金额</text></view>
|
||
<view class="stat"><text class="stat-n">{{ info ? info.invoiceable : 0 }}</text><text class="stat-l">可开票</text></view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="grid">
|
||
<view class="gi" v-for="g in entries" :key="g.key" @tap="g.action">
|
||
<view class="gi-icon" :style="{ background: g.bg }"><text class="gi-t" :style="{ color: g.color }">{{ g.icon }}</text></view>
|
||
<text class="gi-name">{{ g.name }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-head"><text class="card-title">按月账单</text><text class="card-more" @tap="load">刷新</text></view>
|
||
<view class="m-row" v-for="(m, i) in months" :key="i">
|
||
<text class="m-month">{{ m.month }}</text>
|
||
<text class="m-cnt">{{ m.cnt }} 单</text>
|
||
<text class="m-amt">¥{{ m.amount }}</text>
|
||
</view>
|
||
<view class="empty" v-if="!months.length">暂无账单</view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-head"><text class="card-title">近期订单</text><text class="card-more" @tap="go('/pages/order/list')">全部 ›</text></view>
|
||
<view class="o-row" v-for="o in orders" :key="o.id">
|
||
<view class="o-l">
|
||
<text class="o-name">{{ o.service_name }}</text>
|
||
<text class="o-no">{{ o.order_no }} · {{ o.time_text }}</text>
|
||
</view>
|
||
<view class="o-r">
|
||
<text class="o-amt">¥{{ o.pay_amount }}</text>
|
||
<text class="o-status">{{ o.status_text }}</text>
|
||
</view>
|
||
</view>
|
||
<view class="empty" v-if="!orders.length">暂无订单</view>
|
||
</view>
|
||
|
||
<view class="back" @tap="backToUser">切换到业主身份</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed } from 'vue';
|
||
import { onShow } from '@dcloudio/uni-app';
|
||
import api from '@/utils/api.js';
|
||
import { isLogin, toLogin } from '@/utils/request.js';
|
||
import { setRole } from '@/utils/role.js';
|
||
|
||
const info = ref(null);
|
||
const months = ref([]);
|
||
const orders = ref([]);
|
||
|
||
const verifyText = computed(() => {
|
||
if (!info.value) return '';
|
||
return { pending: '审核中', pass: '已认证', reject: '未通过' }[info.value.verify_status] || '';
|
||
});
|
||
|
||
const entries = [
|
||
{ key: 'batch', name: '批量下单', icon: '批', bg: '#FFF1E0', color: '#E07A2E', action: () => go('/pages/merchant/batch') },
|
||
{ key: 'orders', name: '企业订单', icon: '单', bg: '#EAF2FF', color: '#4A7CFF', action: () => go('/pages/order/list') },
|
||
{ key: 'invoice', name: '开具发票', icon: '票', bg: '#E8F7EE', color: '#2FA84F', action: () => go('/pages/merchant/invoice') },
|
||
{ key: 'profile', name: '企业资料', icon: '档', bg: '#F0EBFF', color: '#7A5AF8', action: () => go('/pages/merchant/apply') },
|
||
{ key: 'address', name: '服务地址', icon: '址', bg: '#FFF0F0', color: '#E8331B', action: () => go('/pages/address/list') },
|
||
{ key: 'service', name: '联系客服', icon: '服', bg: '#EAF6FF', color: '#2A8FD8', action: () => uni.makePhoneCall({ phoneNumber: '4000000000' }) }
|
||
];
|
||
|
||
function go(url) { uni.navigateTo({ url: url }); }
|
||
|
||
async function load() {
|
||
if (!isLogin()) { toLogin(); return; }
|
||
try {
|
||
const res = await api.merchantInfo();
|
||
if (!res.applied || res.merchant.verify_status !== 'pass') {
|
||
uni.redirectTo({ url: '/pages/merchant/apply' });
|
||
return;
|
||
}
|
||
info.value = res.merchant;
|
||
} catch (e) { return; }
|
||
try {
|
||
const b = await api.merchantBills();
|
||
months.value = b.months || [];
|
||
orders.value = b.orders || [];
|
||
} catch (e) {}
|
||
}
|
||
|
||
function backToUser() {
|
||
api.switchRole({ role: 'user' }).then((res) => {
|
||
setRole('user');
|
||
uni.reLaunch({ url: res.redirect || '/YJYF/YJYF' });
|
||
}).catch(() => {});
|
||
}
|
||
|
||
onShow(() => load());
|
||
</script>
|
||
|
||
<style scoped>
|
||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 60rpx; }
|
||
.header { position: relative; padding: 34rpx 30rpx 26rpx; overflow: hidden; background: linear-gradient(160deg,#FFB85C 0%,#F98D25 55%,#ED6F0E 100%); }
|
||
.deco { position: absolute; width: 320rpx; height: 320rpx; right: -120rpx; top: -130rpx; border-radius: 50%; background: rgba(255,255,255,.13); }
|
||
.h-top { position: relative; display: flex; align-items: center; justify-content: space-between; }
|
||
.h-l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
||
.h-name { font-size: 36rpx; font-weight: 700; color: #fff; }
|
||
.h-meta { margin-top: 8rpx; font-size: 22rpx; color: rgba(255,255,255,.9); }
|
||
.h-badge { flex-shrink: 0; padding: 0 22rpx; line-height: 52rpx; border-radius: 26rpx; background: #fff; color: #E36B0C; font-size: 22rpx; font-weight: 700; }
|
||
.stats { position: relative; display: flex; margin-top: 26rpx; padding-top: 22rpx; border-top: 1rpx solid rgba(255,255,255,.25); }
|
||
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; }
|
||
.stat-n { font-size: 34rpx; font-weight: 700; color: #fff; }
|
||
.stat-l { margin-top: 4rpx; font-size: 20rpx; color: rgba(255,255,255,.88); }
|
||
.grid { display: flex; flex-wrap: wrap; margin: 22rpx 28rpx 0; padding: 16rpx 0; background: #fff; border-radius: 22rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06); }
|
||
.gi { width: 33.33%; display: flex; flex-direction: column; align-items: center; padding: 18rpx 0; }
|
||
.gi-icon { width: 84rpx; height: 84rpx; border-radius: 24rpx; display: flex; align-items: center; justify-content: center; }
|
||
.gi-t { font-size: 30rpx; font-weight: 700; }
|
||
.gi-name { margin-top: 12rpx; font-size: 22rpx; color: #333; }
|
||
.card { margin: 22rpx 28rpx 0; padding: 24rpx; background: #fff; border-radius: 22rpx; 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; }
|
||
.m-row { display: flex; align-items: center; padding: 16rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.m-month { flex: 1; font-size: 26rpx; color: #333; }
|
||
.m-cnt { width: 120rpx; text-align: right; font-size: 22rpx; color: #9A9A9A; }
|
||
.m-amt { width: 160rpx; text-align: right; font-size: 28rpx; font-weight: 700; color: #F0710D; }
|
||
.o-row { display: flex; align-items: center; justify-content: space-between; padding: 16rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.o-l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
||
.o-name { font-size: 26rpx; color: #333; }
|
||
.o-no { margin-top: 4rpx; font-size: 20rpx; color: #B5B5B5; }
|
||
.o-r { display: flex; flex-direction: column; align-items: flex-end; }
|
||
.o-amt { font-size: 28rpx; font-weight: 700; color: #F0710D; }
|
||
.o-status { margin-top: 4rpx; font-size: 20rpx; color: #9A9A9A; }
|
||
.empty { padding: 40rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||
.back { margin: 26rpx 28rpx 0; height: 92rpx; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 46rpx; font-size: 28rpx; color: #F0710D; font-weight: 600; }
|
||
</style>
|
||
|