89 lines
2.8 KiB
Vue
89 lines
2.8 KiB
Vue
<template>
|
|
<el-form ref="form" label-width="80px">
|
|
<el-form-item label="退款原因" required>
|
|
<el-input v-model="refundReason" placeholder="请输入退款原因"/>
|
|
</el-form-item>
|
|
<el-form-item label="图片">
|
|
<u-upload
|
|
multiple
|
|
:fileList="refundPhotos"
|
|
@afterRead="afterRead"
|
|
@delete="deletePic"
|
|
width="120rpx"
|
|
height="120rpx"
|
|
></u-upload>
|
|
</el-form-item>
|
|
<div class="mt-20 flex justify-center items-center text-center">
|
|
<el-button type="primary" size="small" plain @click.native="cancel">取消</el-button>
|
|
<el-button type="primary" size="small" @click.native="confirm">确定</el-button>
|
|
</div>
|
|
</el-form>
|
|
</template>
|
|
|
|
<script>
|
|
import dayjs from "dayjs";
|
|
import md5 from "js-md5";
|
|
|
|
export default {
|
|
name: "setRefund",
|
|
props: {
|
|
id: Number | String
|
|
},
|
|
data() {
|
|
return {
|
|
refundReason: null,
|
|
refundPhotos: [],
|
|
}
|
|
},
|
|
methods: {
|
|
afterRead({file}) {
|
|
file.forEach(item => {
|
|
const suffix = item.name.split('.').pop()
|
|
uniCloud.uploadFile({
|
|
filePath: item.url,
|
|
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(item.name + Date.now().toString()) + `.${suffix}`,
|
|
success: ({fileID}) => {
|
|
uniCloud.getTempFileURL({
|
|
fileList: [fileID]
|
|
}).then(res => {
|
|
this.refundPhotos.push({url: res.fileList[0].tempFileURL})
|
|
})
|
|
}
|
|
})
|
|
})
|
|
},
|
|
deletePic({index}) {
|
|
this.refundPhotos.splice(index, 1)
|
|
},
|
|
close() {
|
|
this.$emit('close')
|
|
},
|
|
cancel() {
|
|
this.refundReason = null
|
|
this.refundPhotos = []
|
|
this.close()
|
|
},
|
|
async confirm() {
|
|
if (!this.refundReason) return this.$message({
|
|
type: 'error',
|
|
message: '请填写退款原因'
|
|
})
|
|
const res = await vk.callFunction({
|
|
url: 'client/order/kh/refund',
|
|
data: {
|
|
id: this.id,
|
|
refundReason: this.refundReason,
|
|
refundPhotos: this.refundPhotos,
|
|
}
|
|
}).catch(err => false)
|
|
if (res) {
|
|
this.$emit('close')
|
|
this.$message({
|
|
type: 'success',
|
|
message: '平台将在2个工作日内审核,请您耐心等待'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script> |