123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <view>
- <view>
- 服务评价:
- <up-image :show-loading="true" :src="src" width="80px" height="80px" @click="click"></up-image>
- </view>
- <view>
- <view>
- <text>服务礼仪:</text>
- <template>
- <up-rate :count="count" v-model="IfonForm.protocolScore" count="5"></up-rate>
- </template>
- </view>
- <view>
- <text>着装整洁:</text>
- <template>
- <up-rate :count="count" v-model="IfonForm.clothingScore" count="5"></up-rate>
- </template>
- </view>
- <view>
- <text>专业能力:</text>
- <template>
- <up-rate :count="count" v-model="IfonForm.abilityScore" count="5"></up-rate>
- </template>
- </view>
- <view>
- <text>服务质量:</text>
- <template>
- <up-rate :count="count" v-model="IfonForm.qualityScore" count="5"></up-rate>
- </template>
- </view>
- </view>
- <view class="service-info order-card">
- <!-- 回顯 -->
- <view class="upload-box">
- <view class="upload-img-item" v-for="(item, index) in fileList" :key="item.url">
- <view class="delete-icon" @click="deletePic(index)"><up-icon name="close-circle-fill"
- color="#f64a1f" size="18"></up-icon></view>
- <img class="upload-img" :src="item.url" :alt="item.fileName" srcset="">
- </view>
- <img src="/static/img/upload.png" alt="" class="upload-img" @click="uploadClick('img')"
- v-if="fileList.length < 10">
- </view>
- </view>
- <up-textarea v-model="IfonForm.userReview" placeholder="请输入评论内容"></up-textarea>
- <up-button type="error" text="发布" @click="handlButClick"></up-button>
- </view>
- </template>
- <script setup>
- import {
- onMounted,
- ref
- } from 'vue';
- import {
- usersUserFinishOrder
- } from "@/api/userList.js";
- import {
- onLoad,
- } from '@dcloudio/uni-app';
- import {
- wxUploadFile
- } from '@/utils/wxRequest.js'
- const count = ref(4);
- const fileList = ref([]);
- const src = ref('https://cdn.uviewui.com/uview/album/1.jpg');
- const IfonForm = ref({
- protocolScore: 0, //服务礼仪
- clothingScore: 0, //服装整洁
- abilityScore: 0, //专业能力
- qualityScore: 0, //服务质量
- userReview:'',
- })
- // 删除图片
- const deletePic = (event) => {
- fileList.value.splice(event.index, 1);
- };
- const uploadClick = async (type) => {
- const res = await wxUploadFile(type);
- fileList.value = [...fileList.value, ...res];
- console.log('xxxxres', res, fileList.value);
- }
- const handlButClick = async () => {
- // 提取所有图片的 URL
- const imageUrls = fileList.value.map(item => item.url);
- const volunteerInfoId = IfonForm.value.volunteerInfoId;
- const secondOrderId = IfonForm.value.secondOrderId;
- try {
- const params = {
- ...IfonForm.value,
- images: imageUrls,
- volunteerInfoId: volunteerInfoId,
- secondOrderId: secondOrderId,
- }
- console.log(params, 'params>>>')
- const res = await usersUserFinishOrder(params)
- if (res.code == 200) {
- uni.navigateTo({
- url: '/pages/classify'
- })
- uni.showToast({
- title: '评价提交成功',
- icon: 'success'
- });
- } else {
- console.log('提交失败')
- }
- } catch (e) {
- uni.showToast({
- title: '提交失败,请重试',
- icon: 'error'
- });
- }
- }
- onLoad(async (options) => {
- const data = JSON.parse(decodeURIComponent(options.data));
- console.log(data, '》》》》》》 获取传递的 listData'); // 获取传递的 listData
- const secondOrderList = data.secondOrderList || [];
-
- // 获取第一个 secondOrderId
- const secondOrderId = secondOrderList.length > 0 ? secondOrderList[0].secondOrderId : null;
- // 如果 secondOrderId 存在,则设置到 IfonForm 中
- if (secondOrderId) {
- IfonForm.value.secondOrderId = secondOrderId;
- }
- // 获取 volunteerInfoId
- const volunteerInfoId = data.volunteerInfo?.volunteerInfoId || data.volunteerInfoId;
- IfonForm.value.volunteerInfoId = volunteerInfoId;
- });
- </script>
- <style>
- </style>
|