| | |
| | | */ |
| | | @RequestMapping("/small") |
| | | public String small(Model model) { |
| | | //跨城小件物流 |
| | | TSystemPrice one = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 5).eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | if (SinataUtil.isNotEmpty(one)){ |
| | | JSONObject json1 = JSONObject.fromObject(one.getContent()); |
| | | model.addAttribute("json1",json1); |
| | | } |
| | | //同城小件物流 |
| | | TSystemPrice two = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | if (SinataUtil.isNotEmpty(two)){ |
| | | JSONObject json2 = JSONObject.fromObject(two.getContent()); |
| | | model.addAttribute("json2",json2); |
| | | } |
| | | return PREFIX + "small.html"; |
| | | // //跨城小件物流 |
| | | // TSystemPrice one = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 5).eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | // if (SinataUtil.isNotEmpty(one)){ |
| | | // JSONObject json1 = JSONObject.fromObject(one.getContent()); |
| | | // model.addAttribute("json1",json1); |
| | | // } |
| | | // //同城小件物流 |
| | | // TSystemPrice two = tSystemPriceService.selectOne(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", ShiroKit.getUser().getObjectId())); |
| | | // if (SinataUtil.isNotEmpty(two)){ |
| | | // JSONObject json2 = JSONObject.fromObject(two.getContent()); |
| | | // model.addAttribute("json2",json2); |
| | | // } |
| | | // return PREFIX + "small.html"; |
| | | return PREFIX + "tSmall.html"; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | model.addAttribute("modelList",serverCarmodels); |
| | | return PREFIX + "tSystemPrice_add.html"; |
| | | } |
| | | |
| | | @RequestMapping("/tSmallPrice_add") |
| | | public String tSmallPriceAdd(Model model) { |
| | | //查询所有专车车型 |
| | | Integer objectId = ShiroKit.getUser().getObjectId(); |
| | | List<TSystemPrice> tSystemPrices = tSystemPriceService.selectList(new EntityWrapper<TSystemPrice>().eq("type", 4).eq("companyId", objectId).ne("state", 3)); |
| | | List<TServerCarmodel> modelList = tServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 4).eq("state", 1)); |
| | | List<TServerCarmodel> serverCarmodels = new ArrayList<>(); |
| | | for(TServerCarmodel tsc : modelList){ |
| | | boolean b = true; |
| | | for(TSystemPrice tsp : tSystemPrices){ |
| | | if(tsc.getId() == tsp.getServerCarModelId()){ |
| | | b = false; |
| | | break; |
| | | } |
| | | } |
| | | if(b){ |
| | | serverCarmodels.add(tsc); |
| | | } |
| | | } |
| | | model.addAttribute("modelList",serverCarmodels); |
| | | return PREFIX + "tSmallPrice_add.html"; |
| | | } |
| | | |
| | | /** |
| | |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/listSmall") |
| | | @ResponseBody |
| | | public Object listSmall(String name,Integer state) { |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tSystemPriceService.getSpecialPriceList(page,ShiroKit.getUser().getObjectId(),name,state)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | /** |
| | | * 新增专车价格设置 |
| | | */ |
| | |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | @RequestMapping(value = "/smalladd") |
| | | @ResponseBody |
| | | public Object smalladd(TSystemPrice tSystemPrice) { |
| | | //判断当前公司是否添加过该专车车型价格配置 |
| | | int count = tSystemPriceService.selectCount(new EntityWrapper<TSystemPrice>() |
| | | .eq("type", 1) |
| | | .eq("serverCarModelId", tSystemPrice.getServerCarModelId()) |
| | | .eq("companyId",ShiroKit.getUser().getObjectId()) |
| | | .last(" and not FIND_IN_SET(state,'3')")); |
| | | if (count > 0){ |
| | | TServerCarmodel one = tServerCarmodelService.selectById(tSystemPrice.getServerCarModelId()); |
| | | return new ErrorTip(500, "【"+one.getName()+"】已存在,请重新选择"); |
| | | } |
| | | tSystemPrice.setCompanyId(ShiroKit.getUser().getObjectId()); |
| | | tSystemPrice.setType(4); |
| | | tSystemPrice.setState(1); |
| | | tSystemPriceService.insert(tSystemPrice); |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | /** |
| | | * 修改专车价格设置 |
| | | */ |
| | |
| | | |
| | | <!--查询专车价格设置--> |
| | | <select id="getSpecialPriceList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page"> |
| | | SELECT * FROM (SELECT sp.id,sp.type,sp.companyId,sc.`name`,sc.img,sp.state from t_system_price as sp |
| | | SELECT * FROM (SELECT sp.id,sp.type,sp.companyId,sc.`name`,sc.img,sp.state from t_system_price as sp |
| | | LEFT JOIN t_server_carmodel as sc on sc.id = sp.serverCarModelId) as o |
| | | <where> |
| | | o.type = 1 and o.state != 3 and o.companyId = #{companyId} |
| | | o.type = 4 and o.state != 3 and o.companyId = #{companyId} |
| | | <if test="name != null and name != ''"> |
| | | and o.name LIKE CONCAT('%',#{name},'%') |
| | | </if> |
| | |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="col-sm-3" style="padding-top: 10px;display: none;"> |
| | | <div class="col-sm-3" style="padding-top: 10px;"> |
| | | <div class="input-group" style="width: 100%;"> |
| | | <select class="form-control" id="language"> |
| | | <option value="1">中文</option> |
| | |
| | | </ul> |
| | | <div class="tab-content"> |
| | | <div id="tab-1" class="tab-pane active"> |
| | | <div class="col-sm-3" style="padding-top: 10px;display: none;"> |
| | | <div class="col-sm-3" style="padding-top: 10px;"> |
| | | <div class="input-group" style="width: 100%;"> |
| | | <select class="form-control" id="language"> |
| | | <option value="1">中文</option> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>小件物流价格设置管理</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="name" name="车型名称" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#SelectCon id="state" name="状态" > |
| | | <option value="">全部</option> |
| | | <option value="1">正常</option> |
| | | <option value="2">冻结</option> |
| | | </#SelectCon> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TSystemPrice.search()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="TSystemPrice.resetSearch()" space="true"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TSystemPriceTableToolbar" role="group"> |
| | | @if(shiro.hasPermission("/tSystemPrice/addSpecial")){ |
| | | <#button name="添加" icon="fa-plus" clickFun="TSystemPrice.addSpecial()"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tSystemPrice/updateSpecial")){ |
| | | <#button name="修改" icon="fa-edit" clickFun="TSystemPrice.updateSpecial()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tSystemPrice/deleteSpecial")){ |
| | | <#button name="删除" icon="fa-remove" clickFun="TSystemPrice.deleteSpecial()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tSystemPrice/freezeSpecial")){ |
| | | <#button name="冻结" icon="fa-remove" clickFun="TSystemPrice.freezeSpecial()" space="true"/> |
| | | @} |
| | | @if(shiro.hasPermission("/tSystemPrice/thawSpecial")){ |
| | | <#button name="解冻" icon="fa-remove" clickFun="TSystemPrice.thawSpecial()" space="true"/> |
| | | @} |
| | | </div> |
| | | <#table id="TSystemPriceTable"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tSystemPrice/tSmallPrice.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <style> |
| | | .newWidth, .single-line{ |
| | | max-width:150px !important;display: initial !important; |
| | | } |
| | | </style> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-content"> |
| | | <div class="form-horizontal" id="specialPriceInfoForm"> |
| | | |
| | | <div class="row"> |
| | | <div class="col-sm-11"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">选择车型:</label> |
| | | <div class="col-sm-10"> |
| | | <select class="form-control" id="serverCarModelId" name="serverCarModelId" style="width: 200px;"> |
| | | <option value="">选择车型</option> |
| | | @for(obj in modelList!){ |
| | | <option value="${obj.id}">${obj.name}</option> |
| | | @} |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">运价类型说明:</label> |
| | | <div class="col-sm-10"> |
| | | <textarea class="form-control" id="fareTypeNote" name="fareTypeNote" style="height: 100px;"></textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">起步价设置:</label> |
| | | <div class="col-sm-10"> |
| | | 起步价为 <input type="text" oninput="checkIsYuan(this)" name="num1" id="num1" class="form-control newWidth" placeholder="最多3位数"/> 元, |
| | | 起步包含 <input type="text" oninput="checkIsGongLi(this)" name="num2" id="num2" class="form-control newWidth" placeholder="最多3位数"/> 公里, |
| | | <input type="text" oninput="checkIsMinute(this)" name="num3" id="num3" class="form-control newWidth" placeholder="最多3位数"/> 分钟 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">里程费设置:</label> |
| | | <div class="col-sm-10"> |
| | | 超过起步里程后每公里 <input type="text" oninput="checkIsYuan(this)" name="num4" id="num4" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">时长费设置:</label> |
| | | <div class="col-sm-10"> |
| | | 超过起步时长后每分钟 <input type="text" oninput="checkIsYuan(this)" name="num5" id="num5" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">等待费设置:</label> |
| | | <div class="col-sm-10"> |
| | | 司机到达预约地点 <input type="text" oninput="checkIsMinute(this)" name="num6" id="num6" class="form-control newWidth" placeholder="最多3位数"/> 分钟过后开始收取等待费, |
| | | 为 <input type="text" oninput="checkIsYuan(this)" name="num7" id="num7" class="form-control newWidth" placeholder="最多3位数"/> 元/分,不足一分钟按照一分钟计算 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">远途费设置:</label> |
| | | <div class="col-sm-10"> |
| | | 总里程超过 <input type="text" oninput="checkIsGongLi(this)" name="num8" id="num8" class="form-control newWidth" placeholder="最多3位数"/> 公里 |
| | | 不足 <input type="text" oninput="checkIsGongLi(this)" name="num9" id="num9" class="form-control newWidth" placeholder="最多3位数"/> 公里, |
| | | 超出部分每公里加收 <input type="text" oninput="checkIsYuan(this)" name="num10" id="num10" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br> |
| | | <br> |
| | | 超过 <input type="text" disabled oninput="checkIsGongLi(this)" name="num11" id="num11" class="form-control newWidth" placeholder="最多3位数"/> 公里 |
| | | 不足 <input type="text" oninput="checkIsGongLi(this)" name="num12" id="num12" class="form-control newWidth" placeholder="最多3位数"/> 公里时, |
| | | 超出部分每公里加收 <input type="text" oninput="checkIsYuan(this)" name="num13" id="num13" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br/> |
| | | <br> |
| | | 超过 <input type="text" disabled oninput="checkIsGongLi(this)" name="num14" id="num14" class="form-control newWidth" placeholder="最多3位数"/> 公里以后, |
| | | 超出部分每公里加收 <input type="text" oninput="checkIsYuan(this)" name="num15" id="num15" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | <!-- |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">夜间行驶费用设置:</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" name="num16" id="num16" class="form-control newWidth" placeholder="选择时间"/> 点为夜间行驶时间, |
| | | 起步价变为 <input type="text" oninput="checkIsYuan(this)" name="num17" id="num17" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br> |
| | | <br> |
| | | 里程费为每公里 <input type="text" oninput="checkIsYuan(this)" name="num18" id="num18" class="form-control newWidth" placeholder="最多3位数"/> 元, |
| | | 时长费为每分钟 <input type="text" oninput="checkIsYuan(this)" name="num19" id="num19" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br> |
| | | <br> |
| | | 远途费为每公里加收 <input type="text" oninput="checkIsYuan(this)" name="num20" id="num20" class="form-control newWidth" placeholder="最多3位数"/> |
| | | 、 <input type="text" oninput="checkIsYuan(this)" name="num21" id="num21" class="form-control newWidth" placeholder="最多3位数"/> |
| | | 、 <input type="text" oninput="checkIsYuan(this)" name="num22" id="num22" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | --> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">高峰期费用设置:</label> |
| | | <div class="col-sm-10"> |
| | | <input type="text" name="num23" id="num23" class="form-control newWidth" placeholder="选择时间段"/> |
| | | 和 <input type="text" name="num24" id="num24" class="form-control newWidth" placeholder="选择时间段"/> 为高峰期行车时间, |
| | | 起步价变为 <input type="text" oninput="checkIsYuan(this)" name="num25" id="num25" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br> |
| | | <br> |
| | | 里程费为每公里 <input type="text" oninput="checkIsYuan(this)" name="num26" id="num26" class="form-control newWidth" placeholder="最多3位数"/> 元, |
| | | 时长费为每分钟 <input type="text" oninput="checkIsYuan(this)" name="num27" id="num27" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br> |
| | | <br> |
| | | 远途费为每公里加收 <input type="text" oninput="checkIsYuan(this)" name="num28" id="num28" class="form-control newWidth" placeholder="最多3位数"/> |
| | | 、 <input type="text" oninput="checkIsYuan(this)" name="num29" id="num29" class="form-control newWidth" placeholder="最多3位数"/> |
| | | 、 <input type="text" oninput="checkIsYuan(this)" name="num30" id="num30" class="form-control newWidth" placeholder="最多3位数"/> 元 |
| | | <br/> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10 col-sm-offset-5"> |
| | | <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TSystemPriceInfoDlg.addSubmit()"/> |
| | | <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TSystemPriceInfoDlg.close()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/static/modular/system/tSystemPrice/tSmallPrice_info.js"></script> |
| | | <script type="text/javascript"> |
| | | laydate.render({ |
| | | elem: '#num16' |
| | | ,type: 'time' |
| | | ,range: '-' |
| | | ,format: 'HH:mm' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#num23' |
| | | ,type: 'time' |
| | | ,range: '-' |
| | | ,format: 'HH:mm' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#num24' |
| | | ,type: 'time' |
| | | ,range: '-' |
| | | ,format: 'HH:mm' |
| | | }); |
| | | |
| | | var regDouble = /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/; |
| | | var regInt = /^[0-9]{0,3}$/; |
| | | function checkIsYuan(obj){ |
| | | var num = $(obj).val(); |
| | | if(!regDouble.test(num)){ |
| | | layer.msg("【元】输入框不能超过3位数,保留两位小数"); |
| | | } |
| | | } |
| | | function checkIsGongLi(obj){ |
| | | var num = $(obj).val(); |
| | | if(!regDouble.test(num)){ |
| | | layer.msg("【公里】输入框不能超过3位数,保留两位小数"); |
| | | } |
| | | if (obj.id == "num9"){ |
| | | $("#num11").val(num); |
| | | }else if (obj.id == "num12"){ |
| | | $("#num14").val(num); |
| | | } |
| | | } |
| | | function checkIsMinute(obj){ |
| | | var num = $(obj).val(); |
| | | if(!regInt.test(num)){ |
| | | layer.msg("【分钟】输入框不能超过3位数"); |
| | | } |
| | | } |
| | | |
| | | </script> |
| | | @} |
New file |
| | |
| | | /** |
| | | * 专车价格设置管理初始化 |
| | | */ |
| | | var TSystemPrice = { |
| | | id: "TSystemPriceTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TSystemPrice.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '车型名称', field: 'name', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | var btn = ""; |
| | | if(row.name != '' && row.name != null) { |
| | | btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.name + '" onfocus="TUser.tooltip()">' + row.name + '</p>'] |
| | | } |
| | | return btn; |
| | | } |
| | | }, |
| | | {title: '车型图片', field: 'img', visible: true, align: 'center', valign: 'middle',width:'20%', |
| | | formatter: function (value, row) { |
| | | if (row.img == null || row.img == '') { |
| | | return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></a>'; |
| | | } else { |
| | | return '<a class = "view" href="javascript:void(0)"><img style="width: 90px;height:50px;" src="' + row.img + '" /></a>'; |
| | | } |
| | | }, |
| | | events: 'operateEvents' |
| | | }, |
| | | {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle', |
| | | formatter: function (value, row) { |
| | | var btn = ""; |
| | | if(row.state != '' && row.state != null) { |
| | | if(row.state == 1){ |
| | | btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="正常" onfocus="TUser.tooltip()">正常</p>'] |
| | | }else if(row.state == 2){ |
| | | btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="冻结" onfocus="TUser.tooltip()">冻结</p>'] |
| | | } |
| | | } |
| | | return btn; |
| | | } |
| | | } |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TSystemPrice.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TSystemPrice.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 点击添加专车价格设置 |
| | | */ |
| | | TSystemPrice.addSpecial = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加小件物流价格设置', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tSystemPrice/tSmallPrice_add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | | |
| | | /** |
| | | * 打开查看专车价格设置详情 |
| | | */ |
| | | TSystemPrice.updateSpecial = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '专车价格设置详情', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tSystemPrice/tSystemPrice_update/' + TSystemPrice.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 删除专车价格设置 |
| | | */ |
| | | TSystemPrice.deleteSpecial = function () { |
| | | if (this.check()) { |
| | | var name = TSystemPrice.seItem.name; |
| | | if (name == "" || name == null || name == undefined){ |
| | | name = "该专车车型价格配置"; |
| | | }else{ |
| | | name = "【"+name+"】价格配置"; |
| | | } |
| | | swal({ |
| | | title: "您是否确认删除"+ name + "?", |
| | | text: "请谨慎操作,删除后数据无法恢复!", |
| | | type: "warning", |
| | | showCancelButton: true, |
| | | confirmButtonColor: "#DD6B55", |
| | | confirmButtonText: "删除", |
| | | closeOnConfirm: true |
| | | }, function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/opt", function (data) { |
| | | swal("删除成功", "您已经删除了" + name + "。", "success"); |
| | | TSystemPrice.table.refresh(); |
| | | }, function (data) { |
| | | swal("删除失败", data.responseJSON.message + "!", "warning"); |
| | | }); |
| | | ajax.set("tSystemPriceId",TSystemPrice.seItem.id); |
| | | ajax.set("optType",3); |
| | | ajax.start(); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 冻结 |
| | | */ |
| | | TSystemPrice.freezeSpecial = function(){ |
| | | if (this.check()) { |
| | | var name = TSystemPrice.seItem.name; |
| | | if (name == "" || name == null || name == undefined) { |
| | | name = "该专车车型价格配置"; |
| | | } else { |
| | | name = "【" + name + "】价格配置"; |
| | | } |
| | | if (TSystemPrice.seItem.state != 1) { |
| | | swal("冻结失败", "【正常】状态下才能执行此操作", "warning"); |
| | | return; |
| | | } else { |
| | | swal({ |
| | | title: "您是否确认冻结"+ name + "?", |
| | | text: "请谨慎操作,删除后数据无法恢复!", |
| | | type: "warning", |
| | | showCancelButton: true, |
| | | confirmButtonColor: "#DD6B55", |
| | | confirmButtonText: "冻结", |
| | | closeOnConfirm: true |
| | | }, function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/opt", function (data) { |
| | | swal("冻结成功", "您已经冻结了" + name + "。", "success"); |
| | | TSystemPrice.table.refresh(); |
| | | }, function (data) { |
| | | swal("冻结失败", data.responseJSON.message + "!", "warning"); |
| | | }); |
| | | ajax.set("tSystemPriceId",TSystemPrice.seItem.id); |
| | | ajax.set("optType", 1); |
| | | ajax.start(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 解冻 |
| | | */ |
| | | TSystemPrice.thawSpecial = function(){ |
| | | if (this.check()) { |
| | | var name = TSystemPrice.seItem.name; |
| | | if (name == "" || name == null || name == undefined) { |
| | | name = "该专车车型价格配置"; |
| | | } else { |
| | | name = "【" + name + "】价格配置"; |
| | | } |
| | | if (TSystemPrice.seItem.state != 2) { |
| | | swal("解冻失败", "【冻结】状态下才能执行此操作", "warning"); |
| | | return; |
| | | } else { |
| | | swal({ |
| | | title: "您是否确认解冻"+ name + "?", |
| | | text: "请谨慎操作,删除后数据无法恢复!", |
| | | type: "warning", |
| | | showCancelButton: true, |
| | | confirmButtonColor: "#DD6B55", |
| | | confirmButtonText: "解冻", |
| | | closeOnConfirm: true |
| | | }, function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/opt", function (data) { |
| | | swal("解冻成功", "您已经解冻了" + name + "。", "success"); |
| | | TSystemPrice.table.refresh(); |
| | | }, function (data) { |
| | | swal("解冻失败", data.responseJSON.message + "!", "warning"); |
| | | }); |
| | | ajax.set("tSystemPriceId",TSystemPrice.seItem.id); |
| | | ajax.set("optType", 2); |
| | | ajax.start(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询专车价格设置列表 |
| | | */ |
| | | TSystemPrice.search = function () { |
| | | var queryData = {}; |
| | | queryData['name'] = $("#name").val(); |
| | | queryData['state'] = $("#state").val(); |
| | | TSystemPrice.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | TSystemPrice.resetSearch = function () { |
| | | $("#name").val(""); |
| | | $("#state").val(""); |
| | | TSystemPrice.search(); |
| | | }; |
| | | |
| | | $(function () { |
| | | var defaultColunms = TSystemPrice.initColumn(); |
| | | var table = new BSTable(TSystemPrice.id, "/tSystemPrice/listSmall", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | TSystemPrice.table = table.init(); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 初始化专车价格设置详情对话框 |
| | | */ |
| | | var TSystemPriceInfoDlg = { |
| | | tSystemPriceInfoData : {}, |
| | | validateFields: { |
| | | serverCarModelId: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '请选择车型' |
| | | } |
| | | } |
| | | }, |
| | | fareTypeNote: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '运价类型说明不能为空' |
| | | } |
| | | } |
| | | }, |
| | | num1: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num2: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【公里】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【公里】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num3: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【分钟】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^[0-9]{0,3}$/, |
| | | message: '【分钟】输入框不能超过3位数' |
| | | } |
| | | } |
| | | }, |
| | | num4: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num5: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num6: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【分钟】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^[0-9]{0,3}$/, |
| | | message: '【分钟】输入框不能超过3位数' |
| | | } |
| | | } |
| | | }, |
| | | num7: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num8: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【公里】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【公里】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num9: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【公里】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【公里】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num10: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num11: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【公里】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【公里】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num12: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【公里】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【公里】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num13: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num14: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【公里】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【公里】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num15: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | // num16: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【时间】输入框不能为空' |
| | | // } |
| | | // } |
| | | // }, |
| | | // num17: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【元】输入框不能为空' |
| | | // }, |
| | | // regexp: { |
| | | // regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | // message: '【元】输入框不能超过3位数,保留两位小数' |
| | | // } |
| | | // } |
| | | // }, |
| | | // num18: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【元】输入框不能为空' |
| | | // }, |
| | | // regexp: { |
| | | // regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | // message: '【元】输入框不能超过3位数,保留两位小数' |
| | | // } |
| | | // } |
| | | // }, |
| | | // num19: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【元】输入框不能为空' |
| | | // }, |
| | | // regexp: { |
| | | // regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | // message: '【元】输入框不能超过3位数,保留两位小数' |
| | | // } |
| | | // } |
| | | // }, |
| | | // num20: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【元】输入框不能为空' |
| | | // }, |
| | | // regexp: { |
| | | // regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | // message: '【元】输入框不能超过3位数,保留两位小数' |
| | | // } |
| | | // } |
| | | // }, |
| | | // num21: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【元】输入框不能为空' |
| | | // }, |
| | | // regexp: { |
| | | // regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | // message: '【元】输入框不能超过3位数,保留两位小数' |
| | | // } |
| | | // } |
| | | // }, |
| | | // num22: { |
| | | // validators: { |
| | | // notEmpty: { |
| | | // message: '【元】输入框不能为空' |
| | | // }, |
| | | // regexp: { |
| | | // regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | // message: '【元】输入框不能超过3位数,保留两位小数' |
| | | // } |
| | | // } |
| | | // }, |
| | | num23: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【时间】输入框不能为空' |
| | | } |
| | | } |
| | | }, |
| | | num24: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【时间】输入框不能为空' |
| | | } |
| | | } |
| | | }, |
| | | num25: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num26: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num27: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num28: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num29: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | }, |
| | | num30: { |
| | | validators: { |
| | | notEmpty: { |
| | | message: '【元】输入框不能为空' |
| | | }, |
| | | regexp: { |
| | | regexp: /^(0|[1-9]\d{0,2})(\.\d{1,2})?$/, |
| | | message: '【元】输入框不能超过3位数,保留两位小数' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * 验证数据是否为空 |
| | | */ |
| | | TSystemPriceInfoDlg.validate = function () { |
| | | $('#specialPriceInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#specialPriceInfoForm').bootstrapValidator('validate'); |
| | | return $("#specialPriceInfoForm").data('bootstrapValidator').isValid(); |
| | | }; |
| | | |
| | | /** |
| | | * 清除数据 |
| | | */ |
| | | TSystemPriceInfoDlg.clearData = function() { |
| | | this.tSystemPriceInfoData = {}; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | TSystemPriceInfoDlg.set = function(key, val) { |
| | | this.tSystemPriceInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val; |
| | | return this; |
| | | } |
| | | |
| | | /** |
| | | * 设置对话框中的数据 |
| | | * |
| | | * @param key 数据的名称 |
| | | * @param val 数据的具体值 |
| | | */ |
| | | TSystemPriceInfoDlg.get = function(key) { |
| | | return $("#" + key).val(); |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | | */ |
| | | TSystemPriceInfoDlg.close = function() { |
| | | parent.layer.close(window.parent.TSystemPrice.layerIndex); |
| | | } |
| | | |
| | | /** |
| | | * 收集数据 |
| | | */ |
| | | TSystemPriceInfoDlg.collectData = function() { |
| | | this |
| | | .set('id') |
| | | .set('type') |
| | | .set('companyId') |
| | | .set('serverCarModelId') |
| | | .set('fareTypeNote') |
| | | .set('content'); |
| | | } |
| | | |
| | | /** |
| | | * 提交添加 |
| | | */ |
| | | TSystemPriceInfoDlg.addSubmit = function() { |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | var content = '{'; |
| | | //拼接数据 |
| | | $("input").each(function(){ |
| | | var value = $(this).val(); |
| | | content = content + '"'+$(this)[0].name+'":"'+value+'",'; |
| | | }); |
| | | content = content.substring(0,content.length-1); |
| | | content += '}'; |
| | | console.log(content); |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/smalladd", function(data){ |
| | | if (500 == data.code){ |
| | | Feng.error(data.message); |
| | | return; |
| | | }else{ |
| | | Feng.success("添加成功!"); |
| | | window.parent.TSystemPrice.table.refresh(); |
| | | TSystemPriceInfoDlg.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(this.tSystemPriceInfoData); |
| | | ajax.set("content",content); |
| | | ajax.start(); |
| | | } |
| | | |
| | | /** |
| | | * 提交修改 |
| | | */ |
| | | TSystemPriceInfoDlg.editSubmit = function() { |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | var content = '{'; |
| | | //拼接数据 |
| | | $("input").each(function(){ |
| | | var value = $(this).val(); |
| | | content = content + '"'+$(this)[0].name+'":"'+value+'",'; |
| | | }); |
| | | content = content.substring(0,content.length-1); |
| | | content += '}'; |
| | | console.log(content); |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tSystemPrice/update", function(data){ |
| | | if (500 == data.code){ |
| | | Feng.error(data.message); |
| | | return; |
| | | }else { |
| | | Feng.success("修改成功!"); |
| | | window.parent.TSystemPrice.table.refresh(); |
| | | TSystemPriceInfoDlg.close(); |
| | | } |
| | | },function(data){ |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set(this.tSystemPriceInfoData); |
| | | ajax.set("id",$("#id").html()); |
| | | ajax.set("content",content); |
| | | ajax.start(); |
| | | } |
| | | |
| | | $(function() { |
| | | Feng.initValidator("specialPriceInfoForm", TSystemPriceInfoDlg.validateFields); |
| | | }); |
| | |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tSystemPrice/tSystemPrice_add' |
| | | content: Feng.ctxPath + '/tSystemPrice/tSmallPrice_add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |