文件
yjyf/yjyf-app/pages/master/success.vue
YuanWen f60b2df7b3 style: 统一替换橙色渐变主题色并重构导航栏组件
- 新增 back-white.svg 和 home.svg 图标文件
- 重构 YjyfNavBar 组件,默认主题改为橙色,使用 SVG 图标
- 统一各页面导航栏为自定义组件,替换原生导航栏
- 调整所有页面背景色为 #F5F6F8,统一视觉风格
- 优化渐变背景为 135deg 线性渐变,消除分层断层
- 更新 pages.json 配置,所有页面使用自定义导航样式
2026-11-05 14:11:24 +08:00

423 行
9.5 KiB
Vue

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<template>
<view class="success-page">
<!-- 统一规范顶部白底导航栏 -->
<YjyfNavBar theme="orange" title="抢单结果" @back="goHall" />
<view class="content-body">
<!-- 1. 成功插画 -->
<view class="illustration-box">
<image class="success-img" src="/static/icons/master/grab-success.svg" mode="aspectFit" />
</view>
<!-- 2. 主标题 -->
<text class="main-title">抢单成功</text>
<!-- 3. 核心倒计时考核警示(对标工奇兵实机标语) -->
<view class="alert-box">
<text class="alert-txt">请尽快联系业主预约上门时间,并提交预约结果。超过2小时不预约,订单将自动取消。</text>
</view>
<!-- 4. 工钱结算规则提醒 -->
<view class="settle-box">
<text class="settle-txt">为不影响工钱结算,完工后请上传完工图片,并在施工现场让业主验收订单。预计72小时后,工钱将自动结算至您的到账账户。</text>
</view>
<!-- 5. 主行动按钮(预约上门时间) -->
<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">查看工单详情</text>
</view>
<text class="divider">|</text>
<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>
<image class="close-ico clickable-hover" src="/static/icons/close.svg" mode="aspectFit" @tap="showModal = false" />
</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">{{ appointDate }} ›</view>
</picker>
</view>
<view class="form-row">
<text class="form-label">预约时段</text>
<picker mode="selector" :range="timeSlots" @change="onSlotChange">
<view class="picker-val">{{ appointSlot }} ›</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 today = new Date().toISOString().slice(0, 10);
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) {
orderId.value = Number(query.order_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;
}
function makeCall() {
if (!userMobile.value) {
uni.showToast({ title: '暂未获取到客户电话', icon: 'none' });
return;
}
api.masterContact({ order_id: orderId.value }).catch(() => {});
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(() => {
uni.redirectTo({ url: '/pages/master/orders' });
}, 800);
} catch (e) {
} finally {
submitting.value = false;
}
}
function goDetail() {
if (orderId.value > 0) {
uni.navigateTo({ url: `/pages/master/detail?id=${orderId.value}` });
} else {
uni.redirectTo({ url: '/pages/master/orders' });
}
}
function goHall() {
uni.reLaunch({ url: '/pages/master/hall' });
}
</script>
<style scoped>
.success-page {
min-height: 100vh;
background: #FFFFFF;
display: flex;
flex-direction: column;
}
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 28rpx;
height: 88rpx;
box-sizing: border-box;
border-bottom: 1rpx solid #F0F0F0;
}
.nav-btn {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.nav-icon {
width: 36rpx;
height: 36rpx;
}
.nav-title {
font-size: 32rpx;
font-weight: 600;
color: #1F1F1F;
}
.nav-placeholder {
width: 60rpx;
}
.content-body {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
padding: 70rpx 48rpx 50rpx;
}
.illustration-box {
width: 220rpx;
height: 220rpx;
display: flex;
align-items: center;
justify-content: center;
}
.success-img {
width: 200rpx;
height: 200rpx;
}
.main-title {
margin-top: 36rpx;
font-size: 44rpx;
font-weight: 700;
color: #1F1F1F;
letter-spacing: 1rpx;
}
.alert-box {
margin-top: 36rpx;
width: 100%;
padding: 24rpx 28rpx;
border-radius: 16rpx;
background: #FFF5F0;
border: 1rpx solid #FFE2D4;
box-sizing: border-box;
}
.alert-txt {
font-size: 26rpx;
line-height: 40rpx;
color: #EB5D2A;
font-weight: 500;
}
.settle-box {
margin-top: 24rpx;
width: 100%;
padding: 22rpx 24rpx;
border-radius: 14rpx;
background: #F9FAFB;
box-sizing: border-box;
}
.settle-txt {
font-size: 24rpx;
line-height: 38rpx;
color: #6B7280;
}
.action-btn {
margin-top: 64rpx;
width: 100%;
height: 92rpx;
border-radius: 46rpx;
background: linear-gradient(135deg, #F98D25 0%, #ED6F0E 100%);
box-shadow: 0 8rpx 24rpx rgba(237, 111, 14, 0.35);
display: flex;
align-items: center;
justify-content: center;
}
.action-txt {
font-size: 32rpx;
font-weight: 600;
color: #FFFFFF;
}
.sub-actions {
display: flex;
align-items: center;
justify-content: center;
margin-top: 36rpx;
}
.sub-btn {
padding: 10rpx 24rpx;
}
.sub-txt {
font-size: 26rpx;
color: #8E8E93;
}
.divider {
color: #D1D5DB;
font-size: 22rpx;
}
/* 预约弹窗 */
.modal-mask {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0, 0, 0, 0.55);
z-index: 999;
display: flex;
align-items: flex-end;
}
.modal-card {
width: 100%;
background: #FFFFFF;
border-radius: 32rpx 32rpx 0 0;
padding: 36rpx 36rpx constant(safe-area-inset-bottom);
padding: 36rpx 36rpx env(safe-area-inset-bottom);
box-sizing: border-box;
animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
from { transform: translateY(100%); }
to { transform: translateY(0); }
}
.modal-head {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 24rpx;
border-bottom: 1rpx solid #F0F0F0;
}
.modal-title {
font-size: 32rpx;
font-weight: 700;
color: #1F1F1F;
}
.close-ico {
width: 36rpx;
height: 36rpx;
}
.modal-body {
padding: 24rpx 0;
}
.form-row {
display: flex;
align-items: center;
justify-content: space-between;
height: 90rpx;
border-bottom: 1rpx solid #F5F5F5;
}
.form-label {
font-size: 28rpx;
color: #374151;
}
.picker-val {
font-size: 28rpx;
color: #F0710D;
font-weight: 500;
}
.call-hint {
margin-top: 24rpx;
padding: 20rpx 24rpx;
background: #F8F9FA;
border-radius: 14rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.call-txt {
font-size: 26rpx;
color: #4B5563;
}
.call-btn {
display: flex;
align-items: center;
padding: 8rpx 18rpx;
background: #E8F5E9;
border-radius: 20rpx;
}
.phone-ico {
width: 24rpx;
height: 24rpx;
margin-right: 6rpx;
}
.call-btn-txt {
font-size: 24rpx;
color: #2E7D32;
font-weight: 600;
}
.modal-foot {
padding-top: 24rpx;
}
.confirm-btn {
height: 88rpx;
border-radius: 44rpx;
background: linear-gradient(135deg, #F98D25 0%, #ED6F0E 100%);
display: flex;
align-items: center;
justify-content: center;
}
.confirm-txt {
color: #FFFFFF;
font-size: 30rpx;
font-weight: 600;
}
.confirm-btn.disabled {
opacity: 0.6;
}
</style>