Commit 069a06c3 authored by jiaorz's avatar jiaorz

1456

parent 18f8da7c
......@@ -171,3 +171,12 @@ export function orderDetail(query) {
params: query
});
}
export function refund(orderNo) {
return fetch({
url: 'api/order/baseOrder/app/unauth/refundDeposit/'+orderNo,
method: 'get'
});
}
......@@ -94,7 +94,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="cancel">取 消</el-button>
<el-button @click="refundMoney" v-if = "orderDetailInfo.refundStatus == 2">立即退款</el-button>
<el-button type="primary" @click="okHandler('form')">确 定</el-button>
</div>
</el-dialog>
......@@ -104,7 +104,7 @@ import { page, saveOrderViolation } from 'api/order/rentVehicle'
import { mapGetters } from 'vuex'
import { formatDate } from '../../../utils/dateFormattor'
import { getToken } from '../../../utils/auth'
import { getOneIllegalRow } from 'api/order/rentVehicle'
import { getOneIllegalRow, orderDetail,refund } from 'api/order/rentVehicle'
import ElRow from 'element-ui/packages/row/src/row'
import ElInput from '../../../../node_modules/element-ui/packages/input/src/input.vue'
import ElCol from 'element-ui/packages/col/src/col'
......@@ -123,12 +123,19 @@ export default {
data() {
return {
BASE_API: process.env.BASE_API,
price: undefined, //违章罚款金额
price: 0, //违章罚款金额
isVisible: false,
fileList2: [] //违章截图
fileList2: [], //违章截图
refundStatus: 0,
orderDetailInfo:{}
}
},
created() {},
created() {
console.log(this.row)
console.log(this.row.orderNo)
this.getOrderDetail(this.row.orderNo);
},
watch: {
isVisible(newValue, oldValue) {
if (!newValue) {
......@@ -182,6 +189,81 @@ export default {
}
})
},
refundMoney() {
let that = this;
console.log(that.orderDetailInfo)
var orderNo = that.orderDetailInfo.no
//1、查询订单押金状态
if (that.orderDetailInfo.refundStatus == 2) {//可以退还
var money = that.orderDetailInfo.orderRentVehicleDetail.returnPayResidue - that.price
console.log(money)
that.$confirm('违章罚款金'+that.price+"元, 将退还" + money + "元", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (that.price <= 0) { //当金额小于0直接退款
refund(orderNo).then(() => {
that.$notify({
title: '成功',
message: '退款成功',
type: 'success',
duration: 2000
})
})
} else { //当金额大于0先添加记录,再退款
that.okHandler();
setTimeout(
refund(orderNo).then(() => {
that.$notify({
title: '成功',
message: '退款成功',
type: 'success',
duration: 2000
})
}), 2000)
}
})
} else {
this.$notify({
title: '失败',
message: '订单当前不能退还违章保证金!',
type: 'error',
duration: 2000
})
}
},
refund(orderNo) {
refund(orderNo).then(data=>{
if (data.status == 200) {
console.log(data)
this.$notify({
title: '成功',
message: '押金退还成功!',
type: 'success',
duration: 2000
})
}
})
},
getOrderDetail(orderNo) {
let param = {
"orderNo":orderNo,
"flag" : true
}
orderDetail(param).then(data=>{
console.log(data)
if (data.status == 200) {
this.orderDetailInfo = data.data
}
})
},
/**
* 上传成功
* */
......@@ -218,6 +300,7 @@ export default {
type: 'success',
duration: 2000
})
//添加退款
this.$emit('illegalEvent', false)
} else {
this.$notify({
......
......@@ -1248,6 +1248,7 @@ export default {
* */
illegalEvent(params) {
this.illegalVisible = false
console.log(params)
if (params) {
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment