2024-08-07 10:31:42 +08:00
|
|
|
|
<!-- 评价 -->
|
|
|
|
|
<template>
|
2024-08-07 21:40:27 +08:00
|
|
|
|
<s-layout title="评价">
|
|
|
|
|
<view>
|
|
|
|
|
<view v-for="(item, index) in state.orderInfo.items" :key="item.id">
|
|
|
|
|
<view>
|
|
|
|
|
<view class="commont-from-wrap">
|
|
|
|
|
<!-- 评价商品 -->
|
|
|
|
|
<s-goods-item
|
2024-08-07 10:31:42 +08:00
|
|
|
|
:img="item.picUrl"
|
|
|
|
|
:title="item.spuName"
|
|
|
|
|
:skuText="item.properties.map((property) => property.valueName).join(' ')"
|
2024-08-07 21:40:27 +08:00
|
|
|
|
:price="item.payPrice"
|
2024-08-07 10:31:42 +08:00
|
|
|
|
:num="item.count"
|
|
|
|
|
/>
|
2024-08-07 21:40:27 +08:00
|
|
|
|
</view>
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
<view class="form-item">
|
|
|
|
|
<!-- 评分 -->
|
|
|
|
|
<view class="star-box ss-flex ss-col-center">
|
|
|
|
|
<view class="star-title ss-m-r-40">商品质量</view>
|
|
|
|
|
<uni-rate v-model="state.commentList[index].descriptionScores" />
|
|
|
|
|
</view>
|
|
|
|
|
<view class="star-box ss-flex ss-col-center">
|
|
|
|
|
<view class="star-title ss-m-r-40">服务态度</view>
|
|
|
|
|
<uni-rate v-model="state.commentList[index].benefitScores" />
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 评价 -->
|
|
|
|
|
<view class="area-box">
|
|
|
|
|
<uni-easyinput
|
|
|
|
|
:inputBorder="false"
|
|
|
|
|
type="textarea"
|
|
|
|
|
maxlength="120"
|
|
|
|
|
autoHeight
|
|
|
|
|
v-model="state.commentList[index].content"
|
|
|
|
|
placeholder="宝贝满足你的期待吗?说说你的使用心得,分享给想买的他们吧~"
|
|
|
|
|
/>
|
2024-08-07 10:31:42 +08:00
|
|
|
|
<!-- TODO 芋艿:文件上传 -->
|
2024-08-07 21:40:27 +08:00
|
|
|
|
<view class="img-box">
|
|
|
|
|
<s-uploader
|
|
|
|
|
v-model:url="state.commentList[index].images"
|
|
|
|
|
fileMediatype="image"
|
|
|
|
|
limit="9"
|
|
|
|
|
mode="grid"
|
|
|
|
|
:imageStyles="{ width: '168rpx', height: '168rpx' }"
|
|
|
|
|
/>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-08-07 10:31:42 +08:00
|
|
|
|
<!-- TODO 芋艿:是否匿名 -->
|
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
<su-fixed bottom placeholder>
|
|
|
|
|
<view class="foot_box ss-flex ss-row-center ss-col-center">
|
|
|
|
|
<button class="ss-reset-button post-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onSubmit">
|
|
|
|
|
发布
|
|
|
|
|
</button>
|
|
|
|
|
</view>
|
|
|
|
|
</su-fixed>
|
|
|
|
|
</s-layout>
|
2024-08-07 10:31:42 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-08-07 21:40:27 +08:00
|
|
|
|
import sheep from '@/sheep';
|
|
|
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
|
|
|
import { reactive } from 'vue';
|
2024-08-07 10:31:42 +08:00
|
|
|
|
import OrderApi from '@/sheep/api/trade/order';
|
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
const state = reactive({
|
|
|
|
|
orderInfo: {},
|
|
|
|
|
commentList: [],
|
|
|
|
|
id: null,
|
|
|
|
|
});
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
async function onSubmit() {
|
2024-08-07 10:31:42 +08:00
|
|
|
|
// 顺序提交评论
|
|
|
|
|
for (const comment of state.commentList) {
|
|
|
|
|
await OrderApi.createOrderItemComment(comment);
|
|
|
|
|
}
|
|
|
|
|
// 都评论好,返回
|
2024-10-25 18:00:36 +08:00
|
|
|
|
// sheep.$router.back();
|
|
|
|
|
sheep.$router.redirect('/pages/order/list');
|
2024-08-07 21:40:27 +08:00
|
|
|
|
}
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
onLoad(async (options) => {
|
2024-08-07 10:31:42 +08:00
|
|
|
|
if (!options.id) {
|
|
|
|
|
sheep.$helper.toast(`缺少订单信息,请检查`);
|
2024-08-07 21:40:27 +08:00
|
|
|
|
return;
|
2024-08-07 10:31:42 +08:00
|
|
|
|
}
|
2024-08-07 21:40:27 +08:00
|
|
|
|
state.id = options.id;
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
const { code, data } = await OrderApi.getOrder(state.id);
|
2024-08-07 10:31:42 +08:00
|
|
|
|
if (code !== 0) {
|
|
|
|
|
sheep.$helper.toast('无待评价订单');
|
2024-08-07 21:40:27 +08:00
|
|
|
|
return;
|
2024-08-07 10:31:42 +08:00
|
|
|
|
}
|
|
|
|
|
// 处理评论
|
|
|
|
|
data.items.forEach((item) => {
|
|
|
|
|
state.commentList.push({
|
|
|
|
|
anonymous: false,
|
|
|
|
|
orderItemId: item.id,
|
|
|
|
|
descriptionScores: 5,
|
|
|
|
|
benefitScores: 5,
|
|
|
|
|
content: '',
|
2024-08-07 21:40:27 +08:00
|
|
|
|
picUrls: [],
|
2024-08-07 10:31:42 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
state.orderInfo = data;
|
2024-08-07 21:40:27 +08:00
|
|
|
|
});
|
2024-08-07 10:31:42 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2024-08-07 21:40:27 +08:00
|
|
|
|
// 评价商品
|
|
|
|
|
.goods-card {
|
|
|
|
|
margin: 10rpx 0;
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
// 评论,选择图片
|
|
|
|
|
.form-item {
|
|
|
|
|
background: #fff;
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
.star-box {
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
padding: 0 25rpx;
|
|
|
|
|
}
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
.star-title {
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
.area-box {
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
min-height: 306rpx;
|
|
|
|
|
background: rgba(249, 250, 251, 1);
|
|
|
|
|
border-radius: 20rpx;
|
|
|
|
|
padding: 28rpx;
|
|
|
|
|
margin: auto;
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
.img-box {
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-08-07 10:31:42 +08:00
|
|
|
|
|
2024-08-07 21:40:27 +08:00
|
|
|
|
.post-btn {
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
line-height: 80rpx;
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
color: rgba(#fff, 0.9);
|
|
|
|
|
margin-bottom: 20rpx;
|
|
|
|
|
}
|
|
|
|
|
</style>
|