<template>
|
<div class="refund inner-bg-style">
|
<refund-basic-info ref="refundForm" :form="form" :warehouseData="warehouseData"
|
:logisticSupplier="logisticSupplier" :warehouse="warehouse">
|
<template slot="refundResult" slot-scope="scope">
|
<el-form-item label="审核结果:">
|
<el-radio-group v-model="auditState">
|
<el-radio :label="true">通过</el-radio>
|
<el-radio :label="false">驳回</el-radio>
|
</el-radio-group>
|
<!-- <el-switch v-model="auditState" active-color="#13ce66" inactive-color="#ff4949" active-text="通过" inactive-text="驳回"></el-switch> -->
|
</el-form-item>
|
<div v-if="form.omsOrder && form.omsOrder.orderSource === 'DY'&& !auditState">
|
<el-form-item label="上传凭证:" prop="evidence"
|
:rules="[{required:!auditState, message:'请上传凭证'}]">
|
<custom-upload-img :limitNumber="1" @handle-success="handleSuccess"
|
@handle-remove="handleRemove" :fileList="fileList">
|
</custom-upload-img>
|
</el-form-item>
|
<el-form-item label="审核意见:" prop="operationDesc"
|
:rules="[{required:!auditState, message:'请选择审核意见'}]">
|
<el-select v-model="scope.data.operationDesc" placeholder="请选择审核意见">
|
<el-option v-for="item in dyRefuseType" :key="item.id" :value="item.id"
|
:label="item.name"></el-option>
|
</el-select>
|
</el-form-item>
|
</div>
|
<el-form-item v-else label="审核意见:" prop="operationDesc"
|
:rules="[{required:!auditState, message:'请输入审核意见'},{max:1024, message:'审核意见最多只能输入 1024 个字'}]">
|
<el-input type="textarea" v-model="scope.data.operationDesc"
|
:autosize="{minRows:4,maxRows:8}"></el-input>
|
</el-form-item>
|
</template>
|
</refund-basic-info>
|
<el-row class="buttonPosition" v-if="showBtn">
|
<el-button type="primary" size="mini" @click="submit">保存</el-button>
|
<el-button size="mini" @click="cancel">取消</el-button>
|
</el-row>
|
</div>
|
</template>
|
<script>
|
import orderMgtApi from '@/api/orderMgt'
|
import refundBasicInfo from '@/views/refundMgt/components/refundBasicInfo.vue'
|
import dyRefuseType from '@/utils/constant/dyRefuseType'
|
import uploadFileApi from '@/api/uploadFile'
|
|
export default {
|
components: { refundBasicInfo },
|
props: ['refundApi', 'name'],
|
data () {
|
return {
|
form: {
|
evidence: null
|
},
|
auditState: true,
|
fileList: [],
|
dyRefuseType,
|
showBtn: false,
|
logisticSupplier: null,
|
warehouse: null,
|
warehouseData: []
|
}
|
},
|
created () {
|
this.getDetails()
|
},
|
methods: {
|
/**
|
* 获取上传成功的图片
|
*/
|
handleSuccess (data) {
|
this.form.evidence = data.url
|
this.fileList.push({
|
url: data.url,
|
id: data.id
|
})
|
this.$refs.refundForm.$refs.form.clearValidate('evidence')
|
},
|
/**
|
* 移除图片
|
*/
|
handleRemove (file) {
|
uploadFileApi.removeFile({ key: file.id }).then(res => {
|
this.fileList = this.fileList.filter(v => {
|
return v.id !== file.id
|
})
|
this.form.evidence = null
|
})
|
},
|
/**
|
* 查询详情
|
*/
|
getDetails () {
|
this.refundApi.detailsInfo({ orderRefundId: this.$route.query.orderRefundId }).then(res => {
|
if (res.data) {
|
res.data.operationDesc = null
|
res.data.evidence = null
|
res.data.shopName = this.$route.query.shopName
|
this.form = res.data
|
this.showBtn = true
|
// 获取物流服务商
|
this.getLogisticsProvidersData()
|
}
|
})
|
},
|
/**
|
* 获取物流服务商
|
*/
|
async getLogisticsProvidersData () {
|
this.logisticSupplier = null
|
this.warehouse = null
|
const res = await orderMgtApi.getWarehouseTree({})
|
if (res.code === '200' && res.data.length) {
|
this.warehouseData = res.data
|
const obj = this.warehouseData.find((v1) => v1.warehouseService === this.form.omsOrderDelivery.logisticSupplier)
|
if (obj) {
|
this.logisticSupplier = obj.warehouseServiceName
|
const obj1 = obj.treeList && obj.treeList.length ? obj.treeList.find((v2) => v2.entityWarehouseNo === this.form.omsOrderDelivery.warehouse) : null
|
if (obj1) {
|
this.warehouse = obj1.warehouseName
|
}
|
}
|
}
|
},
|
/**
|
* 保存
|
*/
|
submit () {
|
this.$refs.refundForm.$refs.form.validate().then(res => {
|
const params = {
|
operationDesc: this.form.operationDesc,
|
orderRefundId: this.$route.query.orderRefundId,
|
evidence: this.form.evidence
|
}
|
if (this.form.omsOrderRefund.refundType !== '1' && this.auditState) {
|
this.isRefundAndReturn(params)
|
} else {
|
if (this.auditState) {
|
this.platformPass(params)
|
} else {
|
this.platformRefuse(params)
|
}
|
}
|
}).catch(() => { })
|
},
|
// 当退款类型为退款退货且通过退款时提示
|
isRefundAndReturn (params) {
|
this.$confirm('确认后需用户寄回商品,确认通过审核?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.platformPass(params)
|
}).catch(() => { })
|
},
|
/**
|
* 通过退款
|
*/
|
platformPass (params) {
|
this.refundApi.platformPass(params).then(res => {
|
if (res.code === '0') {
|
this.$router.push({ name: this.name })
|
this.$message({
|
type: 'success',
|
message: '操作成功'
|
})
|
}
|
})
|
},
|
/**
|
* 拒绝退款
|
*/
|
platformRefuse (params) {
|
this.refundApi.platformRefuse(params).then(res => {
|
if (res.code === '0') {
|
this.$router.push({ name: this.name })
|
this.$message({
|
type: 'success',
|
message: '操作成功'
|
})
|
}
|
})
|
},
|
/**
|
* ‘取消
|
*/
|
cancel () {
|
this.$router.push({ name: this.name })
|
}
|
}
|
}
|
</script>
|
<style lang="scss">
|
.refund {
|
padding: 10px;
|
.buttonPosition {
|
text-align: center;
|
margin-top: 10px;
|
}
|
}
|
</style>
|