1. 账号体系与数据库解耦: - 师傅表 fa_master 解除对 fa_user.id 的外键依赖,升级为独立认证账号主表; - 新增师傅端独立支撑表:fa_master_security、fa_master_token、fa_master_wechat、fa_master_agreement_read; - 新增工单超时未接单自动关闭与原路退款配置(order_unaccepted_close_days)。 2. 服务端(Server): - 新增师傅端独立 API 控制器与认证库(MasterAuth, MasterBase, MasterMessage, MasterSecurity, MasterToken); - WxLogin 支持双小程序端(user/master)独立换取 session_key、openid 与 access_token; - 新增控制台调度命令 php think order:autoclose,支持订单超时自动关闭与售后退款闭环; - 修复 PHP 8.5 兼容性问题(Request.php 的 (bool) 强制转换); - 系统业务配置全面收敛至数据库 fa_config 及 site.php。 3. 小程序端: - yjyf-app(用户端):彻底剥离师傅端路由、组件及静态资源,增加隐私授权弹窗与评价模块; - yjyf-master-app(师傅端):全新独立微信小程序工程(wx140d90ceda786107),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
294 行
6.8 KiB
Vue
294 行
6.8 KiB
Vue
<template>
|
||
<view class="yjyf-tabbar-container">
|
||
<view class="tabbar">
|
||
<!-- 1. 首页 -->
|
||
<view class="tab" :class="{ on: activeIndex === 0 }" @tap="switchTab(0)">
|
||
<view class="icon-stage">
|
||
<image class="tab-icon" :class="{ faded: activeIndex === 0 }" src="/static/tabbar/home.svg" mode="aspectFit" />
|
||
<image class="tab-icon tab-icon-active" :class="{ visible: activeIndex === 0 }" src="/static/tabbar/home-active.svg" mode="aspectFit" />
|
||
</view>
|
||
<text class="tab-txt">首页</text>
|
||
</view>
|
||
|
||
<!-- 2. 订单 -->
|
||
<view class="tab" :class="{ on: activeIndex === 1 }" @tap="switchTab(1)">
|
||
<view class="icon-stage">
|
||
<image class="tab-icon" :class="{ faded: activeIndex === 1 }" src="/static/tabbar/order.svg" mode="aspectFit" />
|
||
<image class="tab-icon tab-icon-active" :class="{ visible: activeIndex === 1 }" src="/static/tabbar/order-active.svg" mode="aspectFit" />
|
||
</view>
|
||
<text class="tab-txt">订单</text>
|
||
</view>
|
||
|
||
<!-- 3. 中央上浮主按钮:立即下单 -->
|
||
<view class="tab tab-center">
|
||
<view class="fab" :class="{ active: activeIndex === 'order' }" @tap="onOrder">
|
||
<image class="fab-icon" src="/static/tabbar/order-quick.svg" mode="aspectFit" />
|
||
<text class="fab-txt">立即下单</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 4. 消息 -->
|
||
<view class="tab" :class="{ on: activeIndex === 2 }" @tap="switchTab(2)">
|
||
<view class="icon-box">
|
||
<view class="icon-stage">
|
||
<image class="tab-icon" :class="{ faded: activeIndex === 2 }" src="/static/tabbar/message.svg" mode="aspectFit" />
|
||
<image class="tab-icon tab-icon-active" :class="{ visible: activeIndex === 2 }" src="/static/tabbar/message-active.svg" mode="aspectFit" />
|
||
</view>
|
||
<view class="unread-badge" v-if="unreadCount > 0">
|
||
<text class="unread-txt">{{ unreadCount > 99 ? '99+' : unreadCount }}</text>
|
||
</view>
|
||
</view>
|
||
<text class="tab-txt">消息</text>
|
||
</view>
|
||
|
||
<!-- 5. 我的 -->
|
||
<view class="tab" :class="{ on: activeIndex === 3 }" @tap="switchTab(3)">
|
||
<view class="icon-stage">
|
||
<image class="tab-icon" :class="{ faded: activeIndex === 3 }" src="/static/tabbar/mine.svg" mode="aspectFit" />
|
||
<image class="tab-icon tab-icon-active" :class="{ visible: activeIndex === 3 }" src="/static/tabbar/mine-active.svg" mode="aspectFit" />
|
||
</view>
|
||
<text class="tab-txt">我的</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部防遮挡垫高占位 -->
|
||
<view class="tabbar-placeholder"></view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, watch, onMounted, onBeforeUnmount } from 'vue';
|
||
import api from '@/utils/api.js';
|
||
import { isLogin, toLogin } from '@/utils/request.js';
|
||
|
||
const props = defineProps({
|
||
current: {
|
||
type: [Number, String],
|
||
default: 0
|
||
},
|
||
standalone: {
|
||
type: Boolean,
|
||
default: false
|
||
}
|
||
});
|
||
|
||
const emit = defineEmits(['change']);
|
||
|
||
const activeIndex = ref(props.current);
|
||
const unreadCount = ref(0);
|
||
|
||
async function fetchUnread() {
|
||
if (!isLogin()) {
|
||
unreadCount.value = 0;
|
||
return;
|
||
}
|
||
try {
|
||
const res = await api.messageUnread({ type: 'user' });
|
||
unreadCount.value = Number(res?.unread || 0);
|
||
} catch (e) {}
|
||
}
|
||
|
||
watch(() => props.current, (val) => {
|
||
activeIndex.value = val;
|
||
fetchUnread();
|
||
});
|
||
|
||
onMounted(() => {
|
||
fetchUnread();
|
||
uni.$on('yjyf:refreshUnread', fetchUnread);
|
||
});
|
||
|
||
onBeforeUnmount(() => {
|
||
uni.$off('yjyf:refreshUnread', fetchUnread);
|
||
});
|
||
|
||
const TAB_ROUTES = [
|
||
'/pages/index/index',
|
||
'/pages/index/index?tab=1',
|
||
'/pages/index/index?tab=2',
|
||
'/pages/index/index?tab=3'
|
||
];
|
||
|
||
function needLogin(targetUrl) {
|
||
if (isLogin()) return true;
|
||
toLogin(targetUrl);
|
||
return false;
|
||
}
|
||
|
||
function onOrder() {
|
||
if (activeIndex.value === 'order') return;
|
||
uni.navigateTo({ url: '/pages/category/category' });
|
||
}
|
||
|
||
function switchTab(index) {
|
||
if (activeIndex.value === index) return;
|
||
const targetUrl = TAB_ROUTES[index] || '/pages/index/index';
|
||
|
||
activeIndex.value = index;
|
||
emit('change', index);
|
||
|
||
if (props.standalone) {
|
||
uni.reLaunch({
|
||
url: targetUrl
|
||
});
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
/* #ifdef MP-WEIXIN */
|
||
:host {
|
||
display: block;
|
||
width: 100%;
|
||
flex-shrink: 0;
|
||
}
|
||
/* #endif */
|
||
|
||
.yjyf-tabbar-container {
|
||
position: relative;
|
||
z-index: 99;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
/* ---------- 自定义底部导航栏 (保持 content-box 避免被 safe-area 挤压高度) ---------- */
|
||
.tabbar {
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
z-index: 99;
|
||
box-sizing: content-box !important;
|
||
height: 112rpx;
|
||
padding-bottom: constant(safe-area-inset-bottom);
|
||
padding-bottom: env(safe-area-inset-bottom);
|
||
display: flex;
|
||
background: #ffffff;
|
||
box-shadow: 0 -6rpx 24rpx rgba(0, 0, 0, 0.07);
|
||
}
|
||
|
||
.tab {
|
||
flex: 1;
|
||
height: 112rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding-bottom: 8rpx;
|
||
}
|
||
|
||
.tab-txt {
|
||
margin-top: 8rpx;
|
||
font-size: 22rpx;
|
||
line-height: 1.2;
|
||
color: #9A9A9A;
|
||
}
|
||
|
||
.tab.on .tab-txt {
|
||
color: #F0710D;
|
||
font-weight: 600;
|
||
}
|
||
|
||
/* 底部图标 */
|
||
.icon-box {
|
||
position: relative;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.unread-badge {
|
||
position: absolute;
|
||
top: -10rpx;
|
||
right: -22rpx;
|
||
min-width: 32rpx;
|
||
height: 32rpx;
|
||
padding: 0 8rpx;
|
||
border-radius: 16rpx;
|
||
background: #E8331B;
|
||
border: 2rpx solid #FFFFFF;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-sizing: border-box;
|
||
}
|
||
.unread-txt {
|
||
font-size: 22rpx;
|
||
color: #FFFFFF;
|
||
font-weight: 700;
|
||
line-height: 1;
|
||
transform: scale(0.85);
|
||
}
|
||
.icon-stage {
|
||
position: relative;
|
||
width: 44rpx;
|
||
height: 44rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
.tab-icon {
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
width: 44rpx;
|
||
height: 44rpx;
|
||
}
|
||
.tab-icon.faded {
|
||
opacity: 0;
|
||
}
|
||
.tab-icon-active {
|
||
opacity: 0;
|
||
}
|
||
.tab-icon-active.visible {
|
||
opacity: 1;
|
||
}
|
||
|
||
/* ---------- 中央上浮主按钮 ---------- */
|
||
.tab-center {
|
||
position: relative;
|
||
height: 112rpx;
|
||
overflow: visible;
|
||
}
|
||
|
||
.fab {
|
||
position: absolute;
|
||
left: 50%;
|
||
top: -52rpx;
|
||
width: 128rpx;
|
||
height: 128rpx;
|
||
margin-left: -64rpx;
|
||
border-radius: 50%;
|
||
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 10rpx 28rpx rgba(240, 113, 13, 0.45);
|
||
border: 8rpx solid #ffffff;
|
||
box-sizing: border-box;
|
||
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
||
}
|
||
|
||
.fab:active {
|
||
transform: scale(0.94);
|
||
box-shadow: 0 4rpx 16rpx rgba(240, 113, 13, 0.35);
|
||
}
|
||
|
||
.fab-icon {
|
||
width: 52rpx;
|
||
height: 52rpx;
|
||
}
|
||
|
||
.fab-txt {
|
||
font-size: 22rpx;
|
||
font-weight: 600;
|
||
color: #ffffff;
|
||
line-height: 1;
|
||
margin-top: 4rpx;
|
||
}
|
||
|
||
.tabbar-placeholder {
|
||
height: 112rpx;
|
||
padding-bottom: constant(safe-area-inset-bottom);
|
||
padding-bottom: env(safe-area-inset-bottom);
|
||
box-sizing: content-box !important;
|
||
}
|
||
</style>
|