feat: 后台增加保险
This commit is contained in:
parent
a13ac431dc
commit
e24cbde6f0
|
|
@ -128,6 +128,9 @@ public class OrderMasterController extends BaseController {
|
|||
@Resource
|
||||
private InsuranceService insuranceService;
|
||||
|
||||
@Resource
|
||||
private IInsuranceManagerService insuranceManagerService;
|
||||
|
||||
@GetMapping("/changePrice/{orderIds}")
|
||||
public String changePrice(@PathVariable("orderIds") String orderIds, ModelMap mmap)
|
||||
{
|
||||
|
|
@ -191,6 +194,44 @@ public class OrderMasterController extends BaseController {
|
|||
return "order/pcOrderWorker";
|
||||
}
|
||||
|
||||
@GetMapping("/pcOrderInsurance/{orderIds}")
|
||||
public String pcOrderInsurance(@PathVariable(value = "orderIds") String orderIds, ModelMap mmap) {
|
||||
// 不知道为啥参数可能会带上双引号 这里去掉再转Long
|
||||
orderIds = orderIds.replace("\"", "");
|
||||
List<InsuranceManager> insuranceManagers = insuranceManagerService.selectInsuranceManagerList(new InsuranceManager());
|
||||
mmap.put("orderIds", orderIds);
|
||||
mmap.put("insurances", insuranceManagers);
|
||||
return "order/pcOrderInsurance";
|
||||
}
|
||||
|
||||
@PostMapping("/pcOrderWorker/changeInsurance")
|
||||
@ResponseBody
|
||||
public AjaxResult changeInsurance(OrderMaster orderMaster) {
|
||||
// 原单
|
||||
OrderMaster master = orderMasterService.selectById(orderMaster.getId());
|
||||
if(master==null || master.getInsuranceId() != null){
|
||||
return AjaxResult.error("订单已经选择过保险了!");
|
||||
}
|
||||
// 查询保险信息
|
||||
InsuranceManager insuranceManager = insuranceManagerService.selectInsuranceManagerById(orderMaster.getInsuranceId());
|
||||
if(insuranceManager == null){
|
||||
return AjaxResult.error("保险信息有误!");
|
||||
}
|
||||
// 修改主单金额 财务单总金额增加 平台金额增加
|
||||
FinancialMaster financialMaster = financialMasterService.selectByOrderMasterId(master.getId());
|
||||
financialMaster.setPayMoney(financialMaster.getPayMoney().add(insuranceManager.getInsuranceAmount()));
|
||||
financialMaster.setTotalMoney(financialMaster.getTotalMoney().add(insuranceManager.getInsuranceAmount()));
|
||||
financialMasterService.updateFinancialMaster(financialMaster);
|
||||
// 修改子单
|
||||
List<FinancialDetail> details = financialDetailService.selectByFinancialMasterIdAndType(financialMaster.getId(), FinancialDetailType.PLATFORM_FEE.getCode());
|
||||
if(CollectionUtils.isNotEmpty(details)){
|
||||
FinancialDetail detail = details.get(0);
|
||||
detail.setPayMoney(detail.getPayMoney().add(insuranceManager.getInsuranceAmount()));
|
||||
financialDetailService.updateFinancialDetail(detail);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping("/assign")
|
||||
@ResponseBody
|
||||
public AjaxResult assign(@RequestBody OrderMaster orderMaster){
|
||||
|
|
|
|||
|
|
@ -717,6 +717,7 @@
|
|||
if (row.payStatus == 0) {
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="showPayQrcode(\'' + row.id + '\')"></i>付款</a> ');
|
||||
}
|
||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="pcOrderInsurance(\'' + row.id + '\')"></i>选择保险</a> ');
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
|
|
@ -988,9 +989,23 @@
|
|||
});
|
||||
}
|
||||
|
||||
function pcOrderInsurance(orderId) {
|
||||
var url = prefix + '/pcOrderInsurance/' + orderId;
|
||||
$.modal.open("选择保险", url, '800', '300');
|
||||
|
||||
function pcOrderInsurance(id) {
|
||||
var url = prefix + "/pcOrderInsurance/" + id;
|
||||
$.modal.open("选择保险", url, '600', '300');
|
||||
// var url = "pcOrderInsurance/" + id;
|
||||
// layer.open({
|
||||
// type: 2,
|
||||
// area: ['600px', '250px'],
|
||||
// fix: false,
|
||||
// //不固定
|
||||
// maxmin: true,
|
||||
// shade: 0.3,
|
||||
// title: '选择保险',
|
||||
// content: url,
|
||||
// // 弹层外区域关闭
|
||||
// shadeClose: true
|
||||
// });
|
||||
}
|
||||
|
||||
function batchChangePrice() {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-change-provider">
|
||||
<input name="id" type="hidden" th:value="${applyId}" />
|
||||
<form class="form-horizontal m" id="form-change-insurance">
|
||||
<input name="id" type="hidden" th:value="${orderIds}" />
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">保险:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="guideUserId" name="guideUserId" class="form-control control-label" required>
|
||||
<option th:each="guide:${guides}" th:value="${guide.userId}" th:text="${guide.userName}" ></option>
|
||||
<select id="insuranceId" name="insuranceId" class="form-control control-label" required>
|
||||
<option th:each="insurance:${insurances}" th:value="${insurance.id}" th:text="${insurance.insuranceName}" ></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<script type="text/javascript">
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(ctx + "system/apply/changeGuide", $('#form-change-provider').serialize());
|
||||
$.operate.save(ctx + "order/master/pcOrderWorker/changeInsurance", $('#form-change-insurance').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue