浏览代码

客户系统

wangxiaoming 5 年之前
父节点
当前提交
3d645d2f49
共有 21 个文件被更改,包括 623 次插入95 次删除
  1. 52 8
      watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerChannel.java
  2. 51 0
      watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerChannelStore.java
  3. 3 3
      watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerProduct.java
  4. 35 4
      watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerProductStore.java
  5. 32 0
      watero-rst-interface/src/main/java/com/iamberry/rst/faces/dm/DealerChannelStoreService.java
  6. 48 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/DealerChannelStoreServiceImpl.java
  7. 72 16
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/DmDealerServiceImpl.java
  8. 8 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/DealerChannelMapper.java
  9. 37 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/DealerChannelStoreMapper.java
  10. 24 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dealerChannelMapper.xml
  11. 60 0
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dealerChannelStoreMapper.xml
  12. 17 10
      watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dealerProductStoreMapper.xml
  13. 47 7
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/dm/DmDealerController.java
  14. 2 0
      watero-rst-web/src/main/resources/watero-rst-orm.xml
  15. 10 9
      watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/add_dealer.ftl
  16. 77 4
      watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/add_dealer_channel.ftl
  17. 5 2
      watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/add_dealer_product.ftl
  18. 7 3
      watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/update_dealer.ftl
  19. 4 4
      watero-rst-web/src/main/webapp/WEB-INF/views/dm/financialReceipt/fr_list.ftl
  20. 2 0
      watero-rst-web/src/main/webapp/common/js/common/common.js
  21. 30 25
      watero-rst-web/src/main/webapp/common/js/dealer/dealer.js

+ 52 - 8
watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerChannel.java

@@ -1,6 +1,10 @@
 package com.iamberry.rst.core.dm;
-import  java.util.Date;
-import  java.io.Serializable;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  *  客户渠道信息类
  * @author Administrator
