主单退单/商家退单

This commit is contained in:
kuang.yife 2023-10-15 00:45:44 +08:00
parent 1264052f30
commit 572bfcbc05
3 changed files with 68 additions and 7 deletions

View File

@ -52,6 +52,7 @@ import com.ghy.worker.service.IWorkerCertificationService;
import com.ghy.worker.service.WorkerService;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -865,6 +866,32 @@ public class OrderMasterController extends BaseController {
return AjaxResult.success();
}
/*
* 主单退单
* */
@PostMapping("/console/cancel")
@ResponseBody
public AjaxResult consoleCancel(Long id) {
if(id == null){
return AjaxResult.error("订单编码id不能为空!");
}
// 判断该主单状态
OrderMaster orderMaster = orderMasterService.selectById(id);
if(!orderMaster.getOrderStatus().equals(OrderStatus.PLAIN.code()) && !orderMaster.getOrderStatus().equals(OrderStatus.RECEIVE.code())){
return AjaxResult.error("该订单处于无法退单状态!");
}
// 含有子单
List<OrderDetail> orderDetails = orderDetailService.selectByOrderMasterId(id);
if(CollectionUtils.isNotEmpty(orderDetails)){
return AjaxResult.error("该订单已经派发过子单,无法退单状态!");
}
// 清空id
orderMasterService.removeWorker(orderMaster.getId());
// 更新状态待接单
orderMasterService.updateStatus(orderMaster.getId(), OrderStatus.RECEIVE.code());
return AjaxResult.success();
}
/**
* 师傅审核取消主订单申请
*

View File

@ -654,7 +654,7 @@
formatter: function (value, row, index) {
if(value){
return '<small>' + value.name + value.phone + '</small><br>'
+ '<small>接单时间:' + row.revTime + '</small>';
+ '<small>接单时间:' + row.createTime + '</small>';
}
}
},
@ -664,7 +664,10 @@
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info"></i>查看</a> ');
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="orderMasterReject(\'' + row.orderMasterId + '\')"></i>商家退单</a> ');
if(row.orderStatus == 0 || row.orderStatus == 1){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="orderMasterReject(\'' + row.id + '\')"></i>主单退单</a> ');
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="orderMasterCancel(\'' + row.id + '\')"></i>商家退单</a> ');
}
if (row.workerId != null) {
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showOrderWorker(\'' + row.id + '\')"></i>指派</a> ');
} else {
@ -739,9 +742,26 @@
$.operate.post(url, data);
});
}
// function orderMasterReject(id) {
// $.modal.confirm("确定要退单吗?", function() {
// const url = "master/reject";
// const data = { "id": id };
// $.operate.post(url, data);
// });
// }
// 商家退单
function orderMasterCancel(id){
$.modal.confirm("确定要取消订单吗?", function() {
const url = "cancel";
const data = { "orderMasterId": id };
$.operate.post(url, data);
});
}
function orderMasterReject(id) {
$.modal.confirm("确定要退单吗?", function() {
const url = "master/reject";
const url = "console/cancel";
const data = { "id": id };
$.operate.post(url, data);
});

View File

@ -439,8 +439,10 @@
field: 'worker',
title: '接单信息',
formatter: function (value, row, index) {
<!-- return '<small>' + value.name + value.phone + '</small><br>'-->
<!-- + '<small>接单时间:' + row.revTime + '</small>';-->
if(value){
return '<small>' + value.name + value.phone + '</small><br>'
+ '<small>接单时间:' + row.createTime + '</small>';
}
}
},
{
@ -449,7 +451,9 @@
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info"></i>查看</a> ');
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="orderMasterReject(\'' + row.orderMasterId + '\')"></i>商家退单</a> ');
if(row.orderStatus == 0 || row.orderStatus == 1){
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="orderMasterCancel(\'' + row.id + '\')"></i>商家退单</a> ');
}
if (row.payStatus == 0) {
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showPayQrcode(\'' + row.id + '\')"></i>付款</a> ');
}
@ -534,9 +538,19 @@
$.operate.post(url, data);
});
}
// 商家退单
function orderMasterCancel(id){
$.modal.confirm("确定要取消订单吗?", function() {
const url = "cancel";
const data = { "orderMasterId": id };
$.operate.post(url, data);
});
}
function orderMasterReject(id) {
$.modal.confirm("确定要退单吗?", function() {
const url = "master/reject";
const url = "console/cancel";
const data = { "id": id };
$.operate.post(url, data);
});