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),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
421 行
10 KiB
Vue
421 行
10 KiB
Vue
<template>
|
||
<view class="success-page">
|
||
<YjyfNavBar theme="orange" title="抢单结果" :customBack="true" @back="goHall" />
|
||
|
||
<view class="result-card">
|
||
<view class="illustration-box">
|
||
<image class="success-img" src="/static/icons/master/grab-success.svg" mode="aspectFit" />
|
||
</view>
|
||
|
||
<text class="main-title">抢单成功</text>
|
||
|
||
<view class="alert-box">
|
||
<text class="alert-txt">请在 2 小时内联系业主预约上门时间并登记预约结果,超时未联系将自动回流大厅。</text>
|
||
</view>
|
||
|
||
<view class="settle-box">
|
||
<text class="settle-txt">完工后请上传现场实拍照片,并输入业主订单详情页中的 6 位验收核销码完成验收,核销后工钱即刻结算至您的钱包。</text>
|
||
</view>
|
||
|
||
<view class="action-btn clickable-hover" @tap="openScheduleModal">
|
||
<text class="action-txt">预约上门时间</text>
|
||
</view>
|
||
|
||
<view class="sub-actions">
|
||
<view class="sub-btn clickable-hover" @tap="goDetail">
|
||
<text class="sub-txt primary">查看工单详情</text>
|
||
</view>
|
||
<view class="sub-divider"></view>
|
||
<view class="sub-btn clickable-hover" @tap="goHall">
|
||
<text class="sub-txt">返回抢单大厅</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 预约上门时间半屏抽屉 -->
|
||
<view class="modal-mask" v-if="showModal" @tap="showModal = false">
|
||
<view class="modal-card" @tap.stop>
|
||
<view class="modal-head">
|
||
<text class="modal-title">预约上门时间</text>
|
||
<view class="close-hit" @tap="showModal = false">
|
||
<image class="close-ico" src="/static/icons/close.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
|
||
<view class="modal-body">
|
||
<view class="form-row">
|
||
<text class="form-label">预约日期</text>
|
||
<picker mode="date" :value="appointDate" :start="today" @change="onDateChange">
|
||
<view class="picker-val">
|
||
<text class="picker-txt">{{ appointDate }}</text>
|
||
<image class="picker-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
|
||
<view class="form-row">
|
||
<text class="form-label">预约时段</text>
|
||
<picker mode="selector" :range="timeSlots" @change="onSlotChange">
|
||
<view class="picker-val">
|
||
<text class="picker-txt">{{ appointSlot }}</text>
|
||
<image class="picker-arrow" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
|
||
<view class="call-hint" v-if="userMobile">
|
||
<text class="call-txt">业主电话:{{ userMobile }}</text>
|
||
<view class="call-btn clickable-hover" @tap="makeCall">
|
||
<image class="phone-ico" src="/static/icons/phone.svg" mode="aspectFit" />
|
||
<text class="call-btn-txt">拨打电话</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="modal-foot">
|
||
<view class="confirm-btn clickable-hover" :class="{ disabled: submitting }" @tap="submitSchedule">
|
||
<text class="confirm-txt">{{ submitting ? '提交中...' : '确认预约上门' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref } from 'vue';
|
||
import { onLoad } from '@dcloudio/uni-app';
|
||
import api from '@/utils/api.js';
|
||
|
||
const orderId = ref(0);
|
||
const userMobile = ref('');
|
||
const showModal = ref(false);
|
||
const submitting = ref(false);
|
||
|
||
const _now = new Date();
|
||
const today = `${_now.getFullYear()}-${String(_now.getMonth() + 1).padStart(2, '0')}-${String(_now.getDate()).padStart(2, '0')}`;
|
||
const appointDate = ref(today);
|
||
const timeSlots = ['上午 (09:00 - 12:00)', '下午 (13:00 - 18:00)', '晚上 (18:00 - 21:00)', '全天随时上门'];
|
||
const appointSlot = ref(timeSlots[1]);
|
||
|
||
onLoad((query) => {
|
||
if (query && (query.order_id || query.id)) {
|
||
orderId.value = Number(query.order_id || query.id);
|
||
}
|
||
if (query && query.mobile) {
|
||
userMobile.value = query.mobile;
|
||
}
|
||
if (!userMobile.value && orderId.value > 0) {
|
||
loadOrderDetail();
|
||
}
|
||
});
|
||
|
||
async function loadOrderDetail() {
|
||
try {
|
||
const res = await api.masterOrderDetail(orderId.value);
|
||
if (res && res.mobile) {
|
||
userMobile.value = res.mobile;
|
||
}
|
||
} catch (e) {}
|
||
}
|
||
|
||
function onDateChange(e) {
|
||
appointDate.value = e.detail.value;
|
||
}
|
||
|
||
function onSlotChange(e) {
|
||
appointSlot.value = timeSlots[e.detail.value];
|
||
}
|
||
|
||
function openScheduleModal() {
|
||
showModal.value = true;
|
||
}
|
||
|
||
const contactReported = ref(false);
|
||
|
||
function makeCall() {
|
||
if (!userMobile.value) {
|
||
uni.showToast({ title: '暂未获取到客户电话', icon: 'none' });
|
||
return;
|
||
}
|
||
if (!contactReported.value) {
|
||
contactReported.value = true;
|
||
api.masterContact({ order_id: orderId.value }).catch(() => {
|
||
contactReported.value = false;
|
||
});
|
||
}
|
||
uni.makePhoneCall({
|
||
phoneNumber: String(userMobile.value),
|
||
fail: () => {}
|
||
});
|
||
}
|
||
|
||
async function submitSchedule() {
|
||
if (submitting.value) return;
|
||
submitting.value = true;
|
||
try {
|
||
let hour = 14;
|
||
if (appointSlot.value.includes('上午')) hour = 10;
|
||
else if (appointSlot.value.includes('晚上')) hour = 19;
|
||
const targetDateStr = `${appointDate.value} ${String(hour).padStart(2, '0')}:00:00`.replace(/-/g, '/');
|
||
const appointTimestamp = Math.floor(new Date(targetDateStr).getTime() / 1000);
|
||
|
||
await api.masterSchedule({
|
||
order_id: orderId.value,
|
||
appoint_time: appointTimestamp
|
||
});
|
||
showModal.value = false;
|
||
uni.showToast({ title: '预约成功,已通知业主', icon: 'success' });
|
||
setTimeout(() => {
|
||
submitting.value = false;
|
||
uni.redirectTo({ url: `/pages/master/detail?id=${orderId.value}` });
|
||
}, 700);
|
||
} catch (e) {
|
||
submitting.value = false;
|
||
}
|
||
}
|
||
|
||
function goDetail() {
|
||
if (orderId.value > 0) {
|
||
uni.redirectTo({ url: `/pages/master/detail?id=${orderId.value}` });
|
||
} else {
|
||
uni.reLaunch({ url: '/pages/master/hall?tab=1' });
|
||
}
|
||
}
|
||
|
||
function goHall() {
|
||
uni.reLaunch({ url: '/pages/master/hall' });
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
@import '@/uni.scss';
|
||
.success-page {
|
||
min-height: 100vh;
|
||
background: $yjyf-bg-page;
|
||
padding-bottom: 48rpx;
|
||
}
|
||
|
||
.result-card {
|
||
margin: 24rpx $yjyf-space-md 0;
|
||
padding: 56rpx 36rpx 44rpx;
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-md;
|
||
box-shadow: $yjyf-shadow-card;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
}
|
||
|
||
.illustration-box {
|
||
width: 200rpx;
|
||
height: 200rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.success-img {
|
||
width: 184rpx;
|
||
height: 184rpx;
|
||
}
|
||
|
||
.main-title {
|
||
margin-top: 28rpx;
|
||
font-size: $yjyf-font-hero;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.alert-box {
|
||
margin-top: 32rpx;
|
||
width: 100%;
|
||
padding: 22rpx 24rpx;
|
||
border-radius: $yjyf-radius-sm;
|
||
background: $yjyf-primary-bg;
|
||
box-sizing: border-box;
|
||
}
|
||
.alert-txt {
|
||
font-size: $yjyf-font-sub;
|
||
line-height: 1.55;
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.settle-box {
|
||
margin-top: 20rpx;
|
||
width: 100%;
|
||
padding: 22rpx 24rpx;
|
||
border-radius: $yjyf-radius-sm;
|
||
background: $yjyf-bg-page;
|
||
box-sizing: border-box;
|
||
}
|
||
.settle-txt {
|
||
font-size: $yjyf-font-sub;
|
||
line-height: 1.55;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
|
||
.action-btn {
|
||
margin-top: 48rpx;
|
||
width: 100%;
|
||
height: 88rpx;
|
||
border-radius: $yjyf-radius-pill;
|
||
background: $yjyf-gradient-primary;
|
||
box-shadow: $yjyf-shadow-card;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.action-txt {
|
||
font-size: $yjyf-font-body;
|
||
font-weight: 700;
|
||
color: $yjyf-bg-card;
|
||
}
|
||
|
||
.sub-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-top: 32rpx;
|
||
}
|
||
.sub-btn {
|
||
padding: 12rpx 24rpx;
|
||
}
|
||
.sub-txt {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
.sub-txt.primary {
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
}
|
||
.sub-divider {
|
||
width: 1rpx;
|
||
height: 26rpx;
|
||
background: $yjyf-border-color;
|
||
}
|
||
|
||
/* 预约弹窗 */
|
||
.modal-mask {
|
||
position: fixed;
|
||
inset: 0;
|
||
background: rgba(0, 0, 0, 0.48);
|
||
z-index: 999;
|
||
display: flex;
|
||
align-items: flex-end;
|
||
}
|
||
.modal-card {
|
||
width: 100%;
|
||
background: $yjyf-bg-card;
|
||
border-radius: 28rpx 28rpx 0 0;
|
||
padding: 28rpx $yjyf-space-lg calc(32rpx + env(safe-area-inset-bottom));
|
||
box-sizing: border-box;
|
||
}
|
||
.modal-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding-bottom: 20rpx;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
}
|
||
.modal-title {
|
||
font-size: $yjyf-font-title;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
.close-hit {
|
||
width: 56rpx;
|
||
height: 56rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.close-ico {
|
||
width: 30rpx;
|
||
height: 30rpx;
|
||
}
|
||
|
||
.modal-body {
|
||
padding: 16rpx 0;
|
||
}
|
||
.form-row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
height: 92rpx;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
}
|
||
.form-label {
|
||
font-size: $yjyf-font-body;
|
||
color: $yjyf-text-regular;
|
||
}
|
||
.picker-val {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.picker-txt {
|
||
font-size: $yjyf-font-body;
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
}
|
||
.picker-arrow {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
margin-left: 8rpx;
|
||
}
|
||
|
||
.call-hint {
|
||
margin-top: 24rpx;
|
||
padding: 20rpx 24rpx;
|
||
background: $yjyf-bg-page;
|
||
border-radius: $yjyf-radius-sm;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
.call-txt {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-text-regular;
|
||
}
|
||
.call-btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 52rpx;
|
||
padding: 0 22rpx;
|
||
background: $yjyf-primary-bg;
|
||
border-radius: $yjyf-radius-pill;
|
||
}
|
||
.phone-ico {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
margin-right: 8rpx;
|
||
}
|
||
.call-btn-txt {
|
||
font-size: $yjyf-font-sub;
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.modal-foot {
|
||
padding-top: 20rpx;
|
||
}
|
||
.confirm-btn {
|
||
height: 88rpx;
|
||
border-radius: $yjyf-radius-pill;
|
||
background: $yjyf-gradient-primary;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
.confirm-txt {
|
||
color: $yjyf-bg-card;
|
||
font-size: $yjyf-font-body;
|
||
font-weight: 600;
|
||
}
|
||
.confirm-btn.disabled {
|
||
opacity: 0.6;
|
||
}
|
||
</style>
|