租车套餐
This commit is contained in:
@ -5,11 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.operation.domain.ZcRentBatteyRule;
|
||||
@ -124,4 +120,12 @@ public class ZcRentBatteyRuleController extends BaseController
|
||||
{
|
||||
return toAjax(zcRentBatteyRuleService.deleteZcRentBatteyRuleByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/list/byLeaseType")
|
||||
@ResponseBody
|
||||
public List<ZcRentBatteyRule> listByLeaseType(@RequestParam("leaseType") Long leaseType) {
|
||||
ZcRentBatteyRule zcRentBatteyRule = new ZcRentBatteyRule();
|
||||
zcRentBatteyRule.setMealType(leaseType);
|
||||
return zcRentBatteyRuleService.selectZcRentBatteyRuleList(zcRentBatteyRule);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,6 +150,16 @@ public class ZcRentCarRuleController extends BaseController
|
||||
|
||||
|
||||
|
||||
@Log(title = "运营商管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("operation:company:edit")
|
||||
@PostMapping("/changeStatus")
|
||||
@ResponseBody
|
||||
public AjaxResult changeStatus(ZcRentCarRule zcRentCarRule)
|
||||
{
|
||||
return toAjax(zcRentCarRuleService.changeStatus(zcRentCarRule));
|
||||
}
|
||||
|
||||
|
||||
public static String generateTimestampBasedCode() {
|
||||
Random random = new Random();
|
||||
// 获取当前时间戳的后6位
|
||||
|
||||
@ -77,11 +77,11 @@ public class CompanyStore extends BaseEntity
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
private String latitude;
|
||||
private double latitude;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
private String longitude;
|
||||
private double longitude;
|
||||
|
||||
/** 合同签订日期 */
|
||||
@Excel(name = "合同签订日期")
|
||||
@ -329,21 +329,21 @@ public class CompanyStore extends BaseEntity
|
||||
{
|
||||
return image;
|
||||
}
|
||||
public void setLatitude(String latitude)
|
||||
public void setLatitude(double latitude)
|
||||
{
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public String getLatitude()
|
||||
public double getLatitude()
|
||||
{
|
||||
return latitude;
|
||||
}
|
||||
public void setLongitude(String longitude)
|
||||
public void setLongitude(double longitude)
|
||||
{
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getLongitude()
|
||||
public double getLongitude()
|
||||
{
|
||||
return longitude;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.operation.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.operation.domain.ZcRentCarRule;
|
||||
|
||||
/**
|
||||
@ -58,4 +59,6 @@ public interface IZcRentCarRuleService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcRentCarRuleById(Long id);
|
||||
|
||||
public int changeStatus(ZcRentCarRule zcRentCarRule);
|
||||
}
|
||||
|
||||
@ -95,4 +95,10 @@ public class ZcRentCarRuleServiceImpl implements IZcRentCarRuleService
|
||||
{
|
||||
return zcRentCarRuleMapper.deleteZcRentCarRuleById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int changeStatus(ZcRentCarRule zcRentCarRule) {
|
||||
zcRentCarRule.setUpdateTime(DateUtils.getNowDate());
|
||||
return zcRentCarRuleMapper.updateZcRentCarRule(zcRentCarRule);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1145,6 +1145,11 @@ var table = {
|
||||
table.set();
|
||||
$.modal.open("添加" + table.options.modalName, $.operate.addUrl(id));
|
||||
},
|
||||
// 添加自定义
|
||||
addCustomize: function(id,width,height) {
|
||||
table.set();
|
||||
$.modal.open("添加" + table.options.modalName, $.operate.addUrl(id),width,height);
|
||||
},
|
||||
// 添加信息,以tab页展现
|
||||
addTab: function (id) {
|
||||
table.set();
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">租赁天数:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="rentalDays" class="form-control" type="text">
|
||||
@ -89,12 +89,19 @@
|
||||
</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"
|
||||
$("#form-rentCarRule-add").validate({
|
||||
rules:{
|
||||
rentalPrice:{
|
||||
@ -110,6 +117,52 @@
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
// 初始隐藏租赁天数
|
||||
var $rentalDaysGroup = $('input[name="rentalDays"]').closest('.form-group').hide();
|
||||
|
||||
// 保存当前选中的值
|
||||
var currentRentalType = $('input[name="rentalType"]:checked').val();
|
||||
|
||||
// 检查初始选中项
|
||||
if(currentRentalType === '3') {
|
||||
$rentalDaysGroup.show();
|
||||
}
|
||||
|
||||
// 监听单选按钮变化
|
||||
$('input[name="rentalType"]').change(function() {
|
||||
var newRentalType = $(this).val();
|
||||
|
||||
// 如果新值和当前值相同,则不处理
|
||||
if(newRentalType === currentRentalType) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新当前值
|
||||
currentRentalType = newRentalType;
|
||||
|
||||
// 处理租赁天数显示/隐藏
|
||||
if(newRentalType === '3') {
|
||||
$rentalDaysGroup.show();
|
||||
} else {
|
||||
$rentalDaysGroup.hide().find('input').val('');
|
||||
}
|
||||
|
||||
// 清空规则列表
|
||||
$('#batteryRuleList').empty();
|
||||
|
||||
// 只有选择了有效值才加载数据
|
||||
if(newRentalType) {
|
||||
$.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>`;
|
||||
});
|
||||
$('#batteryRuleList').html(html);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-rentCarRule-add').serialize());
|
||||
|
||||
@ -90,7 +90,12 @@
|
||||
</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>
|
||||
@ -112,6 +117,26 @@
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
// 初始隐藏租赁天数
|
||||
$('input[name="rentalDays"]').closest('.form-group').hide();
|
||||
|
||||
// 监听单选按钮变化
|
||||
$('input[name="rentalType"]').change(function() {
|
||||
if($(this).val() === '3') {
|
||||
$('input[name="rentalDays"]').closest('.form-group').show();
|
||||
} else {
|
||||
$('input[name="rentalDays"]').closest('.form-group').hide().find('input').val('');
|
||||
}
|
||||
});
|
||||
|
||||
// 检查初始选中项
|
||||
if($('input[name="rentalType"]:checked').val() === '3') {
|
||||
$('input[name="rentalDays"]').closest('.form-group').show();
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-rentCarRule-edit').serialize());
|
||||
|
||||
@ -66,12 +66,9 @@
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="operation:rentCarRule:add">
|
||||
<a class="btn btn-success" onclick="$.operate.addCustomize(null,900,700)" shiro:hasPermission="operation:rentCarRule:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="operation:rentCarRule:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="operation:rentCarRule:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
@ -92,6 +89,7 @@
|
||||
var overdueTypeDatas = [[${@dict.getType('key_rent_overdue_type')}]];
|
||||
var depositFreeDatas = [[${@dict.getType('key_rent_deposit_free')}]];
|
||||
var autoDeductDatas = [[${@dict.getType('key_rent_auto_deduct')}]];
|
||||
var keyCompanyStatus = [[${@dict.getType('key_company_status')}]];
|
||||
var prefix = ctx + "operation/rentCarRule";
|
||||
|
||||
$(function() {
|
||||
@ -168,7 +166,10 @@
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '状态'
|
||||
title: '状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(keyCompanyStatus, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'operatingCompanyName',
|
||||
@ -179,14 +180,33 @@
|
||||
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> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
/* 停用 */
|
||||
function disable(id,phone) {
|
||||
$.modal.confirm("确认是否停用该套餐?<span style='color: red'>此套餐停用后正在租用订单继续生效,续租订单继续以原订单为准</span>", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 1 });
|
||||
})
|
||||
}
|
||||
|
||||
/* 启用 */
|
||||
function enable(id,phone) {
|
||||
$.modal.confirm("确认是否启用该套餐?", function() {
|
||||
$.operate.post(prefix + "/changeStatus", { "id": id, "status": 0 });
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -206,6 +206,14 @@
|
||||
var prefix = ctx + "operation/store"
|
||||
var areaPrefix = ctx + "system/areaHn";
|
||||
$("#form-store-add").validate({
|
||||
rules:{
|
||||
latitude:{
|
||||
number:true
|
||||
},
|
||||
longitude:{
|
||||
number:true
|
||||
}
|
||||
},
|
||||
focusCleanup: true
|
||||
});
|
||||
$(document).ready(function () {
|
||||
|
||||
@ -207,6 +207,14 @@
|
||||
var prefix = ctx + "operation/store"
|
||||
var areaPrefix = ctx + "system/areaHn";
|
||||
$("#form-store-add").validate({
|
||||
rules:{
|
||||
latitude:{
|
||||
number:true
|
||||
},
|
||||
longitude:{
|
||||
number:true
|
||||
}
|
||||
},
|
||||
focusCleanup: true
|
||||
});
|
||||
$(document).ready(function () {
|
||||
|
||||
Reference in New Issue
Block a user