DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverMapper.xml
@@ -559,7 +559,11 @@ ((select sum(fraction) from t_order_evaluate where driverId = a.id) / (select count(fraction) from t_order_evaluate where driverId = a.id)) as score, if((select id from t_merchant where auditStatus = 2 and userType = 2 and userId = a.id and state = 1) is null, 0, 1) as merchant, a.companyId as companyId, e.name as companyName e.name as companyName, e.isCanSelectSeat as isCanSelectSeat, e.isCanModifyAmount as isCanModifyAmount, e.isOfflinePay as isOfflinePay, e.isOpenDriverSelfTrip as isOpenDriverSelfTrip from t_driver a left join t_car b on (a.carId = b.id) left join t_car_model c on (b.carModelId = c.id) DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/warpper/DriverInfoWarpper.java
@@ -65,6 +65,14 @@ private String networkCarlssueImg; @ApiModelProperty("是否开通商家(0=否,1=是)") private Integer merchant; @ApiModelProperty("是否允许线下付款(1=是,2=否)") private Integer isCanSelectSeat; @ApiModelProperty("代客下单是否可修改金额(1=是,2=否)") private Integer isCanModifyAmount; @ApiModelProperty("是否允许线下付款(1=是,2=否)") private Integer isOfflinePay; @ApiModelProperty("是否开启司机自助行程(1=是,2=否)") private Integer isOpenDriverSelfTrip; public Integer getId() { return id; @@ -298,6 +306,38 @@ this.merchant = merchant; } public Integer getIsCanSelectSeat() { return isCanSelectSeat; } public void setIsCanSelectSeat(Integer isCanSelectSeat) { this.isCanSelectSeat = isCanSelectSeat; } public Integer getIsCanModifyAmount() { return isCanModifyAmount; } public void setIsCanModifyAmount(Integer isCanModifyAmount) { this.isCanModifyAmount = isCanModifyAmount; } public Integer getIsOfflinePay() { return isOfflinePay; } public void setIsOfflinePay(Integer isOfflinePay) { this.isOfflinePay = isOfflinePay; } public Integer getIsOpenDriverSelfTrip() { return isOpenDriverSelfTrip; } public void setIsOpenDriverSelfTrip(Integer isOpenDriverSelfTrip) { this.isOpenDriverSelfTrip = isOpenDriverSelfTrip; } @Override public String toString() { return "DriverInfoWarpper{" + @@ -364,6 +404,10 @@ driverInfoWarpper.setLaveActivityMoney(null != map.get("laveActivityMoney") ? Double.valueOf(String.valueOf(map.get("laveActivityMoney"))) : 0); driverInfoWarpper.setLaveBusinessMoney(null != map.get("laveBusinessMoney") ? Double.valueOf(String.valueOf(map.get("laveBusinessMoney"))) : 0); driverInfoWarpper.setMerchant(null != map.get("merchant") ? Integer.valueOf(String.valueOf(map.get("merchant"))) : 0); driverInfoWarpper.setIsCanSelectSeat(null != map.get("isCanSelectSeat") ? Integer.valueOf(String.valueOf(map.get("isCanSelectSeat"))) : 2); driverInfoWarpper.setIsCanModifyAmount(null != map.get("isCanModifyAmount") ? Integer.valueOf(String.valueOf(map.get("isCanModifyAmount"))) : 2); driverInfoWarpper.setIsOfflinePay(null != map.get("isOfflinePay") ? Integer.valueOf(String.valueOf(map.get("isOfflinePay"))) : 2); driverInfoWarpper.setIsOpenDriverSelfTrip(null != map.get("isOpenDriverSelfTrip") ? Integer.valueOf(String.valueOf(map.get("isOpenDriverSelfTrip"))) : 2); } return driverInfoWarpper; } ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/specialTrain/TLineController.java
@@ -10,6 +10,7 @@ import com.stylefeng.guns.core.log.LogObjectHolder; import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.util.SinataUtil; import com.stylefeng.guns.core.util.ToolUtil; import com.stylefeng.guns.modular.system.model.*; import com.stylefeng.guns.modular.system.service.*; import com.stylefeng.guns.modular.system.util.ResultUtil; @@ -26,6 +27,7 @@ import java.util.Date; import java.util.List; import java.util.Map; import java.math.BigDecimal; /** * 跨城线路管理控制器 @@ -56,6 +58,9 @@ @Autowired private ITLineShiftService itLineShiftService; @Autowired private ITLineDestinationService itLineDestinationService; @Autowired private ITCompanyService itCompanyService; @@ -168,6 +173,10 @@ //查询所有班次 List<TLineShift> lineShiftList = itLineShiftService.selectList(new EntityWrapper<TLineShift>().eq("lineId", tLineId).last(" and not FIND_IN_SET(state,'3')")); model.addAttribute("lineShiftList",lineShiftList); //查询线路目的地 List<TLineDestination> lineDestinationList = itLineDestinationService.selectList( new EntityWrapper<TLineDestination>().eq("lineId", tLineId).ne("state", 3).orderBy("isMain", false).orderBy("id", true)); model.addAttribute("lineDestinationList", lineDestinationList); return PREFIX + "tLine_edit.html"; } @@ -224,7 +233,8 @@ */ @RequestMapping(value = "/add") @ResponseBody public ResultUtil add(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr,@RequestParam String shuArr) { public ResultUtil add(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr, @RequestParam String shuArr, @RequestParam(required = false) String destArr) { JSONArray jsonArray1 = JSON.parseArray(shuArr); int size1 = jsonArray1.size(); for (int i = 0; i < size1; i++) { @@ -267,7 +277,16 @@ addPrice(tLine.getId(), subArr); //添加班次设置 return addShift(tLine.getId(), shuArr); ResultUtil shiftResult = addShift(tLine.getId(), shuArr); if(200 != shiftResult.getStatus()){ return shiftResult; } //添加目的地设置 ResultUtil destinationResult = addDestination(tLine.getId(), destArr); if(200 != destinationResult.getStatus()){ return destinationResult; } return ResultUtil.success(); } /** @@ -411,7 +430,8 @@ */ @RequestMapping(value = "/update") @ResponseBody public ResultUtil update(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr,@RequestParam String shuArr) { public ResultUtil update(TLine tLine,Integer startSiteId,Integer endSiteId,@RequestParam String subArr, @RequestParam String shuArr, @RequestParam(required = false) String destArr) { JSONArray jsonArray1 = JSON.parseArray(shuArr); int size1 = jsonArray1.size(); for (int i = 0; i < size1; i++) { @@ -470,8 +490,115 @@ //删除线路班次 itLineShiftService.delete(new EntityWrapper<TLineShift>().eq("lineId",tLine.getId())); //添加班次设置 return addShift(tLine.getId(), shuArr); ResultUtil shiftResult = addShift(tLine.getId(), shuArr); if(200 != shiftResult.getStatus()){ return shiftResult; } //删除线路目的地并重建 itLineDestinationService.delete(new EntityWrapper<TLineDestination>().eq("lineId", tLine.getId())); ResultUtil destinationResult = addDestination(tLine.getId(), destArr); if(200 != destinationResult.getStatus()){ return destinationResult; } return ResultUtil.success(); } /** * 添加线路目的地配置 */ private ResultUtil addDestination(Integer lineId, String destArr) { if (SinataUtil.isEmpty(destArr)) { return ResultUtil.success(); } JSONArray jsonArray = JSON.parseArray(destArr); int size = jsonArray.size(); if(size <= 0){ return ResultUtil.success(); } if(size > 3){ return ResultUtil.error("最多只能添加3个目的地"); } int mainCount = 0; for (int i = 0; i < size; i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = ToolUtil.formatting(jsonObject.getString("name")); if (SinataUtil.isEmpty(name)) { return ResultUtil.error("目的地名称不能为空"); } Integer fenceType = jsonObject.getInteger("fenceType"); if (fenceType == null || (fenceType != 1 && fenceType != 2)) { return ResultUtil.error("围栏类型错误"); } String coordinate = jsonObject.getString("coordinate"); if (SinataUtil.isEmpty(coordinate)) { return ResultUtil.error("目的地围栏不能为空"); } BigDecimal price5; BigDecimal price7; try { price5 = new BigDecimal(jsonObject.getString("price5")); price7 = new BigDecimal(jsonObject.getString("price7")); } catch (Exception ex) { return ResultUtil.error("目的地价格格式不正确"); } if (price5.compareTo(BigDecimal.ZERO) < 0 || price7.compareTo(BigDecimal.ZERO) < 0) { return ResultUtil.error("目的地价格不能小于0"); } Integer isMain = jsonObject.getInteger("isMain"); if (isMain != null && isMain == 1) { mainCount++; } if(mainCount > 1){ return ResultUtil.error("最多只能设置一个主要目的地"); } Double defaultPointLon = jsonObject.getDouble("defaultPointLon"); Double defaultPointLat = jsonObject.getDouble("defaultPointLat"); if (fenceType == 1) { String[] arr = coordinate.split(";"); if (arr.length != 2) { return ResultUtil.error("圆形围栏坐标格式错误"); } String[] center = arr[0].split(","); if (center.length != 2) { return ResultUtil.error("圆形围栏中心点格式错误"); } try { defaultPointLon = Double.valueOf(center[0]); defaultPointLat = Double.valueOf(center[1]); double radius = Double.valueOf(arr[1]); if(radius <= 0 || radius > 5000){ return ResultUtil.error("圆形围栏半径必须在(0,5000]米"); } } catch (Exception ex) { return ResultUtil.error("圆形围栏坐标格式错误"); } } else { if(defaultPointLon == null || defaultPointLat == null){ return ResultUtil.error("多边形围栏需要设置默认点"); } } TLineDestination destination = new TLineDestination(); destination.setLineId(lineId); destination.setName(name); destination.setFenceType(fenceType); destination.setCoordinate(coordinate); destination.setDefaultPointLon(defaultPointLon); destination.setDefaultPointLat(defaultPointLat); destination.setPrice5(price5); destination.setPrice7(price7); Integer state = jsonObject.getInteger("state"); destination.setState(state == null ? 1 : state); destination.setIsMain(isMain == null ? 0 : isMain); destination.setAddTime(jsonObject.getString("time")); destination.setInsertTime(new Date()); itLineDestinationService.insert(destination); } return ResultUtil.success(); } } ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/TLineDestinationMapper.java
New file @@ -0,0 +1,15 @@ package com.stylefeng.guns.modular.system.dao; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.stylefeng.guns.modular.system.model.TLineDestination; /** * <p> * 线路目的地 Mapper 接口 * </p> * * @author Codex * @since 2026-04-19 */ public interface TLineDestinationMapper extends BaseMapper<TLineDestination> { } ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/model/TLineDestination.java
New file @@ -0,0 +1,172 @@ package com.stylefeng.guns.modular.system.model; import com.baomidou.mybatisplus.activerecord.Model; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.enums.IdType; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; /** * <p> * 线路目的地配置 * </p> * * @author Codex * @since 2026-04-19 */ @TableName("t_line_destination") public class TLineDestination extends Model<TLineDestination> { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.AUTO) private Integer id; private Integer lineId; private String name; /** * 围栏类型(1=圆形围栏,2=多边形围栏) */ private Integer fenceType; /** * 围栏坐标(圆:lng,lat;radius;多边形:lng,lat;lng,lat...) */ private String coordinate; private Double defaultPointLon; private Double defaultPointLat; private BigDecimal price5; private BigDecimal price7; /** * 状态(1=启用,2=关闭,3=删除) */ private Integer state; /** * 是否主要(1=是,0=否) */ private Integer isMain; private String addTime; private Date insertTime; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getLineId() { return lineId; } public void setLineId(Integer lineId) { this.lineId = lineId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getFenceType() { return fenceType; } public void setFenceType(Integer fenceType) { this.fenceType = fenceType; } public String getCoordinate() { return coordinate; } public void setCoordinate(String coordinate) { this.coordinate = coordinate; } public Double getDefaultPointLon() { return defaultPointLon; } public void setDefaultPointLon(Double defaultPointLon) { this.defaultPointLon = defaultPointLon; } public Double getDefaultPointLat() { return defaultPointLat; } public void setDefaultPointLat(Double defaultPointLat) { this.defaultPointLat = defaultPointLat; } public BigDecimal getPrice5() { return price5; } public void setPrice5(BigDecimal price5) { this.price5 = price5; } public BigDecimal getPrice7() { return price7; } public void setPrice7(BigDecimal price7) { this.price7 = price7; } public Integer getState() { return state; } public void setState(Integer state) { this.state = state; } public Integer getIsMain() { return isMain; } public void setIsMain(Integer isMain) { this.isMain = isMain; } public String getAddTime() { return addTime; } public void setAddTime(String addTime) { this.addTime = addTime; } public Date getInsertTime() { return insertTime; } public void setInsertTime(Date insertTime) { this.insertTime = insertTime; } @Override protected Serializable pkVal() { return this.id; } } ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/ITLineDestinationService.java
New file @@ -0,0 +1,15 @@ package com.stylefeng.guns.modular.system.service; import com.baomidou.mybatisplus.service.IService; import com.stylefeng.guns.modular.system.model.TLineDestination; /** * <p> * 线路目的地 服务类 * </p> * * @author Codex * @since 2026-04-19 */ public interface ITLineDestinationService extends IService<TLineDestination> { } ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/TLineDestinationServiceImpl.java
New file @@ -0,0 +1,19 @@ package com.stylefeng.guns.modular.system.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.stylefeng.guns.modular.system.dao.TLineDestinationMapper; import com.stylefeng.guns.modular.system.model.TLineDestination; import com.stylefeng.guns.modular.system.service.ITLineDestinationService; import org.springframework.stereotype.Service; /** * <p> * 线路目的地 服务实现类 * </p> * * @author Codex * @since 2026-04-19 */ @Service public class TLineDestinationServiceImpl extends ServiceImpl<TLineDestinationMapper, TLineDestination> implements ITLineDestinationService { } ManagementYKDTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tLine/tLine_add.html
@@ -68,6 +68,124 @@ <div class="row" style="margin-top: 30px;"> <div class="col-sm-4"> <h2 style="font-weight: 700;">目的地设置</h2> </div> </div> <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"> <#button btnCss="info" name="添加目的地" id="addDestinationBtn" icon="fa-plus" clickFun="TLineInfoDlg.openDestinationDialog()"/> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">已添加目的地</label> <div class="col-sm-10"> <div style="height: 220px; border: 1px solid #e5e6e7;overflow-y: auto;"> <table class="table table-striped table-bordered table-hover table-condensed"> <thead> <tr> <th style="text-align: center;">围栏类型</th> <th style="text-align: center;">目的地</th> <th style="text-align: center;">5座车价格</th> <th style="text-align: center;">7座车价格</th> <th style="text-align: center;">状态</th> <th style="text-align: center;">是否为主要</th> <th style="text-align: center;">操作</th> </tr> </thead> <tbody id="destinationValue"> </tbody> </table> </div> </div> </div> </div> </div> <div id="destinationDialogContent" style="display: none;padding: 20px 20px 0 20px;"> <div class="form-horizontal"> <input type="hidden" id="destinationEditIndex"> <div class="form-group"> <label class="col-sm-2 control-label">目的地名称:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="destinationName" placeholder="请输入"> </div> <label class="col-sm-2 control-label">围栏类型:</label> <div class="col-sm-4" style="display: flex;align-items: center;"> <div class="radio radio-info radio-inline"> <input type="radio" id="destinationFenceType1" value="1" name="destinationFenceType" checked onclick="TLineInfoDlg.destinationFenceTypeChange(1)"> <label for="destinationFenceType1"> 圆形围栏 </label> </div> <div class="radio radio-success radio-inline"> <input type="radio" id="destinationFenceType2" value="2" name="destinationFenceType" onclick="TLineInfoDlg.destinationFenceTypeChange(2)"> <label for="destinationFenceType2"> 多边形围栏 </label> </div> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">目的地围栏:</label> <div class="col-sm-10"> <div style="margin-bottom: 10px;"> <button type="button" class="btn btn-info btn-sm" onclick="TLineInfoDlg.startDrawDestinationFence()">选择围栏</button> <button type="button" class="btn btn-default btn-sm" onclick="TLineInfoDlg.clearDestinationFence()">清除围栏</button> <button type="button" class="btn btn-default btn-sm" onclick="TLineInfoDlg.selectDestinationDefaultPoint()">选择默认点</button> <span id="destinationFenceTip" style="margin-left: 10px;color: #999;"></span> </div> <div style="margin-bottom: 10px;"> <input type="text" class="form-control" id="destinationAddressKeyword" placeholder="输入地址搜索后定位默认点" style="width: 320px;display: inline-block;"> <button type="button" class="btn btn-default btn-sm" onclick="TLineInfoDlg.searchDestinationAddress()">搜索</button> <span id="destinationDefaultPointText" style="margin-left: 10px;color: #666;"></span> </div> <div id="destinationMapContainer" style="height: 420px;width: 100%;"></div> <input type="hidden" id="destinationCoordinate"> <input type="hidden" id="destinationDefaultPointLon"> <input type="hidden" id="destinationDefaultPointLat"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">5座车费用:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="destinationPrice5" placeholder="请输入"> </div> <label class="col-sm-2 control-label">7座车费用:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="destinationPrice7" placeholder="请输入"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">是否主要:</label> <div class="col-sm-4" style="display: flex;align-items: center;"> <div class="radio radio-info radio-inline"> <input type="radio" id="destinationIsMain1" value="1" name="destinationIsMain"> <label for="destinationIsMain1"> 是 </label> </div> <div class="radio radio-success radio-inline"> <input type="radio" id="destinationIsMain0" value="0" name="destinationIsMain" checked> <label for="destinationIsMain0"> 否 </label> </div> </div> <label class="col-sm-2 control-label">是否启用:</label> <div class="col-sm-4" style="display: flex;align-items: center;"> <div class="radio radio-info radio-inline"> <input type="radio" id="destinationState1" value="1" name="destinationState" checked> <label for="destinationState1"> 启用 </label> </div> <div class="radio radio-success radio-inline"> <input type="radio" id="destinationState2" value="2" name="destinationState"> <label for="destinationState2"> 关闭 </label> </div> </div> </div> </div> </div> <div class="row" style="margin-top: 30px;"> <div class="col-sm-4"> <h2 style="font-weight: 700;">价格设置</h2> </div> </div> @@ -249,6 +367,12 @@ </div> </div> <script type="text/javascript"> window._AMapSecurityConfig = { securityJsCode: '44c5ee9ad584605d91ca69bfac32c761', } </script> <script src="https://webapi.amap.com/maps?v=1.4.15&key=d3bde6afb050067e1a765a8d1d1f4c54&plugin=AMap.MouseTool,AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocoder"></script> <script src="${ctxPath}/static/modular/system/tLine/tLine_info.js"></script> <script type="text/javascript"> laydate.render({ ManagementYKDTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tLine/tLine_edit.html
@@ -69,6 +69,149 @@ <div class="row" style="margin-top: 30px;"> <div class="col-sm-4"> <h2 style="font-weight: 700;">目的地设置</h2> </div> </div> <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"> <#button btnCss="info" name="添加目的地" id="addDestinationBtn" icon="fa-plus" clickFun="TLineInfoDlg.openDestinationDialog()"/> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">已添加目的地</label> <div class="col-sm-10"> <div style="height: 220px; border: 1px solid #e5e6e7;overflow-y: auto;"> <table class="table table-striped table-bordered table-hover table-condensed"> <thead> <tr> <th style="text-align: center;">围栏类型</th> <th style="text-align: center;">目的地</th> <th style="text-align: center;">5座车价格</th> <th style="text-align: center;">7座车价格</th> <th style="text-align: center;">状态</th> <th style="text-align: center;">是否为主要</th> <th style="text-align: center;">操作</th> </tr> </thead> <tbody id="destinationValue"> @for(obj in lineDestinationList!){ <tr class="destinationValueClass"> <td style="text-align: center;"> <input type="hidden" name="destinationTimeValue" value="${obj.addTime}"> <input type="hidden" name="destinationFenceTypeValue" value="${obj.fenceType}"> <input type="hidden" name="destinationCoordinateValue" value="${obj.coordinate}"> <input type="hidden" name="destinationDefaultPointLonValue" value="${obj.defaultPointLon}"> <input type="hidden" name="destinationDefaultPointLatValue" value="${obj.defaultPointLat}"> <input type="hidden" name="destinationNameValue" value="${obj.name}"> <input type="hidden" name="destinationPrice5Value" value="${obj.price5}"> <input type="hidden" name="destinationPrice7Value" value="${obj.price7}"> <input type="hidden" name="destinationStateValue" value="${obj.state}"> <input type="hidden" name="destinationIsMainValue" value="${obj.isMain}"> ${obj.fenceType == 1 ? "圆形围栏" : "多边形围栏"} </td> <td style="text-align: center;">${obj.name}</td> <td style="text-align: center;">${obj.price5}</td> <td style="text-align: center;">${obj.price7}</td> <td style="text-align: center;">${obj.state == 1 ? "启用" : "关闭"}</td> <td style="text-align: center;">${obj.isMain == 1 ? "是" : "否"}</td> <td style="text-align: center;"> <button type="button" onclick="TLineInfoDlg.editDestination(this)">编辑</button> <button type="button" onclick="TLineInfoDlg.deleteDestination(this)">删除</button> </td> </tr> @} </tbody> </table> </div> </div> </div> </div> </div> <div id="destinationDialogContent" style="display: none;padding: 20px 20px 0 20px;"> <div class="form-horizontal"> <input type="hidden" id="destinationEditIndex"> <div class="form-group"> <label class="col-sm-2 control-label">目的地名称:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="destinationName" placeholder="请输入"> </div> <label class="col-sm-2 control-label">围栏类型:</label> <div class="col-sm-4" style="display: flex;align-items: center;"> <div class="radio radio-info radio-inline"> <input type="radio" id="destinationFenceType1" value="1" name="destinationFenceType" checked onclick="TLineInfoDlg.destinationFenceTypeChange(1)"> <label for="destinationFenceType1"> 圆形围栏 </label> </div> <div class="radio radio-success radio-inline"> <input type="radio" id="destinationFenceType2" value="2" name="destinationFenceType" onclick="TLineInfoDlg.destinationFenceTypeChange(2)"> <label for="destinationFenceType2"> 多边形围栏 </label> </div> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">目的地围栏:</label> <div class="col-sm-10"> <div style="margin-bottom: 10px;"> <button type="button" class="btn btn-info btn-sm" onclick="TLineInfoDlg.startDrawDestinationFence()">选择围栏</button> <button type="button" class="btn btn-default btn-sm" onclick="TLineInfoDlg.clearDestinationFence()">清除围栏</button> <button type="button" class="btn btn-default btn-sm" onclick="TLineInfoDlg.selectDestinationDefaultPoint()">选择默认点</button> <span id="destinationFenceTip" style="margin-left: 10px;color: #999;"></span> </div> <div style="margin-bottom: 10px;"> <input type="text" class="form-control" id="destinationAddressKeyword" placeholder="输入地址搜索后定位默认点" style="width: 320px;display: inline-block;"> <button type="button" class="btn btn-default btn-sm" onclick="TLineInfoDlg.searchDestinationAddress()">搜索</button> <span id="destinationDefaultPointText" style="margin-left: 10px;color: #666;"></span> </div> <div id="destinationMapContainer" style="height: 420px;width: 100%;"></div> <input type="hidden" id="destinationCoordinate"> <input type="hidden" id="destinationDefaultPointLon"> <input type="hidden" id="destinationDefaultPointLat"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">5座车费用:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="destinationPrice5" placeholder="请输入"> </div> <label class="col-sm-2 control-label">7座车费用:</label> <div class="col-sm-4"> <input type="text" class="form-control" id="destinationPrice7" placeholder="请输入"> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label">是否主要:</label> <div class="col-sm-4" style="display: flex;align-items: center;"> <div class="radio radio-info radio-inline"> <input type="radio" id="destinationIsMain1" value="1" name="destinationIsMain"> <label for="destinationIsMain1"> 是 </label> </div> <div class="radio radio-success radio-inline"> <input type="radio" id="destinationIsMain0" value="0" name="destinationIsMain" checked> <label for="destinationIsMain0"> 否 </label> </div> </div> <label class="col-sm-2 control-label">是否启用:</label> <div class="col-sm-4" style="display: flex;align-items: center;"> <div class="radio radio-info radio-inline"> <input type="radio" id="destinationState1" value="1" name="destinationState" checked> <label for="destinationState1"> 启用 </label> </div> <div class="radio radio-success radio-inline"> <input type="radio" id="destinationState2" value="2" name="destinationState"> <label for="destinationState2"> 关闭 </label> </div> </div> </div> </div> </div> <div class="row" style="margin-top: 30px;"> <div class="col-sm-4"> <h2 style="font-weight: 700;">价格设置</h2> </div> </div> @@ -268,6 +411,12 @@ </div> </div> <script type="text/javascript"> window._AMapSecurityConfig = { securityJsCode: '44c5ee9ad584605d91ca69bfac32c761', } </script> <script src="https://webapi.amap.com/maps?v=1.4.15&key=d3bde6afb050067e1a765a8d1d1f4c54&plugin=AMap.MouseTool,AMap.Autocomplete,AMap.PlaceSearch,AMap.Geocoder"></script> <script src="${ctxPath}/static/modular/system/tLine/tLine_info.js"></script> <script type="text/javascript"> laydate.render({ ManagementYKDTravel/guns-admin/src/main/webapp/static/modular/system/tLine/tLine_info.js
@@ -3,6 +3,15 @@ */ var TLineInfoDlg = { tLineInfoData : {}, destinationLayerIndex: null, destinationEditRow: null, destinationMap: null, destinationMouseTool: null, destinationFenceOverlay: null, destinationDefaultPointMarker: null, destinationSelectPointMode: false, destinationAutoComplete: null, destinationPlaceSearch: null, validateFields: { name: { validators: { @@ -177,6 +186,10 @@ Feng.error("请至少设置一条班次设置"); return; } var destArr = TLineInfoDlg.collectDestinationArr(); if(destArr === false){ return; } $(e).attr('disabled','disabled'); //点击后就禁用,若想再次点击需刷新页面; //提交信息 var ajax = new $ax(Feng.ctxPath + "/tLine/add", function(data){ @@ -196,6 +209,7 @@ ajax.set("endSiteId",endSiteId); ajax.set("subArr",JSON.stringify(subArr)); ajax.set("shuArr",JSON.stringify(shuArr)); ajax.set("destArr",JSON.stringify(destArr)); ajax.start(); } @@ -242,6 +256,10 @@ Feng.error("请至少设置一条班次设置"); return; } var destArr = TLineInfoDlg.collectDestinationArr(); if(destArr === false){ return; } //提交信息 var ajax = new $ax(Feng.ctxPath + "/tLine/update", function(data){ if(data.status == 200){ @@ -259,6 +277,7 @@ ajax.set("endSiteId",endSiteId); ajax.set("subArr",JSON.stringify(subArr)); ajax.set("shuArr",JSON.stringify(shuArr)); ajax.set("destArr",JSON.stringify(destArr)); ajax.start(); } @@ -628,6 +647,460 @@ } } TLineInfoDlg.collectDestinationArr = function () { var destArr = []; var mainCount = 0; $(".destinationValueClass").each(function () { var item = { time: $(this).find("input[name='destinationTimeValue']").val(), fenceType: $(this).find("input[name='destinationFenceTypeValue']").val(), coordinate: $(this).find("input[name='destinationCoordinateValue']").val(), defaultPointLon: $(this).find("input[name='destinationDefaultPointLonValue']").val(), defaultPointLat: $(this).find("input[name='destinationDefaultPointLatValue']").val(), name: $(this).find("input[name='destinationNameValue']").val(), price5: $(this).find("input[name='destinationPrice5Value']").val(), price7: $(this).find("input[name='destinationPrice7Value']").val(), state: $(this).find("input[name='destinationStateValue']").val(), isMain: $(this).find("input[name='destinationIsMainValue']").val() }; if (item.isMain == "1") { mainCount++; } destArr.push(item); }); if (mainCount > 1) { Feng.error("最多只能设置一个主要目的地"); return false; } return destArr; } TLineInfoDlg.escapeHtml = function (str) { return (str || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); } TLineInfoDlg.escapeAttr = function (str) { return TLineInfoDlg.escapeHtml(str).replace(/"/g, """); } TLineInfoDlg.openDestinationDialog = function () { if ($(".destinationValueClass").length >= 3) { Feng.error("最多只能添加3个目的地"); return; } TLineInfoDlg.destinationEditRow = null; TLineInfoDlg.resetDestinationForm(); TLineInfoDlg.openDestinationLayer("添加目的地"); } TLineInfoDlg.openDestinationLayer = function (title) { TLineInfoDlg.destinationLayerIndex = layer.open({ type: 1, title: title, area: ['1000px', '760px'], btn: ['保存', '取消'], content: $("#destinationDialogContent"), success: function () { $("#destinationDialogContent").show(); TLineInfoDlg.initDestinationMap(); setTimeout(function () { if (TLineInfoDlg.destinationMap) { TLineInfoDlg.destinationMap.resize(); TLineInfoDlg.destinationMap.setFitView(); } }, 100); }, yes: function (index) { TLineInfoDlg.saveDestination(index); }, end: function () { $("#destinationDialogContent").hide(); TLineInfoDlg.destinationSelectPointMode = false; if (TLineInfoDlg.destinationMouseTool) { TLineInfoDlg.destinationMouseTool.close(); } } }); } TLineInfoDlg.resetDestinationForm = function () { $("#destinationEditIndex").val(""); $("#destinationName").val(""); $("#destinationPrice5").val(""); $("#destinationPrice7").val(""); $("#destinationAddressKeyword").val(""); $("#destinationCoordinate").val(""); $("#destinationDefaultPointLon").val(""); $("#destinationDefaultPointLat").val(""); $("#destinationDefaultPointText").text(""); $("#destinationFenceType1").prop("checked", true); $("#destinationState1").prop("checked", true); $("#destinationIsMain0").prop("checked", true); TLineInfoDlg.destinationFenceTypeChange(1); TLineInfoDlg.clearDestinationFence(); } TLineInfoDlg.destinationFenceTypeChange = function (type) { if (type == 1) { $("#destinationFenceTip").text("圆形围栏默认点为圆心"); } else { $("#destinationFenceTip").text("多边形围栏需要确认一个默认点"); } } TLineInfoDlg.initDestinationMap = function () { if (TLineInfoDlg.destinationMap) { return; } TLineInfoDlg.destinationMap = new AMap.Map("destinationMapContainer", { resizeEnable: true, zoom: 13 }); TLineInfoDlg.destinationMouseTool = new AMap.MouseTool(TLineInfoDlg.destinationMap); TLineInfoDlg.destinationMouseTool.on('draw', function (e) { var type = $("input[name='destinationFenceType']:checked").val(); TLineInfoDlg.clearDestinationFence(); TLineInfoDlg.destinationFenceOverlay = e.obj; if (type == "1") { var center = e.obj.getCenter(); var radius = e.obj.getRadius(); if (radius > 5000) { Feng.error("圆形围栏半径不能大于5000米"); TLineInfoDlg.clearDestinationFence(); return; } var coordinate = center.lng + "," + center.lat + ";" + radius; $("#destinationCoordinate").val(coordinate); $("#destinationDefaultPointLon").val(center.lng); $("#destinationDefaultPointLat").val(center.lat); TLineInfoDlg.setDestinationDefaultPointMarker(center.lng, center.lat, true); } else { var path = e.obj.getPath(); var coordinate = TLineInfoDlg.pathToCoordinate(path); $("#destinationCoordinate").val(coordinate); } }); TLineInfoDlg.destinationMap.on('click', function (e) { if (!TLineInfoDlg.destinationSelectPointMode) { return; } var fenceType = $("input[name='destinationFenceType']:checked").val(); if (fenceType != "2") { Feng.info("圆形围栏默认点为圆心,无需单独设置"); TLineInfoDlg.destinationSelectPointMode = false; return; } $("#destinationDefaultPointLon").val(e.lnglat.getLng()); $("#destinationDefaultPointLat").val(e.lnglat.getLat()); TLineInfoDlg.setDestinationDefaultPointMarker(e.lnglat.getLng(), e.lnglat.getLat(), false); TLineInfoDlg.destinationSelectPointMode = false; Feng.success("默认点设置成功"); }); TLineInfoDlg.destinationAutoComplete = new AMap.Autocomplete({ city: "", input: "destinationAddressKeyword" }); TLineInfoDlg.destinationPlaceSearch = new AMap.PlaceSearch({ map: TLineInfoDlg.destinationMap, pageSize: 1, pageIndex: 1, citylimit: false }); AMap.event.addListener(TLineInfoDlg.destinationAutoComplete, "select", function (e) { if (!e.poi || !e.poi.location) { return; } var lon = e.poi.location.lng; var lat = e.poi.location.lat; TLineInfoDlg.destinationMap.setCenter([lon, lat]); TLineInfoDlg.destinationMap.setZoom(15); $("#destinationDefaultPointLon").val(lon); $("#destinationDefaultPointLat").val(lat); TLineInfoDlg.setDestinationDefaultPointMarker(lon, lat, false); }); } TLineInfoDlg.searchDestinationAddress = function () { var keyword = $("#destinationAddressKeyword").val(); if (!keyword) { Feng.info("请输入地址关键词"); return; } if (!TLineInfoDlg.destinationPlaceSearch) { return; } TLineInfoDlg.destinationPlaceSearch.search(keyword, function (status, result) { if (status !== "complete" || !result || !result.poiList || result.poiList.count <= 0) { Feng.error("未找到相关地址"); return; } var poi = result.poiList.pois[0]; if (!poi || !poi.location) { Feng.error("地址定位失败"); return; } var lon = poi.location.lng; var lat = poi.location.lat; TLineInfoDlg.destinationMap.setCenter([lon, lat]); TLineInfoDlg.destinationMap.setZoom(15); $("#destinationDefaultPointLon").val(lon); $("#destinationDefaultPointLat").val(lat); TLineInfoDlg.setDestinationDefaultPointMarker(lon, lat, false); }); } TLineInfoDlg.pathToCoordinate = function (path) { var arr = []; for (var i = 0; i < path.length; i++) { arr.push(path[i].lng + "," + path[i].lat); } return arr.join(";"); } TLineInfoDlg.selectDestinationDefaultPoint = function () { var fenceType = $("input[name='destinationFenceType']:checked").val(); if (fenceType == "1") { Feng.info("圆形围栏默认点为圆心,无需单独设置"); return; } TLineInfoDlg.destinationSelectPointMode = true; Feng.info("请在地图上点击设置默认点"); } TLineInfoDlg.startDrawDestinationFence = function () { TLineInfoDlg.initDestinationMap(); var type = $("input[name='destinationFenceType']:checked").val(); TLineInfoDlg.clearDestinationFence(); if (type == "1") { TLineInfoDlg.destinationMouseTool.circle({ fillColor: '#00b0ff', strokeColor: '#80d8ff' }); } else { TLineInfoDlg.destinationMouseTool.polygon({ fillColor: '#00b0ff', strokeColor: '#80d8ff' }); } } TLineInfoDlg.clearDestinationFence = function () { if (TLineInfoDlg.destinationFenceOverlay) { TLineInfoDlg.destinationMap.remove(TLineInfoDlg.destinationFenceOverlay); TLineInfoDlg.destinationFenceOverlay = null; } if (TLineInfoDlg.destinationDefaultPointMarker) { TLineInfoDlg.destinationMap.remove(TLineInfoDlg.destinationDefaultPointMarker); TLineInfoDlg.destinationDefaultPointMarker = null; } $("#destinationCoordinate").val(""); $("#destinationDefaultPointLon").val(""); $("#destinationDefaultPointLat").val(""); $("#destinationDefaultPointText").text(""); } TLineInfoDlg.setDestinationDefaultPointMarker = function (lon, lat, auto) { if (!TLineInfoDlg.destinationMap) { return; } if (TLineInfoDlg.destinationDefaultPointMarker) { TLineInfoDlg.destinationMap.remove(TLineInfoDlg.destinationDefaultPointMarker); } TLineInfoDlg.destinationDefaultPointMarker = new AMap.Marker({ map: TLineInfoDlg.destinationMap, position: new AMap.LngLat(lon, lat) }); var text = "默认点:" + lon + "," + lat; if (auto) { text += "(圆心)"; } $("#destinationDefaultPointText").text(text); } TLineInfoDlg.validateDestinationForm = function () { var name = $("#destinationName").val(); if (!name) { Feng.error("请填写目的地名称"); return false; } var priceReg = /^(0|[1-9]\d{0,6})(\.\d{1,2})?$/; var price5 = $("#destinationPrice5").val(); var price7 = $("#destinationPrice7").val(); if (!priceReg.test(price5)) { Feng.error("5座车费用格式不正确"); return false; } if (!priceReg.test(price7)) { Feng.error("7座车费用格式不正确"); return false; } var coordinate = $("#destinationCoordinate").val(); if (!coordinate) { Feng.error("请先设置目的地围栏"); return false; } var fenceType = $("input[name='destinationFenceType']:checked").val(); var defaultPointLon = $("#destinationDefaultPointLon").val(); var defaultPointLat = $("#destinationDefaultPointLat").val(); if (fenceType == "2" && (!defaultPointLon || !defaultPointLat)) { Feng.error("多边形围栏必须设置默认点"); return false; } if ($("input[name='destinationIsMain']:checked").val() == "1") { var sameMainCount = 0; $(".destinationValueClass").each(function () { if ($(this).find("input[name='destinationIsMainValue']").val() == "1") { if (!TLineInfoDlg.destinationEditRow || this != TLineInfoDlg.destinationEditRow[0]) { sameMainCount++; } } }); if (sameMainCount > 0) { Feng.error("已存在主要目的地,请先调整后再保存"); return false; } } return true; } TLineInfoDlg.saveDestination = function (layerIndex) { if (!TLineInfoDlg.validateDestinationForm()) { return; } var data = { time: getNowFormatDate(), fenceType: $("input[name='destinationFenceType']:checked").val(), coordinate: $("#destinationCoordinate").val(), defaultPointLon: $("#destinationDefaultPointLon").val(), defaultPointLat: $("#destinationDefaultPointLat").val(), name: $("#destinationName").val(), price5: $("#destinationPrice5").val(), price7: $("#destinationPrice7").val(), state: $("input[name='destinationState']:checked").val(), isMain: $("input[name='destinationIsMain']:checked").val() }; if (TLineInfoDlg.destinationEditRow) { TLineInfoDlg.destinationEditRow.replaceWith(TLineInfoDlg.buildDestinationRowHtml(data)); } else { $("#destinationValue").append(TLineInfoDlg.buildDestinationRowHtml(data)); } layer.close(layerIndex); } TLineInfoDlg.buildDestinationRowHtml = function (data) { var fenceTypeText = data.fenceType == "1" ? "圆形围栏" : "多边形围栏"; var stateText = data.state == "1" ? "启用" : "关闭"; var isMainText = data.isMain == "1" ? "是" : "否"; var nameHtml = TLineInfoDlg.escapeHtml(data.name); var coordinateAttr = TLineInfoDlg.escapeAttr(data.coordinate); var nameAttr = TLineInfoDlg.escapeAttr(data.name); return '<tr class="destinationValueClass">' + '<td style="text-align: center;">' + '<input type="hidden" name="destinationTimeValue" value="' + TLineInfoDlg.escapeAttr(data.time) + '">' + '<input type="hidden" name="destinationFenceTypeValue" value="' + data.fenceType + '">' + '<input type="hidden" name="destinationCoordinateValue" value="' + coordinateAttr + '">' + '<input type="hidden" name="destinationDefaultPointLonValue" value="' + TLineInfoDlg.escapeAttr(data.defaultPointLon) + '">' + '<input type="hidden" name="destinationDefaultPointLatValue" value="' + TLineInfoDlg.escapeAttr(data.defaultPointLat) + '">' + '<input type="hidden" name="destinationNameValue" value="' + nameAttr + '">' + '<input type="hidden" name="destinationPrice5Value" value="' + TLineInfoDlg.escapeAttr(data.price5) + '">' + '<input type="hidden" name="destinationPrice7Value" value="' + TLineInfoDlg.escapeAttr(data.price7) + '">' + '<input type="hidden" name="destinationStateValue" value="' + data.state + '">' + '<input type="hidden" name="destinationIsMainValue" value="' + data.isMain + '">' + fenceTypeText + '</td>' + '<td style="text-align: center;">' + nameHtml + '</td>' + '<td style="text-align: center;">' + TLineInfoDlg.escapeHtml(data.price5) + '</td>' + '<td style="text-align: center;">' + TLineInfoDlg.escapeHtml(data.price7) + '</td>' + '<td style="text-align: center;">' + stateText + '</td>' + '<td style="text-align: center;">' + isMainText + '</td>' + '<td style="text-align: center;">' + '<button type="button" onclick="TLineInfoDlg.editDestination(this)">编辑</button> ' + '<button type="button" onclick="TLineInfoDlg.deleteDestination(this)">删除</button>' + '</td></tr>'; } TLineInfoDlg.editDestination = function (btn) { var $row = $(btn).closest("tr"); TLineInfoDlg.destinationEditRow = $row; TLineInfoDlg.resetDestinationForm(); $("#destinationName").val($row.find("input[name='destinationNameValue']").val()); $("#destinationPrice5").val($row.find("input[name='destinationPrice5Value']").val()); $("#destinationPrice7").val($row.find("input[name='destinationPrice7Value']").val()); $("#destinationCoordinate").val($row.find("input[name='destinationCoordinateValue']").val()); $("#destinationDefaultPointLon").val($row.find("input[name='destinationDefaultPointLonValue']").val()); $("#destinationDefaultPointLat").val($row.find("input[name='destinationDefaultPointLatValue']").val()); var fenceType = $row.find("input[name='destinationFenceTypeValue']").val(); var state = $row.find("input[name='destinationStateValue']").val(); var isMain = $row.find("input[name='destinationIsMainValue']").val(); $("input[name='destinationFenceType'][value='" + fenceType + "']").prop("checked", true); $("input[name='destinationState'][value='" + state + "']").prop("checked", true); $("input[name='destinationIsMain'][value='" + isMain + "']").prop("checked", true); TLineInfoDlg.destinationFenceTypeChange(parseInt(fenceType, 10)); TLineInfoDlg.openDestinationLayer("编辑目的地"); setTimeout(function () { TLineInfoDlg.restoreDestinationMapFence(); }, 150); } TLineInfoDlg.restoreDestinationMapFence = function () { TLineInfoDlg.initDestinationMap(); TLineInfoDlg.clearDestinationFence(); var fenceType = $("input[name='destinationFenceType']:checked").val(); var coordinate = $("#destinationCoordinate").val(); if (!coordinate) { return; } if (fenceType == "1") { var arr = coordinate.split(";"); if (arr.length != 2) { return; } var centerArr = arr[0].split(","); if (centerArr.length != 2) { return; } var center = new AMap.LngLat(parseFloat(centerArr[0]), parseFloat(centerArr[1])); var radius = parseFloat(arr[1]); TLineInfoDlg.destinationFenceOverlay = new AMap.Circle({ center: center, radius: radius, fillColor: '#00b0ff', strokeColor: '#80d8ff' }); TLineInfoDlg.destinationMap.add(TLineInfoDlg.destinationFenceOverlay); TLineInfoDlg.setDestinationDefaultPointMarker(center.getLng(), center.getLat(), true); TLineInfoDlg.destinationMap.setFitView(); } else { var pointsArr = coordinate.split(";"); var points = []; for (var i = 0; i < pointsArr.length; i++) { var point = pointsArr[i].split(","); if (point.length == 2) { points.push([parseFloat(point[0]), parseFloat(point[1])]); } } if (points.length > 0) { TLineInfoDlg.destinationFenceOverlay = new AMap.Polygon({ path: points, fillColor: '#00b0ff', strokeColor: '#80d8ff' }); TLineInfoDlg.destinationMap.add(TLineInfoDlg.destinationFenceOverlay); var lon = $("#destinationDefaultPointLon").val(); var lat = $("#destinationDefaultPointLat").val(); if (lon && lat) { TLineInfoDlg.setDestinationDefaultPointMarker(parseFloat(lon), parseFloat(lat), false); } TLineInfoDlg.destinationMap.setFitView(); } } } TLineInfoDlg.deleteDestination = function (btn) { $(btn).closest("tr").remove(); } /** * 添加公司 */