461 lines
13 KiB
Vue
Raw Normal View History

2025-04-09 17:25:08 +08:00
<template>
<div class="c-evaluate-warp">
<div class="evaluate-warp-top">
<div class="user-evaluate">
<div class="score">{{ score }}</div>
<div class="score-tips">
<div class="tips">用户评价</div>
2025-05-20 13:05:37 +08:00
<div class="score-val"><el-rate v-model="score" :allow-half="true" :colors="colors" size="large" :disabled="true" /></div>
2025-04-09 17:25:08 +08:00
</div>
</div>
<div v-for="(n, index) in totalList" :key="n.name" class="top-tag-btn" @click="selectLabel(n.name)">
<div class="tag-btn-warp">
<div class="tag-btn-pos" :class="currentlabel != n.name ? 'normal' : 'act'">
<span class="label-title">{{ n.title || '--' }}</span>
<span class="label-num">{{ n.num || 0 }}</span>
</div>
</div>
</div>
</div>
<div class="user-do-warp">
<div class="do-title">用户评价</div>
2025-05-20 13:05:37 +08:00
<div class="do-date"><el-rate v-model="score" allow-half="true" :colors="colors" size="large" :disabled="false" /></div>
2025-04-09 17:25:08 +08:00
<div class="do-title">评价内容</div>
<div class="do-fill">
<el-input v-model="remark" type="textarea" placeholder="质量好,品质过硬,值得推荐!"></el-input>
<!-- <upImg></upImg> -->
</div>
<div class="is-anonymous">
<div class="do-is" :class="isAnonymous ? 'do-is-act' : 'do-is-no'" @click="doAnonymous">
<div class="is-radio"></div>
<span class="do-is-txt">匿名评价</span>
</div>
<div class="do-submit">
<el-button type="primary" @click="submitEvaluate">提交评价</el-button>
</div>
</div>
</div>
<div class="evaluate-list">
<div class="list-content">
2025-06-09 10:59:28 +08:00
<template v-for="(e, index) in 1" :key="index">
2025-04-09 17:25:08 +08:00
<div class="evaluate-item">
<div class="evaluate-item-top">
<div class="user-info">
<div class="info-img">
2025-06-09 10:59:28 +08:00
<el-image :src="getAssetsFile('images/avatar.jfif')?.href ?? ''" fit="cover" />
2025-04-09 17:25:08 +08:00
</div>
<div class="info-txt">
<div class="info-txt-pos">
<div class="info-txt-c">
2025-06-09 10:59:28 +08:00
<div class="name">{{ mockData[currentMock].userName }}</div>
<div class="time">{{ mockData[currentMock].createTime }}</div>
2025-04-09 17:25:08 +08:00
</div>
</div>
</div>
</div>
<div class="score-val">
2025-06-09 10:59:28 +08:00
<el-rate :model-value="mockData[currentMock].stars" :colors="colors" size="large" :disabled="true" />
2025-04-09 17:25:08 +08:00
</div>
</div>
<div class="evaluate-item-content">
2025-06-09 10:59:28 +08:00
<div class="content-txt">{{ mockData[currentMock].content }}</div>
2025-04-09 17:25:08 +08:00
<div class="content-img">
2025-06-09 10:59:28 +08:00
<template v-for="(m, indexm) in 1" :key="indexm">
2025-04-09 17:25:08 +08:00
<div class="img-item">
2025-06-09 10:59:28 +08:00
<el-image :src="goodUrl ? goodUrl : ''" fit="cover" />
2025-04-09 17:25:08 +08:00
</div>
</template>
</div>
</div>
</div>
</template>
</div>
</div>
</div>
</template>
<script setup>
import { isEmpty, getAssetsFile } from '@/utils';
import { useRoute, useRouter } from 'vue-router';
import { ref, reactive, onMounted, watch } from 'vue';
import upImg from '@/components/upImg.vue';
2025-05-23 16:42:43 +08:00
import { agriculturalContent } from '@/apis/agricultural.js';
2025-04-09 17:25:08 +08:00
const route = useRoute();
const router = useRouter();
let score = ref(4.5);
2025-05-23 16:42:43 +08:00
const props = defineProps({
goodId: {
type: Number,
default: () => 0,
},
2025-06-09 10:59:28 +08:00
goodUrl: {
type: String,
default: () => '',
},
2025-05-23 16:42:43 +08:00
});
2025-06-09 10:59:28 +08:00
const currentMock = ref(0);
const mockData = ref([
{
userName: '用户17378225',
createTime: '2025.02.05',
content: '正准备复购,基本没踩雷!推荐购买。',
stars: 4,
},
{
userName: '用户35613587',
createTime: '2025.02.06',
content: '平台服务:发货很快,来平台买过好多次了,喜欢平台服务。',
stars: 5,
},
{
userName: '用户33578135',
createTime: '2025.02.08',
content: '物流挺快,到货了也没发现有坏损。',
stars: 4.5,
},
{
userName: '用户23467467',
createTime: '2025.02.10',
content: '包装无损坏,拍品也很好,以后就在平台上购买了,放心,省心,还在犹豫亲们可以下单啦!',
stars: 5,
},
{
userName: '用户78613489',
createTime: '2025.02.14',
content: '实物跟图片描述的一样,不错,值的赞,值得推荐!',
stars: 5,
},
{
userName: '用户23497825',
createTime: '2025.02.18',
content: '少发了商品,在平台联系商家后处理速度很快,马上补发了,商家态度也好。',
stars: 4,
},
{
userName: '用户35789421',
createTime: '2025.02.24',
content: '买错了。退换速度很快,商家很好交流,平台处理速度也很快。',
stars: 4,
},
{
userName: '用户83154378',
createTime: '2025.02.26',
content:
'货品质量非常好,与平台页面描述的完全一致,非常满意,完全超出期望值,发货速度非常快,包装非常仔细严实,运送速度很快,很满意的一次平台购物!',
stars: 5,
},
{
userName: '用户61398765',
createTime: '2025.03.01',
content: '东西很好,价美物廉!收到的时候包装完整,货品比我想象中的还要好!不得不得竖起大拇指。下次需要的时候我还会再来的!',
stars: 5,
},
{
userName: '用户91357862',
createTime: '2025.03.05',
content: '包装很完整,没有破损。发货迅速,态度很好,很满意!很好,很好!没想到平台的服务这么好,商品质量好而价低廉,下次还来,祝生意兴隆!',
stars: 5,
},
{
userName: '用户31578673',
createTime: '2025.03.08',
content: '先说商品质量,总体不错,包装严实,再为平台服务点赞啦,最后点评快递发货很快。希望平台有更多优惠,祝生意兴隆!',
stars: 5,
},
{
userName: '用户43124789',
createTime: '2025.03.10',
content:
'超级喜欢,非常支持,质量非常好,与平台描述的完全一致,非常满意,完全超出期望值,发货速度非常快,包装非常仔细严实,物流公司服务态度很好,运送速度很快,很满意的一次购物。平台客服态度很专业、热情,有问必答,回复也很快。',
stars: 5,
},
]);
function getRandomIndex(mockData) {
if (!Array.isArray(mockData) || mockData.length === 0) {
throw new Error('mockData 必须是非空数组');
}
currentMock.value = Math.floor(Math.random() * mockData.length);
}
2025-05-23 16:42:43 +08:00
const data = reactive({
type: 1,
current: 1,
size: 20,
goodId: 0,
});
2025-04-09 17:25:08 +08:00
const colors = ref(['#99A9BF', '#25BF82', '#25BF82']);
const totalList = reactive([
2025-06-09 10:59:28 +08:00
{ title: '全部', name: 'all', num: 1 },
{ title: '成活率高', name: 'label1', num: 0 },
{ title: '抗病率高', name: 'label2', num: 0 },
{ title: '抗倒伏率高', name: 'label3', num: 0 },
{ title: '坐果率高', name: 'label4', num: 0 },
2025-04-09 17:25:08 +08:00
]);
let currentlabel = ref('all');
const selectLabel = (name) => {
currentlabel.value = name;
};
let remark = ref('');
let isAnonymous = ref(false);
const doAnonymous = () => {
isAnonymous.value = !isAnonymous.value;
};
2025-05-23 16:42:43 +08:00
onMounted(() => {
data.goodId = props.goodId;
2025-06-09 10:59:28 +08:00
getRandomIndex(mockData.value);
// getContentList('1');
2025-05-23 16:42:43 +08:00
});
const getContentList = (type) => {
2025-06-09 10:59:28 +08:00
data.type = type;
2025-05-23 16:42:43 +08:00
agriculturalContent(data).then((res) => {
if (res.code === '200') {
console.log(res);
}
});
};
2025-04-09 17:25:08 +08:00
const submitEvaluate = () => {};
</script>
<style lang="scss" scoped>
.c-evaluate-warp {
width: 100%;
::v-deep() {
.el-rate {
.el-icon {
font-size: 22px !important;
}
}
}
.evaluate-warp-top {
display: inline-flex;
2025-05-20 13:05:37 +08:00
justify-content: flex-start;
2025-04-09 17:25:08 +08:00
width: 100%;
gap: 16px;
flex-wrap: wrap;
.user-evaluate {
display: inline-flex;
justify-content: flex-start;
.score,
.score-tips {
display: inline-block;
vertical-align: middle;
}
.score {
width: 80px;
height: 80px;
font-size: 32px;
font-weight: 700;
border-radius: 8px;
2025-05-20 13:05:37 +08:00
text-align: center;
color: $color-main;
background: $color-main-table-header;
line-height: 80px;
2025-04-09 17:25:08 +08:00
}
.score-tips {
padding-left: 16px;
vertical-align: middle;
.tips {
font-size: 18px;
color: $color-666;
}
.score-val {
}
}
}
.top-tag-btn {
display: inline-block;
cursor: pointer;
.tag-btn-warp {
display: inline-flex;
justify-content: center;
flex-direction: column;
height: 100%;
.tag-btn-pos {
padding: 0 16px;
2025-05-20 13:05:37 +08:00
height: 48px;
2025-04-09 17:25:08 +08:00
font-size: 18px;
2025-05-20 13:05:37 +08:00
border-radius: 16px;
line-height: 48px;
2025-04-09 17:25:08 +08:00
&.normal {
background: $color-main-table-header;
}
&.act {
font-weight: 600;
2025-05-20 13:05:37 +08:00
color: $color-fff;
background: $color-main;
2025-04-09 17:25:08 +08:00
}
.label-title,
.label-num {
display: inline-block;
}
.label-num {
padding-left: 8px;
}
}
}
}
}
.user-do-warp {
width: 100%;
.do-title {
width: 100%;
font-size: 18px;
line-height: 36px;
}
.do-fill {
padding: 16px;
min-height: 100px;
2025-05-20 13:05:37 +08:00
border-radius: 16px;
background: $color-f5;
2025-04-09 17:25:08 +08:00
::v-deep() {
.el-textarea__inner {
font-size: 16px;
color: $color-666;
2025-05-20 13:05:37 +08:00
background: transparent !important;
box-shadow: none !important;
2025-04-09 17:25:08 +08:00
}
}
}
.is-anonymous {
display: inline-flex;
justify-content: space-between;
margin: 16px 0;
2025-05-20 13:05:37 +08:00
width: 100%;
2025-04-09 17:25:08 +08:00
.do-is {
display: inline-block;
font-size: 16px;
cursor: pointer;
&.do-is-act {
.is-radio {
border: 1px solid $color-main;
2025-05-20 13:05:37 +08:00
background: $color-main;
2025-04-09 17:25:08 +08:00
}
.do-is-txt {
color: $color-main;
}
}
&.do-is-no {
.is-radio {
border: 1px solid $color-da;
2025-05-20 13:05:37 +08:00
background: $color-fff;
2025-04-09 17:25:08 +08:00
}
.do-is-txt {
color: $color-999;
}
}
.do-is-txt,
.is-radio {
display: inline-block;
vertical-align: middle;
}
.do-is-txt {
padding-left: 8px;
}
.is-radio {
2025-05-20 13:05:37 +08:00
position: relative;
2025-04-09 17:25:08 +08:00
width: 20px;
2025-05-20 13:05:37 +08:00
height: 20px;
2025-04-09 17:25:08 +08:00
border-radius: 50%;
}
.is-radio::before {
position: absolute;
top: 50%;
2025-05-20 13:05:37 +08:00
left: 50%;
2025-04-09 17:25:08 +08:00
width: 5px;
height: 5px;
border-radius: 50%;
background: $color-fff;
2025-05-20 13:05:37 +08:00
content: ' ';
transform: translate(-50%, -50%);
2025-04-09 17:25:08 +08:00
}
}
}
}
.evaluate-list {
width: 100%;
.list-content {
width: 100%;
.evaluate-item {
margin: 16px 0;
2025-05-20 13:05:37 +08:00
width: 100%;
2025-04-09 17:25:08 +08:00
.evaluate-item-top {
display: inline-flex;
justify-content: space-between;
2025-05-20 13:05:37 +08:00
width: 100%;
2025-04-09 17:25:08 +08:00
.user-info {
display: inline-flex;
justify-content: flex-start;
width: calc(100% - 150px);
.info-img,
.info-txt {
display: inline-block;
vertical-align: middle;
}
.info-img {
2025-05-20 13:05:37 +08:00
overflow: hidden;
2025-04-09 17:25:08 +08:00
width: 64px;
height: 64px;
border-radius: 50%;
}
.info-txt {
padding-left: 16px;
.info-txt-pos {
display: inline-flex;
2025-05-20 13:05:37 +08:00
justify-content: center;
2025-04-09 17:25:08 +08:00
height: 64px;
flex-direction: column;
.name {
font-size: 16px;
}
.time {
font-size: 14px;
color: $color-999;
}
}
}
}
.score-val {
width: 150px;
2025-05-20 13:05:37 +08:00
text-align: right;
2025-04-09 17:25:08 +08:00
}
}
.evaluate-item-content {
width: 100%;
.content-txt {
width: 100%;
font-size: 18px;
}
.content-img {
display: inline-flex;
justify-content: flex-start;
flex-wrap: wrap;
gap: 24px;
margin-top: 24px;
.img-item {
2025-05-20 13:05:37 +08:00
display: inline-block;
overflow: hidden;
2025-04-09 17:25:08 +08:00
width: 138px;
height: 138px;
border-radius: 16px;
}
}
}
}
}
}
}
</style>