dingdong-master/pages/order-manage/modal/reject-after-sale.vue

172 lines
4.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="cu-modal" :class="show?'show':''">
<view class="cu-dialog bg-white">
<view class="cu-bar">
<view class="content">拒绝售后</view>
<view class="action" data-modal="rejectAfterSale" @click="hideModal">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding text-left">
<view>
<view class="flex justify-start">
<view>原因选择</view>
<radio-group @change="changeReasonRadio">
<label class="radio margin-right-sm">
<radio style="transform:scale(0.7)" class="main-color" value="1" :checked="data.reasonType === 1"/>
<text>客户原因</text>
</label>
<label class="radio">
<radio style="transform:scale(0.7)" class="main-color" value="2" :checked="data.reasonType === 2"/>
<text>师傅原因</text>
</label>
<label class="radio">
<radio style="transform:scale(0.7)" class="main-color" value="3" :checked="data.reasonType === 3"/>
<text>其他</text>
</label>
</radio-group>
</view>
<view class="margin-top">
<textarea style="width: 100%; height: 200rpx;" class="solid radius text-left padding-sm"
v-model="remark" maxlength="-1"
placeholder="请输入具体原因或直接同意,更改到帐金额需与客户协商一致,否则可能被拒绝或引起客诉升级"></textarea>
</view>
</view>
<!-- 上传图片 -->
<view class="padding-top">
<view class="grid col-3 grid-square flex-sub margin-top-sm">
<view class="bg-img" v-for="(item,index) in imgList" :key="index"
@tap="viewImage($event, imgList)" :data-url="item">
<image :src="item" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="delImg($event, imgList)" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="chooseImgList(e, imgList)" v-if="imgList.length < 3">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
</view>
<view class="cu-bar solid-top">
<view class="action margin-0 flex-sub text-black" data-modal="rejectAfterSale" @click="hideModal">取消</view>
<view class="action margin-0 flex-sub text-main-color solid-left" data-modal="rejectAfterSale"
@click="submit">确认</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'rejectAfterSale',
props: {
show: {
type: Boolean,
default: false
},
data: {
type: Object,
default: {}
}
},
data() {
return {
reasonType: null,
remark: null,
imgList: []
}
},
methods: {
hideModal(e) {
this.resetData();
uni.$emit(this.$globalFun.HIDE_MODAL, e);
},
resetData() {
this.data = null;
this.reasonType = null;
this.remark = null;
},
changeReasonRadio(e) {
this.reasonType = e.detail.value;
},
chooseImgList(e, imgList) {
uni.chooseImage({
count: 3 - imgList.length, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
uni.showLoading({
title: '上传中',
mask: true
});
res.tempFilePaths.forEach((tmpUrl, index) => {
this.$request.uploadFile(tmpUrl).then((url) => {
imgList.push(url);
if (index === res.tempFilePaths.length - 1) {
uni.hideLoading();
}
});
});
}
});
},
viewImage(e, imgList) {
uni.previewImage({
urls: imgList,
current: e.currentTarget.dataset.url
});
},
delImg(e, imgList) {
uni.showModal({
title: '',
content: '确定要删除这张图片吗?',
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
imgList.splice(e.currentTarget.dataset.index, 1)
}
}
})
},
async submit(e) {
let imgObjList = [];
this.imgList.forEach(url => {
imgObjList.push({
imgUrl: url,
imgUploadBy: 2
})
})
let res = await this.$request.editAfterServiceRecord({
id: this.data.afterServiceRecordList[0].id,
workerFeedbackReasonType: this.reasonType,
workerFeedbackReason: this.remark,
workerFeedbackResult: 0,
imgsList: imgObjList,
updateBy: 2
});
if (res && res.code === 0) {
uni.showToast({
icon: 'success',
duration: 1000
})
this.hideModal(e);
this.$emit('confirmFeedback');
return;
}
uni.showToast({
icon: 'error',
duration: 1000
})
}
},
}
</script>
<style scoped>
.inline-input {
flex-basis: 25%;
}
</style>