index.vue
3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
<view class="page-evaluate">
<view class="evaluate-user-box">
<view class="user-info-title">
<u-avatar :src="pic" size="70"></u-avatar>
<view class="user-name">
居民用户
</view>
</view>
<view v-if="evaluateUser" class="evaluate-content">
<view class="evaluate-score">
<u-icon v-for="todo in maxStar" :name="evaluateUser.garEvaluateScore > todo ? 'star-fill' : 'star'" :key="todo"
color="#f9ae3d" size="28"></u-icon>
</view>
<view class="evaluate-txt">
{{ evaluateUser.garEvaluateContent }}
</view>
</view>
<view class="evaluate-empty" v-else>
暂无评价~~
</view>
</view>
<view class="evaluate-user-box">
<view class="user-info-title">
<u-avatar :src="pic" size="70"></u-avatar>
<view class="user-name">
企业负责人
</view>
</view>
<view v-if="evaluateManager" class="evaluate-content">
<view class="evaluate-score">
<u-icon v-for="todo in maxStar" :name="evaluateManager.garEvaluateScore > todo ? 'star-fill' : 'star'"
:key="todo" color="#f9ae3d" size="28"></u-icon>
</view>
<view class="evaluate-txt">
{{ evaluateManager.garEvaluateContent }}
</view>
</view>
<view class="evaluate-empty" v-else>
暂无评价~~
</view>
</view>
</view>
</template>
<script setup>
import { queryEvaluateDetail } from "@/apis/evaluate";
import headImg from "@/static/image/st_pic.png";
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
const pic = ref(headImg)
// 定义最大积分
let maxScore = 5
const maxStar = ref([])
// 用户评价对象
const evaluateUser = ref()
// 企业负责人评价
const evaluateManager = ref()
onLoad((options) => {
for (let index = 0; index < maxScore; index++) {
maxStar.value.push(index);
}
// 查询评价
queryEvaluateDetail(options.orderId).then(res => {
res.data.data.forEach(element => {
if (element.garEvaluateTarget == 0) {
evaluateUser.value = element
}
if (element.garEvaluateTarget == 1) {
evaluateManager.value = element
}
});
})
})
</script>
<style lang="scss" scoped>
$page-padding: 20rpx;
.page-evaluate {
height: 100%;
width: 100%;
padding: $page-padding;
background-color: #ffffff;
box-sizing: border-box;
.evaluate-user-box {
box-sizing: border-box;
color: $u-main-color;
width: 100%;
padding: $page-padding;
border-radius: $page-padding;
border: 2rpx solid $u-border-color;
margin: 40rpx 0;
min-height: 300rpx;
.user-info-title {
display: flex;
align-items: center;
.user-name {
margin-left: 20rpx;
box-sizing: border-box;
}
}
.evaluate-content {
margin: 20rpx 0;
box-sizing: border-box;
.evaluate-score {
display: flex;
}
.evaluate-txt {
color: $u-info;
}
}
.evaluate-empty {
margin: 20rpx 0;
box-sizing: border-box;
color: $u-info;
}
}
}
</style>