租车套餐

This commit is contained in:
19173159168
2025-07-09 22:53:20 +08:00
parent ed0c78bb13
commit 6cdcb8574a
9 changed files with 226 additions and 27 deletions

View File

@ -12,12 +12,6 @@
<input name="ruleName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐编码:</label>
<div class="col-sm-8">
<input name="ruleCode" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租赁类型:</label>
<div class="col-sm-8">
@ -156,7 +150,7 @@
$.get(prefix2 + '/list/byLeaseType', { leaseType: newRentalType }, function(data) {
var html = '';
data.forEach(function(rule) {
html += `<div class="checkbox"><label><input type="checkbox" name="batteryRules" value="${rule.id}"> ${rule.title}</label></div>`;
html += `<div class="checkbox"><label><input type="checkbox" id="batteryRules" name="batteryRules" value="${rule.id}"> ${rule.title}</label></div>`;
});
$('#batteryRuleList').html(html);
});

View File

@ -0,0 +1,153 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('租车计费规则')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-rentCarRule-edit" th:object="${zcRentCarRule}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐名称:</label>
<div class="col-sm-8">
<input name="ruleName" th:field="*{ruleName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租赁类型:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('key_rent_type')}">
<input type="radio" th:id="${'rentalType_' + dict.dictCode}" name="rentalType" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{rentalType}" >
<label th:for="${'rentalType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">租赁天数:</label>
<div class="col-sm-8">
<input name="rentalDays" th:field="*{rentalDays}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租车价格(元)</label>
<div class="col-sm-8">
<input name="rentalPrice" th:field="*{rentalPrice}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">押金价格(元)</label>
<div class="col-sm-8">
<input name="depositPrice" th:field="*{depositPrice}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">逾期金额(元)</label>
<div class="col-sm-8">
<input name="overdueFee" th:field="*{overdueFee}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">逾期计费类型:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('key_rent_overdue_type')}">
<input type="radio" th:id="${'overdueType_' + dict.dictCode}" name="overdueType" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{overdueType}" >
<label th:for="${'overdueType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否支持免押:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('key_rent_deposit_free')}">
<input type="radio" th:id="${'depositFree_' + dict.dictCode}" name="depositFree" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{depositFree}" >
<label th:for="${'depositFree_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否支持代扣:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('key_rent_auto_deduct')}">
<input type="radio" th:id="${'autoDeduct_' + dict.dictCode}" name="autoDeduct" th:value="${dict.dictValue}" th:checked="${dict.default}" th:field="*{autoDeduct}" >
<label th:for="${'autoDeduct_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">所属运营商:</label>
<div class="col-sm-8">
<select name="operatingCompanyId" id="operatingCompanyId" class="form-control m-b" disabled>
<option value="">请选择所属运营商</option>
<option th:each="company : ${companyList}" th:value="${company.id}" th:text="${company.companyName}" th:field="*{operatingCompanyId}" ></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租电套餐:</label>
<div class="col-sm-8">
<div id="batteryRuleList"></div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "operation/rentCarRule";
var prefix2 = ctx + "operation/rentBatteyRule"
var selectedBatteryRuleIds = [[${#strings.listJoin(selectedBatteryRuleIds, ',')}]];
$("#form-rentCarRule-edit").validate({
rules:{
rentalPrice:{
number:true
},
depositPrice:{
number:true
},
overdueFee:{
number:true
}
},
focusCleanup: true
});
$(document).ready(function() {
// 初始隐藏租赁天数
$('input[name="rentalDays"]').closest('.form-group').hide();
// 检查初始选中项
if($('input[name="rentalType"]:checked').val() === '3') {
$('input[name="rentalDays"]').closest('.form-group').show();
}
var currentRentalType = $('input[name="rentalType"]:checked').val();
// 加载租电规则并回显已选中的项
loadBatteryRules(currentRentalType, /* 回显已选中 */ true);
});
function loadBatteryRules(leaseType, isEdit) {
$.get(prefix2 + '/list/byLeaseType', { leaseType: leaseType }, function(data) {
var html = '';
data.forEach(function(rule) {
var checked = '';
if (isEdit && selectedBatteryRuleIds.includes(rule.id)) {
checked = 'checked';
}
html += `<div class="checkbox"><label><input type="checkbox" name="batteryRules" value="${rule.id}" ${checked}> ${rule.title}</label></div>`;
});
$('#batteryRuleList').html(html);
});
}
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-rentCarRule-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -13,12 +13,6 @@
<input name="ruleName" th:field="*{ruleName}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐编码:</label>
<div class="col-sm-8">
<input name="ruleCode" th:field="*{ruleCode}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">租赁类型:</label>
<div class="col-sm-8">

View File

@ -97,6 +97,7 @@
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
detailUrl: prefix + "/detail/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "租车套餐",
@ -160,10 +161,6 @@
return $.table.selectDictLabel(autoDeductDatas, value);
}
},
{
field: 'operatingCompanyId',
title: '关联电池套餐'
},
{
field: 'status',
title: '状态',
@ -180,13 +177,14 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
if (row.status == 1) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="enable(\'' + row.id + '\',\'' + row.phone + '\')"><i class="fa fa-edit"></i>启用</a> ');
} else {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="disable(\'' + row.id + '\',\'' + row.phone + '\')"><i class="fa fa-edit"></i>停用</a> ');
}
actions.push('<a class="btn btn-primary btn-xs btnOption" href="javascript:void(0)" onClick="$.operate.detail(\''+row.id+'\', 900, 700)"><i class="fa fa-sticky-note-o"></i> 查看</a>');
return actions.join('');
}
}]
@ -195,7 +193,7 @@
});
/* 停用 */
function disable(id,phone) {
function disable(id, phone) {
$.modal.confirm("确认是否停用该套餐?<span style='color: red'>此套餐停用后正在租用订单继续生效,续租订单继续以原订单为准</span>", function() {
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
})