文件
yjyf/yjyf-app/pages/master/quote.vue

97 行
4.3 KiB
Vue

<template>
<view class="page">
<view class="card" v-if="orderId">
<view class="card-title">提交报价</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" :class="{ on: hours === h }" @tap="hours = h">{{ h }}h</view>
</view>
</view>
<textarea class="ta" v-model="desc" maxlength="200" placeholder="服务说明:包含项目、材料、预计工期" />
<view class="btn" :class="{ disabled: submitting }" @tap="submitQuote">{{ submitting ? '提交中...' : '提交报价' }}</view>
</view>
<view class="card">
<view class="card-head"><text class="card-title">我的报价记录</text><text class="card-more">{{ list.length }} 条</text></view>
<view class="q-item" v-for="q in list" :key="q.id">
<view class="q-top">
<text class="q-svc">{{ q.service_name || '订单' }}</text>
<text class="q-amt">¥{{ q.amount }}</text>
</view>
<text class="q-meta">{{ q.order_no }} · 提交 {{ q.time_text }}</text>
<text class="q-meta">有效期至 {{ q.expire_text }}</text>
<text class="q-status">{{ q.status_text }}</text>
</view>
<view class="empty" v-if="!list.length">暂无报价记录</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);
let orderId = 0;
async function load() {
try {
const res = await api.masterQuotes();
list.value = res.list || [];
} catch (e) {}
}
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, amount: amount.value, description: desc.value, valid_hours: hours.value });
uni.showToast({ title: '报价已提交' });
amount.value = '';
desc.value = '';
setTimeout(() => uni.navigateBack(), 600);
} catch (e) {
} finally {
submitting.value = false;
}
}
onLoad((o) => { orderId = Number(o.order_id || 0); });
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: 6rpx; }
.card-title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
.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: 56rpx; margin-right: 12rpx; border-radius: 28rpx; background: #F5F5F5; font-size: 24rpx; color: #666; }
.seg-i.on { background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); color: #fff; }
.ta { width: 100%; height: 150rpx; margin-top: 16rpx; font-size: 26rpx; color: #333; line-height: 38rpx; }
.btn { height: 88rpx; margin-top: 12rpx; display: flex; align-items: center; justify-content: center; border-radius: 44rpx; color: #fff; font-size: 30rpx; font-weight: 600; background: linear-gradient(135deg,#FFA93F 0%,#F0710D 100%); }
.btn.disabled { opacity: .7; }
.q-item { padding: 18rpx 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: 600; color: #1F1F1F; }
.q-amt { font-size: 32rpx; font-weight: 700; color: #F0710D; }
.q-meta { margin-top: 6rpx; font-size: 22rpx; color: #9A9A9A; }
.q-status { margin-top: 8rpx; font-size: 22rpx; color: #4A7CFF; }
.empty { padding: 60rpx 0; text-align: center; font-size: 24rpx; color: #9A9A9A; }
</style>