Browse Source

代理商管理

liujiankang 7 years ago
parent
commit
adfed16e8b

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

@@ -1,5 +1,7 @@
 package com.iamberry.wechat.core.entity.agentInfo;
 
+import com.iamberry.wechat.core.entity.PageBean;
+
 import java.util.Date;
 
 /**
@@ -18,6 +20,7 @@ public class AgentTooth implements java.io.Serializable{
     private Integer agentStatus;    //线下状态
     private String agentOpenid;     //微信openid
     private String agentHead;       //头像
+    private PageBean page;			//分页
 
     public String getAgentHead() {
         return agentHead;
@@ -90,4 +93,12 @@ public class AgentTooth implements java.io.Serializable{
     public void setAgentOpenid(String agentOpenid) {
         this.agentOpenid = agentOpenid;
     }
+
+    public PageBean getPage() {
+        return page;
+    }
+
+    public void setPage(PageBean page) {
+        this.page = page;
+    }
 }

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

@@ -72,4 +72,23 @@ public interface AgentInfoService {
      * @return
      */
     Integer updateAgentOpenId(AgentTooth agentTooth);
+
+    /**
+     * 查询所有代理商
+     * @param agentTooth
+     * @return
+     */
+    List<AgentTooth> selectAllAgentinfo(AgentTooth agentTooth);
+
+    /**
+     * 查询所有代理商条数
+     * @param agentTooth
+     * @return
+     */
+    Integer selectAllAgentinfoCount(AgentTooth agentTooth);
+
+    /**
+     * 新增代理商
+     */
+    Integer addAgentinfo(AgentTooth agentTooth);
 }

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

@@ -63,4 +63,20 @@ public class AgentInfoServiceImpl implements AgentInfoService {
     public Integer updateAgentOpenId(AgentTooth agentTooth) {
         return agentInfoMapper.updateAgentOpenId(agentTooth);
     }
+
+    @Override
+    public List<AgentTooth> selectAllAgentinfo(AgentTooth agentTooth) {
+        return agentInfoMapper.selectAllAgentinfo(agentTooth);
+    }
+
+    @Override
+    public Integer selectAllAgentinfoCount(AgentTooth agentTooth) {
+        int count = agentInfoMapper.selectAllAgentinfoCount(agentTooth);
+        return	count = count % agentTooth.getPage().getPageSize() == 0? count/agentTooth.getPage().getPageSize():(count/agentTooth.getPage().getPageSize())+1;
+    }
+
+    @Override
+    public Integer addAgentinfo(AgentTooth agentTooth) {
+        return agentInfoMapper.addAgentinfo(agentTooth);
+    }
 }

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

@@ -72,4 +72,23 @@ public interface AgentInfoMapper {
      * @return
      */
     Integer updateAgentOpenId(AgentTooth agentTooth);
+
+    /**
+     * 查询所有代理商
+     * @param agentTooth
+     * @return
+     */
+    List<AgentTooth> selectAllAgentinfo(AgentTooth agentTooth);
+
+    /**
+     * 查询所有代理商条数
+     * @param agentTooth
+     * @return
+     */
+    Integer selectAllAgentinfoCount(AgentTooth agentTooth);
+
+    /**
+     * 新增代理商
+     */
+    Integer addAgentinfo(AgentTooth agentTooth);
 }

+ 71 - 0
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/agentInfoMapper.xml

@@ -229,4 +229,75 @@
               agent_tel = #{agentTel}
         </where>
     </update>
+
+
+    <!--查询所有代理商 -->
+    <select id="selectAllAgentinfo" parameterType="AgentTooth" resultType="AgentTooth">
+        SELECT
+        <include refid="agentInfo" />
+        FROM
+        tb_iamberry_agent_agentinfo
+        <where>
+            <if test="agentName != null">
+                and agent_name = #{agentName}
+            </if>
+            <if test="agentTel!=null and agentTel!=''">
+                and agent_tel = #{agentTel}
+            </if>
+            <if test="agentRoleId!=null and agentRoleId!=''">
+                and agent_role_id = #{agentRoleId}
+            </if>
+            <if test="agentStatus!=null and agentStatus!=''">
+                and agent_status = #{agentStatus}
+            </if>
+        </where>
+        order by agent_create_date desc
+        <if test="page!=null and page.pageSize>0 ">
+            LIMIT ${page.recordBegin},${page.pageSize}
+        </if>
+    </select>
+    <!-- 查询所有物流信息(代理商赠送机器记录)总数 -->
+    <select id="selectAllAgentinfoCount" parameterType="AgentTooth" resultType="Integer">
+        SELECT
+          count(*)
+        FROM
+        tb_iamberry_agent_agentinfo
+        <where>
+            <if test="agentName != null">
+                and agent_name = #{agentName}
+            </if>
+            <if test="agentTel!=null and agentTel!=''">
+                and agent_tel = #{agentTel}
+            </if>
+            <if test="agentRoleId!=null and agentRoleId!=''">
+                and agent_role_id = #{agentRoleId}
+            </if>
+            <if test="agentStatus!=null and agentStatus!=''">
+                and agent_status = #{agentStatus}
+            </if>
+        </where>
+    </select>
+
+    <!--新增代理商 -->
+    <insert id="addAgentinfo" parameterType="AgentTooth" >
+        INSERT INTO tb_iamberry_agent_agentinfo(
+          agent_name,
+          agent_addr,
+          agent_tel,
+          agent_role_id,
+          agent_create_date,
+          agent_status,
+          agent_openid
+        )
+        VALUES
+        (
+          #{agentName} ,
+          #{agentAddr},
+          #{agentTel},
+          #{agentRoleId},
+          NOW(),
+          #{agentStatus},
+          #{agentOpenid}
+        )
+    </insert>
 </mapper>

+ 152 - 0
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/admin/AdminAgentToothHandler.java

@@ -6,11 +6,13 @@ import com.iamberry.wechat.core.entity.ResultMsg;
 import com.iamberry.wechat.core.entity.agentInfo.AgentConfig;
 import com.iamberry.wechat.core.entity.agentInfo.AgentOrder;
 import com.iamberry.wechat.core.entity.agentInfo.AgentTooth;
+import com.iamberry.wechat.core.entity.drp.PlaceRoleInfo;
 import com.iamberry.wechat.core.entity.member.Member;
 import com.iamberry.wechat.core.entity.order.Order;
 import com.iamberry.wechat.core.entity.product.ProductColor;
 import com.iamberry.wechat.face.agentInfo.AgentInfoService;
 import com.iamberry.wechat.face.agentInfo.AgentPurchaseOrderService;
+import com.iamberry.wechat.face.drp.DrpRoleInfoService;
 import com.iamberry.wechat.face.efast.EfastRentService;
 import com.iamberry.wechat.face.member.MemberService;
 import com.iamberry.wechat.face.order.CodeService;
