1.报事报修接口联调
This commit is contained in:
@@ -4,54 +4,41 @@
|
||||
<view class="add-repair-scroll-content">
|
||||
<!-- 地址选择 -->
|
||||
<view class="add-repair-section">
|
||||
<view class="add-repair-address-btn" @click="goSelectLocation">
|
||||
<view class="add-repair-address-text">请选择房屋所在地址</view>
|
||||
<image class="add-repair-address-img" src="/static/ic_add_repair_01.png" />
|
||||
</view>
|
||||
<view class="add-repair-detail">
|
||||
<view class="add-repair-detail1">详细地址 </view>
|
||||
<view class="add-repair-detail2">例1栋2单元101室1</view>
|
||||
<input type="text" v-model="repairInfo.location" placeholder="请输入地址" class="add-repair-detail2" />
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<!-- 报事报修类型 -->
|
||||
<view class="add-repair-section2">
|
||||
<view class="add-repair-label">报事报修</view>
|
||||
<view class="add-repair-type-list">
|
||||
<view v-for="(item, idx) in repairTypes" :key="idx"
|
||||
:class="['add-repair-type-btn', selectedType === item ? 'selected' : '']"
|
||||
@click="selectType(item)">{{ item }}</view>
|
||||
</view>
|
||||
<view class="add-repair-label2">其他服务</view>
|
||||
<view class="add-repair-type-list">
|
||||
<view v-for="(item, idx) in otherTypes" :key="idx" class="add-repair-type-btn">{{ item }}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 问题详情 -->
|
||||
<view class="add-repair-section">
|
||||
<view class="add-repair-label">报事报修</view>
|
||||
<view class="repair-type" @click="chooseType">
|
||||
<text class="text-type">{{ selectedType }}</text>
|
||||
<image class="right-arrow" src="/static/ic_right_arrow_g.png" />
|
||||
</view>
|
||||
<view class="add-repair-label">问题详情 <text class="add-repair-optional">(非必填)</text></view>
|
||||
<textarea class="add-repair-detail-textarea" placeholder="如果以上报事不能解决您的问题,可以在这里填写说明" />
|
||||
<textarea v-model="repairInfo.remark" class="add-repair-detail-textarea" placeholder="如果以上报事不能解决您的问题,可以在这里填写说明" />
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 上传照片 -->
|
||||
<view class="add-repair-section">
|
||||
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填,最多三张)</text></view>
|
||||
<view class="add-repair-upload-list">
|
||||
<!-- 修改部分:添加点击事件和图片预览 -->
|
||||
<view
|
||||
class="add-repair-upload-box"
|
||||
@click="handleImageUpload"
|
||||
>
|
||||
<view class="add-repair-upload-plus">+</view>
|
||||
<view class="add-repair-upload-text">上传图片</view>
|
||||
</view>
|
||||
<!-- 显示已选图片 -->
|
||||
<view v-for="(image, index) in selectedImages" :key="index" class="add-repair-upload-box">
|
||||
<image :src="image.path" class="add-repair-upload-image" @click.stop="previewImage(image.path)" />
|
||||
</view>
|
||||
</view>
|
||||
<u-upload
|
||||
:fileList="selectedImages"
|
||||
@delete="deletePic"
|
||||
name="upload"
|
||||
multiple
|
||||
maxCount="3"
|
||||
width="180"
|
||||
height="180"
|
||||
:autoUpload="false"
|
||||
></u-upload>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="add-repair-submit-btn" @click="goRepaired">提交</button>
|
||||
<button class="add-repair-submit-btn" @click="submit">提交</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -59,47 +46,103 @@
|
||||
<script>
|
||||
// 导入MediaSelector和MediaType
|
||||
import MediaSelector, { MediaType } from '@/utils/mediaSelector';
|
||||
|
||||
import {
|
||||
uploadFiles
|
||||
} from '@/common/upload.js';
|
||||
import toast from '../../../../uview-ui/libs/function/toast';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
repairTypes: ['安装挂件', '维修下水', '维修水阀', '疏通管道', '维修线路', '更换灯泡', '维修门窗', '其他维修'],
|
||||
otherTypes: ['园区安保', '通水通电', '维修线路'],
|
||||
selectedType: '更换灯泡',
|
||||
repairInfo:{
|
||||
location:'',
|
||||
type:'1942879389453230082',
|
||||
orderImgUrl:'',
|
||||
remark:''
|
||||
},
|
||||
repairTypes: [],
|
||||
selectedType: '',
|
||||
selectedImages: [] // 存储已选图片
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getOrderType()
|
||||
},
|
||||
methods: {
|
||||
selectType(item) {
|
||||
this.selectedType = item;
|
||||
},
|
||||
// 新增:处理图片上传
|
||||
async handleImageUpload() {
|
||||
try {
|
||||
// 调用MediaSelector选择图片,最多选择3张
|
||||
const images = await MediaSelector.choose({
|
||||
type: MediaType.IMAGE,
|
||||
count: 3 - this.selectedImages.length // 根据剩余数量选择
|
||||
});
|
||||
// 将选择的图片添加到selectedImages数组
|
||||
this.selectedImages = [...this.selectedImages, ...images];
|
||||
} catch (error) {
|
||||
|
||||
async getOrderType() {
|
||||
let params = {parentId:'1952989217332658178'}
|
||||
let res = await this.$u.api.getRepairTypes(params);
|
||||
if (res.code == '200') {
|
||||
this.repairTypes = res.data
|
||||
this.repairInfo.type = res.data[0].id;
|
||||
this.selectType(res.data[0].orderTypeName)
|
||||
}
|
||||
},
|
||||
// 预览图片
|
||||
previewImage(path) {
|
||||
MediaSelector.preview(path, MediaType.IMAGE);
|
||||
// 删除图片
|
||||
deletePic(event) {
|
||||
this.selectedImages.splice(event.index, 1);
|
||||
},
|
||||
|
||||
async submit() {
|
||||
if(!this.repairInfo.location) {
|
||||
toast('请先填写地址')
|
||||
return
|
||||
}
|
||||
if(this.selectedImages.length<=0){
|
||||
this.realSubmit()
|
||||
return
|
||||
}
|
||||
// 遍历selectedImages数组并处理图片路径
|
||||
const images = this.selectedImages.map(item => item.path.replace('file://', ''));
|
||||
const result = await uploadFiles({
|
||||
files: images,
|
||||
url: this.vuex_config.baseUrl + '/resource/oss/upload',
|
||||
name: 'file',
|
||||
vm: this // 关键:用于注入 token 等
|
||||
});
|
||||
|
||||
if (result.code == '200') {
|
||||
// 遍历result获取data.url加上,分割
|
||||
const urls = result.map(item => item.data?.url || '').filter(url => url !== '');
|
||||
this.repairInfo.orderImgUrl = urls.join(',');
|
||||
this.realSubmit()
|
||||
}
|
||||
},
|
||||
|
||||
async realSubmit(){
|
||||
let res = await this.$u.api.addOrder2(this.repairInfo);
|
||||
if (res.code == '200') {
|
||||
// 关闭页面前发送事件通知前页面刷新
|
||||
uni.$emit('refreshData', '');
|
||||
// 返回上一页
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
|
||||
// 添加chooseType方法实现
|
||||
chooseType() {
|
||||
uni.showActionSheet({
|
||||
itemList: this.repairTypes.map(item => item.orderTypeName),
|
||||
success: (res) => {
|
||||
this.selectedType = this.repairTypes[res.tapIndex].orderTypeName;
|
||||
this.repairInfo.type = this.repairTypes[res.tapIndex].id;
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('用户取消选择或出错', err);
|
||||
}
|
||||
});
|
||||
},
|
||||
goRepaired(){
|
||||
uni.navigateTo({ url: '/pages/sys/user/myRepair/repaired' });
|
||||
},
|
||||
goSelectLocation(){
|
||||
uni.navigateTo({ url: '/pages/sys/user/myRepair/selectLocation' });
|
||||
}
|
||||
},
|
||||
goSelectLocation(){
|
||||
uni.navigateTo({ url: '/pages/sys/user/myRepair/selectLocation' });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -110,18 +153,6 @@ export default {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.add-repair-back {
|
||||
position: absolute;
|
||||
left: 37rpx;
|
||||
width: 15rpx;
|
||||
height: 33rpx;
|
||||
}
|
||||
|
||||
.add-repair-title {
|
||||
font-size: 36rpx;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.add-repair-scroll-content {
|
||||
flex: 1;
|
||||
@@ -136,11 +167,25 @@ export default {
|
||||
padding: 24rpx 46rpx 24rpx 44rpx;
|
||||
}
|
||||
|
||||
.add-repair-section2 {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin: 22rpx 30rpx 0 30rpx;
|
||||
padding: 24rpx 26rpx 24rpx 26rpx;
|
||||
.repair-type {
|
||||
width: 363rpx;
|
||||
height: 73rpx;
|
||||
background: #F7F7F7;
|
||||
border-radius: 10rpx;
|
||||
padding:0rpx 28rpx 0rpx 35rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
}
|
||||
.text-type{
|
||||
font-size: 24rpx;
|
||||
color:#808080;
|
||||
}
|
||||
.right-arrow{
|
||||
width: 11rpx;
|
||||
height: 21rpx;
|
||||
}
|
||||
|
||||
.add-repair-address-btn {
|
||||
@@ -180,9 +225,14 @@ export default {
|
||||
}
|
||||
|
||||
.add-repair-detail2 {
|
||||
width: 460rpx;
|
||||
height: 98rpx;
|
||||
background-color: #F7F8FA;
|
||||
border-radius: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #676767;
|
||||
margin-left: 39rpx;
|
||||
margin-left: 25rpx;
|
||||
padding-left: 15rpx;
|
||||
}
|
||||
.add-repair-label {
|
||||
font-size: 32rpx;
|
||||
@@ -249,55 +299,18 @@ export default {
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.add-repair-upload-list {
|
||||
display: flex;
|
||||
gap: 18rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.add-repair-upload-box {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
border: 2rpx dashed #BDBDBD;
|
||||
border-radius: 8rpx;
|
||||
background: #fafbfc;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.add-repair-upload-plus {
|
||||
font-size: 60rpx;
|
||||
color: #BDBDBD;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.add-repair-upload-text {
|
||||
font-size: 24rpx;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.add-repair-submit-btn {
|
||||
width: 90vw;
|
||||
height: 80rpx;
|
||||
background: linear-gradient(90deg, #2186FF 0%, #4FC3F7 100%);
|
||||
width: 60vw;
|
||||
height: 73rpx;
|
||||
background: linear-gradient(90deg, #005DE9 0%, #4B9BFF 100%);
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
border: none;
|
||||
border-radius: 40rpx;
|
||||
margin: 48rpx auto 0 auto;
|
||||
margin: 100rpx auto 0 auto;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
|
||||
/* 新增图片预览样式 */
|
||||
.add-repair-upload-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8rpx;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
</style>
|
@@ -17,13 +17,15 @@
|
||||
<view class="repair-row">
|
||||
<view class="repair-no">工单号:{{ item.orderNo }}</view>
|
||||
<view class="repair-status" :class="getStatusColor(item.status)">
|
||||
{{ getStatusLabel(item.status) }}</view>
|
||||
{{ getStatusLabel(item.status) }}
|
||||
</view>
|
||||
</view>
|
||||
<image class="repair-line-image" src="/static/ic_my_repair_03.png" />
|
||||
<view class="repair-info">建立时间:{{ item.createTime }}</view>
|
||||
<view class="repair-info">报事内容:{{ item.typeName }}</view>
|
||||
<view class="repair-info">报事位置:{{ item.location }}</view>
|
||||
<view v-if="item.statusText === '已结束'" class="repair-eval-btn eval-btn-right">服务评价</view>
|
||||
<view v-if="getStatusLabel(item.status) === '已结束'" class="repair-eval-btn eval-btn-right">服务评价
|
||||
</view>
|
||||
</view>
|
||||
<!-- 悬浮新增按钮 -->
|
||||
<image src="/static/ic_my_repair_02.png" :class="['repair-add-btn-fixed', { 'hide': isAddBtnHidden }]"
|
||||
@@ -54,7 +56,7 @@
|
||||
<view class="repair-detail-info">建立时间:{{ detailItem.createTime }}</view>
|
||||
<view class="repair-detail-info">报事内容:{{ detailItem.typeName }}</view>
|
||||
<view class="repair-detail-info">报事位置:{{ detailItem.location }}</view>
|
||||
<button v-if="detailItem.statusText === '已结束'" class="repair-detail-btn"
|
||||
<button v-if="getStatusLabel(detailItem.status) === '已结束'" class="repair-detail-btn"
|
||||
@click="goTEvaluate">评价服务</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -71,14 +73,20 @@
|
||||
detailItem: {},
|
||||
detailStep: 0,
|
||||
detailStatus: '',
|
||||
progressSteps: ['创建工单', '处理中', '已结束'],
|
||||
progressSteps: ['创建工单', '已接单', '处理中', '已结束'],
|
||||
lastScrollTop: 0,
|
||||
isAddBtnHidden: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// uni.$on('refreshData', this.getOrders);
|
||||
this.getOrders()
|
||||
},
|
||||
onShow() {
|
||||
uni.$once('refreshData',s=> {
|
||||
this.getOrders()
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
@@ -89,7 +97,10 @@
|
||||
});
|
||||
},
|
||||
async getOrders() {
|
||||
let res = await this.$u.api.getOrderList();
|
||||
let params = {
|
||||
"type": "1952989217332658178"
|
||||
}
|
||||
let res = await this.$u.api.getOrderList(params);
|
||||
if (res.code == '200') {
|
||||
this.records = res.rows
|
||||
}
|
||||
@@ -107,16 +118,20 @@
|
||||
showDetail(item) {
|
||||
this.detailItem = item;
|
||||
// 进度映射
|
||||
if (item.status === 0) {
|
||||
if (item.status == 0) {
|
||||
this.detailStep = 0;
|
||||
this.detailStatus = '创建报';
|
||||
} else if (item.status === 4) {
|
||||
this.detailStatus = '创建工单';
|
||||
} else if (item.status == 4) {
|
||||
this.detailStep = 3;
|
||||
this.detailStatus = '已结束';
|
||||
} else {
|
||||
} else if (item.status == 3) {
|
||||
this.detailStep = 2;
|
||||
this.detailStatus = '处理中';
|
||||
} else {
|
||||
this.detailStep = 1;
|
||||
this.detailStatus = '已接单';
|
||||
}
|
||||
|
||||
this.showDetailDialog = true;
|
||||
},
|
||||
closeDetail() {
|
||||
@@ -125,16 +140,18 @@
|
||||
getStatusLabel(status) {
|
||||
const statusMap = {
|
||||
0: '创建工单',
|
||||
1: '处理中',
|
||||
2: '处理中',
|
||||
1: '已接单',
|
||||
2: '已接单',
|
||||
3: '处理中',
|
||||
4: '已完成'
|
||||
4: '已结束'
|
||||
};
|
||||
return statusMap[status] || '';
|
||||
},
|
||||
goTEvaluate() {
|
||||
// 将detailItem转换为JSON字符串并进行编码,以确保安全传输
|
||||
const detailItemStr = encodeURIComponent(JSON.stringify(this.detailItem));
|
||||
uni.navigateTo({
|
||||
url: '/pages/sys/user/myRepair/repairEvaluate'
|
||||
url: `/pages/sys/user/myRepair/repairEvaluate?detailItem=${detailItemStr}`
|
||||
});
|
||||
},
|
||||
handleScroll(e) {
|
||||
@@ -386,7 +403,7 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 5rpx;
|
||||
margin-left: 100rpx;
|
||||
margin-left: 75rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
@@ -1,172 +1,201 @@
|
||||
<template>
|
||||
<view class="evaluate-container">
|
||||
|
||||
<!-- 评分项 -->
|
||||
<view class="evaluate-list">
|
||||
<view class="evaluate-row">
|
||||
<text class="evaluate-label">服务评价</text>
|
||||
<view class="evaluate-stars">
|
||||
<image v-for="i in 5" :key="i" :src="score >= i ? '/static/ic_evaluate_select.png' : '/static/ic_evaluate_disselect.png'" class="evaluate-star" @click="score = i" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="evaluate-desc">- 具体说说看 -</view>
|
||||
<view class="evaluate-row">
|
||||
<text class="evaluate-label">专业性</text>
|
||||
<view class="evaluate-stars">
|
||||
<image v-for="i in 5" :key="i" :src="proScore >= i ? '/static/ic_evaluate_select.png' : '/static/ic_evaluate_disselect.png'" class="evaluate-star" @click="proScore = i" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="evaluate-row">
|
||||
<text class="evaluate-label">服务态度</text>
|
||||
<view class="evaluate-stars">
|
||||
<image v-for="i in 5" :key="i" :src="attitudeScore >= i ? '/static/ic_evaluate_select.png' : '/static/ic_evaluate_disselect.png'" class="evaluate-star" @click="attitudeScore = i" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="evaluate-row">
|
||||
<text class="evaluate-label">时效性</text>
|
||||
<view class="evaluate-stars">
|
||||
<image v-for="i in 5" :key="i" :src="timelyScore >= i ? '/static/ic_evaluate_select.png' : '/static/ic_evaluate_disselect.png'" class="evaluate-star" @click="timelyScore = i" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 标签选择 -->
|
||||
<view class="evaluate-tag-title">- 选择或自定义任一标签 -</view>
|
||||
<view class="evaluate-tags">
|
||||
<view v-for="(tag, idx) in tags" :key="idx" :class="['evaluate-tag', selectedTags.includes(tag) ? 'selected' : '']" @click="toggleTag(tag)">{{ tag }}</view>
|
||||
</view>
|
||||
<!-- 输入框 -->
|
||||
<textarea class="evaluate-textarea" placeholder="说点什么吧..." v-model="comment" />
|
||||
<!-- 提交按钮 -->
|
||||
<button class="evaluate-btn">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
score: 4,
|
||||
proScore: 5,
|
||||
attitudeScore: 4,
|
||||
timelyScore: 4,
|
||||
tags: ['专业性强', '态度谦和', '声音甜美', '速度很快'],
|
||||
selectedTags: ['专业性强', '态度谦和'],
|
||||
comment: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleTag(tag) {
|
||||
if (this.selectedTags.includes(tag)) {
|
||||
this.selectedTags = this.selectedTags.filter(t => t !== tag)
|
||||
} else {
|
||||
this.selectedTags.push(tag)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.evaluate-container {
|
||||
min-height: 100vh;
|
||||
background: #fff;
|
||||
padding-bottom: 40rpx;
|
||||
/* 防止在iOS等设备上滑动到顶部或底部时出现回弹效果 */
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
|
||||
.evaluate-back {
|
||||
position: absolute;
|
||||
left: 37rpx;
|
||||
width: 15rpx;
|
||||
height: 33rpx;
|
||||
}
|
||||
.evaluate-title {
|
||||
font-size: 30rpx;
|
||||
color: #000;
|
||||
}
|
||||
.evaluate-list {
|
||||
margin: 0 53rpx 0 40rpx;
|
||||
}
|
||||
.evaluate-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 38rpx;
|
||||
}
|
||||
.evaluate-label {
|
||||
font-size: 30rpx;
|
||||
color: #222;
|
||||
width: 160rpx;
|
||||
text-align: left;
|
||||
}
|
||||
.evaluate-stars {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.evaluate-star {
|
||||
width: 36rpx;
|
||||
height: 34rpx;
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
.evaluate-desc {
|
||||
color: #BDBDBD;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
margin-top: 67rpx;
|
||||
margin-bottom: 57rpx;
|
||||
}
|
||||
.evaluate-tag-title {
|
||||
color: #BDBDBD;
|
||||
font-size: 24rpx;
|
||||
text-align: center;
|
||||
margin: 60rpx 0 0 0;
|
||||
}
|
||||
.evaluate-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20rpx;
|
||||
margin: 52rpx 25rpx 0 25rpx;
|
||||
}
|
||||
.evaluate-tag {
|
||||
flex: 0 0 calc((100% - 60rpx) / 4);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
background: #F2F2F2;
|
||||
}
|
||||
.evaluate-tag.selected {
|
||||
background: #0090FF;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.evaluate-textarea {
|
||||
width: 85vw;
|
||||
min-height: 120rpx;
|
||||
background: #F5F6F7;
|
||||
border-radius: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color: #B6C2CE;
|
||||
padding: 23rpx 27rpx 23rpx 27rpx;
|
||||
margin: 49rpx auto 0 auto;
|
||||
display: block;
|
||||
}
|
||||
.evaluate-btn {
|
||||
width: 80vw;
|
||||
height: 88rpx;
|
||||
background: #0090FF;
|
||||
color: #fff;
|
||||
font-size: 36rpx;
|
||||
border: none;
|
||||
border-radius: 44rpx;
|
||||
margin: 137rpx auto 0 auto;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0,0,0,0.18);
|
||||
}
|
||||
<template>
|
||||
<view class="evaluate-container">
|
||||
|
||||
<!-- 评分项 -->
|
||||
<view class="evaluate-list">
|
||||
<view class="evaluate-row">
|
||||
<text class="evaluate-label">服务评价</text>
|
||||
<view class="evaluate-stars">
|
||||
<image v-for="i in 5" :key="i"
|
||||
:src="detailItem.serviceEvalua >= i ? '/static/ic_evaluate_select.png' : '/static/ic_evaluate_disselect.png'"
|
||||
class="evaluate-star" @click="detailItem.serviceEvalua = i" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 输入框 -->
|
||||
<textarea class="evaluate-textarea" placeholder="说点什么吧..." v-model="detailItem.serviceEvaluaText" />
|
||||
|
||||
<!-- 上传照片 -->
|
||||
<!-- 上传照片 -->
|
||||
<view class="repair-evaluate-section">
|
||||
<view class="add-repair-label">上传照片 <text class="add-repair-optional">(非必填,最多三张)</text></view>
|
||||
<u-upload :fileList="selectedImages" @delete="deletePic" name="upload" multiple maxCount="3" width="180"
|
||||
height="180" :autoUpload="false"></u-upload>
|
||||
</view>
|
||||
<!-- 提交按钮 -->
|
||||
<button class="evaluate-btn" @click="submit">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 导入MediaSelector和MediaType
|
||||
import MediaSelector, {
|
||||
MediaType
|
||||
} from '@/utils/mediaSelector';
|
||||
import {
|
||||
uploadFiles
|
||||
} from '@/common/upload.js';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
comment: '',
|
||||
selectedImages: [], // 存储已选图片
|
||||
detailItem: null // 接收传递的详情项
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 接收传递的detailItem参数
|
||||
if (options.detailItem) {
|
||||
try {
|
||||
this.detailItem = JSON.parse(decodeURIComponent(options.detailItem));
|
||||
} catch (e) {
|
||||
console.error('解析detailItem参数失败', e);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 删除图片
|
||||
deletePic(event) {
|
||||
this.selectedImages.splice(event.index, 1);
|
||||
},
|
||||
async submit() {
|
||||
if (this.selectedImages.length <= 0) {
|
||||
this.realSubmit()
|
||||
return
|
||||
}
|
||||
// 遍历selectedImages数组并处理图片路径
|
||||
const images = this.selectedImages.map(item => item.path.replace('file://', ''));
|
||||
const result = await uploadFiles({
|
||||
files: images,
|
||||
url: this.vuex_config.baseUrl + '/resource/oss/upload',
|
||||
name: 'file',
|
||||
vm: this // 关键:用于注入 token 等
|
||||
});
|
||||
|
||||
if (result.code == '200') {
|
||||
// 遍历result获取data.url加上,分割
|
||||
const urls = result.map(item => item.data?.url || '').filter(url => url !== '');
|
||||
this.detailItem.imgUrl = urls.join(',');
|
||||
this.realSubmit()
|
||||
}
|
||||
},
|
||||
|
||||
async realSubmit() {
|
||||
let res = await this.$u.api.updateOrder(this.detailItem);
|
||||
if (res.code == '200') {
|
||||
// 关闭页面前发送事件通知前页面刷新
|
||||
uni.$emit('refreshData', '');
|
||||
// 返回上一页
|
||||
uni.navigateBack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.evaluate-container {
|
||||
min-height: 100vh;
|
||||
background: #fff;
|
||||
padding-bottom: 40rpx;
|
||||
/* 防止在iOS等设备上滑动到顶部或底部时出现回弹效果 */
|
||||
overscroll-behavior-y: contain;
|
||||
}
|
||||
|
||||
|
||||
.evaluate-list {
|
||||
margin: 0 53rpx 0 40rpx;
|
||||
}
|
||||
|
||||
.evaluate-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 38rpx;
|
||||
}
|
||||
|
||||
.evaluate-label {
|
||||
font-size: 30rpx;
|
||||
color: #222;
|
||||
width: 160rpx;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.evaluate-stars {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.evaluate-star {
|
||||
width: 36rpx;
|
||||
height: 34rpx;
|
||||
margin-right: 36rpx;
|
||||
}
|
||||
|
||||
|
||||
.evaluate-tag {
|
||||
flex: 0 0 calc((100% - 60rpx) / 4);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 64rpx;
|
||||
border-radius: 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
background: #F2F2F2;
|
||||
}
|
||||
|
||||
.evaluate-tag.selected {
|
||||
background: #0090FF;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.evaluate-textarea {
|
||||
width: 85vw;
|
||||
min-height: 120rpx;
|
||||
background: #F5F6F7;
|
||||
border-radius: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color: #222222;
|
||||
padding: 23rpx 27rpx 23rpx 27rpx;
|
||||
margin: 49rpx auto 0 auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.evaluate-btn {
|
||||
width: 80vw;
|
||||
height: 88rpx;
|
||||
background: #0090FF;
|
||||
color: #fff;
|
||||
font-size: 36rpx;
|
||||
border: none;
|
||||
border-radius: 44rpx;
|
||||
margin: 137rpx auto 0 auto;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.18);
|
||||
}
|
||||
|
||||
.repair-evaluate-section {
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin: 22rpx 0rpx 0 0rpx;
|
||||
padding: 24rpx 46rpx 24rpx 44rpx;
|
||||
}
|
||||
|
||||
.add-repair-label {
|
||||
font-size: 32rpx;
|
||||
color: #000000;
|
||||
font-weight: 500;
|
||||
margin-bottom: 41rpx;
|
||||
}
|
||||
|
||||
|
||||
.add-repair-optional {
|
||||
color: #888;
|
||||
font-size: 24rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user