From d69f9a06fb73f9d5efea882a684d217f12e34a4f Mon Sep 17 00:00:00 2001 From: lisy <linlangsur163@163.com> Date: 星期三, 02 八月 2023 14:22:06 +0800 Subject: [PATCH] 创建省市县实体类+site的mapper实体映射修复 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java | 31 ++ cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/Region.java | 8 cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/RegionServiceImpl.java | 12 cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html | 153 +++++----- cloud-server-management/src/main/resources/mapper/TSiteMapper.xml | 2 cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TStoreList.html | 57 ++++ cloud-server-management/src/main/resources/mapper/RegionMapper.xml | 5 cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js | 396 ++++++---------------------- cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TStoreInfo.js | 92 ++++++ cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IRegionService.java | 16 + cloud-server-management/src/main/java/com/dsh/course/mapper/RegionMapper.java | 10 cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/User.java | 2 12 files changed, 399 insertions(+), 385 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/course/mapper/RegionMapper.java b/cloud-server-management/src/main/java/com/dsh/course/mapper/RegionMapper.java new file mode 100644 index 0000000..4f1fbdc --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/course/mapper/RegionMapper.java @@ -0,0 +1,10 @@ +package com.dsh.course.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dsh.guns.modular.system.model.Region; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RegionMapper extends BaseMapper<Region> { + +} diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java index 9ab794c..615e19a 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java @@ -1,11 +1,14 @@ package com.dsh.guns.modular.system.controller.code; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.course.feignClient.activity.CouponClient; import com.dsh.course.feignClient.activity.model.CouponListOfSearch; import com.dsh.guns.core.common.constant.factory.PageFactory; import com.dsh.guns.core.util.ToolUtil; +import com.dsh.guns.modular.system.model.Region; +import com.dsh.guns.modular.system.service.IRegionService; import com.dsh.guns.modular.system.util.OBSUploadUtil; import org.apache.commons.beanutils.ConvertUtils; import org.springframework.stereotype.Controller; @@ -37,6 +40,9 @@ @Resource + private IRegionService regiService; + + @Resource private CouponClient client; /** @@ -54,6 +60,17 @@ public String memberCouponAdd() { return PREFIX + "TCouponAdd.html"; } + + + + /** + * 跳转到优惠券管理首页 + */ + @RequestMapping("/storeList") + public String storePage(Model model) { + return PREFIX + "TStoreList.html"; + } + /** * 获取 优惠券管理 @@ -73,6 +90,20 @@ return client.getCouponListOfSearch(ofSearch); } + @RequestMapping(value = "/getProvince") + @ResponseBody + public Object getProvince(){ + return regiService.list(new LambdaQueryWrapper<Region>() + .eq(Region::getParentId,0)); + } + + + @RequestMapping(value = "/getCity") + @ResponseBody + public Object getCity(Integer province){ + return regiService.list(new LambdaQueryWrapper<Region>() + .eq(Region::getParentId,province)); + } @RequestMapping(value = "/uploadPic") @ResponseBody diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/Region.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/Region.java index abbed2c..173ee0e 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/Region.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/Region.java @@ -16,7 +16,7 @@ * @author 吕雪 * @since 2019-12-30 */ -@TableName("region") +@TableName("t_region") public class Region extends Model<Region> { private static final long serialVersionUID = 1L; @@ -29,8 +29,13 @@ /** * 城市名称 */ + @TableField("name") private String name; + + @TableField("code") private String code; + + @TableField("citycode") private String citycode; /** * 父级ID @@ -40,6 +45,7 @@ /** * 英文名称 */ + @TableField("english") private String english; diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/User.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/User.java index 5ea5bd6..e4e66e6 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/User.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/User.java @@ -87,10 +87,12 @@ /** * 对象类型(1=平台,2=城市管理员,3=门店) */ + @TableField("objectType") private Integer objectType; /** * objectId */ + @TableField("objectId") private Integer objectId; diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IRegionService.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IRegionService.java new file mode 100644 index 0000000..2ee8018 --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/IRegionService.java @@ -0,0 +1,16 @@ +package com.dsh.guns.modular.system.service; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.dsh.guns.modular.system.model.Region; + +/** + * 字典服务 + * + * @author fengshuonan + * @date 2017-04-27 17:00 + */ +public interface IRegionService extends IService<Region> { + + +} diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/RegionServiceImpl.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/RegionServiceImpl.java new file mode 100644 index 0000000..225e909 --- /dev/null +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/RegionServiceImpl.java @@ -0,0 +1,12 @@ +package com.dsh.guns.modular.system.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dsh.course.mapper.RegionMapper; +import com.dsh.guns.modular.system.model.Region; +import com.dsh.guns.modular.system.service.IRegionService; +import org.springframework.stereotype.Service; + +@Service +public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> implements IRegionService { + +} diff --git a/cloud-server-management/src/main/resources/mapper/RegionMapper.xml b/cloud-server-management/src/main/resources/mapper/RegionMapper.xml new file mode 100644 index 0000000..0d8eada --- /dev/null +++ b/cloud-server-management/src/main/resources/mapper/RegionMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dsh.course.mapper.RegionMapper"> + +</mapper> \ No newline at end of file diff --git a/cloud-server-management/src/main/resources/mapper/TSiteMapper.xml b/cloud-server-management/src/main/resources/mapper/TSiteMapper.xml index 4e999a1..d8c228f 100644 --- a/cloud-server-management/src/main/resources/mapper/TSiteMapper.xml +++ b/cloud-server-management/src/main/resources/mapper/TSiteMapper.xml @@ -3,7 +3,7 @@ <mapper namespace="com.dsh.course.mapper.TSiteMapper"> <!-- 通用查询映射结果 --> - <resultMap id="BaseResultMap" type="com.dsh.course.entity.TSite"> + <resultMap id="BaseResultMap" type="com.dsh.guns.modular.system.model.TSite"> <id column="id" property="id"/> <result column="storeId" property="storeId"/> <result column="name" property="name"/> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html index 2ab5a09..66652cf 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html @@ -40,58 +40,54 @@ <div class="ibox-content"> <div class="form-horizontal"> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*优惠券名称: </label> <div class="col-sm-9"> <input class="form-control" id="name" name="name" autocomplete="off" placeholder="请输入优惠券名称"> </div> </div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> - <div class="initialLevel col-sm-12 control-label form-group"> - <label class="col-sm-3 control-label">*优惠券类型: </label> - <input class="col-sm-1" style="margin-left: 1.7%;width: 13px;height: 13px;" - name="prescription" onclick="radio1()" - value="1" type="radio"> - <label class="col-sm-1" style="margin-left: 18px;width: 17%">满减券: 满</label> - <input type="text" class="col-sm-1" id="conditionalAmount" - onkeyup="value=value.replace(/\D/g,'')"/> - <label class="col-sm-1" style="margin-left: -1.5%;width: 14%"> 元 , 减 </label> - <input type="text" class="col-sm-1" id="deductionAmount" - onkeyup="value=value.replace(/\D/g,'')"/> - <label class="col-sm-1" style="margin-left: -1.5%"> 元</label> - </div> + <label class="col-sm-3 control-label">*优惠券类型: </label> + <input class="col-sm-1" style="margin-left: 2.7%;width: 13px;height: 13px;" + name="prescription" onclick="radio1()" + value="1" type="radio"> + <label class="col-sm-1" style="margin-left: 10px;width: 17%">满减券: 满</label> + <input type="text" class="col-sm-1" id="conditionalAmount" + onkeyup="value=value.replace(/\D/g,'')"/> + <label class="col-sm-1" style="margin-left: -1.5%;width: 14%"> 元 , 减 </label> + <input type="text" class="col-sm-1" id="deductionAmount" + onkeyup="value=value.replace(/\D/g,'')"/> + <label class="col-sm-1" style="margin-left: -1.5%"> 元</label> </div> <div class="form-group"> - <div class="initialLevel col-sm-12 control-label form-group"> - <input class="col-sm-1" name="prescription" type="radio" value="2" - onclick="radio2()" - style="margin-left: 24.7%;"> - <label class="col-sm-1" style="margin-left: -17px;width: 20%;">代金券: 可抵</label> - <input class="col-sm-1" id="voucherAmount" onkeyup="value=value.replace(/\D/g,'')"/> - <label class="col-sm-1">元</label> - </div> + <input class="col-sm-1" name="prescription" type="radio" value="2" + onclick="radio2()" + style="margin-left: 24.7%;"> + <label class="col-sm-1" style="margin-left: -17px;width: 20%;">代金券: 可抵</label> + <input class="col-sm-1" id="voucherAmount" onkeyup="value=value.replace(/\D/g,'')"/> + <label class="col-sm-1">元</label> </div> <div class="form-group"> - <div class="initialLevel col-sm-12 control-label form-group"> - <input class="col-sm-1" name="prescription" type="radio" value="3" - onclick="radio3()" - style="margin-left: 24.7%;"> - <label class="col-sm-3 control-label" style="margin-left: -1%;width: 14%;margin-top: -5px">体验券: </label> - <input class="form-control" style="width: 35%" id="experienceName" name="name" - autocomplete="off" placeholder="请输入体验券名称"> - </div> + <input class="col-sm-1" name="prescription" type="radio" value="3" + onclick="radio3()" + style="margin-left: 24.7%;"> + <label class="col-sm-1 control-label" style="margin-left: -1%;width: 14%;margin-top: -5px">体验券: </label> + <input class="col-sm-1" style="width: 35%" id="experienceName" name="name" + autocomplete="off" placeholder="请输入体验券名称"> </div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*优惠券说明: </label> <div class="col-sm-9"> @@ -99,11 +95,12 @@ placeholder="请输入优惠券说明"></textarea> </div> </div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <div class="initialLevel col-sm-12 control-label form-group"> <label class="col-sm-3 control-label">*发放方式: </label> @@ -118,11 +115,12 @@ <label class="col-sm-1" style="width: 16%;margin-top: 7px">自动发券</label> </div> </div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <div class="initialLevel col-sm-12 control-label form-group"> <label class="col-sm-3 control-label">*兑换方式: </label> @@ -137,11 +135,12 @@ <label class="col-sm-1" style="width: 9%;margin-top: 7px">现金</label> </div> </div> + </div> </div> <div class="row" id="needAmount"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*所需现金</label> <div class="col-sm-9"> @@ -149,12 +148,12 @@ onkeyup="this.value=this.value.replace(/\D/g,'')"> </div> </div> - <div class="hr-line-dashed"></div> + </div> </div> <div class="row" id="needIntegral"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*所需积分</label> <div class="col-sm-9"> @@ -162,12 +161,12 @@ onkeyup="this.value=this.value.replace(/\D/g,'')"> </div> </div> - <div class="hr-line-dashed"></div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <div class="initialLevel col-sm-12 control-label form-group"> <label class="col-sm-3 control-label">*用户人群: </label> @@ -182,10 +181,11 @@ <label class="col-sm-1" style="width: 18%;margin-top: 5px">已有学员用户</label> </div> </div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*发放数量</label> <div class="col-sm-9"> @@ -193,12 +193,12 @@ onkeyup="this.value=this.value.replace(/\D/g,'')"> </div> </div> - <div class="hr-line-dashed"></div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*限领数量</label> <div class="col-sm-9"> @@ -206,21 +206,20 @@ onkeyup="this.value=this.value.replace(/\D/g,'')"> </div> </div> - <div class="hr-line-dashed"></div> + </div> </div> - <div class="row" > - <div class="col-sm-5"> - <div class="form-group"> - <label class="col-sm-3 control-label">*有效期: </label> - <input type="text" style="width: 30%" class="form-control" id="periodOfValidity" placeholder="请选择"/> - </div> + <div class="row"> + <div class="col-sm-6"> + <label class="col-sm-3 control-label">*有效期: </label> + <input type="text" style="width: 30%;margin-left: 1%" class="col-sm-3" id="periodOfValidity" + placeholder="请选择"/> </div> </div> <div class="row" id="app"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*商品封面: </label> <div class="col-sm-2"> @@ -235,11 +234,12 @@ </el-upload> </div> </div> + </div> </div> <div class="row" id="app1"> - <div class="col-sm-5" style="width: 100%"> + <div class="col-sm-6" style="width: 100%"> <div class="form-group"> <label class="col-sm-3 control-label" style="width: 15%;margin-left: 5%">*商品图片(请上传不超过五张图片): </label> <div class="col-sm-2" style="width: 100%;margin-left: 11%;margin-top: 1%"> @@ -257,53 +257,61 @@ <img width="100%" :src="imageUrl1" alt=""> </div> </div> + </div> </div> <div class="row"> - <div class="col-sm-5"> + <div class="col-sm-6"> <div class="form-group"> <div class="initialLevel col-sm-12 control-label form-group"> <label class="col-sm-3 control-label">*适用范围: </label> <input class="col-sm-1 control-label" onclick="scopeOfApplication1()" name="company" type="radio" - value="0" style="margin-top: 10px"/> + value="0" checked style="margin-top: 10px"/> <label class="col-sm-1" style="margin-left: -15px;width: 16%;margin-top: 7px">全国通用</label> <input class="col-sm-1 control-label" name="company" onclick="scopeOfApplication2()" type="radio" - value="1" checked style="margin-left: 5%;margin-top: 10px;width: 13px;height: 13px"/> + value="1" style="margin-left: 5%;margin-top: 10px;width: 13px;height: 13px"/> <label class="col-sm-1" style="width: 16%;margin-top: 7px">指定城市</label> <input class="col-sm-1 control-label" name="company" onclick="scopeOfApplication3()" type="radio" - value="1" checked style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/> + value="1" style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/> <label class="col-sm-1" style="width: 16%;margin-top: -16px;margin-left: 8%">指定门店</label> </div> </div> + </div> </div> - <div class="row" id="citySelect"> - <div class="col-sm-5"> + <div class="row" id="citySelect" hidden="hidden"> + <div class="col-sm-6"> <div class="form-group"> <label class="col-sm-3 control-label">*指定城市: </label> - <select id="province" onchange="changeCity()"></select> - <label class="col-sm-1" style="width: 16%;margin-top: 7px">省</label> - <select id="city"></select> - <label class="col-sm-1" style="width: 16%;margin-top: 7px">市</label> - <select id="County"></select> - <div class="col-sm-1"> - <label name="addBranch" class="form-control" onclick="couponInfoDlg.addBranch()" style="border: 0px;cursor: pointer"><i class="fa fa-plus-circle"></i></label> - <label name="addBranch" class="form-control" onclick="couponInfoDlg.delete()" style="border: 0px;cursor: pointer"><i class="fa fa-trash"></i></label> + <div class="col-sm-9 control-label"> + <select class="col-sm-1" id="provinceData" style="margin-top: 1%;width: 25%" onchange="changeCity(null)"> + <option value="">请选择</option> + </select> + <label class="col-sm-1" style="width: 9%;margin-top: 7px">省</label> + <select class="col-sm-1" style="margin-top: 1%;width: 25%" id="cityData"> + <option value="">请选择</option> + </select> + <label class="col-sm-1" style="width: 7%;margin-top: 7px">市</label> + <label name="addBranch" class="col-sm-1" onclick="couponInfoDlg.addBranch()" style="border: 0px;cursor: pointer;margin-top: 1%"><i class="fa fa-plus-circle"></i></label> </div> + <div id="cityDemo"></div> </div> + </div> </div> - <div class="row" id="storeSelect"> - <div class="col-sm-5"> + <div class="row" id="storeSelect" hidden="hidden"> + <div class="col-sm-6"> <div class="form-group"> - <label class="col-sm-3 control-label">*指定门店: </label> - <button onclick="couponInfoDlg.employeeSelection()" - style="height: 22px;margin-left: -165px;width: 82px;background-color: #4a8ff1;color: white;z-index: 15;position:relative;border: none"> - 选择门店 - </button> + <div class="col-sm-12"> + <label class="col-sm-3 control-label">*指定门店: </label> + <button onclick="storeList()" + style="height: 22px;width: 82px;background-color: #4a8ff1;color: white;z-index: 15;position:relative;border: none;margin-top: 1%"> + 选择门店 + </button> + </div> <div class="col-sm-12" style="margin-left: -57px;margin-top: 20px"> <table class="table table-bordered" style="width: 70%;margin-left: 228px;" id="storeTable"> <thead> @@ -318,6 +326,7 @@ </table> </div> </div> + </div> </div> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TStoreList.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TStoreList.html new file mode 100644 index 0000000..e313066 --- /dev/null +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TStoreList.html @@ -0,0 +1,57 @@ +@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"> + <#SelectCon id="type" name="所在省" > + <option value="">全部</option> + </#SelectCon> + </div> + <div class="col-sm-3"> + <#SelectCon id="distributionMethod" name="所在市" > + <option value="">全部</option> + </#SelectCon> + </div> + <div class="col-sm-3"> + <#SelectCon id="userPopulation" name="所属账号" > + <option value="">全部</option> + </#SelectCon> + </div> + <div class="col-sm-3"> + <#NameCon id="name" name="门店名称" placeholder="请输入门店名称"/> + </div> + <div class="col-sm-3"> + <#button name="搜索" icon="fa-search" clickFun="TStoreProvince.search()"/> + <#button name="重置" icon="fa-trash" clickFun="TStoreProvince.resetSearch()"/> + </div> + </div> + <div class="hidden-xs" id="TStoreProvinceTableToolbar" role="group"> + </div> + <#table id="TStoreProvinceTable"/> + <div style="margin-left: 30%"> + <button type="button" class="btn btn-info button-margin" onclick="storeOfClosePage()" + id="closePage" style="width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> + <i class="fa fa-check"></i> 关闭 + </button> + + <button type="button" class="btn btn-info button-margin" onclick="saveSelectStores()" + id="submit" style="margin-left: 5%;width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> + <i class="fa fa-check"></i> 保存 + </button> + </div> + </div> + </div> +</div> + +</div> +</div> +</div> +<script src="${ctxPath}/modular/system/tCoupon/TStoreInfo.js"></script> +@} diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js index d4f5247..bbf243d 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TCouponInfo.js @@ -90,26 +90,6 @@ } /** - * 全部用户 - */ -function userGroup1() { - $("#demo2").show() -} - -/** - * 年度会员 - */ -function userGroup2() { - $("#demo2").show() -} - -/** - * 已有学员用户 - */ -function userGroup3() { - $("#demo2").show() -} -/** * 全国通用 */ function scopeOfApplication1() { @@ -178,65 +158,99 @@ } +function changeCity(n){ + var provinceSelect = null; + if (n === undefined || n === null || n === ''){ + provinceSelect = document.getElementById("provinceData"); + }else { + provinceSelect = document.getElementById("provinceData"+n); + } -couponInfoDlg.addBranch = function () { + var citySelect = null; + if (n === undefined || n === null || n === ''){ + citySelect = document.getElementById("cityData"); + }else { + citySelect = document.getElementById("cityData"+n); + } - let companies = []; - let brands = []; - $.ajax({ - url : Feng.ctxPath + "/tbMemberTag/getCompanyAndBranch", - method:'POST', - success:function (res) { - companies = res.companies; - brands = res.brands; + var selectedProvince = provinceSelect.value; + // 清空城市下拉框 + citySelect.innerHTML = '<option value="">请选择</option>'; + if (selectedProvince === "") { + return; + } + var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity", function(data){ + data.forEach(province => { + var option = document.createElement("option"); + option.value = province.id; // 根据你的数据结构确定省份的id字段 + option.text = province.name; // 根据你的数据结构确定省份的name字段 + citySelect.appendChild(option); + }); + },function(data){ + console.log('data:',data) + Feng.error("获取失败!" + data.responseJSON.message + "!"); + }); + ajax.set('province',selectedProvince); + ajax.start(); +} - var str = " <div class=\"col-sm-12\">\n" + - " <label class=\"col-sm-1\">公司</label>\n" + - " <select class=\"col-sm-2\" id=\"brandCompany\" name='brandCompany' style=\"width: 88px\">\n" + - " <option value=\"\">全部公司</option>\n"; - if (companies.length > 0) { - for (let i = 0; i < companies.length; i++) { - str += '<option value="'+companies[i].id+'">'+companies[i].name+'</option>' - } - } - str+= " </select>\n" + - " <label class=\"col-sm-1\">品牌</label>\n" + - " <select class=\"col-sm-2\" id=\"brandName\" name='brandName' style=\"width: 88px\">\n" + - " <option value=\"\">全部品牌</option>\n"; - if (brands.length > 0) { - for (let i = 0; i < brands.length; i++) { - str += '<option value="' + brands[i].id + '">' + brands[i].name + '</option>'; - } - } - str += " </select>\n" + - " <div class=\"col-sm-2\">\n" + - " <input class=\"form-control\" id=\"brandDays\" name='brandDays' placeholder=\"近30天\" type=\"number\" min=\"1\"\n" + - " max=\"31\">\n" + - " </div>\n" + - " <select class=\"col-sm-2\" id=\"brandSymbol\" name='brandSymbol' style=\"width: 88px\">\n" + - " <option value=\"1\"> =</option>\n" + - " <option value=\"2\"> ></option>\n" + - " <option value=\"3\"> <</option>\n" + - " </select>\n" + - " <div class=\"col-sm-2\">\n" + - " <input class=\"form-control\" id=\"brandCount\" name='brandCount' placeholder=\"次\">\n" + - " </div>\n" + - " <div class=\"col-sm-1\">\n" + - " <label id=\"addBranch\" onclick='TbMemberTagInfoDlg.addBranch()' class=\"form-control\" style=\"border: 0px;cursor: pointer\"><i class=\"fa fa-plus\"></i></label>\n" + - " </div>\n" + - " <div class=\"col-sm-1\">\n" + - " <label id=\"addBranch\" onclick='TbMemberTagInfoDlg.subtract(this)' class=\"form-control\" style=\"border: 0px;cursor: pointer\"><i class=\"fa fa-minus\"></i></label>\n" + - " </div>\n" + - " </div>"; - $("#branch").append($(str)); +function getProvince(n){ + var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){ + var provinceSelect = null; + if (n === undefined || n === null || ''){ + provinceSelect = document.getElementById("provinceData"); + }else { + provinceSelect = document.getElementById("provinceData"+n); } - }) + data.forEach(province => { + var option = document.createElement("option"); + option.value = province.id; // 根据你的数据结构确定省份的id字段 + option.text = province.name; // 根据你的数据结构确定省份的name字段 + provinceSelect.appendChild(option); + }); + },function(data){ + Feng.error("下拉失败!" + data.responseJSON.message + "!"); + }); + ajax.start(); +} + +function storeList(){ + var index = layer.open({ + type: 2, + title: '门店列表', + area: ['80%', '80%'], //宽高 + fix: false, //不固定 + maxmin: true, + content: Feng.ctxPath + '/tCouponManage/storeList' + }); + this.layerIndex = index; } -couponInfoDlg.delete = function () { +var num = 0; +couponInfoDlg.addBranch = function () { + var a= ""; + a = "<div style=\'margin-left: 25%\' class=\"col-sm-9 control-label\">\n" + + " <select class=\"col-sm-1\" id=\'provinceData"+num+"\' style=\"margin-top: 1%;width: 25%\" onchange=\'changeCity("+num+")\'>\n" + + " <option value=\"\">请选择</option>\n" + + " </select>\n" + + " <label class=\"col-sm-1\" style=\"width: 9%;margin-top: 7px\">省</label>\n" + + " <select class=\"col-sm-1\" style=\"margin-top: 1%;width: 25%\" id=\'cityData"+num+"\'>\n" + + " <option value=\"\">请选择</option>\n" + + " </select>\n" + + " <label class=\"col-sm-1\" style=\"width: 7%;margin-top: 7px\">市</label>\n" + + " <label name=\"addBranch\" class=\"col-sm-1\" onclick=\"couponInfoDlg.delete(this)\" style=\"border: 0px;cursor: pointer;margin-top: 1%\"><i class=\"fa fa-trash\"></i></label>"+ + " </div>"; + $("#cityDemo").append($(a)); + getProvince(num); + num=num+1 +} + + +couponInfoDlg.delete = function (o) { + $(o).parent("div").remove() } /** @@ -285,248 +299,8 @@ .set('useTimes'); } -function couponCheck() { - if ($("#couponType").val() == 6) { - $("#couponName1").show() - } else { - $("#couponName1").hide() - } -} - -function checkCouponTimes() { - if ($("#inlineCheckbox").prop('checked')) { - $("#couponTimes").prop("disabled", true) - $("#couponTimes").val('') - } else { - $("#couponTimes").prop("disabled", false) - } -} - -/** - * 提交添加 - */ -couponInfoDlg.addSubmit = function () { - this.clearData(); - this.collectData(); - - let times = 1; - if ($("#inlineCheckbox").get(0).checked) { - times = 0 - } else { - let times1 = $("#couponTimes").val(); - times = times1 != '' ? times1 : 1; - if (times > 100) { - Feng.error("服务次数最多为100次!") - return; - } - if (times < 1) { - Feng.error("服务次数至少为1次!") - return; - } - } - console.log(times); - var val2 = $("#number").val(); - if (!val2) { - Feng.error("请输入服务券张数!") - return; - } - if (val2 <= 0) { - Feng.error("请输入正确的服务券张数!") - return; - } - let timeType = $(':radio[name="prescription"]:checked').val() - let expDay = 0 - if (timeType == 2) { - expDay = $("#time").val() - if (expDay == null || expDay == '') { - Feng.info("请输入领取后有效天数") - return - } - if (expDay <= 0) { - Feng.info("请输入正确的天数") - return - } - } - var split = $('#createTime').val().split(" - "); - if (timeType == 1) { - if (split == null || split == '' || split == "-") { - Feng.info("请输入有效期") - return - } - } - if ($("#couponType").val() == 6) { - var val2 = $("#couponName1").val(); - if (!val2) { - Feng.info("请输入服务卷名称") - return - } - if (val2.length > 4) { - Feng.info("请输入4个字以内券名称") - return - } - } - - //分公司直接就默认自己 - var val1 = $("#type_").val(); - var val = xmSelect.get('#demo2', true).getValue('valueStr') - if (val1 == 1) { - if ($(':radio[name="company"]:checked').val() == 1) { - if (val == "") { - Feng.error("指定公司未选择!") - return; - } - } - if (val == "" || $(':radio[name="company"]:checked').val() == 0) { - val = 0; - } - } else { - val = $("#companyId_").val(); - } - if (!$("#detail").val()) { - Feng.error("请输入服务描述") - return; - } - if (!$("#couponName").val()) { - Feng.error("请输入服务券名称!") - return; - } - //提交信息 - var ajax = new $ax(Feng.ctxPath + "/couponServer/add", function (data) { - Feng.success("添加成功!"); - window.parent.CouponServer.table.refresh(); - couponInfoDlg.close(); - }, function (data) { - Feng.error("添加失败!" + data.responseJSON.message + "!"); - }); - ajax.setData({ - name: $("#couponName").val(), - type: $("#couponType").val(), - typeName: $("#couponName1").val(), - times: times, - sheetsNum: $("#number").val(), - remark: $("#detail").val(), - startTime: split[0], - endTime: split[1], - timeType: $(':radio[name="prescription"]:checked').val(), - expDay: $("#time").val(), - belongs: val, - }); - ajax.start(); -} - -/** - * 提交修改 - */ -couponInfoDlg.editSubmit = function () { - - this.clearData(); - this.collectData(); - - if (!$("#couponName").val()) { - Feng.error("请输入服务券名称!") - return; - } - let times = 1; - if ($("#inlineCheckbox").get(0).checked) { - times = 0 - } else { - times = $("#couponTimes").val() - if (times > 100) { - Feng.error("服务次数最多为100次!") - return; - } - if (times < 1) { - Feng.error("服务次数至少为1次!") - return; - } - } - var val3 = $("#number").val(); - if (!val3) { - Feng.error("请输入服务券张数!") - return; - } - if (val3 <= 0) { - Feng.error("请输入正确的服务券张数!") - return; - } - if ($("#couponType").val() == 6) { - var val2 = $("#couponName1").val(); - if (!val2) { - Feng.info("请输入服务卷名称") - return - } - if (val2.length > 4) { - Feng.info("请输入4个字以内券名称") - return - } - } - let timeType = $(':radio[name="prescription"]:checked').val() - let expDay = 0 - if (timeType == 2) { - expDay = $("#time").val() - if (expDay == null || expDay == '') { - Feng.info("请输入领取后有效天数") - return - } - if (expDay <= 0) { - Feng.info("请输入正确的天数") - return - } - } - var split = $('#createTime').val().split(" - "); - if (timeType == 1) { - if (split == null || split == '' || split == "-") { - Feng.info("请输入有效期") - return - } - } - - //分公司直接就默认自己 - var val1 = $("#type_").val(); - var val = xmSelect.get('#demo2', true).getValue('valueStr') - if (val1 == 1) { - if ($(':radio[name="company"]:checked').val() == 1) { - if (val == "") { - Feng.error("指定公司未选择!") - return; - } - } - if (val == "" || $(':radio[name="company"]:checked').val() == 0) { - val = 0; - } - } else { - val = $("#companyId_").val(); - } - if (!$("#detail").val()) { - Feng.error("请输入服务描述") - return; - } - - //提交信息 - var ajax = new $ax(Feng.ctxPath + "/couponServer/update", function (data) { - Feng.success("修改成功!"); - window.parent.CouponServer.table.refresh(); - couponInfoDlg.close(); - }, function (data) { - Feng.error("修改失败!" + data.responseJSON.message + "!"); - }); - ajax.setData({ - couponId: $("#couponId_").val(), - name: $("#couponName").val(), - type: $("#couponType").val(), - typeName: $("#couponName1").val(), - times: times, - sheetsNum: $("#number").val(), - remark: $("#detail").val(), - timeType: $(':radio[name="prescription"]:checked').val(), - expDay: $("#time").val(), - belongs: val, - }); - ajax.set("startTimeStr", split[0]); - ajax.set("endTimeStr", split[1]); - ajax.start(); -} $(function () { + getProvince(null); }); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TStoreInfo.js b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TStoreInfo.js new file mode 100644 index 0000000..811e08d --- /dev/null +++ b/cloud-server-management/src/main/webapp/static/modular/system/tCoupon/TStoreInfo.js @@ -0,0 +1,92 @@ +/** + * 管理初始化 + */ +var TStoreProvince = { + id: "TStoreProvinceTable", //表格id + seItem: null, //选中的条目 + table: null, + layerIndex: -1 +}; + +/** + * 初始化表格的列 + */ +TStoreProvince.initColumn = function () { + return [ + {field: 'selectItem', radio: true}, + {title: '选择', field: '', visible: true, align: 'center', valign: 'middle'}, + {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '所属账号', field: 'name', visible: true, align: 'center', valign: 'middle'}, + {title: '所在省市', field: 'useScope', visible: true, align: 'center', valign: 'middle', + formatter: function (value, row, index) { + return {1: "全国", 2: "指定城市", 3: "指定门店"}[value] + } + }, + {title: '门店名称', field: 'type', visible: true, align: 'center', valign: 'middle', + formatter: function (value, row, index) { + return {1: "满减券", 2: "代金券", 3: "体验券"}[value] + }}, + ]; +}; + +/** + * 检查是否选中 + */ +TStoreProvince.check = function () { + var selected = $('#' + this.id).bootstrapTable('getSelections'); + if(selected.length == 0){ + Feng.info("请先选中表格中的某一记录!"); + return false; + }else{ + TStoreProvince.seItem = selected[0]; + return true; + } +}; + + +function storeOfClosePage(){ + +} + +function saveSelectStores(){ + +} + + + +/** + * 查询列表 + */ +TStoreProvince.search = function () { + var queryData = {}; + queryData['name'] = $("#name").val(); + queryData['type'] = $("#type").val(); + queryData['distributionMethod'] = $("#distributionMethod").val(); + queryData['userPopulation'] = $("#userPopulation").val(); + queryData['status'] = $("#status").val(); + queryData['state'] = $("#state").val(); + TStoreProvince.table.refresh({query: queryData}); +}; + + +/** + * 重置搜索 + */ +TStoreProvince.resetSearch = function () { + $("#name").val(''); + $("#type").val(''); + $("#distributionMethod").val(''); + $("#userPopulation").val(''); + $("#status").val(''); + $("#state").val(''); + TStoreProvince.search(); +}; + +$(function () { + var defaultColunms = TStoreProvince.initColumn(); + var table = new BSTable(TStoreProvince.id, "/tCouponManage/storeList", defaultColunms); + table.setPaginationType("client"); + TStoreProvince.table = table.init(); + + +}); -- Gitblit v1.7.1