@@ -61,6 +63,8 @@ public class AdminAgentToothHandler {
     private CodeService codeService;
     @Autowired
     private MemberService memberService;
+    @Autowired
+    private DrpRoleInfoService drpRoleInfoService;
 
     /**
      * 分页查询代理商优惠价配置信息
@@ -488,4 +492,152 @@ public class AdminAgentToothHandler {
         msg.setStatus(true);
         return msg;
     }
+
+
+    /**
+     * 分页查询代理商
+     * @param request
+     * @param pageSize
+     * @param pageNO
+     * @return
+     * @throws Exception
+     */
+    @RequestMapping("/select_agentInfo_list")
+    public ModelAndView selectAgentInfoList(HttpServletRequest request,
+                                              @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
+                                              @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO) throws Exception {
+        AgentTooth agentTooth = new AgentTooth();
+        ModelAndView mv = new ModelAndView("admin/agentInfo/agentInfoList");
+        StringBuilder url = new StringBuilder("/admin/agentTooth/select_agentInfo_list?pageSize=");
+        url.append(pageSize);
+        String agentName = request.getParameter("agentName");
+        String agentTel = request.getParameter("agentTel");
+        String agentStatus = request.getParameter("agentStatus");
+        if (StringUtils.isNotEmpty(agentName)) {
+            agentTooth.setAgentName(agentName);
+            url.append("&agentName=");
+            url.append(agentName);
+            mv.addObject("agentName",agentName);
+        }
+        if (StringUtils.isNotEmpty(agentTel)) {
+            agentTooth.setAgentTel(agentTel);
+            url.append("&agentTel=");
+            url.append(agentTel);
+            mv.addObject("agentTel",agentTel);
+        }
+        if (StringUtils.isNotEmpty(agentStatus)) {
+            agentTooth.setAgentStatus(Integer.valueOf(agentStatus));
+            url.append("&agentStatus=");
+            url.append(agentStatus);
+            mv.addObject("agentStatus",agentStatus);
+        }
+
+        PageBean page = new PageBean();
+        page.setPageSize(pageSize);
+        page.setPageNumber(pageNO);
+        page.initRecordBegin();
+        agentTooth.setPage(page);
+        url.append("&pageNO=");
+        //查询代理商配置金额集合
+        List<AgentTooth> agentToothList = agentInfoService.selectAllAgentinfo(agentTooth);
+        mv.addObject("agentToothList", agentToothList);
+        mv.addObject("pageNO", pageNO);
+        mv.addObject("pageSize", agentInfoService.selectAllAgentinfoCount(agentTooth));
+        mv.addObject("url",url.toString());
+        return mv;
+    }
+
+    /**
+     * 修改代理商
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/update_agentInfo")
+    public ResultMsg updateAgentInfo(HttpServletRequest request,AgentTooth agentTooth) throws Exception{
+        ResultMsg msg = new ResultMsg();
+        if (!StringUtils.isNotEmpty(agentTooth.getAgentId().toString())) {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+            msg.setMessage("修改代理商配置失败!");
+        }
+        //修改代理商信息
+        int num = agentInfoService.updateAgentTooth(agentTooth);
+        if (num > 0) {
+            msg.setResultCode(ResultInfo.SUCCESSCODE);
+            msg.setStatus(true);
+        } else {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+        }
+        return msg;
+    }
+
+    /**
+     * 进入修改代理商页面
+     * @param request
+     * @return
+     */
+    @RequestMapping("/_update_agentInfo")
+    public ModelAndView _updateAgentInfo(HttpServletRequest request){
+        ModelAndView mv = new ModelAndView("admin/agentInfo/updateAgentInfo");
+        String agentId = request.getParameter("agentId");
+        if(agentId == null || agentId.equals("")){
+            return null;
+        }
+        List<PlaceRoleInfo> roleInfoList = drpRoleInfoService.getDrpRoleList2();
+        mv.addObject("roleInfoList",roleInfoList);
+
+        AgentTooth agentTooth = new AgentTooth();
+        agentTooth.setAgentId(Integer.valueOf(agentId));
+        agentTooth = agentInfoService.getAgentTooth(agentTooth);
+        mv.addObject("agentTooth",agentTooth);
+
+        return mv;
+    }
+
+    /**
+     * 进入新增代理商页面
+     * @param request
+     * @return
+     */
+    @RequestMapping("/_add_agentInfo")
+    public ModelAndView _addAgentInfo(HttpServletRequest request){
+        ModelAndView mv = new ModelAndView("admin/agentInfo/addAgentInfo");
+        List<PlaceRoleInfo> roleInfoList = drpRoleInfoService.getDrpRoleList2();
+        mv.addObject("roleInfoList",roleInfoList);
+        return mv;
+    }
+
+    /**
+     * 新增代理商
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping("/add_agentInfo")
+    public ResultMsg addAgentInfo(HttpServletRequest request,AgentTooth agentTooth) throws Exception{
+        ResultMsg msg = new ResultMsg();
+        if (!StringUtils.isNotEmpty(agentTooth.getAgentName())
+                || !StringUtils.isNotEmpty(agentTooth.getAgentAddr())
+                || !StringUtils.isNotEmpty(agentTooth.getAgentTel())
+                || !StringUtils.isNotEmpty(String.valueOf(agentTooth.getAgentRoleId()))
+                || !StringUtils.isNotEmpty(String.valueOf(agentTooth.getAgentStatus()))) {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+            msg.setMessage("修改代理商配置失败!");
+        }
+        //add代理商信息
+        int num = agentInfoService.addAgentinfo(agentTooth);
+        if (num > 0) {
+            msg.setResultCode(ResultInfo.SUCCESSCODE);
+            msg.setStatus(true);
+        } else {
+            msg.setResultCode(ResultInfo.ERRORCODE);
+            msg.setStatus(false);
+        }
+        return msg;
+    }
 }

+ 136 - 0
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/addAgentInfo.jsp

@@ -0,0 +1,136 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+		 pageEncoding="UTF-8"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<meta charset="utf-8">
+	<meta name="renderer" content="webkit|ie-comp|ie-stand">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
+	<meta http-equiv="Cache-Control" content="no-siteapp" />
+	<!--[if lt IE 9]>
+	<script type="text/javascript" src="lib/html5.js"></script>
+	<script type="text/javascript" src="lib/respond.min.js"></script>
+	<script type="text/javascript" src="lib/PIE_IE678.js"></script>
+	<![endif]-->
+	<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
+	<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
+	<link href="${pageContext.request.contextPath }/common/admin/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
+	<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
+	<!--[if IE 6]>
+	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
+	<script>DD_belatedPNG.fix('*');</script>
+	<![endif]-->
+	<title>添加代理商</title>
+</head>
+<body>
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 代理商管理 <span class="c-gray en">&gt;</span> 添加代理商 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
+<div class="pd-20">
+	<form method="post" class="form form-horizontal" id="form-agent-add">
+		<div class="row cl">
+			<label class="form-label col-2"><span class="c-red">*</span>代理商姓名:</label>
+			<div class="formControls col-2">
+				<input id="agentName" name="agentName" type="text" class="input-text" style="width:90%" placeholder="">
+			</div>
+		</div>
+
+		<div class="row cl">
+			<label class="form-label col-2"><span class="c-red">*</span>代理商地址:</label>
+			<div class="formControls col-2">
+				<input id="agentAaddr" type="text" name="agentAddr" placeholder="" value="" class="input-text" style="width:90%">
+			</div>
+		</div>
+
+		<div class="row cl">
+			<label class="form-label col-2"><span class="c-red">*</span>代理商电话:</label>
+			<div class="formControls col-2">
+				<input id="agentTel" type="text" name="agentTel" placeholder="" value="" class="input-text" style="width:90%">
+			</div>
+		</div>
+
+		<div class="row cl">
+			<label  class="form-label col-2"><span class="c-red">*</span>角色名称:</label>
+			<div  class="formControls col-2">
+			<span class="select-box">
+			<select id="agentRoleId" name="agentRoleId" class="select">
+				<c:if test="${! (empty roleInfoList) }">
+					<c:forEach items="${roleInfoList }" var="list">
+							<option value="${list.roleId}">${list.roleName}</option>
+					</c:forEach>
+				</c:if>
+			</select>
+			</span>
+			</div>
+		</div>
+		<div class="row cl">
+			<label class="form-label col-3"><span class="c-red">*</span>代理商状态:</label>
+			<div class="formControls col-5 skin-minimal">
+				<div class="radio-box">
+					<input type="radio" value="1" id="sex-1" checked="checked" name="agentStatus" datatype="*" nullmsg="请选择代理商状态!">
+					<label for="sex-1">正在使用</label>
+				</div>
+				<div class="radio-box">
+					<input type="radio" value="2" id="sex-2" name="agentStatus">
+					<label for="sex-2">停止使用</label>
+				</div>
+			</div>
+			<div class="col-4"> </div>
+		</div>
+		<div class="row cl">
+			<div class="col-9 col-offset-3">
+				<input class="btn btn-primary radius" onclick="checkForm()" type="button" id="submitBtn" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
+			</div>
+		</div>
+	</form>
+</div>
+</div>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/icheck/jquery.icheck.min.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" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/tips.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
+<script type="text/javascript">
+
+    function checkForm(){
+        //名称验证
+        if(!commonTypeJdg('agentName',null,null,true)){
+            layer.msg("代理商名称不能为空",{icon: 2,time:2000});
+            return;
+        }
+        if(!commonLengthJdg('agentAaddr',1,50,null,true)){
+            layer.msg("代理商地址不能为空长度为1-50位",{icon: 2,time:2000});
+            return;
+        }
+        //代理商号码
+        if(!commonTypeJdg('agentTel','mobile',null,true)){
+            layer.msg("代理商号码不能为空!且须为手机号码格式",{icon: 2,time:2000});
+            return;
+        }
+        $.ajax({
+            url: '${pageContext.request.contextPath }/admin/agentTooth/add_agentInfo',
+            type: "POST",
+            dataType: "json",
+            data: $("#form-agent-add").serialize(),
+            error:function(data){
+                layer.msg("添加失败</br>",{icon: 5,time:2000});
+            },
+            success:  function(data){
+                if (data.status) {
+                    layer.msg("添加成功</br>",{icon: 1,time:2000},function() {
+                        window.location.href = '${pageContext.request.contextPath }/admin/agentTooth/select_agentInfo_list';
+                    });
+
+                } else {
+                    layer.msg("添加失败</br>",{icon: 5,time:2000});
+                }
+            }
+        });
+    }
+
+</script>
+</body>
+</html>

+ 168 - 0
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/agentInfoList.jsp

@@ -0,0 +1,168 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+         pageEncoding="UTF-8"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
+<!DOCTYPE HTML>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="renderer" content="webkit|ie-comp|ie-stand">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
+    <meta http-equiv="Cache-Control" content="no-siteapp" />
+    <LINK rel="Bookmark" href="/favicon.ico">
+    <LINK rel="Shortcut Icon" href="/favicon.ico" />
+    <!--[if lt IE 9]>
+    <script type="text/javascript" src="lib/html5.js"></script>
+    <script type="text/javascript" src="lib/respond.min.js"></script>
+    <script type="text/javascript" src="lib/PIE_IE678.js"></script>
+    <![endif]-->
+    <link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/skin/default/skin.css" rel="stylesheet" type="text/css" id="skin" />
+    <link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
+    <link href="${pageContext.request.contextPath }/common/admin/css/style.css" rel="stylesheet" type="text/css" />
+
+    <!--[if IE 6]>
+    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
+    <script>DD_belatedPNG.fix('*');</script>
+    <![endif]-->
+    <title>代理商列表</title>
+</head>
+<body>
+<nav class="breadcrumb">
+    <i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
+    商城管理 <span class="c-gray en">&gt;</span>代理商列表 <a
+        class="btn btn-success radius r mr-20"
+        style="line-height: 1.6em; margin-top: 3px"
+        href="javascript:location.replace(location.href);" title="刷新"><i
+        class="Hui-iconfont">&#xe68f;</i></a>
+</nav>
+<div class="pd-20">
+    <div class="cl pd-5 bg-1 bk-gray mt-20">
+        <form action="${pageContext.request.contextPath }/admin/agentTooth/select_agentInfo_list" method="post" id="searchForm">
+            <div class="text-c">
+                <button type="button" style="float:left;" class="btn btn-success radius" onclick="add_Agent();" id="addAgent" name=""><i class="Hui-iconfont">&#xe665;</i> 添加代理商</button>
+                <select name="agentStatus" style="height: 30px;">
+                    <option value="">线下状态</option>
+                    <option <c:if test="${agentStatus == 1}">selected = "selected"</c:if> value="1">正在使用</option>
+                    <option <c:if test="${agentStatus == 2}">selected = "selected"</c:if> value="2">停止使用</option>
+                  </select>
+                <input type="text" class="input-text" style="width:130px" placeholder="请输入代理商姓名" value="${agentName}" name="agentName">
+                <input type="text" class="input-text" style="width:130px" placeholder="请输入代理商电话" value="${agentTel}" name="agentTel">
+               <button type="submit" class="btn btn-success radius" id="searchButton" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
+            </div>
+        </form>
+    </div>
+    <form id="configform" >
+        <table class="table table-border table-bordered table-bg" id="example">
+            <thead>
+            <tr>
+                <th scope="col" colspan="11">代理商列表</th>
+            </tr>
+            <tr class="text-c">
+                <th width="100">名称</th>
+                <th width="100">地址</th>
+                <th width="100">电话</th>
+                <th width="100">线下状态</th>
+                <th width="100">创建时间</th>
+                <th width="100">操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            <c:if test="${! (empty agentToothList) }">
+            <c:forEach items="${agentToothList }" var="list">
+            <tr class="text-c">
+                <td>${list.agentName }</td>
+                <td>${list.agentAddr }</td>
+                <td>${fn:substring(list.agentTel,0,3)}****${fn:substring(list.agentTel,7,11)}</td>
+                <td>
+                    <c:if test="${list.agentStatus == 1}">
+                        正在使用
+                    </c:if>
+                    <c:if test="${list.agentStatus == 2}">
+                        停止使用
+                    </c:if>
+                </td>
+                <td><fmt:formatDate value="${list.agentCreateDate }" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+                <td class="td-manage">
+                    <div id="config_status">
+                        <c:if test="${list.agentStatus == 2}">
+                            <a onclick="updateagentState('${list.agentId }','1')"
+                               title="修改状态" href="javascript:;"  class="ml-5" style="text-decoration:none">修改为正在使用</a>
+                        </c:if>
+                        <c:if test="${list.agentStatus == 1}">
+                            <a onclick="updateagentState('${list.agentId }','2')"
+                                                                 title="修改状态" href="javascript:;"  class="ml-5" style="text-decoration:none">修改为停用</a>
+            </c:if>
+        </div>
+
+        <a onclick="updateAgent('${list.agentId}')"
+           title="修改" href="javascript:;"  class="ml-5" style="text-decoration:none">修改代理商信息</a>
+        </td>
+        </c:forEach>
+        </c:if>
+        </tbody>
+        </table>
+        <div align="right" class="mt-10 mb-10 mr-10">
+            <%@include file="/common/other/paper/pager.jsp"%>
+        </div>
+    </form>
+</div>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/tips.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/My97DatePicker/WdatePicker.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/js/page/jqPaginator.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/goods/js/utils.js"></script>
+<script type="text/javascript">
+    function updateagentState(id,state){
+        layer.confirm('确认要修改状态吗?',function(index){
+                $.ajax({
+                    url: '${pageContext.request.contextPath }/admin/agentTooth/update_agentInfo',
+                    type: "POST",
+                    dataType: "json",
+                    data: {agentId : id,agentStatus : state},
+                    error:function(data){
+                        layer.msg("修改失败</br>",{icon: 5,time:2000});
+                    },
+                    success:  function(data){
+                        if (data.status) {
+                            layer.msg("修改成功</br>",{icon: 1,time:2000});
+                            location.replace(location.href);
+                            /*var message = '';
+                            switch (state) {
+                                case "1":
+                                    message = '<a onclick="updateagentState('+id+',2)" title="修改状态" href="javascript:;"  class="ml-5" style="text-decoration:none">修改为停止使用</a>';
+                                    break;
+                                case "2":
+                                    message = '<a onclick="updateagentState('+id+',1)" title="修改状态" href="javascript:;"  class="ml-5" style="text-decoration:none">修改为正在使用</a>';
+                                    break;
+                            }*/
+                           /* $('#config_status').html(message);*/
+                        } else {
+                            layer.msg("修改失败</br>",{icon: 5,time:2000});
+                        }
+                    }
+                });
+            }, function () {
+                window.location.reload(location.href);
+            }
+        );
+
+    }
+
+    function updateAgent(id){
+        window.location.href = '${pageContext.request.contextPath }/admin/agentTooth/_update_agentInfo?agentId='+id;
+    }
+    function add_Agent(){
+        window.location.href = '${pageContext.request.contextPath }/admin/agentTooth/_add_agentInfo';
+    }
+</script>
+</body>
+</html>

