feat: 新增用户和师傅消息中心及订单页重构
- 新增用户消息中心组件 UserMessageView - 新增师傅消息中心组件 MasterMessageView - 新增用户订单列表组件 UserOrdersView - 重构订单列表页,复用独立组件 - 新增系统工具 getWindowInfoSafe 兼容多端系统信息获取 - 重构 TabBar 组件,支持单母页模式和事件回调 - 优化消息跳转逻辑,支持角色自适应 Tab 切换
这个提交包含在:
@@ -84,13 +84,14 @@
|
||||
import YjyfTabBar from '@/components/YjyfTabBar.vue';
|
||||
import GoodsPickerDrawer from '@/components/GoodsPickerDrawer.vue';
|
||||
import api from '@/utils/api.js';
|
||||
import { getWindowInfoSafe } from '@/utils/system.js';
|
||||
|
||||
// 系统状态栏高度与胶囊按钮适配
|
||||
const statusBarHeight = ref(20);
|
||||
const navBarHeight = ref(44);
|
||||
|
||||
try {
|
||||
const info = uni.getSystemInfoSync();
|
||||
const info = getWindowInfoSafe();
|
||||
if (info && info.statusBarHeight) statusBarHeight.value = info.statusBarHeight;
|
||||
if (typeof uni.getMenuButtonBoundingClientRect === 'function') {
|
||||
const menu = uni.getMenuButtonBoundingClientRect();
|
||||
|
||||
文件差异内容过多而无法显示
加载差异
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 顶部生活服务场景背景大图与柔和渐变过渡 -->
|
||||
<view class="hero-bg-wrapper">
|
||||
@@ -141,6 +141,7 @@
|
||||
import { setToken, setUser } from '@/utils/request.js';
|
||||
import { getWxCode } from '@/utils/wxlogin.js';
|
||||
import { setRole } from '@/utils/role.js';
|
||||
import { getWindowInfoSafe } from '@/utils/system.js';
|
||||
|
||||
const loading = ref(false);
|
||||
const showBack = ref(false);
|
||||
@@ -174,7 +175,7 @@
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
const sys = uni.getSystemInfoSync();
|
||||
const sys = getWindowInfoSafe();
|
||||
if (sys && sys.statusBarHeight) {
|
||||
statusBarHeight.value = sys.statusBarHeight;
|
||||
}
|
||||
|
||||
@@ -1,740 +1,102 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 顶部一体化沉浸式头部(单一连续背景渐变,彻底消除分层割裂) -->
|
||||
<view class="hall-hero">
|
||||
<YjyfNavBar theme="transparent" title="接单大厅" :fixed="false" />
|
||||
<view class="hall-header-body">
|
||||
<view class="header-main">
|
||||
<view class="h-user">
|
||||
<view class="name-line">
|
||||
<text class="h-name">{{ info ? info.realname : '优匠师傅' }}</text>
|
||||
<view class="level-badge" v-if="info">
|
||||
<text class="level-txt">Lv{{ info.level }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="h-stats">{{ info ? ('综合评分 ' + info.score + ' · 累计完成 ' + info.order_count + ' 单') : '优匠优服师傅工作端' }}</text>
|
||||
</view>
|
||||
<view class="work-toggle clickable-hover" :class="{ paused: info && info.work_status === 'off' }" @tap="toggleWork">
|
||||
<view class="dot"></view>
|
||||
<text class="toggle-txt">{{ info && info.work_status === 'off' ? '已暂停' : '听单中' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="master-container-page">
|
||||
<!-- 1. 抢单大厅 (Tab 0) -->
|
||||
<view v-show="activeTab === 0">
|
||||
<MasterHallView ref="hallRef" />
|
||||
</view>
|
||||
|
||||
<!-- 跑马灯动态通知广播(对标工奇兵广播条) -->
|
||||
<view class="broadcast-bar" v-if="list.length">
|
||||
<image class="broadcast-ico" src="/static/icons/nav-bell.svg" mode="aspectFit" />
|
||||
<swiper class="broadcast-swiper" :vertical="true" :autoplay="true" :interval="3500" :circular="true">
|
||||
<swiper-item class="swiper-item" v-for="(item, idx) in broadcastList" :key="idx">
|
||||
<text class="broadcast-txt">{{ item }}</text>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<!-- 2. 接单管理 (Tab 1) -->
|
||||
<view v-show="activeTab === 1">
|
||||
<MasterOrdersView ref="ordersRef" @switch-tab="onTabChange" />
|
||||
</view>
|
||||
|
||||
<!-- 工奇兵风格筛选导航栏:全部 / 一口价 / 师傅竞价 / 用户定价 -->
|
||||
<view class="filter-sticky">
|
||||
<view class="type-tabs">
|
||||
<view v-for="t in typeTabs" :key="t.key" class="t-tab clickable-hover" :class="{ on: type === t.key }" @tap="type = t.key">
|
||||
<text class="t-txt">{{ t.name }}</text>
|
||||
<view class="t-dot" v-if="t.badge && list.length"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sort-tabs">
|
||||
<view v-for="s in sortTabs" :key="s.key" class="s-tab clickable-hover" :class="{ on: sort === s.key }" @tap="sort = s.key">
|
||||
{{ s.name }}
|
||||
</view>
|
||||
</view>
|
||||
<!-- 3. 消息中心 (Tab 2) -->
|
||||
<view v-show="activeTab === 2">
|
||||
<MasterMessageView ref="messageRef" @switch-tab="onTabChange" />
|
||||
</view>
|
||||
|
||||
<!-- 订单列表(工奇兵高密度信息流卡片,点击卡片进详情) -->
|
||||
<view class="list">
|
||||
<view class="item clickable-hover" v-for="o in list" :key="o.id" @tap="goDetail(o)">
|
||||
<view class="hd">
|
||||
<view class="hd-left">
|
||||
<text class="tag-urgent" v-if="Number(o.urgent)">急单</text>
|
||||
<text class="tag-mode quote" v-if="o.price_type === 'quote'">师傅竞价</text>
|
||||
<text class="tag-mode custom" v-if="o.price_type === 'custom'">用户定价</text>
|
||||
<text class="tag-mode fixed" v-if="o.price_type === 'fixed'">一口价</text>
|
||||
<text class="svc">{{ o.service_name }}</text>
|
||||
</view>
|
||||
<view class="amt-box">
|
||||
<text class="amt-symbol" v-if="o.price_type !== 'quote'">¥</text>
|
||||
<text class="amt">{{ o.price_type === 'quote' ? '竞价中' : o.pay_amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bd">
|
||||
<!-- 地址与距离 -->
|
||||
<view class="info-row">
|
||||
<image class="row-icon" src="/static/icons/master/order-loc.svg" mode="aspectFit" />
|
||||
<text class="row-txt addr-txt">{{ o.address }}</text>
|
||||
<text class="distance-txt" v-if="o.distance_text">{{ o.distance_text }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 预约上门时间 -->
|
||||
<view class="info-row">
|
||||
<image class="row-icon" src="/static/icons/master/order-time.svg" mode="aspectFit" />
|
||||
<text class="row-txt">期望上门:{{ o.appoint_text }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 服务规格与条件微徽标 -->
|
||||
<view class="badge-row">
|
||||
<text class="badge">楼层 {{ o.floor }} 层</text>
|
||||
<text class="badge">{{ Number(o.has_elevator) ? '有电梯' : '步梯无电梯' }}</text>
|
||||
<text class="badge" v-if="o.goods_model">型号:{{ o.goods_model }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 客户工单要求备注 -->
|
||||
<view class="remark-row" v-if="o.remark">
|
||||
<text class="remark-tag">工单要求</text>
|
||||
<text class="remark-txt">{{ o.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="ft" @tap.stop>
|
||||
<view class="time-left">
|
||||
<text class="left-label">有效倒计时:</text>
|
||||
<text class="left-val" :class="{ urgent: o.left_seconds <= 1800 }">
|
||||
{{ o.left_seconds > 0 ? countdown(o.left_seconds) : '即将超时' }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="ft-btns">
|
||||
<view class="quote-btn clickable-hover" v-if="o.price_type === 'quote'" @tap="goDetail(o)">
|
||||
立即报价({{ o.quote_count }})
|
||||
</view>
|
||||
<view class="grab-btn clickable-hover" v-else @tap="openGrabConfirm(o)">
|
||||
{{ o.price_type === 'custom' ? '按此价接单' : '立即抢单' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 4. 师傅工作台 (Tab 3) -->
|
||||
<view v-show="activeTab === 3">
|
||||
<MasterWorkbenchView ref="workbenchRef" @switch-tab="onTabChange" />
|
||||
</view>
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view class="empty-state" v-if="!loading && !list.length">
|
||||
<image class="empty-img" src="/static/icons/master/empty-orders.svg" mode="aspectFit" />
|
||||
<text class="empty-title">当前大厅暂无待接工单</text>
|
||||
<text class="empty-sub">保持听单中状态,有新订单将第一时间呈现</text>
|
||||
<view class="refresh-cta clickable-hover" @tap="load">立即刷新大厅</view>
|
||||
</view>
|
||||
|
||||
<!-- 抢单防误点二次确认弹窗(100% 对标工奇兵实机图3) -->
|
||||
<view class="confirm-mask" v-if="selectedOrder" @tap="selectedOrder = null">
|
||||
<view class="confirm-dialog" @tap.stop>
|
||||
<text class="cd-title">提示</text>
|
||||
<text class="cd-content">请确定已经了解清楚订单服务要求、商品数量、服务地址等信息。您确定可以承揽,并能完成工作,如随意抢单,将影响您的订单推送优先级。</text>
|
||||
<view class="cd-actions">
|
||||
<view class="cd-btn cancel clickable-hover" @tap="selectedOrder = null">
|
||||
<text class="cd-btn-txt cancel">再看看</text>
|
||||
</view>
|
||||
<view class="cd-btn ok clickable-hover" :class="{ disabled: grabbing }" @tap="confirmGrab">
|
||||
<text class="cd-btn-txt ok">{{ grabbing ? '抢单中...' : '确定' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 师傅端专属底部导航 (当前 Tab 0: 首页) -->
|
||||
<YjyfMasterTabBar :current="0" />
|
||||
<!-- 师傅端专属底部导航 (方案 A:单母页组件化调度,0ms 极速秒切) -->
|
||||
<YjyfMasterTabBar :current="activeTab" @change="onTabChange" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin } from '@/utils/request.js';
|
||||
import { ref } from 'vue';
|
||||
import { onLoad, onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import MasterHallView from '@/components/master/MasterHallView.vue';
|
||||
import MasterOrdersView from '@/components/master/MasterOrdersView.vue';
|
||||
import MasterMessageView from '@/components/master/MasterMessageView.vue';
|
||||
import MasterWorkbenchView from '@/components/master/MasterWorkbenchView.vue';
|
||||
import YjyfMasterTabBar from '@/components/YjyfMasterTabBar.vue';
|
||||
|
||||
const list = ref([]);
|
||||
const info = ref(null);
|
||||
const loading = ref(false);
|
||||
const type = ref('all');
|
||||
const sort = ref('new');
|
||||
const selectedOrder = ref(null);
|
||||
const grabbing = ref(false);
|
||||
const activeTab = ref(0);
|
||||
|
||||
const typeTabs = [
|
||||
{ key: 'all', name: '全部订单', badge: true },
|
||||
{ key: 'fixed', name: '一口价' },
|
||||
{ key: 'quote', name: '师傅竞价' },
|
||||
{ key: 'custom', name: '用户定价' }
|
||||
];
|
||||
const sortTabs = [
|
||||
{ key: 'new', name: '最新发布' },
|
||||
{ key: 'amount', name: '报酬最高' },
|
||||
{ key: 'urgent', name: '急单优先' },
|
||||
{ key: 'time', name: '时效最近' }
|
||||
];
|
||||
const hallRef = ref(null);
|
||||
const ordersRef = ref(null);
|
||||
const messageRef = ref(null);
|
||||
const workbenchRef = ref(null);
|
||||
|
||||
// 根据真实订单列表动态生成走马灯播报(拒绝假数据)
|
||||
const broadcastList = computed(() => {
|
||||
if (!list.value.length) return [];
|
||||
return list.value.slice(0, 5).map((o) => {
|
||||
const addrPart = (o.address || '本地').slice(0, 6);
|
||||
const priceDesc = o.price_type === 'quote' ? '需师傅竞价' : `报酬 ¥${o.pay_amount}`;
|
||||
return `${addrPart}发布【${o.service_name}】工单,${priceDesc} · 开放接单`;
|
||||
});
|
||||
function refreshCurrentTab() {
|
||||
if (activeTab.value === 0 && hallRef.value?.load) {
|
||||
hallRef.value.load();
|
||||
} else if (activeTab.value === 1 && ordersRef.value?.load) {
|
||||
ordersRef.value.load();
|
||||
} else if (activeTab.value === 2 && messageRef.value?.load) {
|
||||
messageRef.value.load();
|
||||
} else if (activeTab.value === 3 && workbenchRef.value?.load) {
|
||||
workbenchRef.value.load();
|
||||
}
|
||||
}
|
||||
|
||||
function onTabChange(index) {
|
||||
const targetIndex = Number(index);
|
||||
if (activeTab.value === targetIndex) return;
|
||||
activeTab.value = targetIndex;
|
||||
// 切换时静默刷新对应 Tab 数据,保证最新状态
|
||||
setTimeout(() => {
|
||||
refreshCurrentTab();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
onLoad((query) => {
|
||||
if (query && query.tab !== undefined) {
|
||||
const t = parseInt(query.tab);
|
||||
if (!isNaN(t) && t >= 0 && t <= 3) {
|
||||
activeTab.value = t;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
watch([type, sort], () => load());
|
||||
|
||||
function countdown(sec) {
|
||||
const s = Number(sec) || 0;
|
||||
if (s <= 0) return '已结束';
|
||||
const h = Math.floor(s / 3600);
|
||||
const m = Math.floor((s % 3600) / 60);
|
||||
if (h > 0) {
|
||||
return `${h}小时${m}分`;
|
||||
}
|
||||
return `${m}分钟`;
|
||||
}
|
||||
|
||||
function goDetail(o) {
|
||||
uni.navigateTo({ url: '/pages/master/detail?id=' + o.id });
|
||||
}
|
||||
|
||||
function openGrabConfirm(o) {
|
||||
selectedOrder.value = o;
|
||||
}
|
||||
|
||||
async function confirmGrab() {
|
||||
if (grabbing.value || !selectedOrder.value) return;
|
||||
grabbing.value = true;
|
||||
const o = selectedOrder.value;
|
||||
try {
|
||||
const res = await api.masterGrab({ order_id: o.id });
|
||||
selectedOrder.value = null;
|
||||
uni.showToast({ title: '抢单成功!', icon: 'success' });
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/master/success?order_id=${o.id}&mobile=${res.user_mobile || ''}`
|
||||
});
|
||||
}, 500);
|
||||
} catch (e) {
|
||||
uni.showToast({ title: e.msg || '手慢了,该订单已被抢', icon: 'none' });
|
||||
} finally {
|
||||
grabbing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.masterHall({ limit: 20, type: type.value, sort: sort.value });
|
||||
list.value = res.list || [];
|
||||
} catch (e) {
|
||||
}
|
||||
try {
|
||||
const me = await api.masterInfo();
|
||||
info.value = me.applied ? me.master : null;
|
||||
} catch (e) {}
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
async function toggleWork() {
|
||||
if (!info.value) return;
|
||||
const next = info.value.work_status === 'off' ? 'on' : 'off';
|
||||
try {
|
||||
await api.masterToggle({ work_status: next });
|
||||
info.value.work_status = next;
|
||||
uni.showToast({ title: next === 'on' ? '已开启接单听单' : '已暂停接单', icon: 'none' });
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
load();
|
||||
refreshCurrentTab();
|
||||
});
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
load().then(() => uni.stopPullDownRefresh());
|
||||
onPullDownRefresh(async () => {
|
||||
try {
|
||||
if (activeTab.value === 0 && hallRef.value?.load) {
|
||||
await hallRef.value.load();
|
||||
} else if (activeTab.value === 1 && ordersRef.value?.load) {
|
||||
await ordersRef.value.load();
|
||||
} else if (activeTab.value === 2 && messageRef.value?.load) {
|
||||
await messageRef.value.load();
|
||||
} else if (activeTab.value === 3 && workbenchRef.value?.load) {
|
||||
await workbenchRef.value.load();
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
.master-container-page {
|
||||
min-height: 100vh;
|
||||
background: #F5F6F8;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
/* 顶部一体化沉浸师傅状态区(单一连续渐变) */
|
||||
.hall-hero {
|
||||
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.hall-header-body {
|
||||
padding: 6rpx 28rpx 24rpx;
|
||||
}
|
||||
.header-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.h-user {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.name-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.h-name {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.level-badge {
|
||||
margin-left: 12rpx;
|
||||
padding: 2rpx 12rpx;
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.level-txt {
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
font-weight: 600;
|
||||
}
|
||||
.h-stats {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 22rpx;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
.work-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #FFFFFF;
|
||||
padding: 0 20rpx;
|
||||
height: 52rpx;
|
||||
border-radius: 26rpx;
|
||||
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
.work-toggle.paused {
|
||||
background: rgba(255, 255, 255, 0.35);
|
||||
}
|
||||
.dot {
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
background: #2FA84F;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.work-toggle.paused .dot {
|
||||
background: #E8331B;
|
||||
}
|
||||
.toggle-txt {
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
color: #E36B0C;
|
||||
}
|
||||
.work-toggle.paused .toggle-txt {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* 跑马灯动态通知 */
|
||||
.broadcast-bar {
|
||||
background: #FFF7ED;
|
||||
border-bottom: 1rpx solid #FFEDD5;
|
||||
padding: 12rpx 28rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.broadcast-ico {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
margin-right: 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.broadcast-swiper {
|
||||
flex: 1;
|
||||
height: 36rpx;
|
||||
}
|
||||
.swiper-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.broadcast-txt {
|
||||
font-size: 22rpx;
|
||||
color: #9A3412;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* 筛选标签栏 */
|
||||
.filter-sticky {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.type-tabs {
|
||||
display: flex;
|
||||
padding: 0 12rpx;
|
||||
border-bottom: 1rpx solid #F0F0F0;
|
||||
}
|
||||
.t-tab {
|
||||
position: relative;
|
||||
padding: 22rpx 20rpx 18rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.t-txt {
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
.t-tab.on .t-txt {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1F1F1F;
|
||||
}
|
||||
.t-tab.on::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 20rpx;
|
||||
right: 20rpx;
|
||||
height: 4rpx;
|
||||
border-radius: 2rpx;
|
||||
background: #F0710D;
|
||||
}
|
||||
.t-dot {
|
||||
width: 10rpx;
|
||||
height: 10rpx;
|
||||
border-radius: 50%;
|
||||
background: #EF4444;
|
||||
margin-left: 6rpx;
|
||||
margin-top: -14rpx;
|
||||
}
|
||||
|
||||
.sort-tabs {
|
||||
display: flex;
|
||||
padding: 14rpx 24rpx;
|
||||
background: #FAFAFA;
|
||||
}
|
||||
.s-tab {
|
||||
margin-right: 16rpx;
|
||||
padding: 6rpx 18rpx;
|
||||
border-radius: 20rpx;
|
||||
font-size: 22rpx;
|
||||
color: #666666;
|
||||
background: #FFFFFF;
|
||||
border: 1rpx solid #E5E7EB;
|
||||
}
|
||||
.s-tab.on {
|
||||
color: #F0710D;
|
||||
background: #FFF7ED;
|
||||
border-color: #F0710D;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 订单列表 */
|
||||
.list {
|
||||
padding: 16rpx 20rpx;
|
||||
}
|
||||
.item {
|
||||
background: #FFFFFF;
|
||||
border-radius: 20rpx;
|
||||
padding: 24rpx;
|
||||
margin-bottom: 16rpx;
|
||||
box-shadow: 0 4rpx 14rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.hd {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 16rpx;
|
||||
border-bottom: 1rpx solid #F5F5F5;
|
||||
}
|
||||
.hd-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.tag-urgent {
|
||||
font-size: 20rpx;
|
||||
color: #FFFFFF;
|
||||
background: #EF4444;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.tag-mode {
|
||||
font-size: 20rpx;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-right: 10rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tag-mode.fixed {
|
||||
background: #FFF7ED;
|
||||
color: #EA580C;
|
||||
border: 1rpx solid #FFEDD5;
|
||||
}
|
||||
.tag-mode.quote {
|
||||
background: #EFF6FF;
|
||||
color: #2563EB;
|
||||
border: 1rpx solid #DBEAFE;
|
||||
}
|
||||
.tag-mode.custom {
|
||||
background: #ECFDF5;
|
||||
color: #059669;
|
||||
border: 1rpx solid #D1FAE5;
|
||||
}
|
||||
.svc {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1F1F1F;
|
||||
}
|
||||
.amt-box {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
.amt-symbol {
|
||||
font-size: 24rpx;
|
||||
font-weight: 700;
|
||||
color: #EA580C;
|
||||
}
|
||||
.amt {
|
||||
font-size: 40rpx;
|
||||
font-weight: 800;
|
||||
color: #EA580C;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.bd {
|
||||
padding: 18rpx 0;
|
||||
}
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.row-icon {
|
||||
width: 26rpx;
|
||||
height: 26rpx;
|
||||
margin-right: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.row-txt {
|
||||
font-size: 26rpx;
|
||||
color: #4B5563;
|
||||
line-height: 36rpx;
|
||||
}
|
||||
.addr-txt {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.distance-txt {
|
||||
font-size: 22rpx;
|
||||
color: #EA580C;
|
||||
background: #FFF7ED;
|
||||
padding: 2rpx 10rpx;
|
||||
border-radius: 6rpx;
|
||||
margin-left: 12rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.badge-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.badge {
|
||||
font-size: 22rpx;
|
||||
color: #6B7280;
|
||||
background: #F3F4F6;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.remark-row {
|
||||
margin-top: 14rpx;
|
||||
padding: 10rpx 16rpx;
|
||||
background: #FFFBEB;
|
||||
border-radius: 10rpx;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
.remark-tag {
|
||||
font-size: 20rpx;
|
||||
color: #B45309;
|
||||
font-weight: 700;
|
||||
margin-right: 8rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.remark-txt {
|
||||
font-size: 22rpx;
|
||||
color: #92400E;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
|
||||
.ft {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: 16rpx;
|
||||
border-top: 1rpx solid #F5F5F5;
|
||||
}
|
||||
.time-left {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
.left-label {
|
||||
font-size: 22rpx;
|
||||
color: #9CA3AF;
|
||||
}
|
||||
.left-val {
|
||||
font-size: 22rpx;
|
||||
color: #6B7280;
|
||||
font-weight: 600;
|
||||
}
|
||||
.left-val.urgent {
|
||||
color: #EF4444;
|
||||
}
|
||||
|
||||
.ft-btns {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.quote-btn {
|
||||
height: 64rpx;
|
||||
padding: 0 28rpx;
|
||||
border-radius: 32rpx;
|
||||
background: #EFF6FF;
|
||||
border: 1rpx solid #BFDBFE;
|
||||
color: #2563EB;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.grab-btn {
|
||||
height: 64rpx;
|
||||
padding: 0 32rpx;
|
||||
border-radius: 32rpx;
|
||||
background: linear-gradient(135deg, #F98D25 0%, #ED6F0E 100%);
|
||||
color: #FFFFFF;
|
||||
font-size: 26rpx;
|
||||
font-weight: 700;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4rpx 14rpx rgba(237, 111, 14, 0.3);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 100rpx 40rpx;
|
||||
}
|
||||
.empty-img {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
}
|
||||
.empty-title {
|
||||
margin-top: 24rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #374151;
|
||||
}
|
||||
.empty-sub {
|
||||
margin-top: 8rpx;
|
||||
font-size: 24rpx;
|
||||
color: #9CA3AF;
|
||||
}
|
||||
.refresh-cta {
|
||||
margin-top: 32rpx;
|
||||
padding: 14rpx 36rpx;
|
||||
background: #FFF7ED;
|
||||
border: 1rpx solid #FFEDD5;
|
||||
color: #EA580C;
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
border-radius: 28rpx;
|
||||
}
|
||||
|
||||
/* 抢单二次确认弹窗(100% 对标工奇兵实机图3) */
|
||||
.confirm-mask {
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 60rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.confirm-dialog {
|
||||
width: 100%;
|
||||
background: #FFFFFF;
|
||||
border-radius: 28rpx;
|
||||
padding: 40rpx 36rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.cd-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
color: #1F1F1F;
|
||||
}
|
||||
.cd-content {
|
||||
margin-top: 24rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 44rpx;
|
||||
color: #4B5563;
|
||||
text-align: justify;
|
||||
}
|
||||
.cd-actions {
|
||||
width: 100%;
|
||||
margin-top: 36rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-top: 1rpx solid #F3F4F6;
|
||||
padding-top: 24rpx;
|
||||
}
|
||||
.cd-btn {
|
||||
flex: 1;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.cd-btn.cancel {
|
||||
border-right: 1rpx solid #F3F4F6;
|
||||
}
|
||||
.cd-btn-txt.cancel {
|
||||
font-size: 30rpx;
|
||||
color: #6B7280;
|
||||
}
|
||||
.cd-btn-txt.ok {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #EA580C;
|
||||
}
|
||||
.cd-btn.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,472 +1,25 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 统一规范顶部白底导航栏 -->
|
||||
<YjyfNavBar theme="orange" title="接单管理" />
|
||||
|
||||
<!-- 顶部状态漏斗看板(对标工奇兵 4 态流转漏斗) -->
|
||||
<view class="funnel-card">
|
||||
<view class="funnel-row">
|
||||
<view class="f-item clickable-hover" :class="{ on: cur === 'active' }" @tap="switchTab('active')">
|
||||
<text class="f-num">{{ activeCount }}</text>
|
||||
<text class="f-lab">待处理</text>
|
||||
<view class="f-line" v-if="cur === 'active'"></view>
|
||||
</view>
|
||||
<view class="f-divider"></view>
|
||||
<view class="f-item clickable-hover" :class="{ on: cur === 'verify' }" @tap="switchTab('verify')">
|
||||
<text class="f-num">{{ verifyCount }}</text>
|
||||
<text class="f-lab">待验收</text>
|
||||
<view class="f-line" v-if="cur === 'verify'"></view>
|
||||
</view>
|
||||
<view class="f-divider"></view>
|
||||
<view class="f-item clickable-hover" :class="{ on: cur === 'completed' }" @tap="switchTab('completed')">
|
||||
<text class="f-num">{{ completedCount }}</text>
|
||||
<text class="f-lab">已完成</text>
|
||||
<view class="f-line" v-if="cur === 'completed'"></view>
|
||||
</view>
|
||||
<view class="f-divider"></view>
|
||||
<view class="f-item clickable-hover" @tap="goQuotes">
|
||||
<text class="f-num f-quote">{{ quoteCount }}</text>
|
||||
<text class="f-lab">我的报价</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单列表 -->
|
||||
<view class="list" v-if="list.length">
|
||||
<view class="item" v-for="o in list" :key="o.id">
|
||||
<view class="hd">
|
||||
<view class="svc-box">
|
||||
<text class="svc">{{ o.service_name }}</text>
|
||||
<view class="time-urgent-pill" v-if="Number(o.status) === 3 && !o.contact_time">
|
||||
<image class="time-urgent-ico" src="/static/icons/master/order-time.svg" mode="aspectFit" />
|
||||
<text class="time-urgent-txt">2小时首联中</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-badge" :class="'st-' + o.status">
|
||||
<text class="status-txt">{{ o.status_text }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bd">
|
||||
<view class="info-line">
|
||||
<image class="info-ico" src="/static/icons/master/order-loc.svg" mode="aspectFit" />
|
||||
<text class="addr-txt">{{ o.address }}</text>
|
||||
</view>
|
||||
<view class="info-line">
|
||||
<image class="info-ico" src="/static/icons/master/order-time.svg" mode="aspectFit" />
|
||||
<text class="meta-txt">预约时间:{{ o.appoint_text }}</text>
|
||||
</view>
|
||||
<view class="meta-tags">
|
||||
<text class="tag">楼层 {{ o.floor }} 层</text>
|
||||
<text class="tag">{{ Number(o.has_elevator) ? '有电梯' : '步梯无电梯' }}</text>
|
||||
<text class="tag" v-if="o.goods_model">型号:{{ o.goods_model }}</text>
|
||||
</view>
|
||||
<view class="customer-row">
|
||||
<view class="cust-mobile" @tap="call(o)">
|
||||
<image class="phone-ico" src="/static/icons/phone.svg" mode="aspectFit" />
|
||||
<text class="phone-num">客户:{{ o.mobile }}</text>
|
||||
</view>
|
||||
<view class="amt-box">
|
||||
<text class="amt-symbol">¥</text>
|
||||
<text class="amt-val">{{ o.pay_amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作动作条 -->
|
||||
<view class="ops">
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 3 && !o.contact_time" @tap="act('contact', o)">标记已联系</view>
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 3" @tap="act('schedule', o)">约定上门</view>
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 4" @tap="act('arrive', o)">到达打卡</view>
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 5" @tap="act('start', o)">开始服务</view>
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 5 || Number(o.status) === 6" @tap="act('requestDiff', o)">增项补差</view>
|
||||
<view class="op primary clickable-hover" v-if="Number(o.status) === 6" @tap="act('finish', o)">现场水印拍照完工</view>
|
||||
<view class="op primary clickable-hover" v-if="Number(o.status) === 7" @tap="act('verifyCode', o)">输入验证码核销</view>
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 7" @tap="call(o)">联系客户催码</view>
|
||||
<view class="op clickable-hover" v-if="Number(o.status) === 3 || Number(o.status) === 4" @tap="call(o)">联系客户</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 空状态引导 -->
|
||||
<view class="empty-state" v-if="!loading && !list.length">
|
||||
<image class="empty-img" src="/static/icons/master/empty-orders.svg" mode="aspectFit" />
|
||||
<text class="empty-title">当前无{{ curTabText }}工单</text>
|
||||
<text class="empty-sub">前往订单大厅,海量订单实时抢</text>
|
||||
<view class="empty-cta clickable-hover" @tap="goHall">前往大厅抢单</view>
|
||||
</view>
|
||||
|
||||
<!-- 师傅端专属底部导航 (当前 Tab 1: 订单) -->
|
||||
<!-- 水印合成离屏 Canvas -->
|
||||
<canvas canvas-id="watermarkCanvas" :style="{ width: canvasW + 'px', height: canvasH + 'px', position: 'fixed', left: '-9999px', top: '-9999px' }"></canvas>
|
||||
|
||||
<YjyfMasterTabBar :current="1" />
|
||||
<template>
|
||||
<view>
|
||||
<MasterOrdersView @switch-tab="onSwitchTab" />
|
||||
<YjyfMasterTabBar :current="1" @change="onSwitchTab" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import api from '@/utils/api.js';
|
||||
import { isLogin, toLogin } from '@/utils/request.js';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import MasterOrdersView from '@/components/master/MasterOrdersView.vue';
|
||||
import YjyfMasterTabBar from '@/components/YjyfMasterTabBar.vue';
|
||||
|
||||
const cur = ref('active');
|
||||
const list = ref([]);
|
||||
const loading = ref(false);
|
||||
const activeCount = ref(0);
|
||||
const verifyCount = ref(0);
|
||||
const completedCount = ref(0);
|
||||
const quoteCount = ref(0);
|
||||
const canvasW = ref(750);
|
||||
const canvasH = ref(1000);
|
||||
onLoad(() => {
|
||||
// 自动平滑收敛到单母页 Tab 1
|
||||
uni.redirectTo({
|
||||
url: '/pages/master/hall?tab=1'
|
||||
});
|
||||
});
|
||||
|
||||
function getNowTimeStr() {
|
||||
const d = new Date();
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
||||
}
|
||||
|
||||
function createWatermarkPhoto(tempPath, o) {
|
||||
return new Promise((resolve) => {
|
||||
uni.getImageInfo({
|
||||
src: tempPath,
|
||||
success: (info) => {
|
||||
let w = info.width;
|
||||
let h = info.height;
|
||||
const maxEdge = 1200;
|
||||
if (w > maxEdge || h > maxEdge) {
|
||||
if (w > h) {
|
||||
h = Math.round((h * maxEdge) / w);
|
||||
w = maxEdge;
|
||||
} else {
|
||||
w = Math.round((w * maxEdge) / h);
|
||||
h = maxEdge;
|
||||
}
|
||||
}
|
||||
canvasW.value = w;
|
||||
canvasH.value = h;
|
||||
|
||||
setTimeout(() => {
|
||||
const ctx = uni.createCanvasContext('watermarkCanvas');
|
||||
ctx.drawImage(info.path, 0, 0, w, h);
|
||||
|
||||
const barHeight = Math.max(90, Math.round(h * 0.16));
|
||||
ctx.setFillStyle('rgba(0, 0, 0, 0.65)');
|
||||
ctx.fillRect(0, h - barHeight, w, barHeight);
|
||||
|
||||
const fontSize = Math.max(14, Math.round(w * 0.028));
|
||||
ctx.setFillStyle('#FFFFFF');
|
||||
ctx.setFontSize(fontSize);
|
||||
|
||||
const timeStr = getNowTimeStr();
|
||||
const line1 = `【优匠优服·现场施工取证】 时间: ${timeStr}`;
|
||||
const line2 = `施工地点: ${o.address || '客户服务现场'}`;
|
||||
const line3 = `工单流水: ${o.order_no || o.id}`;
|
||||
|
||||
const paddingX = Math.round(w * 0.04);
|
||||
const lineSpacing = Math.round(barHeight / 3.4);
|
||||
const startY = h - barHeight + lineSpacing - 4;
|
||||
|
||||
ctx.fillText(line1, paddingX, startY);
|
||||
ctx.fillText(line2, paddingX, startY + lineSpacing);
|
||||
ctx.fillText(line3, paddingX, startY + lineSpacing * 2);
|
||||
|
||||
ctx.draw(false, () => {
|
||||
uni.canvasToTempFilePath({
|
||||
canvasId: 'watermarkCanvas',
|
||||
fileType: 'jpg',
|
||||
quality: 0.85,
|
||||
success: (res) => resolve(res.tempFilePath),
|
||||
fail: () => resolve(tempPath)
|
||||
});
|
||||
});
|
||||
}, 150);
|
||||
},
|
||||
fail: () => resolve(tempPath)
|
||||
});
|
||||
function onSwitchTab(index) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/master/hall?tab=${index}`
|
||||
});
|
||||
}
|
||||
|
||||
const curTabText = computed(() => {
|
||||
const m = { active: '待处理', verify: '待验收', completed: '已完成' };
|
||||
return m[cur.value] || '';
|
||||
});
|
||||
|
||||
async function loadCounts() {
|
||||
try {
|
||||
const infoRes = await api.masterInfo();
|
||||
if (infoRes && infoRes.master) {
|
||||
activeCount.value = infoRes.master.todo_count || 0;
|
||||
verifyCount.value = infoRes.master.verify_count || 0;
|
||||
}
|
||||
const qRes = await api.masterQuotes();
|
||||
quoteCount.value = (qRes.list || []).length;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await api.masterOrders({ status: cur.value, limit: 20 });
|
||||
list.value = res.list || [];
|
||||
if (cur.value === 'completed') {
|
||||
completedCount.value = (res.list || []).length;
|
||||
}
|
||||
} catch (e) {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function switchTab(k) {
|
||||
cur.value = k;
|
||||
load();
|
||||
}
|
||||
|
||||
function goQuotes() {
|
||||
uni.navigateTo({ url: '/pages/master/quote' });
|
||||
}
|
||||
|
||||
function call(o) {
|
||||
if (!o.mobile) return;
|
||||
uni.makePhoneCall({ phoneNumber: String(o.mobile) });
|
||||
}
|
||||
|
||||
function goHall() {
|
||||
uni.redirectTo({ url: '/pages/master/hall' });
|
||||
}
|
||||
|
||||
function act(type, o) {
|
||||
const id = o.id;
|
||||
if (type === 'contact') {
|
||||
api.masterContact({ order_id: id }).then(() => {
|
||||
uni.showToast({ title: '已记录已联系' });
|
||||
load();
|
||||
loadCounts();
|
||||
}).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (type === 'arrive') {
|
||||
api.masterArrive({ order_id: id }).then(() => {
|
||||
uni.showToast({ title: '已到达打卡' });
|
||||
load();
|
||||
}).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (type === 'start') {
|
||||
api.masterStart({ order_id: id }).then(() => {
|
||||
uni.showToast({ title: '已开始服务' });
|
||||
load();
|
||||
}).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (type === 'finish') {
|
||||
// 现场强制拍摄,压入防伪水印
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['camera'],
|
||||
success: async (chooseRes) => {
|
||||
const rawFile = chooseRes.tempFilePaths[0];
|
||||
uni.showLoading({ title: '压印防伪水印中...' });
|
||||
try {
|
||||
const watermarkedFile = await createWatermarkPhoto(rawFile, o);
|
||||
uni.showLoading({ title: '上传完工照片...' });
|
||||
const uploadData = await api.upload(watermarkedFile, 'order');
|
||||
const remoteImg = uploadData.fullurl || uploadData.url;
|
||||
const res = await api.masterFinish({
|
||||
order_id: id,
|
||||
'images[0]': remoteImg
|
||||
});
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
title: '完工提交成功',
|
||||
content: '系统已向客户手机发送 6 位验收码,请向客户索取核销码后点击【输入验证码核销】完成工费结算!',
|
||||
showCancel: false
|
||||
});
|
||||
load();
|
||||
loadCounts();
|
||||
} catch (err) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '上传失败,请重试', icon: 'none' });
|
||||
}
|
||||
},
|
||||
fail: () => {}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (type === 'verifyCode') {
|
||||
uni.showModal({
|
||||
title: '客户验收码核销',
|
||||
editable: true,
|
||||
placeholderText: '请输入客户手机收到的 6 位核销码',
|
||||
confirmText: '核销结算',
|
||||
confirmColor: '#F0710D',
|
||||
success: async (r) => {
|
||||
if (!r.confirm) return;
|
||||
const code = (r.content || '').trim();
|
||||
if (!code) {
|
||||
uni.showToast({ title: '核销码不能为空', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '核销验证中...' });
|
||||
try {
|
||||
const res = await api.masterVerifyCode({ order_id: id, verify_code: code });
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
title: '核销成功!',
|
||||
content: `订单已正式完工!本次工费 ¥${res.settle_amount} 已划入您的钱包余额`,
|
||||
showCancel: false
|
||||
});
|
||||
load();
|
||||
loadCounts();
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (type === 'requestDiff') {
|
||||
uni.showModal({
|
||||
title: '申请施工增项补差价',
|
||||
editable: true,
|
||||
placeholderText: '请输入增项金额(元),如: 50',
|
||||
confirmText: '发起补差',
|
||||
confirmColor: '#F0710D',
|
||||
success: async (r) => {
|
||||
if (!r.confirm) return;
|
||||
const amt = parseFloat((r.content || '').trim());
|
||||
if (!amt || amt <= 0) {
|
||||
uni.showToast({ title: '请输入有效金额', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '提交申请中...' });
|
||||
try {
|
||||
await api.masterRequestDiff({ order_id: id, amount: amt, remark: '施工现场打孔/拆旧等增项补差' });
|
||||
uni.hideLoading();
|
||||
uni.showModal({
|
||||
title: '补差申请已发起',
|
||||
content: `已成功发起增项补差价 ¥${amt},请提醒客户在订单详情中点击【去支付补差】完成在线支付!`,
|
||||
showCancel: false
|
||||
});
|
||||
load();
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (type === 'schedule') {
|
||||
const ts = Math.floor(Date.now() / 1000) + 7200;
|
||||
api.masterSchedule({ order_id: id, appoint_time: ts }).then(() => {
|
||||
uni.showToast({ title: '已约定 2 小时后上门' });
|
||||
load();
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
load();
|
||||
loadCounts();
|
||||
});
|
||||
|
||||
onPullDownRefresh(async () => {
|
||||
await Promise.all([load(), loadCounts()]);
|
||||
uni.stopPullDownRefresh();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 30rpx; }
|
||||
|
||||
/* 顶部工奇兵风格数据漏斗看板 */
|
||||
.funnel-card {
|
||||
background: #ffffff;
|
||||
padding: 24rpx 20rpx 16rpx;
|
||||
box-shadow: 0 4rpx 14rpx rgba(0,0,0,0.03);
|
||||
position: sticky; top: 0; z-index: 10;
|
||||
}
|
||||
.funnel-row { display: flex; align-items: center; justify-content: space-around; }
|
||||
.f-item {
|
||||
flex: 1; display: flex; flex-direction: column; align-items: center;
|
||||
position: relative; padding-bottom: 12rpx;
|
||||
}
|
||||
.f-num { font-size: 38rpx; font-weight: 700; color: #666; line-height: 1.1; }
|
||||
.f-quote { color: #7A5AF8; }
|
||||
.f-item.on .f-num { color: #F0710D; }
|
||||
.f-lab { margin-top: 8rpx; font-size: 22rpx; color: #8E8E93; }
|
||||
.f-item.on .f-lab { color: #F0710D; font-weight: 600; }
|
||||
.f-line {
|
||||
position: absolute; bottom: 0; width: 44rpx; height: 6rpx;
|
||||
border-radius: 3rpx; background: #F0710D;
|
||||
}
|
||||
.f-divider { width: 1rpx; height: 38rpx; background: #EEEEEE; }
|
||||
|
||||
/* 列表卡片 */
|
||||
.list { padding: 20rpx 24rpx; }
|
||||
.item {
|
||||
background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; padding: 24rpx;
|
||||
box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06);
|
||||
}
|
||||
.hd { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16rpx; border-bottom: 1rpx solid #F4F4F4; }
|
||||
.svc-box { display: flex; align-items: center; }
|
||||
.svc { font-size: 30rpx; font-weight: 700; color: #1F1F1F; }
|
||||
.time-urgent-pill {
|
||||
display: inline-flex; align-items: center;
|
||||
margin-left: 14rpx; padding: 2rpx 12rpx; border-radius: 16rpx;
|
||||
background: #FFF1F0; border: 1rpx solid #FFA39E;
|
||||
}
|
||||
.time-urgent-ico { width: 22rpx; height: 22rpx; margin-right: 6rpx; }
|
||||
.time-urgent-txt { font-size: 20rpx; color: #CF1322; font-weight: 600; }
|
||||
.status-badge { padding: 4rpx 16rpx; border-radius: 20rpx; background: #FFF3E6; }
|
||||
.status-txt { font-size: 22rpx; font-weight: 600; color: #E36B0C; }
|
||||
.status-badge.st-7 { background: #FDEEEB; }
|
||||
.status-badge.st-7 .status-txt { color: #E8331B; }
|
||||
.status-badge.st-8 { background: #E9F7EE; }
|
||||
.status-badge.st-8 .status-txt { color: #2FA84F; }
|
||||
|
||||
.bd { padding: 18rpx 0; display: flex; flex-direction: column; }
|
||||
.info-line { display: flex; align-items: flex-start; margin-bottom: 10rpx; }
|
||||
.info-ico { width: 28rpx; height: 28rpx; margin-right: 10rpx; margin-top: 4rpx; flex-shrink: 0; }
|
||||
.addr-txt { font-size: 26rpx; color: #222; font-weight: 500; line-height: 36rpx; }
|
||||
.meta-txt { font-size: 24rpx; color: #666; line-height: 36rpx; }
|
||||
.meta-tags { display: flex; flex-wrap: wrap; margin-top: 6rpx; }
|
||||
.tag { padding: 4rpx 14rpx; background: #F5F6F8; color: #777; font-size: 20rpx; border-radius: 8rpx; margin-right: 10rpx; margin-bottom: 6rpx; }
|
||||
|
||||
.customer-row {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
margin-top: 14rpx; padding-top: 14rpx; border-top: 1rpx dashed #EEEEEE;
|
||||
}
|
||||
.cust-mobile { display: flex; align-items: center; }
|
||||
.phone-ico { width: 28rpx; height: 28rpx; margin-right: 8rpx; }
|
||||
.phone-num { font-size: 24rpx; color: #4A7CFF; font-weight: 500; }
|
||||
.amt-box { display: flex; align-items: baseline; }
|
||||
.amt-symbol { font-size: 24rpx; font-weight: 700; color: #F0710D; }
|
||||
.amt-val { font-size: 34rpx; font-weight: 700; color: #F0710D; line-height: 1; }
|
||||
|
||||
.ops { display: flex; flex-wrap: wrap; justify-content: flex-end; padding-top: 16rpx; border-top: 1rpx solid #F4F4F4; }
|
||||
.op {
|
||||
margin: 8rpx 0 0 14rpx; padding: 0 26rpx; height: 60rpx; line-height: 58rpx;
|
||||
border-radius: 30rpx; border: 1.5rpx solid #DDD; font-size: 24rpx; color: #555;
|
||||
}
|
||||
.op.primary {
|
||||
border-color: #F0710D; color: #fff;
|
||||
background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%);
|
||||
box-shadow: 0 4rpx 14rpx rgba(240,113,13,0.25);
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 120rpx 40rpx 40rpx; }
|
||||
.empty-img { width: 180rpx; height: 180rpx; margin-bottom: 24rpx; }
|
||||
.empty-title { font-size: 28rpx; font-weight: 600; color: #333; margin-bottom: 8rpx; }
|
||||
.empty-sub { font-size: 22rpx; color: #9A9A9A; text-align: center; margin-bottom: 32rpx; }
|
||||
.empty-cta {
|
||||
padding: 0 48rpx; height: 74rpx; line-height: 74rpx; border-radius: 37rpx;
|
||||
background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%);
|
||||
color: #fff; font-size: 26rpx; font-weight: 600;
|
||||
box-shadow: 0 6rpx 16rpx rgba(240,113,13,0.25);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,322 +1,25 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 1. 师傅顶部一体化沉浸名片区(单一大背景贯穿,彻底消除分层断层) -->
|
||||
<view class="profile-hero">
|
||||
<view class="hero-deco d1"></view>
|
||||
<view class="hero-deco d2"></view>
|
||||
|
||||
<!-- 沉浸式透明导航栏 -->
|
||||
<YjyfNavBar theme="transparent" title="师傅工作台" :fixed="false" />
|
||||
|
||||
<view class="hero-body">
|
||||
<view class="user-block">
|
||||
<view class="avatar-wrap">
|
||||
<image class="avatar-img" src="/static/icons/user-avatar.svg" mode="aspectFit" />
|
||||
</view>
|
||||
<view class="user-meta">
|
||||
<view class="name-row">
|
||||
<text class="user-name">{{ info ? info.realname : '师傅' }}</text>
|
||||
<view class="auth-tag">
|
||||
<image class="auth-ico" src="/static/icons/shield.svg" mode="aspectFit" />
|
||||
<text class="auth-txt">实名认证师傅</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="user-level" v-if="info">
|
||||
等级 Lv{{ info.level }} · 综合评分 {{ info.score }} 分 · 履约 {{ info.order_count }} 单
|
||||
</text>
|
||||
</view>
|
||||
<view class="status-pill clickable-hover" :class="{ off: info && info.work_status === 'off' }" @tap="toggleWork">
|
||||
<view class="status-dot"></view>
|
||||
<text class="status-txt">{{ info && info.work_status === 'off' ? '暂停接单' : '听单中' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 2. 资产工钱大卡(对标工奇兵待结算工钱) -->
|
||||
<view class="assets-box">
|
||||
<view class="asset-top">
|
||||
<text class="asset-title">可提现工钱(元)</text>
|
||||
<view class="bill-link clickable-hover" @tap="go('/pages/master/wallet')">
|
||||
<text class="bill-txt">账单明细</text>
|
||||
<image class="arrow-ico" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="asset-main">
|
||||
<text class="asset-val">{{ info ? Number(info.money).toFixed(2) : '0.00' }}</text>
|
||||
<view class="withdraw-btn clickable-hover" @tap="go('/pages/master/wallet')">
|
||||
申请提现
|
||||
</view>
|
||||
</view>
|
||||
<view class="asset-sub">
|
||||
<text class="sub-item">今日收入 ¥{{ todayIncome }}</text>
|
||||
<text class="sub-divider">|</text>
|
||||
<text class="sub-item">累计收入 ¥{{ totalIncome }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 3. 核心功能菜单组(对标工奇兵功能列表) -->
|
||||
<view class="menu-card">
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/master/orders')">
|
||||
<view class="mi-left">
|
||||
<image class="mi-ico" src="/static/icons/master/menu-orders.svg" mode="aspectFit" />
|
||||
<text class="mi-title">我的接单管理</text>
|
||||
</view>
|
||||
<view class="mi-right">
|
||||
<text class="mi-badge" v-if="info && info.todo_count > 0">{{ info.todo_count }} 待办</text>
|
||||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/master/quote')">
|
||||
<view class="mi-left">
|
||||
<image class="mi-ico" src="/static/icons/master/menu-quote.svg" mode="aspectFit" />
|
||||
<text class="mi-title">报价记录与管理</text>
|
||||
</view>
|
||||
<view class="mi-right">
|
||||
<text class="mi-tip">查看出价状态</text>
|
||||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item clickable-hover" @tap="go('/pages/master/credit')">
|
||||
<view class="mi-left">
|
||||
<image class="mi-ico" src="/static/icons/master/menu-credit.svg" mode="aspectFit" />
|
||||
<text class="mi-title">服务信用与申诉</text>
|
||||
</view>
|
||||
<view class="mi-right">
|
||||
<text class="mi-tip" v-if="credit">好评率 {{ credit.good_rate }}%</text>
|
||||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="menu-item clickable-hover" @tap="callService">
|
||||
<view class="mi-left">
|
||||
<image class="mi-ico" src="/static/icons/master/menu-service.svg" mode="aspectFit" />
|
||||
<text class="mi-title">联系平台客服</text>
|
||||
</view>
|
||||
<view class="mi-right">
|
||||
<text class="mi-tip">4000000000</text>
|
||||
<image class="mi-arrow" src="/static/icons/arrow-right.svg" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 4. 服务技能与品类 -->
|
||||
<view class="card">
|
||||
<view class="card-head clickable-hover" @tap="goSkills">
|
||||
<text class="card-title">已认证服务技能</text>
|
||||
<view style="display: flex; align-items: center; gap: 8rpx;">
|
||||
<text class="card-tip">{{ skills.length }} 项技能</text>
|
||||
<text style="font-size: 24rpx; color: #EA580C; font-weight: 600;">修改 ›</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="skills-box" @tap="goSkills">
|
||||
<text class="skill-tag" v-for="s in skills" :key="s.name">{{ s.name }}</text>
|
||||
<text class="skill-tag empty" v-if="!skills.length">暂无已认证技能,点击去选择</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 5. 身份切换通道(对标工奇兵我要下单找师傅) -->
|
||||
<view class="switch-role-card clickable-hover" @tap="backToUser">
|
||||
<view class="src-left">
|
||||
<image class="src-ico" src="/static/icons/role-switch.svg" mode="aspectFit" />
|
||||
<view class="src-text">
|
||||
<text class="src-title">我要下单找师傅</text>
|
||||
<text class="src-desc">切换至业主身份发布安装维修需求</text>
|
||||
</view>
|
||||
</view>
|
||||
<image class="src-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
|
||||
</view>
|
||||
|
||||
<!-- 师傅端专属底部导航 (当前 Tab 3: 我的) -->
|
||||
<YjyfMasterTabBar :current="3" />
|
||||
<view>
|
||||
<MasterWorkbenchView @switch-tab="onSwitchTab" />
|
||||
<YjyfMasterTabBar :current="3" @change="onSwitchTab" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } 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';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import MasterWorkbenchView from '@/components/master/MasterWorkbenchView.vue';
|
||||
import YjyfMasterTabBar from '@/components/YjyfMasterTabBar.vue';
|
||||
|
||||
const info = ref(null);
|
||||
const credit = ref(null);
|
||||
const skills = ref([]);
|
||||
const todayIncome = ref('0.00');
|
||||
const totalIncome = ref('0.00');
|
||||
onLoad(() => {
|
||||
// 自动平滑收敛到单母页 Tab 3
|
||||
uni.redirectTo({
|
||||
url: '/pages/master/hall?tab=3'
|
||||
});
|
||||
});
|
||||
|
||||
function go(url) {
|
||||
uni.navigateTo({ url });
|
||||
function onSwitchTab(index) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/master/hall?tab=${index}`
|
||||
});
|
||||
}
|
||||
|
||||
function goSkills() {
|
||||
uni.navigateTo({ url: '/pages/master/skills' });
|
||||
}
|
||||
|
||||
function callService() {
|
||||
uni.makePhoneCall({ phoneNumber: '4000000000' });
|
||||
}
|
||||
|
||||
async function load() {
|
||||
if (!isLogin()) { toLogin(); return; }
|
||||
try {
|
||||
const res = await api.masterInfo();
|
||||
if (!res.applied || res.master.verify_status !== 'pass') {
|
||||
uni.redirectTo({ url: '/pages/master/apply' });
|
||||
return;
|
||||
}
|
||||
info.value = res.master;
|
||||
skills.value = res.skills || [];
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
const inc = await api.masterIncome();
|
||||
if (inc) {
|
||||
todayIncome.value = Number(inc.today_income || 0).toFixed(2);
|
||||
totalIncome.value = Number(inc.total_income || 0).toFixed(2);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
try {
|
||||
credit.value = await api.masterCredit();
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function toggleWork() {
|
||||
if (!info.value) return;
|
||||
const next = info.value.work_status === 'off' ? 'on' : 'off';
|
||||
try {
|
||||
await api.masterToggle({ work_status: next });
|
||||
info.value.work_status = next;
|
||||
uni.showToast({ title: next === 'on' ? '已开启接单听单' : '已暂停接单', icon: 'none' });
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function backToUser() {
|
||||
api.switchRole({ role: 'user' }).then((res) => {
|
||||
setRole('user');
|
||||
uni.reLaunch({ url: res.redirect || '/pages/index/index' });
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
onShow(() => load());
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 40rpx; }
|
||||
|
||||
/* 顶部名片(单一连续大渐变) */
|
||||
.profile-hero {
|
||||
position: relative; overflow: hidden; padding-bottom: 30rpx;
|
||||
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||||
}
|
||||
.hero-body {
|
||||
position: relative; z-index: 2; padding: 10rpx 28rpx 0;
|
||||
}
|
||||
.hero-deco { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.13); }
|
||||
.d1 { width: 320rpx; height: 320rpx; right: -120rpx; top: -130rpx; }
|
||||
.d2 { width: 180rpx; height: 180rpx; left: -80rpx; bottom: -60rpx; }
|
||||
|
||||
.user-block { position: relative; display: flex; align-items: center; justify-content: space-between; }
|
||||
.avatar-wrap {
|
||||
width: 104rpx; height: 104rpx; border-radius: 52rpx; background: #fff;
|
||||
display: flex; align-items: center; justify-content: center; flex-shrink: 0;
|
||||
box-shadow: 0 4rpx 14rpx rgba(0,0,0,0.1);
|
||||
}
|
||||
.avatar-img { width: 72rpx; height: 72rpx; }
|
||||
.user-meta { flex: 1; min-width: 0; margin-left: 20rpx; }
|
||||
.name-row { display: flex; align-items: center; }
|
||||
.user-name { font-size: 36rpx; font-weight: 700; color: #fff; }
|
||||
.auth-tag {
|
||||
margin-left: 12rpx; display: flex; align-items: center; padding: 2rpx 12rpx;
|
||||
border-radius: 8rpx; background: rgba(255,255,255,0.22);
|
||||
}
|
||||
.auth-ico { width: 20rpx; height: 20rpx; margin-right: 6rpx; }
|
||||
.auth-txt { font-size: 18rpx; color: #fff; font-weight: 600; }
|
||||
.user-level { margin-top: 8rpx; font-size: 22rpx; color: rgba(255,255,255,0.92); }
|
||||
|
||||
.status-pill {
|
||||
display: flex; align-items: center; padding: 0 22rpx; height: 54rpx;
|
||||
border-radius: 27rpx; background: #fff; box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.08);
|
||||
}
|
||||
.status-pill.off { background: rgba(255,255,255,0.35); }
|
||||
.status-dot { width: 12rpx; height: 12rpx; border-radius: 50%; background: #2FA84F; margin-right: 8rpx; }
|
||||
.status-pill.off .status-dot { background: #E8331B; }
|
||||
.status-txt { font-size: 22rpx; font-weight: 600; color: #E36B0C; }
|
||||
.status-pill.off .status-txt { color: #fff; }
|
||||
|
||||
/* 资产大卡 */
|
||||
.assets-box {
|
||||
position: relative; margin-top: 30rpx; padding: 24rpx 24rpx 20rpx;
|
||||
border-radius: 20rpx; background: rgba(255,255,255,0.18);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
.asset-top { display: flex; align-items: center; justify-content: space-between; }
|
||||
.asset-title { font-size: 24rpx; color: rgba(255,255,255,0.9); }
|
||||
.bill-link { display: flex; align-items: center; }
|
||||
.bill-txt { font-size: 22rpx; color: #fff; font-weight: 500; }
|
||||
.arrow-ico { width: 22rpx; height: 22rpx; margin-left: 4rpx; }
|
||||
|
||||
.asset-main { display: flex; align-items: baseline; justify-content: space-between; margin-top: 10rpx; }
|
||||
.asset-val { font-size: 56rpx; font-weight: 700; color: #fff; line-height: 1.1; }
|
||||
.withdraw-btn {
|
||||
padding: 0 32rpx; height: 56rpx; line-height: 56rpx; border-radius: 28rpx;
|
||||
background: #fff; color: #E36B0C; font-size: 24rpx; font-weight: 700;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.08);
|
||||
}
|
||||
.asset-sub { display: flex; align-items: center; margin-top: 14rpx; padding-top: 14rpx; border-top: 1rpx solid rgba(255,255,255,0.22); }
|
||||
.sub-item { font-size: 22rpx; color: rgba(255,255,255,0.9); }
|
||||
.sub-divider { margin: 0 16rpx; font-size: 18rpx; color: rgba(255,255,255,0.5); }
|
||||
|
||||
/* 菜单组 */
|
||||
.menu-card {
|
||||
margin: 20rpx 24rpx 0; background: #fff; border-radius: 20rpx;
|
||||
box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06); overflow: hidden;
|
||||
}
|
||||
.menu-item {
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
padding: 28rpx 24rpx; border-bottom: 1rpx solid #F5F5F5;
|
||||
}
|
||||
.menu-item:last-child { border-bottom: none; }
|
||||
.mi-left { display: flex; align-items: center; }
|
||||
.mi-ico { width: 40rpx; height: 40rpx; margin-right: 18rpx; flex-shrink: 0; }
|
||||
.mi-title { font-size: 28rpx; font-weight: 600; color: #2C2C2E; }
|
||||
.mi-right { display: flex; align-items: center; }
|
||||
.mi-badge {
|
||||
padding: 2rpx 14rpx; border-radius: 14rpx; background: #FDEEEB;
|
||||
color: #E8331B; font-size: 20rpx; font-weight: 600; margin-right: 8rpx;
|
||||
}
|
||||
.mi-tip { font-size: 24rpx; color: #9A9A9A; margin-right: 8rpx; }
|
||||
.mi-arrow { width: 24rpx; height: 24rpx; }
|
||||
|
||||
/* 类目卡片 */
|
||||
.card {
|
||||
margin: 20rpx 24rpx 0; padding: 24rpx; background: #fff; border-radius: 20rpx;
|
||||
box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06);
|
||||
}
|
||||
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14rpx; }
|
||||
.card-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
|
||||
.card-tip { font-size: 22rpx; color: #9A9A9A; }
|
||||
.skills-box { display: flex; flex-wrap: wrap; }
|
||||
.skill-tag {
|
||||
padding: 0 22rpx; line-height: 52rpx; margin: 0 12rpx 12rpx 0;
|
||||
border-radius: 26rpx; background: #FFF3E6; color: #C4580A; font-size: 22rpx; font-weight: 500;
|
||||
}
|
||||
.skill-tag.empty { background: #F5F5F5; color: #9A9A9A; }
|
||||
|
||||
/* 切换业主角色卡片 */
|
||||
.switch-role-card {
|
||||
margin: 24rpx 24rpx 0; padding: 24rpx; background: #fff; border-radius: 20rpx;
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06);
|
||||
}
|
||||
.src-left { display: flex; align-items: center; }
|
||||
.src-ico { width: 44rpx; height: 44rpx; margin-right: 18rpx; flex-shrink: 0; }
|
||||
.src-text { display: flex; flex-direction: column; }
|
||||
.src-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
|
||||
.src-desc { margin-top: 4rpx; font-size: 22rpx; color: #8E8E93; }
|
||||
.src-arrow { width: 28rpx; height: 28rpx; }
|
||||
</style>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 角色自适应 TabBar:师傅端显示 MasterTabBar,业主端显示 YjyfTabBar -->
|
||||
<YjyfMasterTabBar :current="2" v-if="isMasterRole" />
|
||||
<YjyfTabBar :current="2" v-else />
|
||||
<YjyfMasterTabBar :current="2" @change="onMasterTabChange" v-if="isMasterRole" />
|
||||
<YjyfTabBar :current="2" @change="onUserTabChange" v-else />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -42,6 +42,14 @@
|
||||
const category = ref('all');
|
||||
const isMasterRole = ref(false);
|
||||
|
||||
function onMasterTabChange(idx) {
|
||||
uni.redirectTo({ url: `/pages/master/hall?tab=${idx}` });
|
||||
}
|
||||
|
||||
function onUserTabChange(idx) {
|
||||
uni.redirectTo({ url: `/pages/index/index?tab=${idx}` });
|
||||
}
|
||||
|
||||
const cats = [
|
||||
{ key: 'all', name: '全部' },
|
||||
{ key: 'order', name: '订单' },
|
||||
|
||||
@@ -1,818 +1,25 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 头部个人名片与资产核心区 (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>
|
||||
|
||||
<!-- 统一底部 TabBar -->
|
||||
<YjyfTabBar :current="3" />
|
||||
<view>
|
||||
<UserMineView />
|
||||
<YjyfTabBar :current="3" @change="onSwitchTab" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import UserMineView from '@/components/user/UserMineView.vue';
|
||||
import YjyfTabBar from '@/components/YjyfTabBar.vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
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;
|
||||
onLoad(() => {
|
||||
// 自动平滑收敛到单母页 Tab 3
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index?tab=3'
|
||||
});
|
||||
});
|
||||
|
||||
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 onSwitchTab(index) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/index/index?tab=${index}`
|
||||
});
|
||||
}
|
||||
|
||||
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' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onShow(() => load());
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page {
|
||||
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>
|
||||
|
||||
@@ -1,155 +1,25 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 统一规范顶部导航栏(安全距离自适应) -->
|
||||
<YjyfNavBar theme="orange" title="我的订单" />
|
||||
|
||||
<view class="tabs">
|
||||
<view v-for="t in tabs" :key="t.key" class="tab" :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" v-if="o.can_cancel" @tap.stop="cancel(o)">取消订单</view>
|
||||
<view class="op primary" v-if="o.can_pay" @tap.stop="pay(o)">去支付</view>
|
||||
<view class="op primary" v-if="o.can_verify" @tap.stop="verify(o)">确认验收</view>
|
||||
<view class="op primary" 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>
|
||||
<YjyfTabBar :current="1" />
|
||||
<view>
|
||||
<UserOrdersView />
|
||||
<YjyfTabBar :current="1" @change="onSwitchTab" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import UserOrdersView from '@/components/user/UserOrdersView.vue';
|
||||
import YjyfTabBar from '@/components/YjyfTabBar.vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
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);
|
||||
onLoad(() => {
|
||||
// 自动平滑收敛到单母页 Tab 1
|
||||
uni.redirectTo({
|
||||
url: '/pages/index/index?tab=1'
|
||||
});
|
||||
});
|
||||
|
||||
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) {}
|
||||
}
|
||||
function onSwitchTab(index) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/index/index?tab=${index}`
|
||||
});
|
||||
}
|
||||
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 });
|
||||
}
|
||||
|
||||
onShow(() => load());
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.page { 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); }
|
||||
|
||||
</style>
|
||||
|
||||
@@ -708,13 +708,14 @@
|
||||
import FeeDetailDrawer from '@/components/FeeDetailDrawer.vue';
|
||||
import ModePickerDrawer from '@/components/ModePickerDrawer.vue';
|
||||
import MediaActionDrawer from '@/components/MediaActionDrawer.vue';
|
||||
import { getWindowInfoSafe } from '@/utils/system.js';
|
||||
|
||||
// 状态栏与导航栏高度
|
||||
const statusBarHeight = ref(20);
|
||||
const navBarHeight = ref(44);
|
||||
|
||||
try {
|
||||
const info = uni.getSystemInfoSync();
|
||||
const info = getWindowInfoSafe();
|
||||
if (info && info.statusBarHeight) statusBarHeight.value = info.statusBarHeight;
|
||||
if (typeof uni.getMenuButtonBoundingClientRect === 'function') {
|
||||
const menu = uni.getMenuButtonBoundingClientRect();
|
||||
|
||||
在新工单中引用
屏蔽一个用户