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),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
508 行
11 KiB
Vue
508 行
11 KiB
Vue
<template>
|
||
<view class="page">
|
||
<YjyfNavBar theme="orange" title="报价管理" />
|
||
|
||
<!-- 针对特定工单提交报价 -->
|
||
<view class="card form-card" v-if="orderId">
|
||
<view class="card-head">
|
||
<text class="card-title">提交工单报价</text>
|
||
<text class="card-tip">工单 #{{ orderId }}</text>
|
||
</view>
|
||
<view class="fi">
|
||
<text class="fk">报价金额</text>
|
||
<input class="fv" type="digit" v-model="amount" placeholder="请输入您的全包报价(元)" />
|
||
</view>
|
||
<view class="fi">
|
||
<text class="fk">报价有效期</text>
|
||
<view class="seg">
|
||
<view
|
||
v-for="h in [24, 48, 72]"
|
||
:key="h"
|
||
class="seg-i clickable-hover"
|
||
:class="{ on: hours === h }"
|
||
@tap="hours = h"
|
||
>{{ h }}小时</view>
|
||
</view>
|
||
</view>
|
||
<textarea class="ta" v-model="desc" maxlength="200" placeholder="服务说明:包含施工内容、辅材配件、预计上门时间等" />
|
||
<view class="btn clickable-hover" :class="{ disabled: submitting }" @tap="submitQuote">
|
||
{{ submitting ? '提交中...' : '确认提交报价' }}
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 状态筛选栏 -->
|
||
<view class="tabs-bar" v-if="list.length">
|
||
<view
|
||
class="tab-item clickable-hover"
|
||
:class="{ active: activeFilter === f.val }"
|
||
v-for="f in filters"
|
||
:key="f.val"
|
||
@tap="activeFilter = f.val"
|
||
>
|
||
<text class="tab-txt">{{ f.label }}</text>
|
||
<view class="tab-line" v-if="activeFilter === f.val"></view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 独立报价卡片列表(点击直达工单详情) -->
|
||
<view class="q-list" v-if="filteredList.length">
|
||
<view
|
||
class="q-card clickable-hover"
|
||
v-for="q in filteredList"
|
||
:key="q.id"
|
||
@tap="goOrderDetail(q)"
|
||
>
|
||
<view class="q-top">
|
||
<text class="q-svc">{{ q.service_name || '服务工单' }}</text>
|
||
<text class="q-status" :class="'st-' + q.status">{{ q.status_text }}</text>
|
||
</view>
|
||
|
||
<view class="q-body">
|
||
<view class="q-info">
|
||
<text class="q-meta">工单号:{{ q.order_no }}</text>
|
||
<text class="q-meta">提交于 {{ q.time_text }} · 有效期至 {{ q.expire_text }}</text>
|
||
<text class="q-desc" v-if="q.description">报价说明:{{ q.description }}</text>
|
||
</view>
|
||
<view class="amt-box">
|
||
<text class="amt-label">我的出价</text>
|
||
<view class="amt-val-row">
|
||
<text class="amt-symbol">¥</text>
|
||
<text class="q-amt">{{ Number(q.amount || 0).toFixed(2) }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="q-foot">
|
||
<text class="foot-hint">{{ q.status === 'accept' ? '客户已选定您的报价,点击前往履约' : '点击查看原工单需求详情' }}</text>
|
||
<view class="foot-link">
|
||
<text class="foot-link-txt">{{ q.status === 'accept' ? '去履约' : '工单详情' }}</text>
|
||
<image class="arrow-ico" src="/static/icons/arrow-right-orange.svg" mode="aspectFit" />
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 空状态引导 -->
|
||
<view class="empty-state" v-else-if="!loading">
|
||
<image class="empty-img" src="/static/icons/master/empty-quote.svg" mode="aspectFit" />
|
||
<text class="empty-title">{{ list.length ? '该状态下暂无报价记录' : '暂无报价记录' }}</text>
|
||
<text class="empty-sub">前往抢单大厅查看支持师傅竞价的工单</text>
|
||
<view class="go-hall-btn clickable-hover" @tap="goHall">前往抢单大厅</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed } from 'vue';
|
||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||
import YjyfNavBar from '@/components/YjyfNavBar.vue';
|
||
import api from '@/utils/api.js';
|
||
|
||
const filters = [
|
||
{ label: '全部', val: 'all' },
|
||
{ label: '待选标', val: 'wait' },
|
||
{ label: '已选中', val: 'accept' },
|
||
{ label: '未选中', val: 'reject' }
|
||
];
|
||
|
||
const activeFilter = ref('all');
|
||
const list = ref([]);
|
||
const loading = ref(false);
|
||
const amount = ref('');
|
||
const desc = ref('');
|
||
const hours = ref(24);
|
||
const submitting = ref(false);
|
||
const orderId = ref(0);
|
||
|
||
const filteredList = computed(() => {
|
||
if (activeFilter.value === 'all') return list.value;
|
||
return list.value.filter((q) => q.status === activeFilter.value);
|
||
});
|
||
|
||
async function load() {
|
||
loading.value = true;
|
||
try {
|
||
const res = await api.masterQuotes();
|
||
list.value = (res && res.list) ? res.list : [];
|
||
} catch (e) {
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
|
||
function goOrderDetail(q) {
|
||
if (!q || !q.order_id) return;
|
||
uni.navigateTo({ url: `/pages/master/detail?id=${q.order_id}` });
|
||
}
|
||
|
||
function goHall() {
|
||
uni.reLaunch({ url: '/pages/master/hall' });
|
||
}
|
||
|
||
async function submitQuote() {
|
||
if (submitting.value) return;
|
||
if (!amount.value || Number(amount.value) <= 0) {
|
||
uni.showToast({ title: '请填写有效报价金额', icon: 'none' });
|
||
return;
|
||
}
|
||
submitting.value = true;
|
||
try {
|
||
await api.masterQuote({
|
||
order_id: orderId.value,
|
||
amount: Number(amount.value),
|
||
description: desc.value.trim(),
|
||
valid_hours: hours.value
|
||
});
|
||
uni.showToast({ title: '报价提交成功' });
|
||
amount.value = '';
|
||
desc.value = '';
|
||
orderId.value = 0;
|
||
load();
|
||
} catch (e) {
|
||
} finally {
|
||
submitting.value = false;
|
||
}
|
||
}
|
||
|
||
onLoad((o) => {
|
||
if (o && o.order_id) {
|
||
orderId.value = Number(o.order_id);
|
||
}
|
||
});
|
||
|
||
onShow(() => load());
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
@import '@/uni.scss';
|
||
.page {
|
||
min-height: 100vh;
|
||
background: $yjyf-bg-page;
|
||
padding-bottom: calc(48rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.card {
|
||
margin: 24rpx;
|
||
padding: 28rpx;
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-card;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
|
||
.card-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.card-title {
|
||
font-size: $yjyf-font-md;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.card-tip {
|
||
font-size: $yjyf-font-xs;
|
||
color: $yjyf-primary;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.fi {
|
||
display: flex;
|
||
align-items: center;
|
||
min-height: 88rpx;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
}
|
||
|
||
.fk {
|
||
width: 176rpx;
|
||
font-size: $yjyf-font-base;
|
||
color: $yjyf-text-regular;
|
||
}
|
||
|
||
.fv {
|
||
flex: 1;
|
||
height: 88rpx;
|
||
font-size: $yjyf-font-base;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.seg {
|
||
display: flex;
|
||
gap: 12rpx;
|
||
}
|
||
|
||
.seg-i {
|
||
padding: 0 24rpx;
|
||
height: 56rpx;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: $yjyf-radius-pill;
|
||
background: $yjyf-bg-page;
|
||
font-size: $yjyf-font-sm;
|
||
color: $yjyf-text-regular;
|
||
|
||
&.on {
|
||
background: $yjyf-gradient-primary;
|
||
color: $yjyf-text-inverse;
|
||
font-weight: 600;
|
||
}
|
||
}
|
||
|
||
.ta {
|
||
width: 100%;
|
||
height: 156rpx;
|
||
margin-top: 20rpx;
|
||
padding: 18rpx;
|
||
box-sizing: border-box;
|
||
background: $yjyf-bg-page;
|
||
border-radius: $yjyf-radius-md;
|
||
font-size: $yjyf-font-sm;
|
||
color: $yjyf-text-main;
|
||
line-height: 1.5;
|
||
}
|
||
|
||
.btn {
|
||
height: 84rpx;
|
||
margin-top: 24rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: $yjyf-radius-pill;
|
||
color: $yjyf-text-inverse;
|
||
font-size: $yjyf-font-base;
|
||
font-weight: 700;
|
||
background: $yjyf-gradient-primary;
|
||
box-shadow: $yjyf-shadow-button;
|
||
|
||
&.disabled {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
|
||
.tabs-bar {
|
||
background: $yjyf-bg-card;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-around;
|
||
}
|
||
|
||
.tab-item {
|
||
position: relative;
|
||
height: 84rpx;
|
||
padding: 0 20rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.tab-txt {
|
||
font-size: $yjyf-font-base;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
|
||
.tab-item.active .tab-txt {
|
||
color: $yjyf-primary;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.tab-line {
|
||
position: absolute;
|
||
bottom: 0;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
width: 40rpx;
|
||
height: 6rpx;
|
||
border-radius: 3rpx;
|
||
background: $yjyf-primary;
|
||
}
|
||
|
||
.q-list {
|
||
padding: 24rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.q-card {
|
||
background: $yjyf-bg-card;
|
||
border-radius: $yjyf-radius-card;
|
||
padding: 28rpx;
|
||
box-shadow: $yjyf-shadow-card;
|
||
}
|
||
|
||
.q-top {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 16rpx;
|
||
padding-bottom: 18rpx;
|
||
border-bottom: 1rpx solid $yjyf-border-color;
|
||
}
|
||
|
||
.q-svc {
|
||
flex: 1;
|
||
min-width: 0;
|
||
font-size: $yjyf-font-md;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.q-status {
|
||
padding: 6rpx 18rpx;
|
||
border-radius: $yjyf-radius-pill;
|
||
background: rgba(74, 124, 255, 0.1);
|
||
color: $yjyf-info;
|
||
font-size: $yjyf-font-xs;
|
||
font-weight: 600;
|
||
flex-shrink: 0;
|
||
|
||
&.st-accept {
|
||
background: rgba(47, 168, 79, 0.1);
|
||
color: $yjyf-success;
|
||
}
|
||
|
||
&.st-reject,
|
||
&.st-expired {
|
||
background: $yjyf-bg-page;
|
||
color: $yjyf-text-muted;
|
||
}
|
||
}
|
||
|
||
.q-body {
|
||
padding: 20rpx 0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.q-info {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8rpx;
|
||
}
|
||
|
||
.q-meta {
|
||
font-size: $yjyf-font-xs;
|
||
color: $yjyf-text-secondary;
|
||
}
|
||
|
||
.q-desc {
|
||
font-size: $yjyf-font-sm;
|
||
color: $yjyf-text-regular;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
|
||
.amt-box {
|
||
text-align: right;
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
gap: 4rpx;
|
||
}
|
||
|
||
.amt-label {
|
||
font-size: $yjyf-font-xs;
|
||
color: $yjyf-text-muted;
|
||
}
|
||
|
||
.amt-val-row {
|
||
display: flex;
|
||
align-items: baseline;
|
||
}
|
||
|
||
.amt-symbol {
|
||
font-size: $yjyf-font-sm;
|
||
font-weight: 700;
|
||
color: $yjyf-primary;
|
||
}
|
||
|
||
.q-amt {
|
||
font-size: 36rpx;
|
||
font-weight: 800;
|
||
color: $yjyf-primary;
|
||
}
|
||
|
||
.q-foot {
|
||
padding-top: 18rpx;
|
||
border-top: 1rpx solid $yjyf-border-color;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.foot-hint {
|
||
font-size: $yjyf-font-xs;
|
||
color: $yjyf-text-muted;
|
||
}
|
||
|
||
.foot-link {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6rpx;
|
||
}
|
||
|
||
.foot-link-txt {
|
||
font-size: $yjyf-font-sm;
|
||
font-weight: 600;
|
||
color: $yjyf-primary;
|
||
}
|
||
|
||
.arrow-ico {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
}
|
||
|
||
.empty-state {
|
||
padding: 160rpx 48rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.empty-img {
|
||
width: 180rpx;
|
||
height: 180rpx;
|
||
}
|
||
|
||
.empty-title {
|
||
font-size: $yjyf-font-md;
|
||
font-weight: 700;
|
||
color: $yjyf-text-main;
|
||
}
|
||
|
||
.empty-sub {
|
||
font-size: $yjyf-font-sm;
|
||
color: $yjyf-text-secondary;
|
||
text-align: center;
|
||
}
|
||
|
||
.go-hall-btn {
|
||
margin-top: 20rpx;
|
||
height: 76rpx;
|
||
padding: 0 48rpx;
|
||
border-radius: $yjyf-radius-pill;
|
||
background: $yjyf-gradient-primary;
|
||
color: $yjyf-text-inverse;
|
||
font-size: $yjyf-font-base;
|
||
font-weight: 700;
|
||
box-shadow: $yjyf-shadow-button;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
</style>
|