+ 140 - 0
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/agentInfo/updateAgentInfo.jsp

@@ -0,0 +1,140 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+		 pageEncoding="UTF-8"%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+	<meta charset="utf-8">
+	<meta name="renderer" content="webkit|ie-comp|ie-stand">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
+	<meta http-equiv="Cache-Control" content="no-siteapp" />
+	<!--[if lt IE 9]>
+	<script type="text/javascript" src="lib/html5.js"></script>
+	<script type="text/javascript" src="lib/respond.min.js"></script>
+	<script type="text/javascript" src="lib/PIE_IE678.js"></script>
+	<![endif]-->
+	<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
+	<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
+	<link href="${pageContext.request.contextPath }/common/admin/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
+	<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
+	<!--[if IE 6]>
+	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
+	<script>DD_belatedPNG.fix('*');</script>
+	<![endif]-->
+	<title>修改代理商</title>
+</head>
+<body>
+<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 代理商管理 <span class="c-gray en">&gt;</span> 添加代理商 <a class="btn btn-success radius r mr-20" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
+<div class="pd-20">
+	<form method="post" class="form form-horizontal" id="form-agent-add">
+		<div class="row cl">
+			<label class="form-label col-2"><span class="c-red">*</span>代理商姓名:</label>
+			<div class="formControls col-2">
+				<input id="agentName" name="agentName" value="${agentTooth.agentName}" type="text" class="input-text" style="width:90%" placeholder="">
+			</div>
+		</div>
+
+		<div class="row cl">
+			<label class="form-label col-2"><span class="c-red">*</span>代理商地址:</label>
+			<div class="formControls col-2">
+				<input id="agentAaddr" type="text" name="agentAddr" value="${agentTooth.agentAddr}" placeholder="" value="" class="input-text" style="width:90%">
+			</div>
+		</div>
+
+		<div class="row cl">
+			<label class="form-label col-2"><span class="c-red">*</span>代理商电话:</label>
+			<div class="formControls col-2">
+				<input id="agentTel" type="text" name="agentTel" value="${agentTooth.agentTel}" placeholder="" class="input-text" style="width:90%">
+			</div>
+		</div>
+
+		<div class="row cl">
+			<label  class="form-label col-2"><span class="c-red">*</span>角色名称:</label>
+			<div  class="formControls col-2">
+			<span class="select-box">
+			<select id="agentRoleId" name="agentRoleId" class="select">
+				<c:if test="${! (empty roleInfoList) }">
+					<c:forEach items="${roleInfoList }" var="list">
+						<option  <c:if test="${agentTooth.agentRoleId == list.roleId}">selected = "selected"</c:if> value="${list.roleId}">${list.roleName}</option>
+					</c:forEach>
+				</c:if>
+			</select>
+			</span>
+			</div>
+		</div>
+		<div class="row cl">
+			<label class="form-label col-3"><span class="c-red">*</span>代理商状态:</label>
+			<div class="formControls col-5 skin-minimal">
+				<div class="radio-box">
+					<input type="radio" value="1" id="sex-1" <c:if test="${agentTooth.agentStatus == 1}">checked="checked"</c:if> name="agentStatus" datatype="*" nullmsg="请选择代理商状态!">
+					<label for="sex-1">正在使用</label>
+				</div>
+				<div class="radio-box">
+					<input type="radio" value="2" id="sex-2" <c:if test="${agentTooth.agentStatus == 2}">checked="checked"</c:if> name="agentStatus">
+					<label for="sex-2">停止使用</label>
+				</div>
+			</div>
+			<div class="col-4"> </div>
+		</div>
+		<div class="row cl">
+			<div class="col-9 col-offset-3">
+                <input type="hidden" value="${agentTooth.agentId}" name="agentId">
+				<input class="btn btn-primary radius" onclick="checkForm()" type="button" id="submitBtn" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
+			</div>
+		</div>
+	</form>
+</div>
+</div>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/icheck/jquery.icheck.min.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" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/tips.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script>
+<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
+<script type="text/javascript">
+    $(function(){
+
+    });
+
+    function checkForm(){
+        //名称验证
+        if(!commonTypeJdg('agentName',null,null,true)){
+            layer.msg("代理商名称不能为空",{icon: 2,time:2000});
+            return;
+        }
+        if(!commonLengthJdg('agentAaddr',1,50,null,true)){
+            layer.msg("代理商地址不能为空长度为1-50位",{icon: 2,time:2000});
+            return;
+        }
+        //代理商号码
+        if(!commonTypeJdg('agentTel','mobile',null,true)){
+            layer.msg("代理商号码不能为空!且须为手机号码格式",{icon: 2,time:2000});
+            return;
+        }
+
+        $.ajax({
+            url: '${pageContext.request.contextPath }/admin/agentTooth/update_agentInfo',
+            type: "POST",
+            dataType: "json",
+            data: $("#form-agent-add").serialize(),
+            error:function(data){
+                layer.msg("修改失败</br>",{icon: 5,time:2000});
+            },
+            success:  function(data){
+                if (data.status) {
+                    layer.msg("修改成功</br>",{icon: 1,time:2000},function() {
+                        window.location.href = '${pageContext.request.contextPath }/admin/agentTooth/select_agentInfo_list';
+                    });
+                } else {
+                    layer.msg("修改失败</br>",{icon: 5,time:2000});
+                }
+            }
+        });
+    }
+
+</script>
+</body>
+</html>

+ 2 - 2
tooth-wechat-web/src/main/webapp/WEB-INF/views/admin/coupon/addCouponType.jsp

@@ -131,7 +131,7 @@
 	<div class="row cl">
 		<label class="form-label col-2"><strong>【其他】</strong></label>
 	</div>
-		
+
 	<div class="row cl">
 		<label class="form-label col-2"><span class="c-red">*</span>是否允许赠送别人:</label>
 		<div  class="formControls col-2">
@@ -150,7 +150,7 @@
 			<textarea id="couponRemark" name="couponRemark" class="textarea-text" placeholder="" style="width:200px;height:60px;"></textarea>
 		</div>
 	</div>
-		
+
     <div class="row cl">
       <div class="col-9 col-offset-3">
         <input class="btn btn-primary radius" onclick="return checkForm()" type="submit" id="submitBtn" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">