@@ -10,26 +14,22 @@ public class DealerChannel  implements  Serializable{
     private static final long serialVersionUID = -7317583076068205788L;
     //
     private Integer dealChannelId;
+    //渠道名称
+    private String dealChannelName;
     //客户id
     private Integer dealerId;
     //渠道id
     private Integer channelId;
-    //店铺id
-    private Integer storeId;
     //账期
     private String dealChannelAccountPeriod;
     //创建时间'
     private Date createDate;
-
     //渠道大类id
     private Integer channelTypeId;
-
     //渠道类型名称
     private String channelName;
     //渠道大类
     private String channelTypeName;
-    //店铺名称
-    private String storeName;
     //客户名称
     private String dealerName;
     //是否自营 1:自营 2:非自营
@@ -37,6 +37,18 @@ public class DealerChannel  implements  Serializable{
     //
     private String dealChannelIdStr;
 
+    private List<DealerChannelStore> dealerChannelStoreList = new ArrayList<>();
+
+    //店铺id
+    private Integer storeId;
+    //店铺名称
+    private String storeName;
+
+    //店铺id
+    private String storeIdStr;
+    //店铺名称
+    private String storeNameStr;
+
     public Integer getDealChannelId(){
         return dealChannelId;
     }
@@ -140,4 +152,36 @@ public class DealerChannel  implements  Serializable{
     public void setDealerSelfOperated(Integer dealerSelfOperated) {
         this.dealerSelfOperated = dealerSelfOperated;
     }
+
+    public String getDealChannelName() {
+        return dealChannelName;
+    }
+
+    public void setDealChannelName(String dealChannelName) {
+        this.dealChannelName = dealChannelName;
+    }
+
+    public String getStoreIdStr() {
+        return storeIdStr;
+    }
+
+    public void setStoreIdStr(String storeIdStr) {
+        this.storeIdStr = storeIdStr;
+    }
+
+    public String getStoreNameStr() {
+        return storeNameStr;
+    }
+
+    public void setStoreNameStr(String storeNameStr) {
+        this.storeNameStr = storeNameStr;
+    }
+
+    public List<DealerChannelStore> getDealerChannelStoreList() {
+        return dealerChannelStoreList;
+    }
+
+    public void setDealerChannelStoreList(List<DealerChannelStore> dealerChannelStoreList) {
+        this.dealerChannelStoreList = dealerChannelStoreList;
+    }
 }

+ 51 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerChannelStore.java

@@ -0,0 +1,51 @@
+package com.iamberry.rst.core.dm;
+
+import  java.io.Serializable;
+/**
+ * 渠道关联店铺
+ * @author xm
+ * @Date 2019-08-27
+ */
+public class DealerChannelStore  implements  Serializable{
+    private static final long serialVersionUID = 6149228198672016876L;
+    //
+    private Integer dcsId;
+    //渠道信息id
+    private Integer dealChannelId;
+    //店铺id
+    private Integer storeId;
+    //店铺名称
+    private String storeName;
+
+    public Integer getDcsId(){
+        return dcsId;
+    }
+
+    public void setDcsId(Integer  dcsId){
+        this.dcsId=dcsId;
+    }
+
+    public Integer getDealChannelId(){
+        return dealChannelId;
+    }
+
+    public void setDealChannelId(Integer  dealChannelId){
+        this.dealChannelId=dealChannelId;
+    }
+
+    public Integer getStoreId(){
+        return storeId;
+    }
+
+    public void setStoreId(Integer  storeId){
+        this.storeId=storeId;
+    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+}

+ 3 - 3
watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerProduct.java

@@ -20,7 +20,7 @@ public class DealerProduct  implements  Serializable{
     private Integer colorProductId;
     //颜色id
     private Integer colorId;
-    //店铺范围 1:全部店铺  2:部分店铺
+    //店铺范围 1:全部渠道  2:部分渠道
     private Integer dealProdStoreArea;
     //供应价格
     private Integer dealProdPrice;
@@ -37,9 +37,9 @@ public class DealerProduct  implements  Serializable{
     //颜色sku
     private String colorBar;
 
-    //客户产品关联店铺id拼接值
+    //客户产品关联渠道
     private String dealerProductStoreIds;
-    //客户产品关联店铺id拼接值
+    //客户产品关联渠道
     private String dealerProductStoreName;
     //客户产品关联店铺集合
     private List<DealerProductStore> dealerProductStoreList = new ArrayList<>();

+ 35 - 4
watero-rst-core/src/main/java/com.iamberry.rst.core/dm/DealerProductStore.java

@@ -12,13 +12,20 @@ public class DealerProductStore  implements  Serializable{
     private Integer productStoreId;
     //客户产品供应id
     private Integer dealProdId;
-    //店铺id'
-    private Integer storeId;
-    //店铺id'
-    private String storeName;
+    //销售渠道id
+    private Integer dealChannelId;
+    //销售渠道name
+    private String dealChannelName;
+    //销售渠道id
+    private String dealChannelIdStr;
     //在添加页面的状态 1:选中  2:未选中
     private Integer productStoreIsSelect;
 
+    //店铺id
+    private Integer storeId;
+    //店铺name
+    private String storeName;
+
     public Integer getProductStoreId(){
         return productStoreId;
     }
@@ -58,4 +65,28 @@ public class DealerProductStore  implements  Serializable{
     public void setStoreName(String storeName) {
         this.storeName = storeName;
     }
+
+    public Integer getDealChannelId() {
+        return dealChannelId;
+    }
+
+    public void setDealChannelId(Integer dealChannelId) {
+        this.dealChannelId = dealChannelId;
+    }
+
+    public String getDealChannelIdStr() {
+        return dealChannelIdStr;
+    }
+
+    public void setDealChannelIdStr(String dealChannelIdStr) {
+        this.dealChannelIdStr = dealChannelIdStr;
+    }
+
+    public String getDealChannelName() {
+        return dealChannelName;
+    }
+
+    public void setDealChannelName(String dealChannelName) {
+        this.dealChannelName = dealChannelName;
+    }
 }

+ 32 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/dm/DealerChannelStoreService.java

@@ -0,0 +1,32 @@
+package com.iamberry.rst.faces.dm;
+
+import com.iamberry.rst.core.dm.DealerChannelStore;
+
+import java.util.List;
+
+/**
+ *  渠道关联店铺接口
+ * @author xm
+ * @Date 2019-08-27
+ */
+public interface DealerChannelStoreService {
+    /**
+     * 获取集合
+     * @param  dealerChannelStore
+     * @return List
+     */
+    List<DealerChannelStore> getDealerChannelStoreList(DealerChannelStore  dealerChannelStore);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  dealerChannelStore
+     */
+    DealerChannelStore  getDealerChannelStoreById(Integer  id);
+
+    /**
+     * 增加数据 <集合>
+     * @param  dealerChannelStoreList
+     * @return Integer
+     */
+    Integer  saveList(List<DealerChannelStore>  dealerChannelStoreList);
+}

+ 48 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/DealerChannelStoreServiceImpl.java

@@ -0,0 +1,48 @@
+package com.iamberry.rst.service.dm;
+
+import com.iamberry.rst.core.dm.DealerChannelStore;
+import com.iamberry.rst.faces.dm.DealerChannelStoreService;
+import com.iamberry.rst.service.dm.mapper.DealerChannelStoreMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  渠道关联店铺接口
+ * @author xm
+ * @Date 2019-08-27
+ */
+@Service
+public class DealerChannelStoreServiceImpl  implements DealerChannelStoreService {
+    @Autowired
+    private DealerChannelStoreMapper dealerChannelStoreMapper;
+    /**
+     * 获取集合
+     * @param  dealerChannelStore
+     * @return List
+     */
+    @Override
+    public List<DealerChannelStore> getDealerChannelStoreList(DealerChannelStore  dealerChannelStore){
+        return  dealerChannelStoreMapper.getDealerChannelStoreList(dealerChannelStore);
+    }
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  dealerChannelStore
+     */
+    @Override
+    public DealerChannelStore getDealerChannelStoreById(Integer  id){
+        return  dealerChannelStoreMapper.getDealerChannelStoreById(id);
+    }
+
+    /**
+     * 增加数据 <集合>
+     * @param  dealerChannelStoreList
+     * @return Integer
+     */
+    @Override
+    public  Integer  saveList(List<DealerChannelStore>  dealerChannelStoreList){
+        return  dealerChannelStoreMapper.saveList(dealerChannelStoreList);
+    }
+}

+ 72 - 16
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/DmDealerServiceImpl.java

@@ -33,6 +33,8 @@ public class DmDealerServiceImpl  implements DmDealerService {
     @Autowired
     private DealerChannelMapper dealerChannelMapper;
     @Autowired
+    private DealerChannelStoreMapper dealerChannelStoreMapper;
+    @Autowired
     private CooperationAgreeMapper cooperationAgreeMapper;
     /**
      * 获取集合
@@ -89,12 +91,31 @@ public class DmDealerServiceImpl  implements DmDealerService {
         }
 
         if(dmDealer.getDealerChannelList().size() > 0){
+            //与销售渠道关联的店铺集合
+            List<DealerChannelStore> dealerChannelStoreList = new ArrayList<>();
+
             for (DealerChannel dealerChannel:dmDealer.getDealerChannelList()) {
                 dealerChannel.setDealerId(dmDealer.getDealerId());
+                flag = dealerChannelMapper.save(dealerChannel);
+                if(flag < 1){
+                    throw new RuntimeException("添加渠道信息失败");
+                }
+
+                if( dealerChannel.getStoreIdStr() == null || "".equals(dealerChannel.getStoreIdStr())){
+                    throw new RuntimeException(dealerChannel.getDealChannelName()+"渠道没有选择店铺");
+                }
+
+                String[] storeIds = dealerChannel.getStoreIdStr().split(",");
+                for (String storeId:storeIds) {
+                    DealerChannelStore dcs = new DealerChannelStore();
+                    dcs.setDealChannelId(dealerChannel.getDealChannelId());
+                    dcs.setStoreId(Integer.valueOf(storeId));
+                    dealerChannelStoreList.add(dcs);
+                }
             }
-            flag = dealerChannelMapper.saveList(dmDealer.getDealerChannelList());
+            flag = dealerChannelStoreMapper.saveList(dealerChannelStoreList);
             if(flag < 1){
-                throw new RuntimeException("添加渠道信息失败");
+                throw new RuntimeException("添加销售渠道关联的店铺失败");
             }
         }
 
@@ -121,11 +142,16 @@ public class DmDealerServiceImpl  implements DmDealerService {
             boolean isHasStore = false;
             List<DealerProductStore> dealerProductStoreList = new ArrayList<>();
             for (DealerProduct dealerProduct:dmDealer.getDealerProductList()) {
-                if(dealerProduct.getDealProdStoreArea() == 2){   //1:全部店铺  2:部分店铺
-                    String[] storeIds = dealerProduct.getDealerProductStoreIds().split(",");
-                    for (String storeid:storeIds) {
+                if(dealerProduct.getDealProdStoreArea() == 2){   //1:全部渠道  2:部分渠道
+                    String[] dealChannelIds = dealerProduct.getDealerProductStoreIds().split(",");
+                    for (String dealChannelId:dealChannelIds) {
                         DealerProductStore dealerProductStore = new DealerProductStore();
-                        dealerProductStore.setStoreId(Integer.valueOf(storeid));
+
+                        for (DealerChannel dealerChannel:dmDealer.getDealerChannelList()) {
+                            if(Objects.equals(dealChannelId,dealerChannel.getDealChannelIdStr())){
+                                dealerProductStore.setDealChannelId(dealerChannel.getDealChannelId());
+                            }
+                        }
                         dealerProductStore.setDealProdId(dealerProduct.getDealProdId());//prodSuppId
                         dealerProductStoreList.add(dealerProductStore);
                     }
@@ -181,13 +207,41 @@ public class DmDealerServiceImpl  implements DmDealerService {
         }
 
         if(dmDealer.getDealerChannelList().size() > 0){
+
+            //删除与店铺关联表
+            DealerChannel oldDealerChannel = new DealerChannel();
+            oldDealerChannel.setDealerId(dmDealer.getDealerId());
+            List<DealerChannel> dealerChannelList =   dealerChannelMapper.getDealerChannelList(oldDealerChannel);
+            for (DealerChannel dcOld:dealerChannelList) {
+                dealerChannelStoreMapper.deleteByDealChannelId(dcOld.getDealChannelId());
+            }
+            //渠道信息
             dealerChannelMapper.deleteByDealerId(dmDealer.getDealerId());
+            //与销售渠道关联的店铺集合
+            List<DealerChannelStore> dealerChannelStoreList = new ArrayList<>();
+
             for (DealerChannel dealerChannel:dmDealer.getDealerChannelList()) {
                 dealerChannel.setDealerId(dmDealer.getDealerId());
+                flag = dealerChannelMapper.save(dealerChannel);
+                if(flag < 1){
+                    throw new RuntimeException("添加渠道信息失败");
+                }
+
+                if( dealerChannel.getStoreIdStr() == null || "".equals(dealerChannel.getStoreIdStr())){
+                    throw new RuntimeException(dealerChannel.getDealChannelName()+"渠道没有选择店铺");
+                }
+
+                String[] storeIds = dealerChannel.getStoreIdStr().split(",");
+                for (String storeId:storeIds) {
+                    DealerChannelStore dcs = new DealerChannelStore();
+                    dcs.setDealChannelId(dealerChannel.getDealChannelId());
+                    dcs.setStoreId(Integer.valueOf(storeId));
+                    dealerChannelStoreList.add(dcs);
+                }
             }
-            flag = dealerChannelMapper.saveList(dmDealer.getDealerChannelList());
+            flag = dealerChannelStoreMapper.saveList(dealerChannelStoreList);
             if(flag < 1){
-                throw new RuntimeException("添加渠道信息失败");
+                throw new RuntimeException("添加销售渠道关联的店铺失败");
             }
         }
 
@@ -213,18 +267,19 @@ public class DmDealerServiceImpl  implements DmDealerService {
                 }
             }
 
-            for (DealerProduct dp2:dealerProductList) {
-                dealerProductStoreMapper.deleteByDealProdId(dp2.getDealProdId());
-            }
-
             boolean isHasStore = false;
             List<DealerProductStore> dealerProductStoreList = new ArrayList<>();
             for (DealerProduct dealerProduct:dmDealer.getDealerProductList()) {
-                if(dealerProduct.getDealProdStoreArea() == 2){   //1:全部店铺  2:部分店铺
-                    String[] storeIds = dealerProduct.getDealerProductStoreIds().split(",");
-                    for (String storeid:storeIds) {
+                if(dealerProduct.getDealProdStoreArea() == 2){   //1:全部渠道  2:部分渠道
+                    String[] dealChannelIds = dealerProduct.getDealerProductStoreIds().split(",");
+                    for (String dealChannelId:dealChannelIds) {
                         DealerProductStore dealerProductStore = new DealerProductStore();
-                        dealerProductStore.setStoreId(Integer.valueOf(storeid));
+
+                        for (DealerChannel dealerChannel:dmDealer.getDealerChannelList()) {
+                            if(Objects.equals(dealChannelId,dealerChannel.getDealChannelIdStr())){
+                                dealerProductStore.setDealChannelId(dealerChannel.getDealChannelId());
+                            }
+                        }
                         dealerProductStore.setDealProdId(dealerProduct.getDealProdId());//prodSuppId
                         dealerProductStoreList.add(dealerProductStore);
                     }
@@ -243,6 +298,7 @@ public class DmDealerServiceImpl  implements DmDealerService {
             }
         }
 
+        //合作协议
         if(dmDealer.getCooperationAgreeList().size() > 0){
             cooperationAgreeMapper.deleteByDealerId(dmDealer.getDealerId());
             for (CooperationAgree cooperationAgree:dmDealer.getCooperationAgreeList()) {

+ 8 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/DealerChannelMapper.java

@@ -28,6 +28,14 @@ public interface DealerChannelMapper {
      * @return Integer
      */
     Integer  deleteByDealerId(Integer  id);
+
+    /**
+     * 增加数据
+     * @param  dealerChannel
+     * @return Integer
+     */
+    Integer  save(DealerChannel  dealerChannel);
+
     /**
      * 增加数据 <集合>
      * @param  dealerChannelList

+ 37 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/DealerChannelStoreMapper.java

@@ -0,0 +1,37 @@
+package com.iamberry.rst.service.dm.mapper;
+
+import com.iamberry.rst.core.dm.DealerChannelStore;
+
+import java.util.List;
+
+/**
+ *  渠道关联店铺接口
+ * @author xm
+ * @Date 2019-08-27
+ */
+public interface DealerChannelStoreMapper {
+    /**
+     * 获取集合
+     * @param  dealerChannelStore
+     * @return List
+     */
+    List<DealerChannelStore> getDealerChannelStoreList(DealerChannelStore  dealerChannelStore);
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  dealerChannelStore
+     */
+    DealerChannelStore  getDealerChannelStoreById(Integer  id);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  deleteByDealChannelId(Integer  id);
+    /**
+     * 增加数据 <集合>
+     * @param  dealerChannelStoreList
+     * @return Integer
+     */
+    Integer  saveList(List<DealerChannelStore>  dealerChannelStoreList);
+}

+ 24 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dealerChannelMapper.xml

@@ -11,6 +11,7 @@
     </resultMap>
     <sql    id="Base_List" >
         t.deal_channel_id,
+        t.deal_channel_name,
         t.dealer_id,
         t.channel_id,
         t.store_id,
@@ -56,6 +57,29 @@
         tb_rst_dm_dealer_channel
         where dealer_id = #{dealerId}
     </delete>
+
+    <insert id="save" parameterType="DealerChannel" useGeneratedKeys="true"  keyProperty="dealChannelId">
+        insert into
+            tb_rst_dm_dealer_channel
+            (
+                deal_channel_id,
+                deal_channel_name,
+                dealer_id,
+                channel_id,
+                store_id,
+                deal_channel_account_period
+            )
+        values
+            (
+                #{dealChannelId},
+                #{dealChannelName},
+                #{dealerId},
+                #{channelId},
+                #{storeId},
+                #{dealChannelAccountPeriod}
+            )
+    </insert>
+
     <insert id="saveList" parameterType="java.util.List" >
         insert into
         tb_rst_dm_dealer_channel

+ 60 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dealerChannelStoreMapper.xml

@@ -0,0 +1,60 @@
+<?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.iamberry.rst.service.dm.mapper.DealerChannelStoreMapper">
+    <resultMap  id="BaseResultMap" type="DealerChannelStore" >
+        <result    column="dcs_id"    property="dcsId" />
+        <result    column="deal_channel_id"    property="dealChannelId" />
+        <result    column="store_id"    property="storeId" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.dcs_id,
+        t.deal_channel_id,
+        t.store_id
+    </sql>
+    <select id="getDealerChannelStoreList" resultMap="BaseResultMap" parameterType="DealerChannelStore" >
+        select
+          <include refid="Base_List" />,
+          scs.store_name
+        from tb_rst_dm_dealer_channel_store t
+        LEFT JOIN tb_rst_store_info scs ON t.store_id = scs.store_id
+        <where>
+            <if test="dcsId != null ">
+                AND t.dcs_id = #{dcsId}
+            </if >
+            <if test="dealChannelId != null ">
+                AND t.deal_channel_id = #{dealChannelId}
+            </if >
+            <if test="storeId != null ">
+                AND t.store_id = #{storeId}
+            </if >
+        </where>
+    </select>
+    <select id="getDealerChannelStoreById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_dm_dealer_channel_store t
+        where t.dcs_id= #{dcsId}
+    </select>
+    <delete id="deleteByDealChannelId" parameterType="Integer" >
+        delete FROM
+        tb_rst_dm_dealer_channel_store
+        where deal_channel_id = #{id}
+    </delete>
+    <insert id="saveList" parameterType="java.util.List" >
+        insert into
+        tb_rst_dm_dealer_channel_store
+        (
+        dcs_id,
+        deal_channel_id,
+        store_id
+        )
+        values
+        <foreach collection="list" item="node" index="index" separator="," open="" close="">
+            (
+            #{node.dcsId},
+            #{node.dealChannelId},
+            #{node.storeId}
+            )
+        </foreach >
+    </insert>
+</mapper>

+ 17 - 10
watero-rst-service/src/main/java/com/iamberry/rst/service/dm/mapper/dealerProductStoreMapper.xml

@@ -5,18 +5,20 @@
         <result    column="product_store_id"    property="productStoreId" />
         <result    column="deal_prod_id"    property="dealProdId" />
         <result    column="store_id"    property="storeId" />
+        <result    column="deal_channel_id"    property="dealChannelId" />
     </resultMap>
     <sql    id="Base_List" >
         t.product_store_id,
         t.deal_prod_id,
-        t.store_id
+        t.store_id,
+        t.deal_channel_id
     </sql>
     <select id="getDealerProductStoreList" resultMap="BaseResultMap" parameterType="DealerProductStore" >
         select
         <include refid="Base_List" />,
-        si.store_name
+        si.deal_channel_name
         from tb_rst_dm_dealer_product_store t
-        LEFT JOIN  tb_rst_store_info si ON  t.store_id = si.store_id
+        LEFT JOIN  tb_rst_dm_dealer_channel si ON  t.deal_channel_id = si.deal_channel_id
         <where>
             <if test="productStoreId != null ">
                 AND t.product_store_id = #{productStoreId}
@@ -27,6 +29,9 @@
             <if test="storeId != null ">
                 AND t.store_id = #{storeId}
             </if >
+            <if test="dealChannelId != null ">
+                AND t.deal_channel_id = #{dealChannelId}
+            </if >
         </where>
     </select>
     <select id="getDealerProductStoreById" resultMap="BaseResultMap" parameterType="Integer" >
@@ -42,16 +47,18 @@
     </delete>
     <insert id="saveList" parameterType="java.util.List" >
         insert into
-        tb_rst_dm_dealer_product_store
-        (
-        deal_prod_id,
-        store_id
-        )
+          tb_rst_dm_dealer_product_store
+            (
+                deal_prod_id,
+                store_id,
+                deal_channel_id
+            )
         values
         <foreach collection="list" item="node" index="index" separator="," open="" close="">
             (
-            #{node.dealProdId},
-            #{node.storeId}
+                #{node.dealProdId},
+                #{node.storeId},
+                #{node.dealChannelId}
             )
         </foreach >
     </insert>

+ 47 - 7
watero-rst-web/src/main/java/com/iamberry/rst/controllers/dm/DmDealerController.java

@@ -31,7 +31,9 @@ import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 @Controller
 @RequestMapping("/admin/dealer")
@@ -54,6 +56,8 @@ public class DmDealerController {
     private CooperationAgreeService cooperationAgreeService;
     @Autowired
     private StoreInfoService storeInfoService;
+    @Autowired
+    private DealerChannelStoreService dealerChannelStoreService;
 
     /**
      * 查询客户基本信息列表
@@ -133,6 +137,23 @@ public class DmDealerController {
         storeInfo.setStoreStatus(1);
         List<StoreInfo> storeInfoList = storeInfoService.listStore(storeInfo);
         mv.addObject("storeInfoList",storeInfoList);
+
+        List<DealerChannelStore> dealerChannelStoreList = new ArrayList<DealerChannelStore>();
+        String[] nameStr = new String[0];
+        if(dealerChannel.getStoreIdStr() != null && !"".equals(dealerChannel.getStoreIdStr() )){
+            nameStr = dealerChannel.getStoreIdStr().split(",");
+        }
+        for (String str : nameStr){
+            DealerChannelStore dealerChannelStore = new DealerChannelStore();
+            for (StoreInfo si : storeInfoList) {
+                if(Objects.equals(si.getStoreId(), Integer.valueOf(str))){
+                    dealerChannelStore.setStoreName(si.getStoreName());
+                }
+            }
+            dealerChannelStore.setStoreId(Integer.valueOf(str));
+            dealerChannelStoreList.add(dealerChannelStore);
+        }
+        mv.addObject("dealerChannelStoreList",dealerChannelStoreList);
         return mv;
     }
 
@@ -144,11 +165,11 @@ public class DmDealerController {
      */
     @RequiresPermissions(value={"dm:dealer:add","dm:dealer:update"},logical= Logical.OR)
     @RequestMapping("/to_add_dealer_product")
-    public ModelAndView toAddDealerProduct(HttpServletRequest request,DealerProduct dealerProduct,String storeJson) {
+    public ModelAndView toAddDealerProduct(HttpServletRequest request,DealerProduct dealerProduct,String dealerProductStoreJson) {
         ModelAndView mv = new ModelAndView("dm/dealer/add_dealer_product");
         mv.addObject("dealerProduct",dealerProduct);
 
-        JSONArray jsonArray = JSONArray.fromObject(storeJson);
+        JSONArray jsonArray = JSONArray.fromObject(dealerProductStoreJson);
         List<DealerProductStore> dealerProductStoreList =  (List) JSONArray.toCollection(jsonArray, DealerProductStore.class);
         mv.addObject("dealerProductStoreList",dealerProductStoreList);
         return mv;
@@ -323,6 +344,25 @@ public class DmDealerController {
         DealerChannel  dealerChannel = new DealerChannel();
         dealerChannel.setDealerId(dealerId);
         List<DealerChannel> dealerChannelList = dealerChannelService.getDealerChannelList(dealerChannel);
+        for (DealerChannel dc:dealerChannelList) {
+            DealerChannelStore dealerChannelStore = new DealerChannelStore();
+            dealerChannelStore.setDealChannelId(dc.getDealChannelId());
+            List<DealerChannelStore> dealerChannelStoreList = dealerChannelStoreService.getDealerChannelStoreList(dealerChannelStore);
+            dc.setDealerChannelStoreList(dealerChannelStoreList);
+            //店铺
+            String storeNameStr="",storeIdStr="";
+            for (DealerChannelStore dcs: dealerChannelStoreList) {
+                if("".equals(storeNameStr)){
+                    storeIdStr += dcs.getStoreId();
+                    storeNameStr += dcs.getStoreName();
+                }else{
+                    storeIdStr += ","+ dcs.getStoreId();
+                    storeNameStr += ","+ dcs.getStoreName();
+                }
+            }
+            dc.setStoreIdStr(storeIdStr);
+            dc.setStoreNameStr(storeNameStr);
+        }
 
         DealerProduct  dealerProduct = new DealerProduct();
         dealerProduct.setDealerId(dealerId);
@@ -336,11 +376,11 @@ public class DmDealerController {
                 String dealerProductStoreName="";
                 for (DealerProductStore dps:dealerProductStoreList) {
                     if("".equals(dealerProductStoreIds)){
-                        dealerProductStoreIds = String.valueOf(dps.getStoreId());
-                        dealerProductStoreName = dps.getStoreName();
+                        dealerProductStoreIds = String.valueOf(dps.getDealChannelId());
+                        dealerProductStoreName = dps.getDealChannelName();
                     }else{
-                        dealerProductStoreIds += "," + String.valueOf(dps.getStoreId());
-                        dealerProductStoreName += "," +  dps.getStoreName();
+                        dealerProductStoreIds += "," + String.valueOf(dps.getDealChannelId());
+                        dealerProductStoreName += "," + dps.getDealChannelName();
                     }
                 }
                 dp.setDealerProductStoreIds(dealerProductStoreIds);
@@ -366,7 +406,7 @@ public class DmDealerController {
      * @return
      */
     @ResponseBody
-    @RequiresPermissions("dm:supplier:update")
+    @RequiresPermissions("dm:dealer:update")
     @RequestMapping("/dealere_update")
     public ResponseJson dealereUpdate(HttpServletRequest request,DmDealer dmDealer,
                                     String add_contact_json,String add_dealer_channel_json,String add_product_json,String add_coop_agree_json) {

+ 2 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -207,6 +207,7 @@
 		<typeAlias type="com.iamberry.rst.core.dm.ClaimOrder" alias="ClaimOrder"/>
 		<typeAlias type="com.iamberry.rst.core.dm.CooperationAgree" alias="CooperationAgree"/>
 		<typeAlias type="com.iamberry.rst.core.dm.DealerChannel" alias="DealerChannel"/>
+		<typeAlias type="com.iamberry.rst.core.dm.DealerChannelStore" alias="DealerChannelStore"/>
 		<typeAlias type="com.iamberry.rst.core.dm.DealerContact" alias="DealerContact"/>
 		<typeAlias type="com.iamberry.rst.core.dm.DealerProduct" alias="DealerProduct"/>
 		<typeAlias type="com.iamberry.rst.core.dm.DealerProductStore" alias="DealerProductStore"/>
@@ -341,6 +342,7 @@
 		<mapper resource="com/iamberry/rst/service/dm/mapper/claimOrderMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/dm/mapper/cooperationAgreeMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/dm/mapper/dealerChannelMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/dm/mapper/dealerChannelStoreMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/dm/mapper/dealerContactMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/dm/mapper/dealerProductMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/dm/mapper/dealerProductStoreMapper.xml"/>

+ 10 - 9
watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/add_dealer.ftl

@@ -157,16 +157,17 @@
                     <input type="button" class="btn btn-primary" onclick="addDealerChannnel()" value="添加销售渠道" >
                     <table class="table table-border table-bg table-bordered" style="margin-top: 10px;" id="">
                         <thead>
-                        <tr class="text-c" id="table1">
-                            <th style="text-align: center;" width="30" >渠道类别</th>
-                            <th style="text-align: center;" width="30" >渠道类型</th>
-                            <th style="text-align: center;" width="10">渠道名称</th>
-                            <th style="text-align: center;" width="10">账期</th>
-                            <th style="text-align: center;" width="5">操作</th>
-                        </tr>
+                            <tr class="text-c" id="table1">
+                                <th  width="30" >渠道名称</th>
+                                <th width="30" >渠道类别</th>
+                                <th width="30" >渠道类型</th>
+                                <th width="30">店铺名称</th>
+                                <th width="10">账期</th>
+                                <th width="5">操作</th>
+                            </tr>
                         </thead>
                         <tbody id="add_dealer_channel">
-                            <tr><td colspan="5" class="td-manage text-c" >暂时没有销售渠道信息,请添加!</td></tr>
+                            <tr><td colspan="6" class="td-manage text-c" >暂时没有销售渠道信息,请添加!</td></tr>
                         </tbody>
                     </table>
                 </div>
@@ -196,7 +197,7 @@
                         </tr>
                         </thead>
                         <tbody id="add_product">
-                        <tr><td colspan="5" class="td-manage text-c" >暂时没有供应产品,请添加!</td></tr>
+                        <tr><td colspan="6" class="td-manage text-c" >暂时没有供应产品,请添加!</td></tr>
                         </tbody>
                     </table>
                 </div>

+ 77 - 4
watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/add_dealer_channel.ftl

@@ -36,6 +36,11 @@
         .msg-phone{height: 35px;line-height: 35px;}
         .all_down{text-decoration: underline;color: #00c;}
         .form-label{}
+        .my-close{margin-top: 4px;margin-left: 12px;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(45deg);transform: rotate(45deg);display: inline-block;}
+        .my-close:after{content: "";position: absolute;top: 0;left: 0;width:0.15em;height:1em;background: #333;-webkit-transform: rotate(270deg);transform: rotate(270deg);}
+        .b-close{position: relative; display: inline-block;margin: 2px 0; padding:4px 2px 4px 4px; margin-right: 3px;background: #f0f0f0;border: 1px solid rgba(0,0,0,.1);border-radius: 5px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;cursor: pointer;}
+        .b-close-div{float: right;height: 21px;width: 22px;}
+        .close-box{margin-left: 15px;margin-top: -15px;}
     </style>
     <title>对接人添加 - 客户管理 - RST</title>
 </head>
@@ -49,6 +54,14 @@
             <input type="hidden" class="input-text" value="${dealerChannel.dealChannelIdStr!""}" id="dealChannelIdStr" name="dealChannelIdStr"  >
 
             <div class="ulc_contact" code="returnCode" msg="resultMsg" data="returnMsg" urlPrefix="${path}">
+
+                <div class="row cl" id="" style="">
+                    <label class="form-label col-xs-3 col-sm-3" style="text-align: right;"><span class="c-red">*</span>渠道名称:</label>
+                    <div class="formControls col-xs-8 col-sm-8">
+                        <input type="text" class="input-text add_form" value="${dealerChannel.dealChannelName!""}" placeholder="填写渠道名称" id="dealChannelName" name="dealChannelName" myMinlength="1"  myMaxlength="40" errormsg="渠道名称必填,不能超过40个字符"  >
+                    </div>
+                </div>
+
                 <div class="row cl ulc_contact" id="" style="">
                     <label class="form-label col-xs-3 col-sm-3" style="text-align: right;"><span class="c-red">*</span>渠道大类:</label>
                     <div class="formControls col-xs-8 col-sm-8" >
@@ -77,18 +90,39 @@
             </div>
 
             <div class="row cl " id="" style="">
-                <label class="form-label col-xs-3 col-sm-3" style="text-align: right;"><span class="c-red">*</span>渠道类型:</label>
+                <label class="form-label col-xs-3 col-sm-3" style="text-align: right;"><span class="c-red">*</span>店铺:</label>
                 <div class="formControls col-xs-8 col-sm-8">
                     <select class="chosen select" name="storeId" id="storeId" >
+                        <option value="">选择店铺</option>
                         <#if storeInfoList?? &&  (storeInfoList?size > 0) >
                             <#list storeInfoList as store>
-                                <option value="${store.storeId}" <#if dealerChannel.channelId??><#if dealerChannel.storeId==store.storeId>selected</#if></#if>>${store.storeName}</option>
+                                <option value="${store.storeId}" >${store.storeName}</option>
                             </#list>
                         </#if>
                     </select>
                 </div>
             </div>
 
+            <div class="row cl " id="" style="">
+                <label class="form-label col-xs-3 col-sm-3" style="text-align: right;"></label>
+                <div class="formControls col-xs-8 col-sm-8" >
+                    <div class="row">
+                        <ul class="close-box" id="configui1">
+                            <#if dealerChannelStoreList?? &&  (dealerChannelStoreList?size > 0) >
+                                <#list dealerChannelStoreList as dealerChannelStore>
+                                    <li class="b-close" class="configDetele1">
+                                        <input type="hidden" value="${dealerChannelStore.storeId!""}" class="configli1" name="configli1">
+                                        <span class="configliName">${dealerChannelStore.storeName!""}</span>
+                                        <div onclick="deleteli(this)" class="b-close-div" ><span class="my-close" ></span></div>
+                                    </li>
+                                </#list>
+                            </#if>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+
+
             <div class="row cl" id="" style="">
                 <label class="form-label col-xs-3 col-sm-3" style="text-align: right;"><span class="c-red">*</span>账期:</label>
                 <div class="formControls col-xs-8 col-sm-8">
@@ -144,17 +178,56 @@
         var channel = new Object();
         channel.dealChannelId=$("#dealChannelId").val();
         channel.dealChannelIdStr=$("#dealChannelIdStr").val();
+        channel.dealChannelName=$("#dealChannelName").val();
         channel.channelId=$("#channelId").val();
         channel.channelTypeId=$("#channelTypeId").val();
         channel.channelName=$("#channelId").find("option:selected").text();
         channel.channelTypeName=$("#channelTypeId").find("option:selected").text();
-        channel.storeId= $('#storeId').val();
-        channel.storeName=$("#storeId").find("option:selected").text();
+
+        var storeIdStr = '',storeNameStr='';
+        $("#configui1").find("li").each(function (j, item) {
+            if(isEmpty(storeIdStr)){
+                storeIdStr += "," + $(item).find(".configli1").val();
+                storeNameStr +=  "," + $(item).find(".configliName").text();
+            }else{
+                storeIdStr += $(item).find(".configli1").val();
+                storeNameStr +=  $(item).find(".configliName").text();
+            }
+        });
+        if(!isEmpty(storeIdStr)){
+            vailErrorMsg_3($("#configui1"),"必须要选择一个店铺。");
+            return false;
+        }
+        channel.storeIdStr=storeIdStr;
+        channel.storeNameStr=storeNameStr;
         channel.dealChannelAccountPeriod=$("#dealChannelAccountPeriod").val();
         parent.showChannel(channel);
         parent.layer.close(parent.layer.getFrameIndex(window.name));
     }
 
+    $('#storeId').change(function() {
+        var name = $("#storeId option:selected").text();
+        var id = $('#storeId').val();
+        var bl = true;
+        if(id != "") {
+            $("input[name='configli1']").each(function (j, item) {
+                var s = $(item).val();
+                if (s === id) {
+                    bl = false;
+                }
+            });
+            if (bl) {
+                $("#configui1").append('<li class="b-close" class="configDetele1">' +
+                        ' <input type="hidden" value="' + id + '" class="configli1" name="configli1"><span class="configliName">' + name +
+                        '</span><div onclick="deleteli(this)" class="b-close-div" ><span class="my-close" ></span></div>' +
+                        '</li>');
+            }
+        }
+
+    });
+    function deleteli(obj) {
+        $(obj).parent().remove();
+    }
 </script>
 
 

+ 5 - 2
watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/add_dealer_product.ftl

@@ -93,8 +93,8 @@
                         <#if dealerProductStoreList??>
                             <#list dealerProductStoreList as dealerProductStore>
                                 <div class="radio-box">
-                                    <input type="checkbox" class="son_checkbox" id="productAreaRela-${dealerProductStore_index}" name="productAreaRela" value="${dealerProductStore.storeId}"  >
-                                    <label style="width: 130px;display: block;" for="productAreaRela-${dealerProductStore_index}">${dealerProductStore.storeName}</label>
+                                    <input type="checkbox" class="son_checkbox" id="productAreaRela-${dealerProductStore_index}" name="productAreaRela" value="${dealerProductStore.dealChannelIdStr!''}"  >
+                                    <label style="width: 130px;display: block;" for="productAreaRela-${dealerProductStore_index}">${dealerProductStore.dealChannelName!''}</label>
                                 </div>
                             </#list>
                         </#if>
@@ -335,6 +335,9 @@
                     dealerProduct.dealProdPrice=$("#dealProdPrice").val();
                     dealerProductArray.push(dealerProduct);
                 });
+                if(dealerProductArray == null || dealerProductArray.length < 1){
+                    vailErrorMsg_3($("#product_table"),"未选择任何产品。");
+                }
                 parent.showDealerProduct(dealerProductArray);
                 parent.layer.close(parent.layer.getFrameIndex(window.name));
             }

+ 7 - 3
watero-rst-web/src/main/webapp/WEB-INF/views/dm/dealer/update_dealer.ftl

@@ -177,6 +177,7 @@
                     <table class="table table-border table-bg table-bordered" style="margin-top: 10px;" id="">
                         <thead>
                         <tr class="text-c" id="table1">
+                            <th style="text-align: center;" width="30" >渠道名称</th>
                             <th style="text-align: center;" width="30" >渠道类别</th>
                             <th style="text-align: center;" width="30" >渠道类型</th>
                             <th style="text-align: center;" width="10">渠道名称</th>
@@ -192,10 +193,13 @@
                                         <input type="hidden" class="input-text dealChannelIdStr" value="${dealerChannel.dealChannelId!''}" >
                                         <input type="hidden" class="input-text channelId" value="${dealerChannel.channelId!''}" >
                                         <input type="hidden" class="input-text channelTypeId" value="${dealerChannel.channelTypeId!''}" >
-                                        <input type="hidden" class="input-text storeId" value="${dealerChannel.storeId!''}" >
+                                        <input type="hidden" class="input-text storeIdStr" value="${dealerChannel.storeIdStr!''}" >
+                                        <td class="dealChannelName">${dealerChannel.dealChannelName!''}</td>
                                         <td class="channelTypeName">${dealerChannel.channelTypeName!''}</td>
                                         <td class="channelName">${dealerChannel.channelName!''}</td>
-                                        <td class="storeName">${dealerChannel.storeName!''}</td>
+                                        <td class="storeNameStr">
+                                            ${dealerChannel.storeNameStr!''}
+                                        </td>
                                         <td class="dealChannelAccountPeriod">${dealerChannel.dealChannelAccountPeriod!''}</td>
                                         <td>
                                             <a href="javascript:void(0)" onclick="updateDealerChannel($(this))">修改</a>&nbsp;&nbsp;
@@ -249,7 +253,7 @@
                                             <input type="text" style="text-align: center;" class="input-text input-number decimal_input dealProdPrice" value="${((dealerProduct.dealProdPrice/100)?string("0.##"))!''}"   onkeyup="keyFunDecimal($(this),9999999,0)" myMinVal="0" myMaxVal="9999999">
                                         </td>
                                         <#if dealerProduct.dealProdStoreArea == 1>
-                                            <td class="dealerProductStoreName">全部店铺</td>
+                                            <td class="dealerProductStoreName">全部渠道</td>
                                         <#elseif dealerProduct.dealProdStoreArea == 2>
                                             <td class="dealerProductStoreName"> ${dealerProduct.dealerProductStoreName}</td>
                                         </#if>

+ 4 - 4
watero-rst-web/src/main/webapp/WEB-INF/views/dm/financialReceipt/fr_list.ftl

@@ -143,13 +143,13 @@
                                 </#if>
 
                                 <#if financialReceipt.frClaimStatus == 1>
-                                       <a style="text-decoration:none" href="javascript:void(0);" title="绑定订单" onclick="toOrderDesc(${financialReceipt.frId!''})">
-                                            <font color=#06c>绑定订单</font>
+                                       <a style="text-decoration:none" href="javascript:void(0);" title="认领订单" onclick="toOrderDesc(${financialReceipt.frId!''})">
+                                            <font color=#06c>认领订单</font>
                                        </a>
                                 </#if>
                                 <#if financialReceipt.frClaimStatus == 3>
-                                    <a style="text-decoration:none" href="javascript:void(0);" title="继续绑定订单" onclick="toOrderDesc(${financialReceipt.frId!''})">
-                                        <font color=#06c>继续绑定订单</font>
+                                    <a style="text-decoration:none" href="javascript:void(0);" title="认领订单" onclick="toOrderDesc(${financialReceipt.frId!''})">
+                                        <font color=#06c>认领订单</font>
                                     </a>
                                 </#if>
 

+ 2 - 0
watero-rst-web/src/main/webapp/common/js/common/common.js

@@ -377,6 +377,8 @@ function verification(){
             myMinlength = 0;
         }
         if(!isEmpty(myValue) && myMinlength != 0){
+            vailErrorMsg_3($(this),$(this).attr("errormsg"));
+            flag = false;
             return false;
         }
         var myMaxlength = $node.attr("myMaxlength");

+ 30 - 25
watero-rst-web/src/main/webapp/common/js/dealer/dealer.js

@@ -66,7 +66,7 @@ function updateDealerContact($this) {
     contact.dealContactEmail=$contact.find(".dealContactEmail").text();
     contact.dealContactWechat=$contact.find(".dealContactWechat").text();
     contact.dealContactQq=$contact.find(".dealContactQq").text();
-    layer_show_height("添加对接人",url_path+"/admin/dealer/to_add_dealer_contact?"+parseParam(contact),1);
+    layer_show_height("修改对接人",url_path+"/admin/dealer/to_add_dealer_contact?"+parseParam(contact),1);
 }
 //-----------------------对接人 END -----------------------------
 
@@ -81,7 +81,7 @@ function addDealerChannnel() {
     CHANNEL_IS_UPDATE = 1;
     CHANNEL_ID_NUM ++;
     var dealChannelIdStr = CHANNEL_ID_PREFIX + CHANNEL_ID_NUM;
-    layer_show_height("添加对接人",url_path + "/admin/dealer/to_add_dealer_channel?dealChannelIdStr="+dealChannelIdStr,1);
+    layer_show_height("添加销售渠道",url_path + "/admin/dealer/to_add_dealer_channel?dealChannelIdStr="+dealChannelIdStr,2);
 }
 
 function showChannel(channel) {
@@ -92,10 +92,11 @@ function showChannel(channel) {
         html += ' <input type="hidden" class="input-text dealChannelIdStr" value="'+ cufte(channel.dealChannelIdStr) +'" >';
         html += ' <input type="hidden" class="input-text channelId" value="'+ cufte(channel.channelId) +'" >';
         html += ' <input type="hidden" class="input-text channelTypeId" value="'+ cufte(channel.channelTypeId) +'" >';
-        html += ' <input type="hidden" class="input-text storeId" value="'+ cufte(channel.storeId) +'" >';
+        html += ' <input type="hidden" class="input-text storeIdStr" value="'+ cufte(channel.storeIdStr) +'" >';
+        html += '<td class="dealChannelName">'+ cufte(channel.dealChannelName) +'</td>';
         html += '<td class="channelTypeName">'+ cufte(channel.channelTypeName) +'</td>';
         html += '<td class="channelName">'+ cufte(channel.channelName) +'</td>';
-        html += '<td class="storeName">'+ cufte(channel.storeName) +'</td>';
+        html += '<td class="storeNameStr">'+ cufte(channel.storeNameStr) +'</td>';
         html += '<td class="dealChannelAccountPeriod">'+ cufte(channel.dealChannelAccountPeriod) +'</td>';
         html += '<td><a href="javascript:void(0)" onclick="updateDealerChannel($(this))">修改</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="delTableByTr($(this),2)">删除</a></td>';
         if(CHANNEL_TR_NUM == 0){
@@ -114,11 +115,12 @@ function showChannel(channel) {
             }
         });
         $channelTr.find(".channelId").val(cufte(channel.channelId));
-        $channelTr.find(".storeId").val(cufte(channel.storeId));
+        $channelTr.find(".storeIdStr").val(cufte(channel.storeIdStr));
+        $channelTr.find(".dealChannelName").text(cufte(channel.dealChannelName));
         $channelTr.find(".channelTypeId").val(cufte(channel.channelTypeId));
         $channelTr.find(".channelTypeName").text(cufte(channel.channelTypeName));
         $channelTr.find(".channelName").text(cufte(channel.channelName));
-        $channelTr.find(".storeName").text(cufte(channel.storeName));
+        $channelTr.find(".storeNameStr").text(cufte(channel.storeNameStr));
         $channelTr.find(".dealChannelAccountPeriod").text(cufte(channel.dealChannelAccountPeriod));
     }
 }
@@ -132,11 +134,12 @@ function updateDealerChannel($this) {
     var channel = new Object();
     channel.dealChannelId = $contact.find(".dealChannelId").val();
     channel.dealChannelIdStr = $contact.find(".dealChannelIdStr").val();
+    channel.dealChannelName= $contact.find(".dealChannelName").text();
     channel.channelId= $contact.find(".channelId").val();
     channel.channelTypeId= $contact.find(".channelTypeId").val();
-    channel.storeId=$contact.find(".storeId").val();
+    channel.storeIdStr=$contact.find(".storeIdStr").val();
     channel.dealChannelAccountPeriod=$contact.find(".dealChannelAccountPeriod").text();
-    layer_show_height("添加对接人",url_path+"/admin/dealer/to_add_dealer_channel?"+parseParam(channel),1);
+    layer_show_height("修改渠道商",url_path+"/admin/dealer/to_add_dealer_channel?"+parseParam(channel),1);
 }
 //-----------------------渠道商 END -----------------------------
 
@@ -152,22 +155,22 @@ function addDealerProduct() {
     PRODUCT_ID_NUM ++;
     var dealProdIdStr = PRODUCT_ID_PREFIX + PRODUCT_ID_NUM;
 
-    var storeArray = new Array();
+    var dealerProductStoreArray = new Array();
     $("#add_dealer_channel").find("tr").each(function () {
-        var store = new Object();
-        if(!isEmpty($(this).find(".storeId").val())){
+        var dealerProductStore = new Object();
+        if(!isEmpty($(this).find(".dealChannelIdStr").val())){
             return false;
         }
-        store.storeId = $(this).find(".storeId").val();
-        store.storeName = $(this).find(".storeName").text();
-        store.productStoreIsSelect = 2;
-        storeArray.push(store);
+        dealerProductStore.dealChannelIdStr = $(this).find(".dealChannelIdStr").val();
+        dealerProductStore.dealChannelName = $(this).find(".dealChannelName").text();
+        dealerProductStore.productStoreIsSelect = 2;
+        dealerProductStoreArray.push(dealerProductStore);
     });
-    if(storeArray.length < 1){
-        vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个渠道信息");
+    if(dealerProductStoreArray.length < 1){
+        vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个销售渠道");
         return false;
     }
-    var url = url_path + '/admin/dealer/to_add_dealer_product?dealProdIdStr='+dealProdIdStr+'&storeJson='+ JSON.stringify(storeArray);
+    var url = url_path + '/admin/dealer/to_add_dealer_product?dealProdIdStr='+dealProdIdStr+'&dealerProductStoreJson='+ JSON.stringify(dealerProductStoreArray);
     url = encodeURI(url);
     layer_show_norm("添加供应产品",url,5);
 }
@@ -189,7 +192,7 @@ function showDealerProduct(dealerProductArray) {
             html += '<td class="colorName">'+ cufte(obj.colorBar) +'</td>';
             html += '<td><input type="text" style="text-align: center;" class="input-text input-number dealProdPrice" value="'+ cufte(obj.dealProdPrice) +'"   onkeyup="keyFun($(this),99999,0)" onpaste="keyFun($(this),99999,0)"></td>';
             if(obj.dealProdStoreArea == 1){
-                html += '<td class="dealerProductStoreName">全部店铺</td>';
+                html += '<td class="dealerProductStoreName">全部渠道</td>';
             }else{
                 html += '<td class="dealerProductStoreName">'+ cufte(obj.dealerProductStoreName) +'</td>';
             }
@@ -261,7 +264,7 @@ function addCoopAgree() {
     COOPERATIONAGREE_IS_UPDATE = 1;
     COOPERATIONAGREE_ID_NUM ++;
     var coopAgreeIdStr = COOPERATIONAGREE_ID_PREFIX + COOPERATIONAGREE_ID_NUM;
-    layer_show_height("合作协议",url_path+"/admin/dealer/to_add_coop_agree?coopAgreeIdStr="+coopAgreeIdStr,0);
+    layer_show_height("添加合作协议",url_path+"/admin/dealer/to_add_coop_agree?coopAgreeIdStr="+coopAgreeIdStr,0);
 }
 /**
  * 修改合作协议
@@ -279,7 +282,7 @@ function updateCoopAgree($this) {
 
     var url = url_path+"/admin/dealer/to_add_coop_agree?"+parseParam(coopAgree);
     url = encodeURI(url);
-    layer_show_height("合作协议",url,0);
+    layer_show_height("修改合作协议",url,0);
 }
 //-----------------------合作协议 END -----------------------------
 /**
@@ -291,7 +294,7 @@ function delTableByTr($this,type) {
     if(type == 1 && $("#add_contact").find("tr").length < 2){
         vailErrorMsg_3($("#add_contact_make"),"必须要有一个对接人");
     }else if(type == 2 && $("#add_dealer_channel").find("tr").length < 2){
-        vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个渠道信息");
+        vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个销售渠道");
     }else{
         $this.parents("tr").remove();
     }
@@ -361,22 +364,24 @@ $(function(){
                 $("#add_dealer_channel").find("tr").each(function () {
                     var $contact = $(this);
                     var channel = new Object();
+                    channel.dealChannelName = $contact.find(".dealChannelName").text();
                     channel.dealChannelId = $contact.find(".dealChannelId").val();
                     channel.dealChannelIdStr = $contact.find(".dealChannelIdStr").val();
                     channel.channelId= $contact.find(".channelId").val();
                     channel.channelTypeId= $contact.find(".channelTypeId").val();
-                    channel.storeId=$contact.find(".storeId").val();
+                    //channel.storeId=$contact.find(".storeId").val();
+                    channel.storeIdStr=$contact.find(".storeIdStr").val();
                     channel.dealChannelAccountPeriod=$contact.find(".dealChannelAccountPeriod").text();
                     channelArray.push(channel);
                 });
                 if(channelArray.length > 0){
                     $("#add_dealer_channel_json").val(JSON.stringify(channelArray));
                 }else{
-                    vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个渠道信息");
+                    vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个销售渠道");
                     return false;
                 }
             }else{
-                vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个渠道信息");
+                vailErrorMsg_3($("#add_dealer_channel_make"),"必须要有一个销售渠道");
                 return false;
             }