Procházet zdrojové kódy

修改了后台商户优惠价配置

liuzhiwei před 7 roky
rodič
revize
f5bc6b40af

+ 9 - 0
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/agentInfo/AgentConfig.java

@@ -19,9 +19,18 @@ public class AgentConfig implements java.io.Serializable{
     private Date configCreateTime;  //创建时间
     private PageBean page;			//分页
     private String agentName;       //商户姓名
+    private String agentTel;        //商户电话
     private String productName;     //产品名称
     private String colorName;       //产品颜色名称
 
+    public String getAgentTel() {
+        return agentTel;
+    }
+
+    public void setAgentTel(String agentTel) {
+        this.agentTel = agentTel;
+    }
+
     public String getAgentName() {
         return agentName;
     }

+ 7 - 0
tooth-wechat-interface/src/main/java/com/iamberry/wechat/face/agentInfo/AgentInfoService.java

@@ -18,6 +18,13 @@ public interface AgentInfoService {
     List<AgentConfig> listAgentConfig(AgentConfig config);
 
     /**
+     * 查询代理商配置金额数量
+     * @param config
+     * @return
+     */
+    Integer listAgentConfigCount(AgentConfig config);
+
+    /**
      * 查询代理商集合
      * @param agentTooth
      * @return

+ 6 - 0
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/agentInfo/AgentInfoServiceImpl.java

@@ -24,6 +24,12 @@ public class AgentInfoServiceImpl implements AgentInfoService {
     }
 
     @Override
+    public Integer listAgentConfigCount(AgentConfig config) {
+        int count = agentInfoMapper.listAgentConfigCount(config);
+        return	count = count % config.getPage().getPageSize() == 0? count/config.getPage().getPageSize():(count/config.getPage().getPageSize())+1;
+    }
+
+    @Override
     public List<AgentTooth> listAgentTooth(AgentTooth agentTooth) {
         return agentInfoMapper.listAgentTooth(agentTooth);
     }

+ 7 - 0
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/AgentInfoMapper.java

@@ -18,6 +18,13 @@ public interface AgentInfoMapper {
     List<AgentConfig> listAgentConfig(AgentConfig config);
 
     /**
+     * 查询代理商配置金额数量
+     * @param config
+     * @return
+     */
+    Integer listAgentConfigCount(AgentConfig config);
+
+    /**
      * 查询代理商集合
      * @param agentTooth
      * @return

+ 44 - 2
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/agentInfoMapper.xml

@@ -37,16 +37,29 @@
         a.config_create_time configCreateTime,
         c.color_name colorName,
         p.product_name productName,
-        i.agent_name agentName
+        i.agent_name agentName,
+        i.agent_tel agentTel
       from
         tb_iamberry_agent_config a
         LEFT JOIN tb_iamberry_agent_agentinfo i ON a.agent_id = i.agent_id
         LEFT JOIN tb_iamberry_product_color c ON a.color_id = c.color_id
         LEFT JOIN tb_iamberry_product_info p ON c.color_product_id = p.product_id
         <where>
-            <if test="configId != null">
+            <if test="configId != null and configId != ''">
                 a.config_id = #{configId}
             </if>
+            <if test="agentName != null and agentName != ''">
+                and i.agent_name like CONCAT('%',#{agentName},'%')
+            </if>
+            <if test="agentTel != null and agentTel != ''">
+                and i.agent_tel like CONCAT('%',#{agentTel},'%')
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.product_name like CONCAT('%',#{productName},'%')
+            </if>
+            <if test="colorName != null and colorName != ''">
+                and c.color_name like CONCAT('%',#{colorName},'%')
+            </if>
         </where>
         ORDER BY a.config_create_time DESC
         <if test="page!=null and page.pageSize>0 ">
@@ -54,6 +67,35 @@
         </if>
     </select>
 
+    <!-- 查询代理商配置金额数量 -->
+    <select id="listAgentConfigCount" parameterType="AgentConfig" resultType="Integer">
+        select
+          count(a.config_id)
+        from
+        tb_iamberry_agent_config a
+        LEFT JOIN tb_iamberry_agent_agentinfo i ON a.agent_id = i.agent_id
+        LEFT JOIN tb_iamberry_product_color c ON a.color_id = c.color_id
+        LEFT JOIN tb_iamberry_product_info p ON c.color_product_id = p.product_id
+        <where>
+            <if test="configId != null and configId != ''">
+                a.config_id = #{configId}
+            </if>
+            <if test="agentName != null and agentName != ''">
+                and i.agent_name like CONCAT('%',#{agentName},'%')
+            </if>
+            <if test="agentTel != null and agentTel != ''">
+                and i.agent_tel like CONCAT('%',#{agentTel},'%')
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.product_name like CONCAT('%',#{productName},'%')
+            </if>
+            <if test="colorName != null and colorName != ''">
+                and c.color_name like CONCAT('%',#{colorName},'%')
+            </if>
+        </where>
+        ORDER BY a.config_create_time DESC
+    </select>
+
     <!-- 批量新增代理商配置信息 -->
     <insert id="addAgentConfigList" parameterType="ArrayList">
         <selectKey resultType="int" keyProperty="configId" order="AFTER">

+ 80 - 2
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/admin/AdminAgentToothHandler.java

@@ -35,25 +35,72 @@ public class AdminAgentToothHandler {
     @Autowired
     private ProductColorService productColorService;
 
+    /**
+     * 分页查询代理商优惠价配置信息
+     * @param request
+     * @param pageSize
+     * @param pageNO
+     * @return
+     * @throws Exception
+     */
     @RequestMapping("/select_agent_config_list")
     public ModelAndView selectAgentConfigList(HttpServletRequest request,
                                               @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
                                               @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO) throws Exception {
-        ModelAndView mv = new ModelAndView("admin/agentInfo/agentConfigList");
-        StringBuilder url = new StringBuilder("/admin/agentTooth/select_agent_config_list");
         AgentConfig config = new AgentConfig();
+        ModelAndView mv = new ModelAndView("admin/agentInfo/agentConfigList");
+        StringBuilder url = new StringBuilder("/admin/agentTooth/select_agent_config_list?pageSize=");
+        url.append(pageSize);
+        String agentName = request.getParameter("agentName");
+        String agentTel = request.getParameter("agentTel");
+        String productName = request.getParameter("productName");
+        String colorName = request.getParameter("colorName");
+        if (StringUtils.isNotEmpty(agentName)) {
+            config.setAgentName(agentName);
+            url.append("&agentName=");
+            url.append(agentName);
+            mv.addObject("agentName",agentName);
+        }
+        if (StringUtils.isNotEmpty(agentTel)) {
+            config.setAgentTel(agentTel);
+            url.append("&agentTel=");
+            url.append(agentTel);
+            mv.addObject("agentTel",agentTel);
+        }
+        if (StringUtils.isNotEmpty(productName)) {
+            config.setProductName(productName);
+            url.append("&productName=");
+            url.append(productName);
+            mv.addObject("productName",productName);
+        }
+        if (StringUtils.isNotEmpty(colorName)) {
+            config.setColorName(colorName);
+            url.append("&colorName=");
+            url.append(colorName);
+            mv.addObject("colorName",colorName);
+        }
+
         PageBean page = new PageBean();
         page.setPageSize(pageSize);
         page.setPageNumber(pageNO);
         page.initRecordBegin();
         config.setPage(page);
+        url.append("&pageNO=");
         //查询代理商配置金额集合
         List<AgentConfig> configList = agentInfoService.listAgentConfig(config);
         mv.addObject("configList", configList);
         mv.addObject("pageNO", pageNO);
+        mv.addObject("pageSize", agentInfoService.listAgentConfigCount(config));
+        mv.addObject("url",url.toString());
         return mv;
     }
 
+    /**
+     * 进入添加代理商优惠价配置页面
+     * @param request
+     * @return
+     * @throws Exception
+     */
     @RequestMapping("/_add_agent_config")
     public ModelAndView addAgentConfigUI(HttpServletRequest request) throws Exception {
         ModelAndView mv = new ModelAndView("admin/agentInfo/addAgentConfig");
@@ -87,6 +134,12 @@ public class AdminAgentToothHandler {
         return msg;
     }
 
+    /**
+     * 添加代理商优惠价配置信息
+     * @param request
+     * @return
+     * @throws Exception
+     */
     @ResponseBody
     @RequestMapping("/add_agent_config")
     public ResultMsg addAgentConfig(HttpServletRequest request) throws  Exception {
@@ -128,6 +181,12 @@ public class AdminAgentToothHandler {
         }
     }
 
+    /**
+     * 进入修改代理商优惠价页面
+     * @param request
+     * @return
+     * @throws Exception
+     */
     @RequestMapping("/_update_agent_config")
     public ModelAndView updateAgentConfig(HttpServletRequest request) throws Exception {
         String configId = request.getParameter("configId");
@@ -136,6 +195,12 @@ public class AdminAgentToothHandler {
         return mv;
     }
 
+    /**
+     * 获取代理商优惠价和产品信息
+     * @param request
+     * @return
+     * @throws Exception
+     */
     @ResponseBody
     @RequestMapping("/get_agent_config_By_Id")
     public ResultMsg getAgentConfigById(HttpServletRequest request) throws Exception{
@@ -170,6 +235,13 @@ public class AdminAgentToothHandler {
         return msg;
     }
 
+    /**
+     * 修改代理商优惠价信息
+     * @param request
+     * @param config
+     * @return
+     * @throws Exception
+     */
     @ResponseBody
     @RequestMapping("/update_agent_config")
     public ResultMsg updateAgentConfig(HttpServletRequest request,AgentConfig config) throws Exception{
@@ -191,6 +263,12 @@ public class AdminAgentToothHandler {
         return msg;
     }
 
+    /**
+     * 修改代理商优惠价配置的状态
+     * @param request
+     * @return
+     * @throws Exception
+     */
     @ResponseBody
     @RequestMapping("/update_agent_config_status")
     public ResultMsg updateAgentConfigStatus(HttpServletRequest request) throws Exception {

+ 10 - 31
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/addAgentConfig.jsp

@@ -79,7 +79,7 @@
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/select2/zh-CN.js"></script>
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/Validform/5.3.2/Validform.min.js"></script>
 <script type="text/javascript">
-    var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
+    var number = /^\d+(\.\d+)?$/;   //只能输入整数和小数
     var product_color = '';
     var message = '';
     $(function(){
@@ -115,34 +115,6 @@
         });
     });
 
-    //校验输入金额格式
-    function checkValue() {
-        var check = true;
-        var message = '';
-        var pre_price = $('#pre_price').val().trim();
-        var sales_price = $('#sales_price').val().trim();
-        if (pre_price != null && pre_price != '') {
-            if (!isNum.test(pre_price)) {
-                check = false;
-                message = "扫描优惠二维码优惠价格格式不正确,请重新输入!";
-            } else {
-                $('#qrcodePreDiscount').val(pre_price * 100);
-            }
-        }
-        if (sales_price != null && sales_price != '') {
-            if (!isNum.test(sales_price)) {
-                check = false;
-                message = "扫描购买二维码优惠价格格式不正确,请重新输入!";
-            } else {
-                $('#qrcodeSalesDiscount').val(sales_price * 100);
-            }
-        }
-        if (!check) {
-            alert(message);
-        }
-        return check;
-    }
-
     function write_price (val) {
         var check = $('#che_product'+val).prop('checked');
         if (check) {
@@ -162,9 +134,16 @@
                 var price = $('#price'+che_index).val();
                 if (price == null || price == '') {
                     flag = false;
-                    che_index += 1;
+                    che_index++;
                     message = '第'+che_index+'个产品优惠价不能为空!';
                     return flag;
+                } else {
+                    if (!number.test(price)) {
+                        flag = false;
+                        che_index++;
+                        message = '第'+che_index+'个产品优惠价格式不正确!';
+                        return flag;
+                    }
                 }
                 price = price * 100;
                 product_color+=che_product[i].value+':'+price+',';
@@ -177,7 +156,7 @@
     function submit_value() {
         var flag = checkValue();
         if (!flag) {
-            layer.msg(message,{icon:1,time:3000});
+            layer.msg(message,{icon:2,time:3000});
             return;
         }
         var data_value = {

+ 7 - 5
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/agentConfigList.jsp

@@ -48,11 +48,11 @@
 		</span>
         <form action="${pageContext.request.contextPath }/admin/agentTooth/select_agent_config_list" method="post" id="searchForm">
             <div class="text-c">
-                <input type="text" class="input-text" style="width:200px" placeholder="请输入商户名称" value="" name="agentName">
-                <input type="text" class="input-text" style="width:200px" placeholder="请输入电话号码" value="" name="agentName">
-                <input type="text" class="input-text" style="width:200px" placeholder="请输入产品名称" value="" name="agentName">
-                <input type="text" class="input-text" style="width:200px" placeholder="请输入产品颜色" value="" name="agentName">
-                <button type="button" class="btn btn-success radius" id="searchButton" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
+                <input type="text" class="input-text" style="width:200px" placeholder="请输入商户名称" value="${agentName}" name="agentName">
+                <input type="text" class="input-text" style="width:200px" placeholder="请输入电话号码" value="${agentTel}" name="agentTel">
+                <input type="text" class="input-text" style="width:200px" placeholder="请输入产品名称" value="${productName}" name="productName">
+                <input type="text" class="input-text" style="width:200px" placeholder="请输入产品颜色" value="${colorName}" name="colorName">
+                <button type="submit" class="btn btn-success radius" id="searchButton" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
             </div>
         </form>
     </div>
@@ -64,6 +64,7 @@
             </tr>
             <tr class="text-c">
                 <th width="150">商户名称</th>
+                <th width="150">电话号码</th>
                 <th width="100">产品名称</th>
                 <th width="100">产品颜色</th>
                 <th width="130">采购金额</th>
@@ -78,6 +79,7 @@
             <tr class="text-c">
                 <input type="hidden" value="${config.configId }" name="configId">
                 <td>${config.agentName }</td>
+                <td>${config.agentTel }</td>
                 <td>${config.productName }</td>
                 <td>${config.colorName }</td>
                 <td>${config.configAmount==null?"":config.configAmount/100 }</td>

+ 10 - 3
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/updateAgentConfig.jsp

@@ -79,7 +79,7 @@
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/select2/zh-CN.js"></script>
 <script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/Validform/5.3.2/Validform.min.js"></script>
 <script type="text/javascript">
-    var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
+    var number = /^\d+(\.\d+)?$/;
     var color_length = 0;
     var colorId = 0;
     var configAmount = 0;
@@ -158,9 +158,16 @@
                 var price = $('#price'+che_index).val();
                 if (price == null || price == '') {
                     flag = false;
-                    che_index += 1;
+                    che_index++;
                     message = '第'+che_index+'个产品优惠价不能为空!';
                     return flag;
+                } else {
+                    if (!number.test(price)) {
+                        flag = false;
+                        che_index++;
+                        message = '第'+che_index+'个产品优惠价格式不正确!';
+                        return flag;
+                    }
                 }
                 colorId = che_product[i].value;
                 configAmount = price * 100;
@@ -172,7 +179,7 @@
     function submit_value() {
         var flag = checkValue();
         if (!flag) {
-            layer.msg(message,{icon:1,time:3000});
+            layer.msg(message,{icon:2,time:3000});
             return;
         }
         var data_value = {