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

158 行
6.2 KiB
Vue

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

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

<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 }}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="card">
<view class="card-head">
<text class="card-title">我的报价记录</text>
<text class="card-more" v-if="list.length">{{ list.length }} 条记录</text>
</view>
<view class="q-list" v-if="list.length">
<view class="q-item" v-for="q in list" :key="q.id">
<view class="q-top">
<text class="q-svc">{{ q.service_name || '服务工单' }}</text>
<view class="amt-box">
<text class="amt-symbol">¥</text>
<text class="q-amt">{{ q.amount }}</text>
</view>
</view>
<text class="q-meta">工单号:{{ q.order_no }} · 提交于 {{ q.time_text }}</text>
<text class="q-meta">有效期至:{{ q.expire_text }}</text>
<view class="status-wrap">
<text class="q-status">{{ q.status_text }}</text>
</view>
</view>
</view>
<!-- 报价为空引导 -->
<view class="empty-state" v-else>
<image class="empty-img" src="/static/icons/master/empty-orders.svg" mode="aspectFit" />
<text class="empty-title">暂无任何报价记录</text>
<text class="empty-sub">去订单大厅寻找支持师傅自主报价的工单吧</text>
<view class="go-hall-btn clickable-hover" @tap="goHall">前往订单大厅</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onShow, onLoad } from '@dcloudio/uni-app';
import api from '@/utils/api.js';
const list = ref([]);
const amount = ref('');
const desc = ref('');
const hours = ref(24);
const submitting = ref(false);
const orderId = ref(0);
async function load() {
try {
const res = await api.masterQuotes();
list.value = res.list || [];
} catch (e) {}
}
function goHall() {
uni.redirectTo({ 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: amount.value,
description: desc.value,
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 scoped>
.page { min-height: 100vh; background: #F5F6F8; padding: 22rpx 28rpx 60rpx; }
.card { padding: 24rpx; background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,.06); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12rpx; }
.card-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
.card-tip { font-size: 22rpx; color: #F0710D; font-weight: 600; }
.card-more { font-size: 22rpx; color: #9A9A9A; }
.fi { display: flex; align-items: center; min-height: 88rpx; border-bottom: 1rpx solid #F4F4F4; }
.fk { width: 170rpx; font-size: 26rpx; color: #666; }
.fv { flex: 1; height: 88rpx; font-size: 28rpx; color: #222; }
.seg { display: flex; }
.seg-i { padding: 0 24rpx; line-height: 54rpx; margin-right: 12rpx; border-radius: 27rpx; background: #F5F5F5; font-size: 24rpx; color: #666; }
.seg-i.on { background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); color: #fff; font-weight: 600; }
.ta { width: 100%; height: 150rpx; margin-top: 16rpx; padding: 14rpx; box-sizing: border-box; background: #FAFAFA; border-radius: 12rpx; font-size: 26rpx; color: #333; line-height: 38rpx; }
.btn { height: 84rpx; margin-top: 20rpx; display: flex; align-items: center; justify-content: center; border-radius: 42rpx; color: #fff; font-size: 28rpx; font-weight: 600; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); box-shadow: 0 6rpx 16rpx rgba(240,113,13,0.25); }
.btn.disabled { opacity: .7; }
.q-item { padding: 20rpx 0; border-bottom: 1rpx solid #F4F4F4; display: flex; flex-direction: column; }
.q-item:last-child { border-bottom: none; }
.q-top { display: flex; align-items: baseline; justify-content: space-between; }
.q-svc { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
.amt-box { display: flex; align-items: baseline; }
.amt-symbol { font-size: 24rpx; font-weight: 700; color: #F0710D; }
.q-amt { font-size: 34rpx; font-weight: 700; color: #F0710D; }
.q-meta { margin-top: 6rpx; font-size: 22rpx; color: #8A8A8E; }
.status-wrap { margin-top: 10rpx; }
.q-status { display: inline-block; padding: 4rpx 16rpx; border-radius: 16rpx; background: #EAF2FF; color: #4A7CFF; font-size: 22rpx; font-weight: 500; }
/* 空状态 */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 80rpx 20rpx 30rpx; }
.empty-img { width: 150rpx; height: 150rpx; margin-bottom: 20rpx; }
.empty-title { font-size: 28rpx; font-weight: 600; color: #333; margin-bottom: 8rpx; }
.empty-sub { font-size: 22rpx; color: #9A9A9A; text-align: center; margin-bottom: 28rpx; }
.go-hall-btn {
padding: 0 44rpx; height: 68rpx; line-height: 68rpx; border-radius: 34rpx;
background: #FFF3E6; color: #F0710D; font-size: 26rpx; font-weight: 600;
}
</style>