文件
yjyf/pages/order/review.vue
linda 78722b3912 feat(ui): 登录起全链路页面接通 + 逐页面验证(47 项)+ 修复订单列表越权泄漏
前端:
- utils/request.js 统一请求层(token/错误码/401 引导登录)
- utils/api.js 接口清单(与后端控制器一一对应)
- pages/login 登录(手机号+验证码+角色选择)
- pages/service/list|detail 服务列表/详情
- pages/order/create 下单(地址/预约/急单/费用试算/自动支付)
- pages/order/list|detail|review 订单列表/详情轨迹/评价
- pages/master/apply|hall|orders 师傅入驻/订单大厅/接单履约
- YJYF/YJYF 首页接 home/index 真实类目 + 路由跳转

后端 Bug 修复(严重):
- TP5 中 count() 会重置查询条件,导致 Order::index / Master::hall / Master::orders
  在 select 时丢失 where 条件 → 泄漏全部用户订单/跨用户数据
- 改为闭包重建查询,已验证修复
2026-10-28 15:52:39 +08:00

100 行
3.6 KiB
Vue

<template>
<view class="page">
<view class="card">
<view class="title">给本次服务打分</view>
<view class="stars">
<text v-for="i in 5" :key="i" class="star" :class="{ on: i <= score }" @tap="score = i">★</text>
</view>
<text class="score-txt">{{ scoreText }}</text>
</view>
<view class="card">
<view class="title">服务标签</view>
<view class="tags">
<view v-for="t in tagList" :key="t" class="tag" :class="{ on: tags.indexOf(t) > -1 }" @tap="toggleTag(t)">
<text class="tag-txt">{{ t }}</text>
</view>
</view>
</view>
<view class="card">
<view class="title">评价内容</view>
<textarea class="ta" v-model="content" maxlength="200" placeholder="说说师傅的服务、专业度和态度..." />
<view class="anon">
<text class="anon-txt">匿名评价</text>
<switch :checked="anonymous" color="#F0710D" @change="e => (anonymous = e.detail.value)" />
</view>
</view>
<view class="submit" :class="{ disabled: submitting }" @tap="submit">{{ submitting ? '提交中...' : '提交评价' }}</view>
</view>
</template>
<script setup>
import { ref, computed } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import api from '@/utils/api.js';
const score = ref(5);
const tags = ref([]);
const content = ref('');
const anonymous = ref(false);
const submitting = ref(false);
const tagList = ['准时', '专业', '态度好', '收费透明', '干净利落', '值得推荐'];
let orderId = 0;
const scoreText = computed(() => ['', '非常不满意', '不满意', '一般', '满意', '非常满意'][score.value]);
function toggleTag(t) {
const i = tags.value.indexOf(t);
if (i > -1) tags.value.splice(i, 1);
else tags.value.push(t);
}
async function submit() {
if (submitting.value) return;
submitting.value = true;
try {
await api.reviewCreate({
order_id: orderId,
score: score.value,
content: content.value,
tags: tags.value.join(','),
is_anonymous: anonymous.value ? 1 : 0
});
uni.showToast({ title: '评价成功' });
setTimeout(() => uni.navigateBack(), 600);
} catch (e) {
} finally {
submitting.value = false;
}
}
onLoad((o) => { orderId = Number(o.id || 0); });
</script>
<style scoped>
.page { min-height: 100vh; background: #F5F6F8; padding: 22rpx 28rpx 60rpx; }
.card { padding: 26rpx 24rpx; background: #fff; border-radius: 20rpx; margin-bottom: 20rpx; box-shadow: 0 6rpx 20rpx rgba(240,129,31,0.06); }
.title { font-size: 28rpx; font-weight: 700; color: #1F1F1F; }
.stars { display: flex; justify-content: center; padding: 20rpx 0 8rpx; }
.star { font-size: 60rpx; color: #E6E6E6; margin: 0 12rpx; }
.star.on { color: #FFB120; }
.score-txt { display: block; text-align: center; font-size: 24rpx; color: #F0710D; }
.tags { display: flex; flex-wrap: wrap; padding-top: 14rpx; }
.tag { padding: 0 22rpx; line-height: 56rpx; margin: 0 14rpx 14rpx 0; border-radius: 28rpx; background: #F5F5F5; }
.tag.on { background: #FFF3E6; }
.tag-txt { font-size: 24rpx; color: #666; }
.tag.on .tag-txt { color: #E36B0C; font-weight: 600; }
.ta { width: 100%; height: 180rpx; margin-top: 14rpx; font-size: 26rpx; color: #333; line-height: 38rpx; }
.anon { display: flex; align-items: center; justify-content: space-between; margin-top: 10rpx; }
.anon-txt { font-size: 26rpx; color: #666; }
.submit {
height: 96rpx; margin-top: 30rpx; display: flex; align-items: center; justify-content: center;
border-radius: 48rpx; color: #fff; font-size: 32rpx; font-weight: 600;
background: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
box-shadow: 0 10rpx 24rpx rgba(240,113,13,0.3);
}
.submit.disabled { opacity: 0.7; }
</style>