租车套餐

This commit is contained in:
19173159168
2025-07-09 23:36:10 +08:00
parent 6cdcb8574a
commit 5bbf431c3f
4 changed files with 38 additions and 6 deletions

View File

@ -57,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> and a.status = #{status}</if>
<if test="isDefault != null and isDefault != ''"> and a.is_default = #{isDefault}</if>
</where>
order by a.update_time desc
</select>
<select id="selectZcRentCarRuleById" parameterType="Long" resultMap="ZcRentCarRuleResult">

View File

@ -9,7 +9,7 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">套餐名称:</label>
<div class="col-sm-8">
<input name="ruleName" class="form-control" type="text" required>
<input name="ruleName" class="form-control" type="text" maxlength="20" required>
</div>
</div>
<div class="form-group">
@ -114,12 +114,16 @@
$(document).ready(function() {
// 初始隐藏租赁天数
var $rentalDaysGroup = $('input[name="rentalDays"]').closest('.form-group').hide();
// 初始隐藏逾期金额
var $overdueFeeGroup = $('input[name="overdueFee"]').closest('.form-group').show();
// 保存当前选中的值
var currentRentalType = $('input[name="rentalType"]:checked').val();
// 检查初始选中项
if(currentRentalType === '3') {
if(currentRentalType === '1') {
$overdueFeeGroup.hide().find('input').val('');
}else if(currentRentalType === '3') {
$rentalDaysGroup.show();
}
@ -135,6 +139,12 @@
// 更新当前值
currentRentalType = newRentalType;
// 处理逾期金额显示/隐藏
if(newRentalType === '1') {
$overdueFeeGroup.hide().find('input').val('');
} else {
$overdueFeeGroup.show();
}
// 处理租赁天数显示/隐藏
if(newRentalType === '3') {
$rentalDaysGroup.show();
@ -149,6 +159,9 @@
if(newRentalType) {
$.get(prefix2 + '/list/byLeaseType', { leaseType: newRentalType }, function(data) {
var html = '';
if(data.length === 0){
$.modal.alert("未找到与租赁类型相同的租电套餐");
}
data.forEach(function(rule) {
html += `<div class="checkbox"><label><input type="checkbox" id="batteryRules" name="batteryRules" value="${rule.id}"> ${rule.title}</label></div>`;
});
@ -158,6 +171,10 @@
});
});
function submitHandler() {
if($('input[name="batteryRules"]:checked').length === 0){
$.modal.alert("请选择租电套餐");
return;
}
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-rentCarRule-add').serialize());
}

View File

@ -118,13 +118,20 @@
// 初始隐藏租赁天数
$('input[name="rentalDays"]').closest('.form-group').hide();
// 初始显示逾期金额
var $overdueFeeGroup = $('input[name="overdueFee"]').closest('.form-group');
// 检查初始选中项
if($('input[name="rentalType"]:checked').val() === '3') {
$('input[name="rentalDays"]').closest('.form-group').show();
}
var currentRentalType = $('input[name="rentalType"]:checked').val();
// 检查初始选中项
if(currentRentalType === '1') {
$overdueFeeGroup.hide().find('input').val('');
}else if(currentRentalType === '3') {
$rentalDaysGroup.show();
}
// 加载租电规则并回显已选中的项
loadBatteryRules(currentRentalType, /* 回显已选中 */ true);
});

View File

@ -115,7 +115,10 @@
},
{
field: 'ruleCode',
title: '套餐编码'
title: '套餐编码',
formatter: function(value, row, index) {
return '<a href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\', 900, 700)">' + value + '</a>';
}
},
{
field: 'rentalType',
@ -172,19 +175,23 @@
field: 'operatingCompanyName',
title: '所属运营商'
},
{
field: 'updateTime',
title: '操作时间',
sortable: true
},
{
title: '操作',
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-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>');
// 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('');
}
}]