Commit 1660e616 authored by jiaorz's avatar jiaorz

增加后台订单取消

parent 69502ce6
...@@ -104,8 +104,8 @@ export function calculate(no, params) { ...@@ -104,8 +104,8 @@ export function calculate(no, params) {
*/ */
export function getViolatePrice(no) { export function getViolatePrice(no) {
return fetch({ return fetch({
url: '/api/order/orderRefund/back-stage/getViolatePrice/'+ no, url: '/api/order/orderRefund/bg-stage/getViolatePrice/'+ no,
method: 'post', method: 'get',
}); });
} }
......
...@@ -427,6 +427,22 @@ ...@@ -427,6 +427,22 @@
</div> </div>
</el-form> </el-form>
</el-dialog> </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> </div>
</template> </template>
...@@ -471,6 +487,11 @@ export default { ...@@ -471,6 +487,11 @@ export default {
depositRefundRecord: [], depositRefundRecord: [],
dedTotal: '', dedTotal: '',
Tel: '', Tel: '',
showDialog:false,
changeViolateAmount:null,
violateAmount: null,
row:null,
topAmount: null,
form: { form: {
couponAmount: undefined, couponAmount: undefined,
crtHost: undefined, crtHost: undefined,
...@@ -693,7 +714,9 @@ export default { ...@@ -693,7 +714,9 @@ export default {
}, },
methods: { methods: {
//取消订单 //取消订单
cancel(row) { cancel(row, changeViolateAmount) {
let that = this;
if (changeViolateAmount == null || changeViolateAmount == 0) {
this.$confirm('此操作将取消该订单, 是否继续?', '提示', { this.$confirm('此操作将取消该订单, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -701,7 +724,8 @@ export default { ...@@ -701,7 +724,8 @@ export default {
}).then(() => { }).then(() => {
let params = { let params = {
cancelReason: '后台取消', cancelReason: '后台取消',
appUserId: row.userId appUserId: row.userId,
changeViolateAmount: null
} }
calculate(row.no, params).then(data => { calculate(row.no, params).then(data => {
if (data.status == 200) { if (data.status == 200) {
...@@ -716,22 +740,87 @@ export default { ...@@ -716,22 +740,87 @@ export default {
this.$notify({ this.$notify({
title: '失败', title: '失败',
message: '取消订单失败', message: '取消订单失败',
type: 'success', type: 'fail',
duration: 2000 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) { handleViolatePrice(row) {
let that = this;
let params = { let params = {
cancelReason: '后台取消', cancelReason: '后台取消',
appUserId: row.userId appUserId: row.userId
} }
getViolatePrice(row.no).then(data => { getViolatePrice(row.no).then(data => {
if (data.status == 200) { if (data.status == 200) {
console.log(data) that.topAmount = data.data.topAmount;
that.cancel(row, data.data.cutAmount);
} else { } else {
this.$notify({ this.$notify({
title: '失败', title: '失败',
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
size="small" size="small"
v-if="scope.row.status == 3 || scope.row.status == 4" v-if="scope.row.status == 3 || scope.row.status == 4"
class="el-button el-button--text el-button--small" class="el-button el-button--text el-button--small"
@click="cancel(scope.row)" @click="handleViolatePrice(scope.row)"
>取消订单</el-button> >取消订单</el-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -130,7 +130,25 @@ ...@@ -130,7 +130,25 @@
<tourOrderDetailModal :tourRow="tourRow" :insureDetail="insureDetail" v-if="tourDialogVisible" <tourOrderDetailModal :tourRow="tourRow" :insureDetail="insureDetail" v-if="tourDialogVisible"
:tourCostDetail="tourCostDetail" :tourCostDetail="tourCostDetail"
v-on:tourOrderDetailDialogEvent="tourOrderDetailDialogEvent"></tourOrderDetailModal> 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> </div>
</el-dialog>
</div>
</template> </template>
<script> <script>
...@@ -140,7 +158,8 @@ ...@@ -140,7 +158,8 @@
page, page,
getAllBranchCompany, getAllBranchCompany,
getAllBranchCompanyByZoneId, getAllBranchCompanyByZoneId,
calculate calculate,
getViolatePrice
} from 'api/order/rentVehicle'; } from 'api/order/rentVehicle';
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
import rsCode from '../../../utils/rsCode'; import rsCode from '../../../utils/rsCode';
...@@ -162,6 +181,11 @@ ...@@ -162,6 +181,11 @@
}, },
data() { data() {
return { return {
showDialog:false,
changeViolateAmount:null,
violateAmount: null,
row:null,
topAmount: null,
form: { form: {
couponAmount: undefined, couponAmount: undefined,
crtHost: undefined, crtHost: undefined,
...@@ -378,7 +402,10 @@ ...@@ -378,7 +402,10 @@
/** /**
* 取消订单 * 取消订单
*/ */
cancel(row) { //取消订单
cancel(row, changeViolateAmount) {
let that = this;
if (changeViolateAmount == null || changeViolateAmount == 0) {
this.$confirm('此操作将取消该订单, 是否继续?', '提示', { this.$confirm('此操作将取消该订单, 是否继续?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -386,7 +413,8 @@ ...@@ -386,7 +413,8 @@
}).then(() => { }).then(() => {
let params = { let params = {
cancelReason: '后台取消', cancelReason: '后台取消',
appUserId: row.userId appUserId: row.userId,
changeViolateAmount: null
} }
calculate(row.no, params).then(data => { calculate(row.no, params).then(data => {
if (data.status == 200) { if (data.status == 200) {
...@@ -401,11 +429,95 @@ ...@@ -401,11 +429,95 @@
this.$notify({ this.$notify({
title: '失败', title: '失败',
message: '取消订单失败', 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', type: 'success',
duration: 2000 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