- 下单页新增计价方式选择;自主定价填写总价,师傅报价单进入报价大厅 - 用户订单详情展示师傅报价列表并可选定师傅;选定后同步师傅、金额与订单状态 - 师傅大厅新增用户定价筛选与按价接单;报价单禁止直接抢单 - 后端订单新增 custom 价态、金额口径统一由 calcAmount 输出 - 报价中状态纳入用户可取消范围;超时回流重新开放报价 - 新增 fa_order.price_type custom 枚举迁移脚本(schema_phase6)
232 行
12 KiB
Vue
232 行
12 KiB
Vue
<template>
|
||
<view class="page" v-if="order">
|
||
<view class="hero">
|
||
<text class="hero-status">{{ order.status_text }}</text>
|
||
<text class="hero-tip">{{ statusTip }}</text>
|
||
</view>
|
||
|
||
<view class="card" v-if="master">
|
||
<view class="card-title">服务师傅</view>
|
||
<view class="master">
|
||
<view class="avatar"><text class="avatar-txt">{{ (master.realname || '师').slice(0, 1) }}</text></view>
|
||
<view class="m-info">
|
||
<text class="m-name">{{ master.realname }}</text>
|
||
<text class="m-sub">评分 {{ master.score }} · 完成 {{ master.order_count }} 单</text>
|
||
</view>
|
||
<text class="m-mobile">{{ master.mobile }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-title">服务信息</view>
|
||
<view class="li"><text class="k">服务项目</text><text class="v">{{ order.service_name }}</text></view>
|
||
<view class="li"><text class="k">订单号</text><text class="v">{{ order.order_no }}</text></view>
|
||
<view class="li"><text class="k">联系人</text><text class="v">{{ order.contact }} {{ order.mobile }}</text></view>
|
||
<view class="li"><text class="k">服务地址</text><text class="v">{{ order.province }}{{ order.city }}{{ order.district }}{{ order.address }}</text></view>
|
||
<view class="li"><text class="k">楼层</text><text class="v">{{ order.floor }} 层 · {{ Number(order.has_elevator) ? '有电梯' : '无电梯' }}</text></view>
|
||
<view class="li"><text class="k">预约时间</text><text class="v">{{ order.appoint_text }}</text></view>
|
||
<view class="li" v-if="order.goods_model"><text class="k">商品型号</text><text class="v">{{ order.goods_model }}</text></view>
|
||
<view class="li" v-if="order.remark"><text class="k">备注</text><text class="v">{{ order.remark }}</text></view>
|
||
<view class="li" v-if="Number(order.urgent)"><text class="k">加急</text><text class="v">是(+20%)</text></view>
|
||
</view>
|
||
|
||
<view class="card" v-if="order.price_type === 'quote'">
|
||
<view class="card-head">
|
||
<text class="card-title">师傅报价</text>
|
||
<text class="card-refresh" @tap="load">刷新</text>
|
||
</view>
|
||
<view class="quote-tip" v-if="order.status === 2 && quotes.length">已有 {{ quotes.length }} 位师傅报价,选择后师傅将上门服务</view>
|
||
<view class="quote-empty" v-if="!quotes.length">暂无师傅报价,请稍候…</view>
|
||
<view class="quote-item" v-for="q in quotes" :key="q.id" :class="{ chosen: q.status === 'accept' }">
|
||
<view class="q-top">
|
||
<view class="q-master">
|
||
<text class="q-name">{{ q.realname }}</text>
|
||
<text class="q-meta">评分 {{ q.score }} · 完成 {{ q.order_count }} 单</text>
|
||
</view>
|
||
<text class="q-amt">¥{{ q.amount }}</text>
|
||
</view>
|
||
<text class="q-desc" v-if="q.description">{{ q.description }}</text>
|
||
<view class="q-foot">
|
||
<text class="q-expire">有效期至 {{ q.expire_text }}</text>
|
||
<text class="q-status" :class="'qs-' + q.status">{{ q.status_text }}</text>
|
||
<view class="q-choose" v-if="canChoose && q.status === 'wait'" @tap="chooseQuote(q)">选择该师傅</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-title">费用明细</view>
|
||
<view class="li"><text class="k">计价方式</text><text class="v">{{ order.price_type_text }}</text></view>
|
||
<view class="li"><text class="k">{{ order.price_type === 'custom' ? '您的出价' : (order.price_type === 'quote' && Number(order.master_id) > 0 ? '师傅报价' : '基础价') }}</text><text class="v">¥{{ order.base_amount }}</text></view>
|
||
<view class="li" v-if="Number(order.floor_amount) > 0"><text class="k">楼层费</text><text class="v">¥{{ order.floor_amount }}</text></view>
|
||
<view class="li" v-if="Number(order.urgent_amount) > 0"><text class="k">加急费</text><text class="v">¥{{ order.urgent_amount }}</text></view>
|
||
<view class="li" v-if="Number(order.discount_amount) > 0"><text class="k">优惠券抵扣</text><text class="v">-¥{{ order.discount_amount }}</text></view>
|
||
<view class="li"><text class="k">实付</text><text class="v big">¥{{ order.pay_amount }}</text></view>
|
||
</view>
|
||
|
||
<view class="card">
|
||
<view class="card-title">订单轨迹</view>
|
||
<view class="tl" v-for="(l, i) in logs" :key="i">
|
||
<view class="dot" :class="{ on: i === logs.length - 1 }"></view>
|
||
<view class="tl-body">
|
||
<text class="tl-s">{{ l.status_text }}</text>
|
||
<text class="tl-r">{{ l.remark }}</text>
|
||
<text class="tl-t">{{ l.time_text }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="card" v-if="media.length">
|
||
<view class="card-title">现场取证</view>
|
||
<view class="media">
|
||
<view class="media-i" v-for="(m, i) in media" :key="i">
|
||
<text class="media-txt">{{ m.stage === 'damage' ? '损坏申报' : '完工照片' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="bar">
|
||
<view class="op" v-if="order.can_cancel" @tap="cancel">取消订单</view>
|
||
<view class="op primary" v-if="order.can_pay" @tap="pay">去支付</view>
|
||
<view class="op primary" v-if="order.can_verify" @tap="verify">确认验收</view>
|
||
<view class="op primary" v-if="order.can_review" @tap="review">去评价</view>
|
||
<view class="op" @tap="backHome">返回首页</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed } from 'vue';
|
||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||
import api from '@/utils/api.js';
|
||
|
||
const order = ref(null);
|
||
const master = ref(null);
|
||
const logs = ref([]);
|
||
const media = ref([]);
|
||
const quotes = ref([]);
|
||
let orderId = 0;
|
||
|
||
const statusTip = computed(() => {
|
||
if (!order.value) return '';
|
||
return order.value.status_tip || '';
|
||
});
|
||
|
||
const canChoose = computed(() => {
|
||
return !!(order.value && order.value.price_type === 'quote'
|
||
&& Number(order.value.status) === 2 && Number(order.value.master_id) === 0
|
||
&& quotes.value.some(q => q.status === 'wait'));
|
||
});
|
||
|
||
async function load() {
|
||
const res = await api.orderDetail(orderId);
|
||
order.value = res.order;
|
||
master.value = res.master;
|
||
logs.value = res.logs || [];
|
||
media.value = res.media || [];
|
||
quotes.value = res.quotes || [];
|
||
}
|
||
|
||
function chooseQuote(q) {
|
||
uni.showModal({
|
||
title: '选择服务师傅',
|
||
content: `确认选择 ${q.realname} 的报价 ¥${q.amount}?选定后师傅将与您联系`,
|
||
success: async (r) => {
|
||
if (!r.confirm) return;
|
||
try {
|
||
await api.orderChooseQuote({ order_id: orderId, quote_id: q.id });
|
||
toast('已选定师傅');
|
||
load();
|
||
} catch (e) {}
|
||
}
|
||
});
|
||
}
|
||
|
||
function toast(t) { uni.showToast({ title: t, icon: 'none' }); }
|
||
function backHome() { uni.reLaunch({ url: '/YJYF/YJYF' }); }
|
||
|
||
function cancel() {
|
||
uni.showModal({
|
||
title: '取消订单', content: '确认取消该订单?',
|
||
success: async (r) => {
|
||
if (!r.confirm) return;
|
||
try { await api.orderCancel({ order_id: orderId, reason: '用户取消' }); toast('已取消'); load(); } catch (e) {}
|
||
}
|
||
});
|
||
}
|
||
async function pay() {
|
||
try { await api.orderPay({ order_id: orderId, pay_type: 'mock' }); toast('支付成功'); load(); } catch (e) {}
|
||
}
|
||
function verify() {
|
||
uni.showModal({
|
||
title: '确认验收', content: '验收后平台将向师傅结算,确认服务已完成?',
|
||
success: async (r) => {
|
||
if (!r.confirm) return;
|
||
try { await api.orderVerify({ order_id: orderId }); toast('验收成功'); load(); } catch (e) {}
|
||
}
|
||
});
|
||
}
|
||
function review() { uni.navigateTo({ url: '/pages/order/review?id=' + orderId }); }
|
||
|
||
onLoad((o) => { orderId = Number(o.id || 0); });
|
||
onShow(() => { if (orderId) load(); });
|
||
</script>
|
||
<style scoped>
|
||
.page { min-height: 100vh; background: #F5F6F8; padding-bottom: 160rpx; }
|
||
.hero { padding: 40rpx 36rpx; background: linear-gradient(160deg, #FFB85C 0%, #F98D25 60%, #ED6F0E 100%); }
|
||
.hero-status { display: block; font-size: 40rpx; font-weight: 700; color: #fff; letter-spacing: 2rpx; }
|
||
.hero-tip { display: block; margin-top: 10rpx; font-size: 24rpx; color: rgba(255,255,255,0.9); }
|
||
.card { margin: 22rpx 28rpx 0; padding: 24rpx; background: #fff; border-radius: 20rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06); }
|
||
.card-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; margin-bottom: 12rpx; }
|
||
.card-head { display: flex; align-items: center; justify-content: space-between; }
|
||
.card-refresh { font-size: 22rpx; color: #F0710D; }
|
||
.quote-tip { margin-bottom: 10rpx; padding: 12rpx 16rpx; border-radius: 12rpx; background: #FFF3E6; font-size: 22rpx; color: #C07A3A; line-height: 30rpx; }
|
||
.quote-empty { padding: 30rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
|
||
.quote-item { padding: 18rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.quote-item:last-child { border-bottom: none; }
|
||
.quote-item.chosen { background: #FFFBF6; border-radius: 12rpx; padding: 18rpx 14rpx; }
|
||
.q-top { display: flex; align-items: flex-start; justify-content: space-between; }
|
||
.q-master { display: flex; flex-direction: column; }
|
||
.q-name { font-size: 28rpx; font-weight: 700; color: #222; }
|
||
.q-meta { margin-top: 4rpx; font-size: 21rpx; color: #9A9A9A; }
|
||
.q-amt { font-size: 34rpx; font-weight: 700; color: #F0710D; }
|
||
.q-desc { display: block; margin-top: 10rpx; font-size: 23rpx; color: #666; line-height: 32rpx; }
|
||
.q-foot { display: flex; align-items: center; margin-top: 10rpx; }
|
||
.q-expire { flex: 1; font-size: 20rpx; color: #B5B5B5; }
|
||
.q-status { font-size: 21rpx; color: #9A9A9A; margin-right: 14rpx; }
|
||
.q-status.qs-wait { color: #4A7CFF; }
|
||
.q-status.qs-accept { color: #2FA84F; }
|
||
.q-status.qs-reject, .q-status.qs-expired { color: #B5B5B5; }
|
||
.q-choose { padding: 0 24rpx; line-height: 56rpx; border-radius: 28rpx; color: #fff; font-size: 23rpx; font-weight: 600; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); }
|
||
.li { display: flex; justify-content: space-between; padding: 12rpx 0; border-bottom: 1rpx solid #F4F4F4; }
|
||
.k { flex-shrink: 0; width: 150rpx; font-size: 26rpx; color: #666; }
|
||
.v { flex: 1; text-align: right; font-size: 26rpx; color: #333; line-height: 36rpx; }
|
||
.v.big { font-size: 34rpx; font-weight: 700; color: #F0710D; }
|
||
.master { display: flex; align-items: center; }
|
||
.avatar { width: 76rpx; height: 76rpx; border-radius: 50%; background: #FFF1E3; display: flex; align-items: center; justify-content: center; }
|
||
.avatar-txt { font-size: 30rpx; font-weight: 700; color: #E88A2C; }
|
||
.m-info { flex: 1; margin-left: 16rpx; display: flex; flex-direction: column; }
|
||
.m-name { font-size: 28rpx; font-weight: 600; color: #222; }
|
||
.m-sub { margin-top: 4rpx; font-size: 22rpx; color: #9A9A9A; }
|
||
.m-mobile { font-size: 24rpx; color: #666; }
|
||
.tl { display: flex; padding: 10rpx 0; }
|
||
.dot { width: 14rpx; height: 14rpx; margin: 8rpx 16rpx 0 0; border-radius: 50%; background: #E0E0E0; flex-shrink: 0; }
|
||
.dot.on { background: #F0710D; box-shadow: 0 0 0 6rpx rgba(240,113,13,0.15); }
|
||
.tl-body { flex: 1; display: flex; flex-direction: column; }
|
||
.tl-s { font-size: 26rpx; font-weight: 600; color: #333; }
|
||
.tl-r { margin-top: 2rpx; font-size: 22rpx; color: #9A9A9A; }
|
||
.tl-t { margin-top: 2rpx; font-size: 20rpx; color: #C4C4C4; }
|
||
.media { display: flex; flex-wrap: wrap; }
|
||
.media-i { width: 150rpx; height: 110rpx; margin: 0 12rpx 12rpx 0; border-radius: 12rpx; background: linear-gradient(160deg,#FFF7F0,#FCE9D6); display: flex; align-items: center; justify-content: center; }
|
||
.media-txt { font-size: 20rpx; color: #B85E2A; }
|
||
.bar {
|
||
position: fixed; left: 0; right: 0; bottom: 0; height: 118rpx;
|
||
padding: 0 24rpx; padding-bottom: env(safe-area-inset-bottom);
|
||
display: flex; align-items: center; justify-content: flex-end;
|
||
background: #fff; box-shadow: 0 -6rpx 24rpx rgba(0,0,0,0.07);
|
||
}
|
||
.op { margin-left: 16rpx; padding: 0 28rpx; line-height: 68rpx; border-radius: 34rpx; border: 2rpx solid #DDD; font-size: 26rpx; color: #666; }
|
||
.op.primary { border-color: #F0710D; color: #fff; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); }
|
||
</style>
|
||
|