增加子单售后纠纷处理
This commit is contained in:
parent
c55ac047c0
commit
7878cc61c1
|
|
@ -20,6 +20,11 @@ public class AfterServiceDisputeRequest {
|
|||
*/
|
||||
private Long orderMasterId;
|
||||
|
||||
/**
|
||||
* 子单ID
|
||||
*/
|
||||
private Long orderDetailId;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
|
|
@ -41,6 +46,14 @@ public class AfterServiceDisputeRequest {
|
|||
this.orderMasterId = orderMasterId;
|
||||
}
|
||||
|
||||
public Long getOrderDetailId() {
|
||||
return orderDetailId;
|
||||
}
|
||||
|
||||
public void setOrderDetailId(Long orderDetailId) {
|
||||
this.orderDetailId = orderDetailId;
|
||||
}
|
||||
|
||||
public BigDecimal getRefundAmount() {
|
||||
return refundAmount;
|
||||
}
|
||||
|
|
@ -54,6 +67,7 @@ public class AfterServiceDisputeRequest {
|
|||
return "AfterServiceDisputeRequest{" +
|
||||
"recordId='" + recordId + '\'' +
|
||||
", orderMasterId=" + orderMasterId +
|
||||
", orderDetailId=" + orderDetailId +
|
||||
", refundAmount=" + refundAmount +
|
||||
'}';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,6 +220,10 @@ public class OrderDetailController extends BaseController {
|
|||
if(StringUtils.isNotEmpty(orderDetail.getOrderStatusName())){
|
||||
detail.setOrderStatusName(orderDetail.getOrderStatusName());
|
||||
}
|
||||
// 确保afterServiceStatus字段不为null
|
||||
if (detail.getAfterServiceStatus() == null) {
|
||||
detail.setAfterServiceStatus(0);
|
||||
}
|
||||
Customer customer = customerMap.get(detail.getCustomerId());
|
||||
detail.setWorker(workerMap.get(detail.getWorkerId()));
|
||||
if (customer != null) {
|
||||
|
|
|
|||
|
|
@ -1482,8 +1482,7 @@ public class OrderMasterController extends BaseController {
|
|||
|
||||
// 查询主单下的所有子单
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
orderDetail.setOrderMasterId(orderMaster.getId());
|
||||
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
|
||||
List<OrderDetail> orderDetailList = orderDetailService.selectByOrderMasterId(orderMaster.getId());
|
||||
|
||||
if (orderDetailList.isEmpty()) {
|
||||
logger.info("主单[{}]没有子单", orderMaster.getId());
|
||||
|
|
@ -1541,6 +1540,38 @@ public class OrderMasterController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@PostMapping("/after/records/byDetailId")
|
||||
@ResponseBody
|
||||
public AjaxResult getAfterServiceRecordsByDetailId(@RequestBody OrderDetail orderDetail) {
|
||||
try {
|
||||
logger.info("查询子单[{}]的售后纠纷记录", orderDetail.getId());
|
||||
|
||||
// 直接查询该子单的售后纠纷记录
|
||||
AfterServiceRecord queryRecord = new AfterServiceRecord();
|
||||
queryRecord.setOrderDetailId(orderDetail.getId());
|
||||
queryRecord.setCustomerFinalCheck(0L); // 客户不同意
|
||||
queryRecord.setExcludeAfterServiceFinished(Boolean.TRUE); // 排除已完成的售后
|
||||
|
||||
List<AfterServiceRecord> disputeRecords = afterServiceRecordService.selectAfterServiceRecordList(queryRecord);
|
||||
|
||||
logger.info("子单[{}]找到{}条售后纠纷记录", orderDetail.getId(), disputeRecords.size());
|
||||
|
||||
// 为每个售后记录添加子单信息
|
||||
OrderDetail detail = orderDetailService.selectById(orderDetail.getId());
|
||||
if (detail != null) {
|
||||
disputeRecords.forEach(record -> {
|
||||
record.setOrderDetailCode(detail.getCode());
|
||||
});
|
||||
}
|
||||
|
||||
return AjaxResult.success(disputeRecords);
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("查询子单[{}]售后纠纷记录异常", orderDetail.getId(), e);
|
||||
return AjaxResult.error("查询售后纠纷记录失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/after/dispute/handle")
|
||||
@ResponseBody
|
||||
public AjaxResult handleAfterServiceDispute(@RequestBody AfterServiceDisputeRequest request) {
|
||||
|
|
|
|||
|
|
@ -691,6 +691,10 @@
|
|||
if (row.payStatus == 0) {
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showPayQrcode(\'' + row.id + '\')"></i>付款</a> ');
|
||||
}
|
||||
// 售后纠纷处理按钮
|
||||
if (row.afterServiceStatus == 1) {
|
||||
actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="handleAfterServiceDispute(\'' + row.id + '\')"><i class="fa fa-gavel"></i>售后纠纷处理</a> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
|
|
@ -975,6 +979,147 @@
|
|||
});
|
||||
}
|
||||
|
||||
// 售后纠纷处理
|
||||
function handleAfterServiceDispute(orderDetailId) {
|
||||
if (!orderDetailId) {
|
||||
$.modal.msgError("子单ID不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
// 查询该子单的售后纠纷记录
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: prefix + "/after/records/byDetailId",
|
||||
data: {orderDetailId: orderDetailId},
|
||||
success: function (result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
showAfterServiceDisputeModal(orderDetailId, result.data);
|
||||
} else {
|
||||
$.modal.msgError("查询售后纠纷记录失败:" + result.msg);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$.modal.msgError("查询售后纠纷记录失败,请重试");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 显示售后纠纷处理弹窗
|
||||
function showAfterServiceDisputeModal(orderDetailId, disputeRecords) {
|
||||
if (!disputeRecords || disputeRecords.length === 0) {
|
||||
$.modal.msgError("没有找到售后纠纷记录");
|
||||
return;
|
||||
}
|
||||
|
||||
var modalContent = '<div class="modal-body">';
|
||||
modalContent += '<div class="table-responsive">';
|
||||
modalContent += '<table class="table table-bordered table-striped">';
|
||||
modalContent += '<thead><tr>';
|
||||
modalContent += '<th>子单号</th>';
|
||||
modalContent += '<th>售后类型</th>';
|
||||
modalContent += '<th>师傅反馈</th>';
|
||||
modalContent += '<th>客户确认</th>';
|
||||
modalContent += '<th>申请退款金额</th>';
|
||||
modalContent += '<th>操作</th>';
|
||||
modalContent += '</tr></thead><tbody>';
|
||||
|
||||
disputeRecords.forEach(function(record) {
|
||||
modalContent += '<tr>';
|
||||
modalContent += '<td>' + (record.orderDetailCode || record.id) + '</td>';
|
||||
modalContent += '<td>' + getAfterServiceTypeText(record.afterServiceType) + '</td>';
|
||||
modalContent += '<td>' + getWorkerFeedbackText(record.workerFeedbackResult) + '</td>';
|
||||
modalContent += '<td>' + getCustomerCheckText(record.customerFinalCheck) + '</td>';
|
||||
modalContent += '<td>¥' + (record.agreedRefund || 0) + '</td>';
|
||||
modalContent += '<td>';
|
||||
modalContent += '<input type="number" class="form-control" id="refundAmount_' + record.id + '" placeholder="输入退款金额" value="' + (record.agreedRefund || 0) + '" style="width: 120px; display: inline-block;">';
|
||||
modalContent += '<button class="btn btn-primary btn-xs" onclick="processRefund(' + record.id + ', ' + orderDetailId + ')" style="margin-left: 5px;">处理退款</button>';
|
||||
modalContent += '</td>';
|
||||
modalContent += '</tr>';
|
||||
});
|
||||
|
||||
modalContent += '</tbody></table>';
|
||||
modalContent += '</div>';
|
||||
modalContent += '</div>';
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '售后纠纷处理 - 子单ID: ' + orderDetailId,
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['90%', '80%'],
|
||||
content: modalContent
|
||||
});
|
||||
}
|
||||
|
||||
// 处理退款
|
||||
function processRefund(recordId, orderDetailId) {
|
||||
var refundAmount = $('#refundAmount_' + recordId).val();
|
||||
if (!refundAmount || refundAmount <= 0) {
|
||||
$.modal.msgError("请输入有效的退款金额");
|
||||
return;
|
||||
}
|
||||
|
||||
$.modal.confirm("确认处理退款吗?退款金额:¥" + refundAmount, function() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: prefix + "/after/dispute/handle",
|
||||
data: {
|
||||
recordId: recordId,
|
||||
orderDetailId: orderDetailId,
|
||||
refundAmount: refundAmount
|
||||
},
|
||||
success: function (result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess("退款处理成功");
|
||||
// 关闭弹窗
|
||||
layer.closeAll();
|
||||
// 刷新表格
|
||||
$.table.refresh();
|
||||
} else {
|
||||
$.modal.msgError("退款处理失败:" + result.msg);
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$.modal.msgError("退款处理失败,请重试");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 获取售后类型文本
|
||||
function getAfterServiceTypeText(type) {
|
||||
var typeMap = {
|
||||
1: '未收到货',
|
||||
2: '已收到货',
|
||||
3: '质量问题',
|
||||
4: '其他'
|
||||
};
|
||||
return typeMap[type] || '未知';
|
||||
}
|
||||
|
||||
// 获取师傅反馈文本
|
||||
function getWorkerFeedbackText(result) {
|
||||
var resultMap = {
|
||||
0: '拒绝',
|
||||
1: '同意',
|
||||
2: '上门补做/重做',
|
||||
3: '重做/补做完成'
|
||||
};
|
||||
return resultMap[result] || '未处理';
|
||||
}
|
||||
|
||||
// 获取客户确认文本
|
||||
function getCustomerCheckText(check) {
|
||||
var checkMap = {
|
||||
0: '不同意',
|
||||
1: '同意',
|
||||
2: '未处理'
|
||||
};
|
||||
return checkMap[check] || '未处理';
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue