代码提交
This commit is contained in:
@ -1,32 +1,32 @@
|
||||
<template>
|
||||
<layout class="evaluate">
|
||||
<uv-navbar
|
||||
:fixed="false"
|
||||
title="评价"
|
||||
left-arrow
|
||||
@leftClick="$onClickLeft"
|
||||
:fixed="false"
|
||||
title="评价"
|
||||
left-arrow
|
||||
@leftClick="goBack"
|
||||
/>
|
||||
<view class="evaluate-card mb-20">
|
||||
<div class="evaluate-item">
|
||||
<view class="evaluate-label">商品评价</view>
|
||||
<uv-rate
|
||||
:count="5"
|
||||
v-model="productScore"
|
||||
:count="5"
|
||||
v-model="productScore"
|
||||
></uv-rate>
|
||||
</div>
|
||||
<uv-line color="#E6E6E6"></uv-line>
|
||||
<view class="evaluate-content">
|
||||
<uv-textarea
|
||||
v-model="comment"
|
||||
placeholder="请填写您遇到的问题,这将帮助我们为您提供更好的服务"
|
||||
v-model="comment"
|
||||
placeholder="请填写您遇到的问题,这将帮助我们为您提供更好的服务"
|
||||
></uv-textarea>
|
||||
<uv-upload
|
||||
:fileList="pics"
|
||||
name="1"
|
||||
multiple
|
||||
:maxCount="10"
|
||||
@afterRead="afterRead"
|
||||
@delete="handleDeletePic"
|
||||
:fileList="fileList1"
|
||||
name="1"
|
||||
multiple
|
||||
:maxCount="10"
|
||||
@afterRead="afterRead"
|
||||
@delete="handleDeletePic"
|
||||
></uv-upload>
|
||||
|
||||
</view>
|
||||
@ -40,8 +40,8 @@
|
||||
<div class="evaluate-item min">
|
||||
<view class="evaluate-label">服务评价</view>
|
||||
<uv-rate
|
||||
:count="5"
|
||||
v-model="serviceScore"
|
||||
:count="5"
|
||||
v-model="serviceScore"
|
||||
></uv-rate>
|
||||
</div>
|
||||
</view>
|
||||
@ -50,10 +50,10 @@
|
||||
|
||||
<div class="form-buttons">
|
||||
<uv-button
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
@tap="handleOrderComments"
|
||||
round
|
||||
block
|
||||
type="primary"
|
||||
@tap="handleOrderComments"
|
||||
>
|
||||
提交评论
|
||||
</uv-button>
|
||||
@ -63,27 +63,21 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { navigateTo, back } from '@/utils/router'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { useMainStore } from '@/store/store'
|
||||
import { orderComments, orderCancel, orderInfo, orderTake, orderDelete } from '@/api/order'
|
||||
|
||||
|
||||
import {
|
||||
getAddressDel,
|
||||
getAddressDefault,
|
||||
getAddressAddAndEdit,
|
||||
getAddressList,
|
||||
getAddressCityList,
|
||||
} from '@/api/address'
|
||||
import { orderComments } from '@/api/order'
|
||||
import { VUE_APP_UPLOAD_URL } from '@/config'
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
|
||||
const {getParams, push} = useRouter()
|
||||
const productScore = ref(0)
|
||||
const serviceScore = ref(0)
|
||||
const unique = ref(null)
|
||||
const pics = ref([])
|
||||
const fileList1 = ref([])
|
||||
const comment = ref("")
|
||||
const orderInfoData = ref(null)
|
||||
|
||||
const {goBack} = useRouter()
|
||||
const handleOrderComments = async () => {
|
||||
const res = await orderComments([{
|
||||
"comment": comment.value,
|
||||
@ -92,20 +86,28 @@ const handleOrderComments = async () => {
|
||||
"serviceScore": serviceScore.value,
|
||||
"unique": unique.value,
|
||||
}])
|
||||
console.log("--> % handleOrderComments % res:\n", res)
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: "评价成功",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
push({url:'/pages/orderList/orderList'},{data:{type: 3}})
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeletePic = (event) => {
|
||||
pics.value.splice(event.index, 1)
|
||||
fileList1.value.splice(event.index, 1)
|
||||
}
|
||||
|
||||
|
||||
const afterRead = async (event) => {
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file)
|
||||
let fileListLen = this[`fileList${event.name}`].length
|
||||
let fileListLen = fileList1.value.length
|
||||
lists.map((item) => {
|
||||
this[`fileList${event.name}`].push({
|
||||
fileList1.value.push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中'
|
||||
@ -113,12 +115,14 @@ const afterRead = async (event) => {
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await uploadFilePromise(lists[i].url)
|
||||
let item = this[`fileList${event.name}`][fileListLen]
|
||||
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||||
let item = fileList1.value[fileListLen]
|
||||
fileList1.value.splice(fileListLen, 1, Object.assign(item, {
|
||||
status: 'success',
|
||||
message: '',
|
||||
url: result
|
||||
}))
|
||||
let url = JSON.parse(result)
|
||||
pics.value.push(url.data)
|
||||
fileListLen++
|
||||
}
|
||||
}
|
||||
@ -126,7 +130,7 @@ const afterRead = async (event) => {
|
||||
const uploadFilePromise = (url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let a = uni.uploadFile({
|
||||
url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
|
||||
url: VUE_APP_UPLOAD_URL,
|
||||
filePath: url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
@ -134,7 +138,7 @@ const uploadFilePromise = (url) => {
|
||||
},
|
||||
success: (res) => {
|
||||
setTimeout(() => {
|
||||
resolve(res.data.data)
|
||||
resolve(res.data)
|
||||
}, 1000)
|
||||
}
|
||||
});
|
||||
@ -142,17 +146,15 @@ const uploadFilePromise = (url) => {
|
||||
}
|
||||
|
||||
|
||||
|
||||
onLoad((option) => {
|
||||
unique.value = option.unique
|
||||
// unique.value = option.orderId
|
||||
onLoad((options) => {
|
||||
const params = getParams(options)
|
||||
unique.value = params.unique
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
<style lang="scss">
|
||||
.evaluate-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
Reference in New Issue
Block a user