feat: 新增用户和师傅消息中心及订单页重构
- 新增用户消息中心组件 UserMessageView - 新增师傅消息中心组件 MasterMessageView - 新增用户订单列表组件 UserOrdersView - 重构订单列表页,复用独立组件 - 新增系统工具 getWindowInfoSafe 兼容多端系统信息获取 - 重构 TabBar 组件,支持单母页模式和事件回调 - 优化消息跳转逻辑,支持角色自适应 Tab 切换
这个提交包含在:
文件差异内容过多而无法显示
加载差异
@@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<view class="user-message-view">
|
||||
<!-- 统一顶部橙色导航栏 -->
|
||||
<YjyfNavBar theme="orange" title="消息中心" />
|
||||
|
||||
<view class="head">
|
||||
<view class="cats">
|
||||
<view v-for="c in cats" :key="c.key" class="cat clickable-hover" :class="{ on: category === c.key }" @tap="switchCat(c.key)">{{ c.name }}</view>
|
||||
</view>
|
||||
<text class="read-all clickable-hover" @tap="readAll">全部已读</text>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view class="msg" :class="{ unread: !m.is_read }" v-for="m in list" :key="m.id" @tap="open(m)">
|
||||
<view class="msg-top">
|
||||
<view class="dot" v-if="!m.is_read"></view>
|
||||
<text class="title">{{ m.title }}</text>
|
||||
<text class="time">{{ m.time_text }}</text>
|
||||
</view>
|
||||
<text class="content">{{ m.content }}</text>
|
||||
<text class="go" v-if="m.order_id">查看订单 ›</text>
|
||||
</view>
|
||||
<view class="empty" v-if="!loading && !list.length">暂无消息</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin } from '@/utils/request.js';
|
||||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||||
|
||||
const list = ref([]);
|
||||
const loading = ref(false);
|
||||
const category = ref('all');
|
||||
|
||||
const cats = [
|
||||
{ key: 'all', name: '全部' },
|
||||
{ key: 'order', name: '订单' },
|
||||
{ key: 'system', name: '系统' },
|
||||
{ key: 'remind', name: '提醒' }
|
||||
];
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.messageList({ category: category.value, limit: 30 });
|
||||
list.value = res.list || [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function switchCat(k) {
|
||||
category.value = k;
|
||||
load();
|
||||
}
|
||||
|
||||
async function open(m) {
|
||||
if (!m.is_read) {
|
||||
try {
|
||||
await api.messageRead({ id: m.id });
|
||||
m.is_read = 1;
|
||||
} catch (e) {}
|
||||
}
|
||||
if (m.order_id) {
|
||||
uni.navigateTo({ url: `/pages/order/detail?id=${m.order_id}` });
|
||||
}
|
||||
}
|
||||
|
||||
async function readAll() {
|
||||
try {
|
||||
const res = await api.messageReadAll({});
|
||||
uni.showToast({ title: '已全部标记已读(' + res.count + ' 条)', icon: 'none' });
|
||||
load();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
load
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-message-view { min-height: 100vh; background: #F5F6F8; padding-bottom: 40rpx; }
|
||||
.head { display: flex; align-items: center; background: #fff; padding: 20rpx 24rpx; box-shadow: 0 4rpx 12rpx rgba(0,0,0,.03); }
|
||||
.cats { flex: 1; display: flex; }
|
||||
.cat { margin-right: 14rpx; padding: 0 22rpx; line-height: 54rpx; border-radius: 27rpx; background: #F5F5F5; font-size: 24rpx; color: #666; }
|
||||
.cat.on { background: #FFF3E6; color: #E36B0C; font-weight: 600; }
|
||||
.read-all { font-size: 24rpx; color: #F0710D; }
|
||||
.list { padding: 22rpx 28rpx; }
|
||||
.msg { background: #fff; border-radius: 20rpx; padding: 22rpx 24rpx; margin-bottom: 18rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06); }
|
||||
.msg.unread { border-left: 6rpx solid #F0710D; }
|
||||
.msg-top { display: flex; align-items: center; }
|
||||
.dot { width: 12rpx; height: 12rpx; border-radius: 50%; background: #F0710D; margin-right: 10rpx; }
|
||||
.title { flex: 1; min-width: 0; font-size: 28rpx; font-weight: 600; color: #1F1F1F; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
||||
.time { flex-shrink: 0; margin-left: 12rpx; font-size: 22rpx; color: #AAAAAA; }
|
||||
.content { display: block; margin-top: 10rpx; font-size: 24rpx; color: #666; line-height: 34rpx; }
|
||||
.go { display: block; margin-top: 10rpx; font-size: 22rpx; color: #4A7CFF; }
|
||||
.empty { padding: 110rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||||
.clickable-hover:active { opacity: 0.85; transform: scale(0.98); }
|
||||
</style>
|
||||
@@ -0,0 +1,820 @@
|
||||
<template>
|
||||
<view class="user-mine-view">
|
||||
<!-- 头部个人名片与资产核心区 (Zone 1: 一体化沉浸渐变背景) -->
|
||||
<view class="profile-hero">
|
||||
<view class="hero-bg-deco deco-lg"></view>
|
||||
<view class="hero-bg-deco deco-sm"></view>
|
||||
|
||||
<!-- 沉浸式透明导航栏(单一大背景贯穿,彻底消除分层断层) -->
|
||||
<YjyfNavBar theme="transparent" title="个人中心" :fixed="false" />
|
||||
|
||||
<view class="hero-body">
|
||||
<!-- 用户基本信息 -->
|
||||
<view class="user-card">
|
||||
<view class="avatar-wrap">
|
||||
<image v-if="user && user.avatar" class="avatar-img" :src="user.avatar" mode="aspectFill" />
|
||||
<image v-else class="avatar-ph-img" src="/static/icons/user-avatar.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<view class="name-line">
|
||||
<text class="user-name">{{ user ? user.nickname : '未登录' }}</text>
|
||||
<view class="role-badge" :class="{ 'is-pro': isMasterOrMerchant }">
|
||||
<text class="role-badge-txt">{{ roleText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="user-mobile" v-if="mobileText">{{ mobileText }}</text>
|
||||
<text class="user-subtag" v-if="master && master.score">服务评分 {{ master.score }} 分</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 核心资产卡片(仅聚焦余额与优惠券,无冗余项) -->
|
||||
<view class="assets-card">
|
||||
<view class="asset-item clickable-hover" @tap="showBalanceTip">
|
||||
<view class="asset-val-box">
|
||||
<text class="asset-symbol">¥</text>
|
||||
<text class="asset-number">{{ user ? Number(user.balance).toFixed(2) : '0.00' }}</text>
|
||||
</view>
|
||||
<text class="asset-title">账户余额</text>
|
||||
</view>
|
||||
<view class="asset-line"></view>
|
||||
<view class="asset-item clickable-hover" @tap="go('/pages/coupon/coupon')">
|
||||
<view class="asset-val-box">
|
||||
<text class="asset-number">{{ coupon }}</text>
|
||||
<text class="asset-unit">张</text>
|
||||
</view>
|
||||
<text class="asset-title">优惠券</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 页面内容主体区 (Zone 2 - Zone 5) -->
|
||||
<view class="content-body">
|
||||
<!-- 身份工作台专区:针对已认证或审核中用户 (Zone 2) -->
|
||||
<view class="role-workbench-section" v-if="hasRoleStatus">
|
||||
<!-- 师傅身份卡片 -->
|
||||
<view class="workbench-card master-card" v-if="master">
|
||||
<view class="wb-left">
|
||||
<image class="wb-icon" src="/static/icons/join-master.svg" mode="aspectFit" />
|
||||
<view class="wb-texts">
|
||||
<text class="wb-title">{{ masterCard.title }}</text>
|
||||
<text class="wb-desc">{{ masterCard.desc }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wb-btn clickable-hover" @tap="masterCard.action">
|
||||
{{ masterCard.btn }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商家身份卡片 -->
|
||||
<view class="workbench-card merchant-card" v-if="merchant">
|
||||
<view class="wb-left">
|
||||
<image class="wb-icon" src="/static/icons/join-merchant.svg" mode="aspectFit" />
|
||||
<view class="wb-texts">
|
||||
<text class="wb-title">{{ merchantCard.title }}</text>
|
||||
<text class="wb-desc">{{ merchantCard.desc }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="wb-btn clickable-hover" @tap="merchantCard.action">
|
||||
{{ merchantCard.btn }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 常用基础服务 (Zone 3) -->
|
||||
<view class="card-panel">
|
||||
<view class="panel-header">
|
||||
<text class="panel-title">常用服务</text>
|
||||
</view>
|
||||
<view class="menu-group">
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/address/list')">
|
||||
<view class="menu-item-l">
|
||||
<image class="menu-ico" src="/static/icons/menu-address.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')">
|
||||
<view class="menu-item-l">
|
||||
<image class="menu-ico" src="/static/icons/menu-coupon.svg" mode="aspectFit" />
|
||||
<text class="menu-txt">领券中心</text>
|
||||
</view>
|
||||
<view class="menu-item-r">
|
||||
<text class="menu-extra" v-if="coupon > 0">{{ coupon }} 张可用</text>
|
||||
<image class="arrow-ico" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button class="menu-item menu-btn clickable-hover" open-type="contact">
|
||||
<view class="menu-item-l">
|
||||
<image class="menu-ico" src="/static/icons/menu-service.svg" mode="aspectFit" />
|
||||
<text class="menu-txt">在线客服</text>
|
||||
</view>
|
||||
<view class="menu-item-r">
|
||||
<text class="menu-extra">微信官方专属客服</text>
|
||||
<image class="arrow-ico" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view class="menu-item clickable-hover" @tap="callService">
|
||||
<view class="menu-item-l">
|
||||
<image class="menu-ico" src="/static/icons/menu-service.svg" mode="aspectFit" />
|
||||
<text class="menu-txt">联系官方客服</text>
|
||||
</view>
|
||||
<view class="menu-item-r">
|
||||
<text class="menu-extra">400-000-0000</text>
|
||||
<image class="arrow-ico" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view class="menu-item clickable-hover" @tap="showPlatformAssure">
|
||||
<view class="menu-item-l">
|
||||
<image class="menu-ico" src="/static/icons/menu-about.svg" mode="aspectFit" />
|
||||
<text class="menu-txt">平台服务保障</text>
|
||||
</view>
|
||||
<view class="menu-item-r">
|
||||
<text class="menu-extra">实名认证·先行赔付</text>
|
||||
<image class="arrow-ico" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 合作与入驻通道(Zone 4:仅对未全部认证的普通用户开放,轻量化双列排版) -->
|
||||
<view class="card-panel partner-panel" v-if="showPartnerEntry">
|
||||
<view class="panel-header">
|
||||
<text class="panel-title">入驻与合作</text>
|
||||
</view>
|
||||
<view class="partner-grid">
|
||||
<view class="partner-card clickable-hover" v-if="!master" @tap="masterCard.action">
|
||||
<view class="partner-head">
|
||||
<image class="partner-icon" src="/static/icons/join-master.svg" mode="aspectFit" />
|
||||
<text class="partner-tag tag-master">成为师傅</text>
|
||||
</view>
|
||||
<text class="partner-main-title">师傅招募</text>
|
||||
<text class="partner-brief">技能认证,接单赚收入</text>
|
||||
</view>
|
||||
<view class="partner-card clickable-hover" v-if="!merchant" @tap="merchantCard.action">
|
||||
<view class="partner-head">
|
||||
<image class="partner-icon" src="/static/icons/join-merchant.svg" mode="aspectFit" />
|
||||
<text class="partner-tag tag-merchant">企业合作</text>
|
||||
</view>
|
||||
<text class="partner-main-title">商家入驻</text>
|
||||
<text class="partner-brief">批量下单与对账开票</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 账号安全操作 (Zone 5) -->
|
||||
<view class="logout-action clickable-hover" @tap="logout">
|
||||
<text class="logout-txt">退出登录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin, setUser, clearAuth } from '@/utils/request.js';
|
||||
import { getRole, setRole } from '@/utils/role.js';
|
||||
|
||||
const user = ref(null);
|
||||
const master = ref(null);
|
||||
const merchant = ref(null);
|
||||
const coupon = ref(0);
|
||||
const currentRole = ref('user');
|
||||
|
||||
const mobileText = computed(() => {
|
||||
if (!user.value || !user.value.mobile) return '';
|
||||
const m = String(user.value.mobile);
|
||||
if (m.length >= 11) {
|
||||
return m.slice(0, 3) + '****' + m.slice(7);
|
||||
}
|
||||
return m;
|
||||
});
|
||||
|
||||
const isMasterOrMerchant = computed(() => {
|
||||
return (master.value && master.value.verify_status === 'pass') ||
|
||||
(merchant.value && merchant.value.verify_status === 'pass');
|
||||
});
|
||||
|
||||
const hasRoleStatus = computed(() => {
|
||||
return !!(master.value || merchant.value);
|
||||
});
|
||||
|
||||
const showPartnerEntry = computed(() => {
|
||||
return !master.value || !merchant.value;
|
||||
});
|
||||
|
||||
const roleText = computed(() => {
|
||||
const curRole = currentRole.value;
|
||||
if (curRole === 'merchant' && merchant.value && merchant.value.verify_status === 'pass') {
|
||||
return merchant.value.is_owner === false ? '关联商家' : '认证商家';
|
||||
}
|
||||
if (curRole === 'master' && master.value && master.value.verify_status === 'pass') {
|
||||
return '认证师傅';
|
||||
}
|
||||
if (merchant.value && merchant.value.verify_status === 'pass') {
|
||||
return merchant.value.is_owner === false ? '关联商家' : '认证商家';
|
||||
}
|
||||
if (master.value && master.value.verify_status === 'pass') return '认证师傅';
|
||||
if (merchant.value && merchant.value.verify_status === 'pending') return '商家审核中';
|
||||
if (master.value && master.value.verify_status === 'pending') return '师傅审核中';
|
||||
return '个人用户';
|
||||
});
|
||||
|
||||
const masterCard = computed(() => {
|
||||
const m = master.value;
|
||||
if (!m) {
|
||||
return { title: '成为优匠优服师傅', desc: '实名认证 + 技能认证,接单赚收入', btn: '立即入驻', action: () => go('/pages/master/apply') };
|
||||
}
|
||||
if (m.verify_status === 'pending') {
|
||||
return { title: '师傅资质审核中', desc: '平台将在 1-2 个工作日内完成审核', btn: '查看进度', action: () => go('/pages/master/apply') };
|
||||
}
|
||||
if (m.verify_status === 'reject') {
|
||||
return { title: '师傅资质未通过', desc: m.audit_msg || '请补充资料后重新提交', btn: '重新提交', action: () => go('/pages/master/apply') };
|
||||
}
|
||||
return { title: '师傅工作台', desc: '已通过认证,进入工作台开始接单', btn: '切换师傅端', action: switchToMaster };
|
||||
});
|
||||
|
||||
const merchantCard = computed(() => {
|
||||
const m = merchant.value;
|
||||
if (!m) {
|
||||
return { title: '成为优匠优服商家', desc: '企业认证,支持批量下单 / 对账 / 开票', btn: '商家入驻', action: () => go('/pages/merchant/apply') };
|
||||
}
|
||||
if (m.verify_status === 'pending') {
|
||||
return { title: '商家资质审核中', desc: '平台将在 1-2 个工作日内完成审核', btn: '查看进度', action: () => go('/pages/merchant/apply') };
|
||||
}
|
||||
if (m.verify_status === 'reject') {
|
||||
return { title: '商家资质未通过', desc: m.audit_msg || '请补充资料后重新提交', btn: '重新提交', action: () => go('/pages/merchant/apply') };
|
||||
}
|
||||
if (m.is_owner === false) {
|
||||
return { title: m.name || '关联企业账号', desc: '订单 / 账单 / 开票数据与企业主账号同步', btn: '切换商家端', action: switchToMerchant };
|
||||
}
|
||||
return { title: m.name || '商家企业工作台', desc: '进入商家工作台:批量下单 / 账单 / 开票', btn: '切换商家端', action: switchToMerchant };
|
||||
});
|
||||
|
||||
function go(url) {
|
||||
uni.navigateTo({ url });
|
||||
}
|
||||
|
||||
function showBalanceTip() {
|
||||
const bal = user.value ? Number(user.value.balance).toFixed(2) : '0.00';
|
||||
uni.showModal({
|
||||
title: '账户余额',
|
||||
content: `当前可用余额:¥${bal}`,
|
||||
showCancel: false,
|
||||
confirmColor: '#F0710D'
|
||||
});
|
||||
}
|
||||
|
||||
function showPlatformAssure() {
|
||||
uni.showModal({
|
||||
title: '优匠优服 · 服务保障',
|
||||
content: '1. 实名认证:所有上门师傅均通过公安实名与技能审核\n2. 价格公道:标准服务定价,杜绝隐形加价与乱收费\n3. 售后保障:平台客服全程跟踪,质保期内免费返工',
|
||||
showCancel: false,
|
||||
confirmText: '我知道了',
|
||||
confirmColor: '#F0710D'
|
||||
});
|
||||
}
|
||||
|
||||
function callService() {
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: '4000000000',
|
||||
fail: () => {}
|
||||
});
|
||||
}
|
||||
|
||||
async function load() {
|
||||
currentRole.value = getRole();
|
||||
if (!isLogin()) {
|
||||
toLogin();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await api.profile();
|
||||
user.value = res;
|
||||
master.value = res.master;
|
||||
merchant.value = res.merchant;
|
||||
coupon.value = Number(res.coupon_count) || 0;
|
||||
setUser(res);
|
||||
} catch (e) {
|
||||
console.error('加载个人信息失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
async function switchToMerchant() {
|
||||
try {
|
||||
const res = await api.switchRole({ role: 'merchant' });
|
||||
setRole('merchant');
|
||||
currentRole.value = 'merchant';
|
||||
uni.showToast({ title: '已切换为商家身份' });
|
||||
setTimeout(() => uni.reLaunch({ url: res.redirect }), 500);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function switchToMaster() {
|
||||
try {
|
||||
const res = await api.switchRole({ role: 'master' });
|
||||
setRole('master');
|
||||
currentRole.value = 'master';
|
||||
uni.showToast({ title: '已切换为师傅身份' });
|
||||
setTimeout(() => uni.reLaunch({ url: res.redirect }), 500);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认退出当前登录账号?',
|
||||
confirmColor: '#F0710D',
|
||||
success: (r) => {
|
||||
if (!r.confirm) return;
|
||||
clearAuth();
|
||||
uni.reLaunch({ url: '/pages/login/login' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
load
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-mine-view {
|
||||
min-height: 100vh;
|
||||
background: #F5F6F8;
|
||||
padding-bottom: calc(150rpx + env(safe-area-inset-bottom));
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ---------- 头部个人主页英雄区 (Zone 1: 一体化沉浸) ---------- */
|
||||
.profile-hero {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||||
padding-bottom: 36rpx;
|
||||
border-bottom-left-radius: 36rpx;
|
||||
border-bottom-right-radius: 36rpx;
|
||||
}
|
||||
|
||||
.hero-body {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 10rpx 32rpx 0;
|
||||
}
|
||||
|
||||
.hero-bg-deco {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
pointer-events: none;
|
||||
}
|
||||
.hero-bg-deco.deco-lg {
|
||||
width: 360rpx;
|
||||
height: 360rpx;
|
||||
right: -80rpx;
|
||||
top: -100rpx;
|
||||
}
|
||||
.hero-bg-deco.deco-sm {
|
||||
width: 180rpx;
|
||||
height: 180rpx;
|
||||
left: -40rpx;
|
||||
bottom: -60rpx;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.avatar-wrap {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.12);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
border: 4rpx solid rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.avatar-ph-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 24rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.name-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
color: #FFFFFF;
|
||||
line-height: 1.25;
|
||||
max-width: 320rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.role-badge {
|
||||
margin-left: 14rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(255, 255, 255, 0.22);
|
||||
backdrop-filter: blur(4px);
|
||||
border: 1rpx solid rgba(255, 255, 255, 0.35);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.role-badge.is-pro {
|
||||
background: #FFF4E5;
|
||||
border-color: #FFA940;
|
||||
}
|
||||
|
||||
.role-badge-txt {
|
||||
font-size: 20rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.role-badge.is-pro .role-badge-txt {
|
||||
color: #D45B00;
|
||||
}
|
||||
|
||||
.user-mobile {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.88);
|
||||
}
|
||||
|
||||
.user-subtag {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: #FFF2D6;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ---------- 资产双卡片展示行 ---------- */
|
||||
.assets-card {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 28rpx;
|
||||
padding: 24rpx 20rpx 8rpx;
|
||||
border-top: 1rpx solid rgba(255, 255, 255, 0.22);
|
||||
}
|
||||
|
||||
.asset-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.asset-val-box {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.asset-symbol {
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
color: #FFFFFF;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.asset-unit {
|
||||
margin-left: 4rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: normal;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.asset-number {
|
||||
font-size: 40rpx;
|
||||
font-weight: 700;
|
||||
color: #FFFFFF;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
}
|
||||
|
||||
.asset-title {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.asset-line {
|
||||
width: 1rpx;
|
||||
height: 48rpx;
|
||||
background: rgba(255, 255, 255, 0.28);
|
||||
}
|
||||
|
||||
/* ---------- 主体内容区 ---------- */
|
||||
.content-body {
|
||||
padding: 24rpx 28rpx 0;
|
||||
}
|
||||
|
||||
/* ---------- 身份工作台专区 (Zone 2) ---------- */
|
||||
.role-workbench-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.workbench-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 24rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
border-left: 8rpx solid #F0710D;
|
||||
}
|
||||
|
||||
.wb-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.wb-icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
flex-shrink: 0;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.wb-texts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wb-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #1D2129;
|
||||
}
|
||||
|
||||
.wb-desc {
|
||||
margin-top: 4rpx;
|
||||
font-size: 22rpx;
|
||||
color: #86909C;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.wb-btn {
|
||||
flex-shrink: 0;
|
||||
padding: 0 24rpx;
|
||||
height: 56rpx;
|
||||
line-height: 56rpx;
|
||||
border-radius: 28rpx;
|
||||
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||||
color: #FFFFFF;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 4rpx 12rpx rgba(240, 113, 13, 0.25);
|
||||
}
|
||||
|
||||
/* ---------- 通用卡片容器 ---------- */
|
||||
.card-panel {
|
||||
background: #FFFFFF;
|
||||
border-radius: 24rpx;
|
||||
padding: 24rpx 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.035);
|
||||
}
|
||||
|
||||
.panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
padding: 4rpx 0;
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1D2129;
|
||||
position: relative;
|
||||
padding-left: 18rpx;
|
||||
}
|
||||
|
||||
.panel-title::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 24rpx;
|
||||
border-radius: 3rpx;
|
||||
background: #F0710D;
|
||||
}
|
||||
|
||||
.arrow-ico {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* ---------- 常用服务菜单 (Zone 3) ---------- */
|
||||
.menu-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 96rpx;
|
||||
border-bottom: 1rpx solid #F5F6F8;
|
||||
}
|
||||
|
||||
.menu-btn {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
background: transparent;
|
||||
line-height: normal;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
text-align: left;
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.menu-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.menu-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.menu-item-l {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menu-ico {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.menu-txt {
|
||||
font-size: 28rpx;
|
||||
color: #1D2129;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.menu-item-r {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.menu-extra {
|
||||
font-size: 24rpx;
|
||||
color: #86909C;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
/* ---------- 师傅与商家合作专区 (Zone 4) ---------- */
|
||||
.partner-panel {
|
||||
padding-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.partner-grid {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.partner-card {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 22rpx 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: #FBFBFC;
|
||||
border: 1rpx solid #F0F2F5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.partner-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 14rpx;
|
||||
}
|
||||
|
||||
.partner-icon {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
}
|
||||
|
||||
.partner-tag {
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 14rpx;
|
||||
border-radius: 14rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tag-master {
|
||||
background: #FFF2E6;
|
||||
color: #E66606;
|
||||
}
|
||||
|
||||
.tag-merchant {
|
||||
background: #E8F3FF;
|
||||
color: #1976D2;
|
||||
}
|
||||
|
||||
.partner-main-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #1D2129;
|
||||
}
|
||||
|
||||
.partner-brief {
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: #86909C;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* ---------- 退出登录 (Zone 5) ---------- */
|
||||
.logout-action {
|
||||
margin: 32rpx 0 20rpx;
|
||||
height: 88rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1rpx solid #E5E6EB;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
.logout-txt {
|
||||
font-size: 28rpx;
|
||||
color: #86909C;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ---------- 点击反馈与无障碍 ---------- */
|
||||
.clickable-hover {
|
||||
transition: opacity 0.15s ease, transform 0.15s ease;
|
||||
}
|
||||
|
||||
.clickable-hover:active {
|
||||
opacity: 0.75;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<view class="user-orders-view">
|
||||
<!-- 统一规范顶部橙色导航栏 -->
|
||||
<YjyfNavBar theme="orange" title="我的订单" />
|
||||
|
||||
<view class="tabs">
|
||||
<view v-for="t in tabs" :key="t.key" class="tab clickable-hover" :class="{ on: cur === t.key }" @tap="switchTab(t.key)">
|
||||
<text class="tab-txt">{{ t.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list">
|
||||
<view class="item" v-for="o in list" :key="o.id" @tap="goDetail(o.id)">
|
||||
<view class="hd">
|
||||
<text class="no">{{ o.order_no }}</text>
|
||||
<text class="status" :class="'s' + o.status">{{ o.status_text }}</text>
|
||||
</view>
|
||||
<view class="bd">
|
||||
<view class="thumb">
|
||||
<image v-if="o.service_image" class="thumb-img" :src="o.service_image" mode="aspectFill" />
|
||||
<text v-else class="thumb-txt">{{ (o.service_name || '').slice(0, 2) }}</text>
|
||||
</view>
|
||||
<view class="mi">
|
||||
<text class="sname">{{ o.service_name }}</text>
|
||||
<text class="saddr">{{ o.address }}</text>
|
||||
<text class="stime">预约 {{ o.appoint_text }}{{ Number(o.urgent) ? ' · 急单' : '' }}</text>
|
||||
</view>
|
||||
<text class="amt">¥{{ o.pay_amount }}</text>
|
||||
</view>
|
||||
<view class="ops" v-if="o.can_pay || o.can_cancel || o.can_verify || o.can_review">
|
||||
<view class="op clickable-hover" v-if="o.can_cancel" @tap.stop="cancel(o)">取消订单</view>
|
||||
<view class="op primary clickable-hover" v-if="o.can_pay" @tap.stop="pay(o)">去支付</view>
|
||||
<view class="op primary clickable-hover" v-if="o.can_verify" @tap.stop="verify(o)">确认验收</view>
|
||||
<view class="op primary clickable-hover" v-if="o.can_review" @tap.stop="review(o)">去评价</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="empty-state" v-if="!loading && !list.length">
|
||||
<view class="empty-badge">
|
||||
<image class="empty-badge-img" src="/static/icons/scan-paste.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<text class="empty-title">暂无相关订单</text>
|
||||
<text class="empty-desc">优匠师傅随时待命,准时上门,售后有保障</text>
|
||||
<view class="empty-btn clickable-hover" @tap="goOrder">立即找师傅</view>
|
||||
</view>
|
||||
<view class="tip" v-if="list.length"><text>仅展示前 {{ list.length }} 条</text></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin } from '@/utils/request.js';
|
||||
|
||||
const tabs = [
|
||||
{ key: 'all', name: '全部' },
|
||||
{ key: 'active', name: '进行中' },
|
||||
{ key: 'completed', name: '已完成' },
|
||||
{ key: 'cancelled', name: '已取消' }
|
||||
];
|
||||
const cur = ref('all');
|
||||
const list = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.orderList({ status: cur.value, limit: 20 });
|
||||
list.value = res.list || [];
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function switchTab(k) {
|
||||
cur.value = k;
|
||||
load();
|
||||
}
|
||||
function goOrder() { uni.navigateTo({ url: "/pages/order/quick" }); }
|
||||
function goDetail(id) {
|
||||
uni.navigateTo({ url: '/pages/order/detail?id=' + id });
|
||||
}
|
||||
function toast(t) { uni.showToast({ title: t, icon: 'none' }); }
|
||||
|
||||
function cancel(o) {
|
||||
uni.showModal({
|
||||
title: '取消订单', content: '确认取消该订单?',
|
||||
success: async (r) => {
|
||||
if (!r.confirm) return;
|
||||
try { await api.orderCancel({ order_id: o.id, reason: '用户取消' }); toast('已取消'); load(); } catch (e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
async function pay(o) {
|
||||
try { await api.orderPay({ order_id: o.id, pay_type: 'mock' }); toast('支付成功'); load(); } catch (e) {}
|
||||
}
|
||||
function verify(o) {
|
||||
uni.showModal({
|
||||
title: '确认验收', content: '请确认服务已完成,验收后平台将向师傅结算',
|
||||
success: async (r) => {
|
||||
if (!r.confirm) return;
|
||||
try { await api.orderVerify({ order_id: o.id }); toast('验收成功'); load(); } catch (e) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
function review(o) {
|
||||
uni.navigateTo({ url: '/pages/order/review?id=' + o.id });
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
load();
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
load
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-orders-view { min-height: 100vh; background: #F5F6F8; padding-bottom: 40rpx; }
|
||||
.tabs { display: flex; background: #fff; padding: 0 12rpx; box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03); }
|
||||
.tab { flex: 1; text-align: center; padding: 26rpx 0; }
|
||||
.tab-txt { font-size: 28rpx; color: #666; }
|
||||
.tab.on .tab-txt { color: #F0710D; font-weight: 700; }
|
||||
.list { padding: 20rpx 28rpx; }
|
||||
.item { background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; padding: 22rpx 24rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06); }
|
||||
.hd { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||||
.no { font-size: 22rpx; color: #9A9A9A; }
|
||||
.status { font-size: 24rpx; font-weight: 600; color: #F0710D; }
|
||||
.status.s8 { color: #2FA84F; }
|
||||
.status.s9 { color: #9A9A9A; }
|
||||
.status.s7 { color: #E8331B; }
|
||||
.bd { display: flex; align-items: center; padding: 20rpx 0; }
|
||||
.thumb { width: 92rpx; height: 92rpx; border-radius: 16rpx; flex-shrink: 0; background: linear-gradient(160deg,#FFF7F0,#FCE9D6); display: flex; align-items: center; justify-content: center; overflow: hidden; }
|
||||
.thumb-img { width: 100%; height: 100%; }
|
||||
.thumb-txt { font-size: 26rpx; font-weight: 700; color: #B85E2A; }
|
||||
.mi { flex: 1; min-width: 0; margin-left: 18rpx; display: flex; flex-direction: column; }
|
||||
.sname { font-size: 28rpx; font-weight: 600; color: #1F1F1F; }
|
||||
.saddr { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
||||
.stime { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
|
||||
.amt { font-size: 32rpx; font-weight: 700; color: #F0710D; }
|
||||
.ops { display: flex; justify-content: flex-end; padding-top: 16rpx; border-top: 1rpx solid #F4F4F4; }
|
||||
.op { margin-left: 16rpx; padding: 0 26rpx; line-height: 60rpx; border-radius: 30rpx; border: 2rpx solid #DDD; font-size: 24rpx; color: #666; }
|
||||
.op.primary { border-color: #F0710D; color: #F0710D; background: #FFF7F0; }
|
||||
.empty { padding: 120rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||||
.tip { text-align: center; font-size: 20rpx; color: #C4C4C4; }
|
||||
|
||||
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 120rpx 40rpx 80rpx; }
|
||||
.empty-badge-img { width: 56rpx; height: 56rpx; opacity: 0.6; }
|
||||
.empty-badge { width: 120rpx; height: 120rpx; line-height: 120rpx; text-align: center; border-radius: 50%; background: #FFF3E6; font-size: 54rpx; margin-bottom: 24rpx; }
|
||||
.empty-title { font-size: 30rpx; font-weight: 700; color: #1F1F1F; margin-bottom: 10rpx; }
|
||||
.empty-desc { font-size: 24rpx; color: #888888; margin-bottom: 36rpx; text-align: center; line-height: 36rpx; }
|
||||
.empty-btn { height: 80rpx; padding: 0 48rpx; display: flex; align-items: center; justify-content: center; border-radius: 40rpx; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); color: #fff; font-size: 28rpx; font-weight: 600; box-shadow: 0 8rpx 20rpx rgba(240,113,13,0.28); }
|
||||
|
||||
.clickable-hover:active { opacity: 0.85; transform: scale(0.98); }
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户