Commit 1660e616 authored by jiaorz's avatar jiaorz

增加后台订单取消

parent 69502ce6
......@@ -104,8 +104,8 @@ export function calculate(no, params) {
*/
export function getViolatePrice(no) {
return fetch({
url: '/api/order/orderRefund/back-stage/getViolatePrice/'+ no,
method: 'post',
url: '/api/order/orderRefund/bg-stage/getViolatePrice/'+ no,
method: 'get',
});
}
......
......@@ -427,6 +427,22 @@
</div>
</el-form>
</el-dialog>
<el-dialog title="取消订单" :visible.sync="showDialog">
<el-form>
<el-form-item label="违约金金额:" >
<el-input v-model="violateAmount" type="number" @blur="checkViolateAmount()" auto-complete="off"></el-input>
</el-form-item>
<el-form-item>
<span class="label-text">实际违约金是{{changeViolateAmount}}元</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click = "handleCancelDialog()">取 消</el-button>
<el-button type="primary" @click = "handleConfirm()">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -471,6 +487,11 @@ export default {
depositRefundRecord: [],
dedTotal: '',
Tel: '',
showDialog:false,
changeViolateAmount:null,
violateAmount: null,
row:null,
topAmount: null,
form: {
couponAmount: undefined,
crtHost: undefined,
......@@ -693,7 +714,9 @@ export default {
},
methods: {
//取消订单
cancel(row) {
cancel(row, changeViolateAmount) {
let that = this;
if (changeViolateAmount == null || changeViolateAmount == 0) {
this.$confirm('此操作将取消该订单, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -701,7 +724,8 @@ export default {
}).then(() => {
let params = {
cancelReason: '后台取消',
appUserId: row.userId
appUserId: row.userId,
changeViolateAmount: null
}
calculate(row.no, params).then(data => {
if (data.status == 200) {
......@@ -716,22 +740,87 @@ export default {
this.$notify({
title: '失败',
message: '取消订单失败',
type: 'success',
type: 'fail',
duration: 2000
})
}
})
})
},
} else {
// this.$prompt('请输入违约金', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// inputPattern: /^[0-9]*$/,
// inputErrorMessage: '只能输入数字'
// }).then(({ value }) => {
// this.$message({
// type: 'success',
// message: '你的邮箱是: ' + value
// });
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '取消输入'
// });
// });
that.showDialog = true
that.changeViolateAmount = changeViolateAmount
that.violateAmount = changeViolateAmount
that.row = row
}
},
checkViolateAmount() {
console.log(this.topAmount)
console.log(this.violateAmount)
if(this.topAmount < this.violateAmount) {
this.$notify({
title: '失败',
message: '违约金额不能大于最高限制金额' + this.topAmount,
type: 'fail',
duration: 2000
})
}
},
handleConfirm() {
let params = {
cancelReason: '后台取消',
appUserId: this.row.userId,
changeViolateAmount: this.violateAmount
}
calculate(this.row.no, params).then(data => {
if (data.status == 200) {
this.$notify({
title: '成功',
message: '取消订单成功',
type: 'success',
duration: 2000
})
this.showDialog = false
this.getList()
} else {
this.$notify({
title: '失败',
message: '取消订单失败',
type: 'fail',
duration: 2000
})
}
})
},
handleCancelDialog() {
this.showDialog = false
},
handleViolatePrice(row) {
let that = this;
let params = {
cancelReason: '后台取消',
appUserId: row.userId
}
getViolatePrice(row.no).then(data => {
if (data.status == 200) {
console.log(data)
that.topAmount = data.data.topAmount;
that.cancel(row, data.data.cutAmount);
} else {
this.$notify({
title: '失败',
......
......@@ -115,7 +115,7 @@
size="small"
v-if="scope.row.status == 3 || scope.row.status == 4"
class="el-button el-button--text el-button--small"
@click="cancel(scope.row)"
@click="handleViolatePrice(scope.row)"
>取消订单</el-button>
</template>
</el-table-column>
......@@ -130,7 +130,25 @@
<tourOrderDetailModal :tourRow="tourRow" :insureDetail="insureDetail" v-if="tourDialogVisible"
:tourCostDetail="tourCostDetail"
v-on:tourOrderDetailDialogEvent="tourOrderDetailDialogEvent"></tourOrderDetailModal>
<el-dialog title="取消订单" :visible.sync="showDialog">
<el-form>
<el-form-item label="违约金金额:" >
<el-input v-model="violateAmount" type="number" @blur="checkViolateAmount()" auto-complete="off"></el-input>
</el-form-item>
<el-form-item>
<span class="label-text">实际违约金是{{changeViolateAmount}}元</span>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click = "handleCancelDialog()">取 消</el-button>
<el-button type="primary" @click = "handleConfirm()">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
......@@ -140,7 +158,8 @@
page,
getAllBranchCompany,
getAllBranchCompanyByZoneId,
calculate
calculate,
getViolatePrice
} from 'api/order/rentVehicle';
import {mapGetters} from 'vuex';
import rsCode from '../../../utils/rsCode';
......@@ -162,6 +181,11 @@
},
data() {
return {
showDialog:false,
changeViolateAmount:null,
violateAmount: null,
row:null,
topAmount: null,
form: {
couponAmount: undefined,
crtHost: undefined,
......@@ -378,7 +402,10 @@
/**
* 取消订单
*/
cancel(row) {
//取消订单
cancel(row, changeViolateAmount) {
let that = this;
if (changeViolateAmount == null || changeViolateAmount == 0) {
this.$confirm('此操作将取消该订单, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -386,7 +413,8 @@
}).then(() => {
let params = {
cancelReason: '后台取消',
appUserId: row.userId
appUserId: row.userId,
changeViolateAmount: null
}
calculate(row.no, params).then(data => {
if (data.status == 200) {
......@@ -401,11 +429,95 @@
this.$notify({
title: '失败',
message: '取消订单失败',
type: 'fail',
duration: 2000
})
}
})
})
} else {
// this.$prompt('请输入违约金', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// inputPattern: /^[0-9]*$/,
// inputErrorMessage: '只能输入数字'
// }).then(({ value }) => {
// this.$message({
// type: 'success',
// message: '你的邮箱是: ' + value
// });
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '取消输入'
// });
// });
that.showDialog = true
that.changeViolateAmount = changeViolateAmount
that.violateAmount = changeViolateAmount
that.row = row
}
},
checkViolateAmount() {
console.log(this.topAmount)
console.log(this.violateAmount)
if(this.topAmount < this.violateAmount) {
this.$notify({
title: '失败',
message: '违约金额不能大于最高限制金额' + this.topAmount,
type: 'fail',
duration: 2000
})
}
},
handleConfirm() {
let params = {
cancelReason: '后台取消',
appUserId: this.row.userId,
changeViolateAmount: this.violateAmount
}
calculate(this.row.no, params).then(data => {
if (data.status == 200) {
this.$notify({
title: '成功',
message: '取消订单成功',
type: 'success',
duration: 2000
})
this.showDialog = false
this.getList()
} else {
this.$notify({
title: '失败',
message: '取消订单失败',
type: 'fail',
duration: 2000
})
}
})
},
handleCancelDialog() {
this.showDialog = false
},
handleViolatePrice(row) {
let that = this;
let params = {
cancelReason: '后台取消',
appUserId: row.userId
}
getViolatePrice(row.no).then(data => {
if (data.status == 200) {
that.topAmount = data.data.topAmount;
that.cancel(row, data.data.cutAmount);
} else {
this.$notify({
title: '失败',
message: '获取违约金失败',
type: 'success',
duration: 2000
})
}
})
},
......
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