Преглед изворни кода

Merge remote-tracking branch 'origin/developer' into developerB

zhijiezhao пре 2 година
родитељ
комит
bfb8714461
20 измењених фајлова са 1557 додато и 67 уклоњено
  1. 22 1
      src/main/java/com/caimei/modules/coupon/dao/CmCouponDao.java
  2. 10 1
      src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java
  3. 9 0
      src/main/java/com/caimei/modules/coupon/entity/CmVipCoupon.java
  4. 9 0
      src/main/java/com/caimei/modules/coupon/entity/SvipCouponForm.java
  5. 288 2
      src/main/java/com/caimei/modules/coupon/service/CmVipCouponService.java
  6. 40 0
      src/main/java/com/caimei/modules/coupon/web/CmVipCouponController.java
  7. 3 3
      src/main/java/com/caimei/modules/supers/service/CmSvipPackageService.java
  8. 10 1
      src/main/java/com/caimei/modules/user/entity/ClubTemporary.java
  9. 1 1
      src/main/java/com/caimei/modules/user/entity/CmUser.java
  10. 4 0
      src/main/java/com/caimei/modules/user/service/ClubTemporaryService.java
  11. 16 14
      src/main/java/com/caimei/modules/user/service/CmBehaviorRecordService.java
  12. 10 4
      src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java
  13. 96 4
      src/main/resources/mappings/modules/coupon/CmCouponMapper.xml
  14. 24 20
      src/main/resources/mappings/modules/user/ClubTemporaryMapper.xml
  15. 8 8
      src/main/webapp/WEB-INF/views/modules/super/cmSvipPackageForm.jsp
  16. 980 0
      src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponConfiguration.jsp
  17. 9 2
      src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponForm.jsp
  18. 4 3
      src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponList.jsp
  19. 8 1
      src/main/webapp/WEB-INF/views/modules/user/clubTemporaryForm.jsp
  20. 6 2
      src/main/webapp/WEB-INF/views/modules/userNew/recordLinkageForm.jsp

+ 22 - 1
src/main/java/com/caimei/modules/coupon/dao/CmCouponDao.java

@@ -88,4 +88,25 @@ public interface CmCouponDao extends CrudDao<CmCoupon> {
     void updateClubCoupon(@Param("clubCouponId") Integer clubCouponId, @Param("orderId") Integer orderId);
 
     List<CmCoupon> findCouponList(@Param("userId")Integer userId,@Param("moneyCouponFlag")Integer moneyCouponFlag);
-}
+
+    List<CmCoupon> selconfigure();
+
+    Integer selCouponId(@Param("couponId") String couponId);
+    /**
+     * 专属优惠券配置插入
+     * @param cmCoupon
+     */
+    /*void insertConfigure(CmCoupon cmCoupon);
+
+    *//**
+     * 专属优惠券配置修改
+     * @param cmCoupon
+     *//*
+    void updateConfigure(CmCoupon cmCoupon);
+
+    List<Integer> configureCouponId(String couponId);
+
+    void insertCouponConfigure(CmCouponAssociate associate);
+
+    void updateCouponConfigure(CmCouponAssociate a);*/
+}

+ 10 - 1
src/main/java/com/caimei/modules/coupon/entity/CmCoupon.java

@@ -57,6 +57,7 @@ public class CmCoupon extends DataEntity<CmCoupon> {
     private Integer useTimeFlag; // 使用期限同上下架时间
     private Date receiveDate;   // 领取时间
     private Date useEndDate;    // 使用截止时间
+    private Integer configure;  // 专属优惠券配置  1是、0否
 
     public CmCoupon() {
         super();
@@ -386,4 +387,12 @@ public class CmCoupon extends DataEntity<CmCoupon> {
     public void setUseEndDate(Date useEndDate) {
         this.useEndDate = useEndDate;
     }
-}
+
+    public Integer getConfigure() {
+        return configure;
+    }
+
+    public void setConfigure(Integer configure) {
+        this.configure = configure;
+    }
+}

+ 9 - 0
src/main/java/com/caimei/modules/coupon/entity/CmVipCoupon.java

@@ -16,6 +16,7 @@ public class CmVipCoupon extends DataEntity<CmVipCoupon> {
     private String id;
     /** 生效月份 */
     private String useTime;
+    private String endTime;
     /**
      * 0未生效 1已生效 2已关闭 3已失效
      */
@@ -61,6 +62,14 @@ public class CmVipCoupon extends DataEntity<CmVipCoupon> {
         this.useTime = useTime;
     }
 
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
     public String getStatus() {
         return status;
     }

+ 9 - 0
src/main/java/com/caimei/modules/coupon/entity/SvipCouponForm.java

@@ -19,6 +19,7 @@ public class SvipCouponForm extends DataEntity<SvipCouponForm> {
      * 月份
      */
     private String month;
+    private String endMonth;
 
     private String status;
 
@@ -356,6 +357,14 @@ public class SvipCouponForm extends DataEntity<SvipCouponForm> {
         this.month = month;
     }
 
+    public String getEndMonth() {
+        return endMonth;
+    }
+
+    public void setEndMonth(String endMonth) {
+        this.endMonth = endMonth;
+    }
+
     public String getCouponType1() {
         return couponType1;
     }

+ 288 - 2
src/main/java/com/caimei/modules/coupon/service/CmVipCouponService.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.coupon.service;
 
+import com.alibaba.fastjson.JSON;
 import com.caimei.modules.coupon.dao.CmCouponDao;
 import com.caimei.modules.coupon.dao.CmCouponVipDao;
 import com.caimei.modules.coupon.entity.*;
@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -37,6 +39,17 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
     public CmVipCoupon get(String id) {
         CmVipCoupon vipCoupon = super.get(id);
         if (null != vipCoupon) {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+            try {
+                Date parse = simpleDateFormat.parse(vipCoupon.getUseTime());
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(parse);
+                calendar.add(Calendar.MONTH,2);
+                Date time = calendar.getTime();
+                vipCoupon.setEndTime(simpleDateFormat.format(time));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
             setVipCouponStatus(vipCoupon);
             List<CmCoupon> couponList = new ArrayList<>();
             List<String> bindCoupons = cmCouponVipDao.getBindCoupons(id);
@@ -51,9 +64,21 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
 
     @Override
     public Page<CmVipCoupon> findPage(Page<CmVipCoupon> page, CmVipCoupon cmVipCoupon) {
-        Page<CmVipCoupon> vipPage = super.findPage(page, cmVipCoupon);
+        CmVipCoupon couponEnt = quarter(cmVipCoupon);
+        Page<CmVipCoupon> vipPage = super.findPage(page, couponEnt);
         List<CmVipCoupon> cmVipCouponList = vipPage.getList();
         cmVipCouponList.forEach(vipCoupon -> {
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+            try {
+                Date parse = simpleDateFormat.parse(vipCoupon.getUseTime());
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(parse);
+                calendar.add(Calendar.MONTH,2);
+                Date time = calendar.getTime();
+                vipCoupon.setEndTime(simpleDateFormat.format(time));
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
             setVipCouponStatus(vipCoupon);
             List<String> bindCoupons = cmCouponVipDao.getBindCoupons(vipCoupon.getId());
             List<CmCoupon> couponList = cmCouponVipDao.getCouponListByIds(bindCoupons, cmVipCoupon.getCouponType(), cmVipCoupon.getStatus());
@@ -75,11 +100,23 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
                 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
                 String current = df.format(new Date());
                 String useTime = vipCoupon.getUseTime();
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
+                try {
+                    Date parse = simpleDateFormat.parse(vipCoupon.getUseTime());
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(parse);
+                    calendar.add(Calendar.MONTH,2);
+                    Date time = calendar.getTime();
+                    vipCoupon.setEndTime(simpleDateFormat.format(time));
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+                String endTime = vipCoupon.getEndTime();
                 // 0未生效 1已生效 2已关闭 3已失效
                 if (df.parse(useTime).after(df.parse(current))) {
                     // 未生效
                     vipCoupon.setStatus("0");
-                } else if (df.parse(useTime).before(df.parse(current))) {
+                } else if (df.parse(endTime).before(df.parse(current))) {
                     // 已失效
                     vipCoupon.setStatus("3");
                 } else {
@@ -98,6 +135,7 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
     public SvipCouponForm setSvipcouponForms(CmVipCoupon cmVipCoupon){
         SvipCouponForm svipcouponForm = new SvipCouponForm();
         svipcouponForm.setMonth(cmVipCoupon.getUseTime());
+        svipcouponForm.setEndMonth(cmVipCoupon.getEndTime());
         if (null != cmVipCoupon.getCouponList()){
             List<CmCoupon> couponList = cmVipCoupon.getCouponList();
             for (int i = 0; i < couponList.size(); i++) {
@@ -370,6 +408,205 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
             cmCouponVipDao.updateVipCouponRelation(relation4);
         }
     }
+    /**
+     * 设置优惠券配置4张券的表单数据
+     */
+    public SvipCouponForm setSvipcouponConfigure(){
+        SvipCouponForm svipcouponForm = new SvipCouponForm();
+        List<CmCoupon> couponList = cmCouponDao.selconfigure();
+        if (0 != couponList.size()){
+
+            for (int i = 0; i < couponList.size(); i++) {
+                setSvipcouponForm(svipcouponForm, i, couponList.get(i));
+            }
+        }
+        return svipcouponForm;
+    }
+
+    @Transactional(readOnly = false)
+    public void saveConfigure(SvipCouponForm svipcouponForm) {
+        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
+        String current = df.format(new Date());
+        svipcouponForm.setMonth(current);
+        Integer integer = cmCouponDao.selCouponId(svipcouponForm.getCouponId1());
+        String id = "";
+        if (integer == null) {
+            id = null;
+        } else {
+            id = String.valueOf(integer);
+        }
+        CmVipCoupon cmVipCoupon = new CmVipCoupon();
+        cmVipCoupon.setId(id);
+        cmVipCoupon.setUseTime(svipcouponForm.getMonth());
+        cmVipCoupon.setUpdateTime(new Date());
+        cmVipCoupon.setStatus("1");
+        cmVipCoupon.setDelFlag("1");
+        setVipCouponStatus(cmVipCoupon);
+        // 解析 svipcouponForm -> 组装 CmCoupon 列表 保存
+        CmCoupon coupon1 = new CmCoupon();
+        CmCoupon coupon2 = new CmCoupon();
+        CmCoupon coupon3 = new CmCoupon();
+        CmCoupon coupon4 = new CmCoupon();
+        boolean flag = false;
+        if(StringUtils.isNotBlank(cmVipCoupon.getId())){
+            // 修改
+            coupon1.setId(svipcouponForm.getCouponId1());
+            coupon2.setId(svipcouponForm.getCouponId2());
+            coupon3.setId(svipcouponForm.getCouponId3());
+            coupon4.setId(svipcouponForm.getCouponId4());
+            cmCouponVipDao.updateVipCouponMonth(cmVipCoupon);
+        } else {
+            // 新增
+            flag = true;
+            cmCouponVipDao.insertVipCouponMonth(cmVipCoupon);
+        }
+        Date beginTime = DateUtil.getMinDay(svipcouponForm.getMonth());
+        Date endTime = DateUtil.getMaxDay(svipcouponForm.getMonth());
+        /*
+         * 第1张券
+         */
+        coupon1.setName("超级会员优惠券"+svipcouponForm.getMonth());
+        coupon1.setStartDate(beginTime);
+        coupon1.setEndDate(endTime);
+        coupon1.setCouponAmount(svipcouponForm.getCouponAmount1());
+        coupon1.setTouchPrice(svipcouponForm.getTouchPrice1());
+        coupon1.setStatus("1");
+        coupon1.setVipFlag(1);
+        coupon1.setConfigure(1);
+        // 0活动券 1品类券 3店铺券
+        if ("0".equals(svipcouponForm.getCouponType1())){
+            coupon1.setCouponType(0);
+            coupon1.setProductType(svipcouponForm.getProductType1());
+            if ("2".equals(svipcouponForm.getProductType1())){
+                // 指定商品
+                coupon1.setProductInfo(svipcouponForm.getProductInfo1());
+            }
+        } else if ("1".equals(svipcouponForm.getCouponType1())) {
+            coupon1.setCategoryType(svipcouponForm.getCategoryType1());
+            coupon1.setCouponType(1);
+        } else if ("3".equals(svipcouponForm.getCouponType1())) {
+            coupon1.setShopId(svipcouponForm.getShopId1());
+            coupon1.setCouponType(3);
+        }
+        cmCouponService.save(coupon1);
+        /*
+         * 第2张券
+         */
+        coupon2.setName("超级会员优惠券"+svipcouponForm.getMonth());
+        coupon2.setStartDate(beginTime);
+        coupon2.setEndDate(endTime);
+        coupon2.setCouponAmount(svipcouponForm.getCouponAmount2());
+        coupon2.setTouchPrice(svipcouponForm.getTouchPrice2());
+        coupon2.setStatus("1");
+        coupon2.setVipFlag(1);
+        coupon2.setConfigure(1);
+        // 0活动券 1品类券 3店铺券
+        if ("0".equals(svipcouponForm.getCouponType2())){
+            coupon2.setCouponType(0);
+            coupon2.setProductType(svipcouponForm.getProductType2());
+            if ("2".equals(svipcouponForm.getProductType2())){
+                // 指定商品
+                coupon2.setProductInfo(svipcouponForm.getProductInfo2());
+            }
+        } else if ("1".equals(svipcouponForm.getCouponType2())) {
+            coupon2.setCategoryType(svipcouponForm.getCategoryType2());
+            coupon2.setCouponType(1);
+        } else if ("3".equals(svipcouponForm.getCouponType2())) {
+            coupon2.setShopId(svipcouponForm.getShopId2());
+            coupon2.setCouponType(3);
+        }
+        cmCouponService.save(coupon2);
+        /*
+         * 第3张券
+         */
+        coupon3.setName("超级会员优惠券"+svipcouponForm.getMonth());
+        coupon3.setStartDate(beginTime);
+        coupon3.setEndDate(endTime);
+        coupon3.setCouponAmount(svipcouponForm.getCouponAmount3());
+        coupon3.setTouchPrice(svipcouponForm.getTouchPrice3());
+        coupon3.setStatus("1");
+        coupon3.setVipFlag(1);
+        coupon3.setConfigure(1);
+        // 0活动券 1品类券 3店铺券
+        if ("0".equals(svipcouponForm.getCouponType3())){
+            coupon3.setCouponType(0);
+            coupon3.setProductType(svipcouponForm.getProductType3());
+            if ("2".equals(svipcouponForm.getProductType3())){
+                // 指定商品
+                coupon3.setProductInfo(svipcouponForm.getProductInfo3());
+            }
+        } else if ("1".equals(svipcouponForm.getCouponType3())) {
+            coupon3.setCategoryType(svipcouponForm.getCategoryType3());
+            coupon3.setCouponType(1);
+        } else if ("3".equals(svipcouponForm.getCouponType3())) {
+            coupon3.setShopId(svipcouponForm.getShopId3());
+            coupon3.setCouponType(3);
+        }
+        cmCouponService.save(coupon3);
+        /*
+         * 第4张券
+         */
+        coupon4.setName("超级会员优惠券"+svipcouponForm.getMonth());
+        coupon4.setStartDate(beginTime);
+        coupon4.setEndDate(endTime);
+        coupon4.setCouponAmount(svipcouponForm.getCouponAmount4());
+        coupon4.setTouchPrice(svipcouponForm.getTouchPrice4());
+        coupon4.setStatus("1");
+        coupon4.setVipFlag(1);
+        coupon4.setConfigure(1);
+        // 0活动券 1品类券 3店铺券
+        if ("0".equals(svipcouponForm.getCouponType4())){
+            coupon4.setCouponType(0);
+            coupon4.setProductType(svipcouponForm.getProductType4());
+            if ("2".equals(svipcouponForm.getProductType4())){
+                // 指定商品
+                coupon4.setProductInfo(svipcouponForm.getProductInfo4());
+            }
+        } else if ("1".equals(svipcouponForm.getCouponType4())) {
+            coupon4.setCategoryType(svipcouponForm.getCategoryType4());
+            coupon4.setCouponType(1);
+        } else if ("3".equals(svipcouponForm.getCouponType4())) {
+            coupon4.setShopId(svipcouponForm.getShopId4());
+            coupon4.setCouponType(3);
+        }
+        cmCouponService.save(coupon4);
+        /*
+         * vip优惠券月份关系
+         */
+        CmVipCouponRelation relation1 = new CmVipCouponRelation();
+        CmVipCouponRelation relation2 = new CmVipCouponRelation();
+        CmVipCouponRelation relation3 = new CmVipCouponRelation();
+        CmVipCouponRelation relation4 = new CmVipCouponRelation();
+        relation1.setMontId(cmVipCoupon.getId());
+        relation2.setMontId(cmVipCoupon.getId());
+        relation3.setMontId(cmVipCoupon.getId());
+        relation4.setMontId(cmVipCoupon.getId());
+        relation1.setCouponId(coupon1.getId());
+        relation2.setCouponId(coupon2.getId());
+        relation3.setCouponId(coupon3.getId());
+        relation4.setCouponId(coupon4.getId());
+        relation1.setUpdateTime(new Date());
+        relation2.setUpdateTime(new Date());
+        relation3.setUpdateTime(new Date());
+        relation4.setUpdateTime(new Date());
+        relation1.setDelFlag("0");
+        relation2.setDelFlag("0");
+        relation3.setDelFlag("0");
+        relation4.setDelFlag("0");
+        if (flag) {
+            // 新增
+            cmCouponVipDao.insertVipCouponRelation(relation1);
+            cmCouponVipDao.insertVipCouponRelation(relation2);
+            cmCouponVipDao.insertVipCouponRelation(relation3);
+            cmCouponVipDao.insertVipCouponRelation(relation4);
+        } else {
+            // 修改
+            cmCouponVipDao.updateVipCouponRelation(relation1);
+            cmCouponVipDao.updateVipCouponRelation(relation2);
+            cmCouponVipDao.updateVipCouponRelation(relation3);
+            cmCouponVipDao.updateVipCouponRelation(relation4);
+        }
+    }
 
     @Override
     @Transactional(readOnly = false)
@@ -412,4 +649,53 @@ public class CmVipCouponService extends CrudService<CmCouponVipDao, CmVipCoupon>
     public List<String> getAllUseDateList(){
         return cmCouponVipDao.getAllUseDateList();
     };
+
+    /**
+     * 查询条件 优惠月份季度调整
+     * @param cmVipCoupon
+     * @return
+     */
+    public CmVipCoupon quarter(CmVipCoupon cmVipCoupon) {
+        String startDate  = "";
+        String endDate  = "";
+        String year = "";
+        String month = "";
+        if (com.thinkgem.jeesite.common.utils.StringUtils.isNotEmpty(cmVipCoupon.getStartDate())) {
+            year = cmVipCoupon.getStartDate().substring(0,cmVipCoupon.getStartDate().length() - 2);
+            month = cmVipCoupon.getStartDate().substring(cmVipCoupon.getStartDate().length() - 2);
+            if (month.equals("01") || month.equals("02") || month.equals("03")) {
+                month = "01";
+            }
+            if (month.equals("04") || month.equals("05") || month.equals("06")) {
+                month = "04";
+            }
+            if (month.equals("07") || month.equals("08") || month.equals("09")) {
+                month = "07";
+            }
+            if (month.equals("10") || month.equals("11") || month.equals("12")) {
+                month = "10";
+            }
+            startDate = year + month;
+        }
+        if (com.thinkgem.jeesite.common.utils.StringUtils.isNotEmpty(cmVipCoupon.getEndDate())) {
+            year = cmVipCoupon.getEndDate().substring(0,cmVipCoupon.getEndDate().length() - 2);
+            month = cmVipCoupon.getEndDate().substring(cmVipCoupon.getEndDate().length() - 2);
+            if (month.equals("01") || month.equals("02") || month.equals("03")) {
+                month = "03";
+            }
+            if (month.equals("04") || month.equals("05") || month.equals("06")) {
+                month = "06";
+            }
+            if (month.equals("07") || month.equals("08") || month.equals("09")) {
+                month = "09";
+            }
+            if (month.equals("10") || month.equals("11") || month.equals("12")) {
+                month = "12";
+            }
+            endDate = year + month;
+        }
+        cmVipCoupon.setStartDate(startDate);
+        cmVipCoupon.setEndDate(endDate);
+        return cmVipCoupon;
+    }
 }

+ 40 - 0
src/main/java/com/caimei/modules/coupon/web/CmVipCouponController.java

@@ -18,6 +18,8 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -45,13 +47,18 @@ public class CmVipCouponController extends BaseController {
 
     @RequestMapping(value = {"list", ""})
     public String list(CmVipCoupon cmVipCoupon, HttpServletRequest request, HttpServletResponse response, Model model) {
+        String startDate = cmVipCoupon.getStartDate();
+        String endDate = cmVipCoupon.getEndDate();
         Page<CmVipCoupon> page = cmVipCouponService.findPage(new Page<CmVipCoupon>(request, response), cmVipCoupon);
+        cmVipCoupon.setStartDate(startDate);
+        cmVipCoupon.setEndDate(endDate);
         model.addAttribute("page", page);
         return "modules/svip/cmSvipCouponList";
     }
 
     @RequestMapping(value = "form")
     public String form(CmVipCoupon cmVipCoupon, Model model) {
+//        cmVipCoupon.setEndTime(cmVipCoupon.getEndTime());
         model.addAttribute("cmVipCoupon", cmVipCoupon);
         // 设置4张券的表单
         SvipCouponForm svipcouponForm = cmVipCouponService.setSvipcouponForms(cmVipCoupon);
@@ -61,6 +68,17 @@ public class CmVipCouponController extends BaseController {
         return "modules/svip/cmSvipCouponForm";
     }
 
+    /**
+     * 专属优惠券配置
+     * @return
+     */
+    @RequestMapping(value = "configuration")
+    public String configuration(Model model) {
+        SvipCouponForm svipcouponForm = cmVipCouponService.setSvipcouponConfigure();
+
+        model.addAttribute("svipcouponForm",svipcouponForm);
+        return "modules/svip/cmSvipCouponConfiguration";
+    }
     /**
      * 保存
      *
@@ -86,6 +104,28 @@ public class CmVipCouponController extends BaseController {
         return "redirect:" + Global.getAdminPath() + "/vip/cmCoupon/?repage";
     }
 
+    /**
+     * 专属优惠券保存
+     * @param svipcouponForm
+     * @param model
+     * @param redirectAttributes
+     * @return
+     * @throws ParseException
+     */
+    @RequestMapping(value = "saveConfigure")
+    public String configureSave(SvipCouponForm svipcouponForm, Model model, RedirectAttributes redirectAttributes) throws ParseException {
+        if (StringUtils.isNotBlank(svipcouponForm.getCouponId1())) {
+            // 修改
+            cmVipCouponService.saveConfigure(svipcouponForm);
+            addMessage(redirectAttributes, "超级会员专属优惠券配置修改成功");
+        } else {
+            // 新增
+            cmVipCouponService.saveConfigure(svipcouponForm);
+            addMessage(redirectAttributes, "超级会员专属优惠券配置新增成功");
+        }
+        return "redirect:" + Global.getAdminPath() + "/vip/cmCoupon/?repage";
+    }
+
     @RequestMapping(value = "close")
     public String close(CmVipCoupon cmVipCoupon, RedirectAttributes redirectAttributes) {
         cmVipCouponService.close(cmVipCoupon);

+ 3 - 3
src/main/java/com/caimei/modules/supers/service/CmSvipPackageService.java

@@ -81,12 +81,12 @@ public class CmSvipPackageService extends CrudService<CmSvipPackageDao, CmSvipPa
         //1套餐12,2套餐3月,3套餐1月
         Double price1 = Double.valueOf(cmSvipPackage.getPrice1());
         Double price2 = Double.valueOf(cmSvipPackage.getPrice2());
-        Double price3 = Double.valueOf(cmSvipPackage.getPrice3());
+//        Double price3 = Double.valueOf(cmSvipPackage.getPrice3());
         String p = cmSvipPackage.getProportion();
         Integer proportion = Integer.valueOf(p);
         dao.updatePrice(price1, 12, proportion);
         dao.updatePrice(price2, 3, proportion);
-        dao.updatePrice(price3, 1, proportion);
+//        dao.updatePrice(price3, 1, proportion);
     }
 
     @Transactional(readOnly = false)
@@ -94,4 +94,4 @@ public class CmSvipPackageService extends CrudService<CmSvipPackageDao, CmSvipPa
         super.delete(cmSvipPackage);
     }
 
-}
+}

+ 10 - 1
src/main/java/com/caimei/modules/user/entity/ClubTemporary.java

@@ -22,6 +22,7 @@ public class ClubTemporary extends DataEntity<ClubTemporary> {
     private String bindMobile;        // 企业绑定手机号
     private String contractEmail;        // 联系邮箱
     private String linkMan;        // 联系人
+    private String linkManIdentity;        // 联系人
     private Integer provinceId;        // 省id
     private Integer cityId;        // 市id
     private Integer townId;        // 地址Id
@@ -124,6 +125,14 @@ public class ClubTemporary extends DataEntity<ClubTemporary> {
         this.linkMan = linkMan;
     }
 
+    public String getLinkManIdentity() {
+        return linkManIdentity;
+    }
+
+    public void setLinkManIdentity(String linkManIdentity) {
+        this.linkManIdentity = linkManIdentity;
+    }
+
     public Integer getProvinceId() {
         return provinceId;
     }
@@ -299,4 +308,4 @@ public class ClubTemporary extends DataEntity<ClubTemporary> {
     public void setImages(String[] images) {
         this.images = images;
     }
-}
+}

+ 1 - 1
src/main/java/com/caimei/modules/user/entity/CmUser.java

@@ -861,4 +861,4 @@ public class CmUser extends DataEntity<CmUser> {
     public void setStoreStatus(boolean storeStatus) {
         this.storeStatus = storeStatus;
     }
-}
+}

+ 4 - 0
src/main/java/com/caimei/modules/user/service/ClubTemporaryService.java

@@ -129,6 +129,10 @@ public class ClubTemporaryService extends CrudService<ClubTemporaryDao, ClubTemp
             club.setContractMobile(clubTemporary.getBindMobile());
             // 联系人
             club.setLinkMan(clubTemporary.getLinkMan());
+            // 联系人身份
+            if (StringUtils.isNotBlank(clubTemporary.getLinkManIdentity())) {
+                club.setLinkManIdentity(Integer.parseInt(clubTemporary.getLinkManIdentity()));
+            }
             // 用户Id
             club.setUserID(user.getUserID());
             // 设置协销ID

+ 16 - 14
src/main/java/com/caimei/modules/user/service/CmBehaviorRecordService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.caimei.modules.user.dao.CmBehaviorRecordDao;
 import com.caimei.modules.user.entity.CmBehaviorRecord;
 import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtils;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import okhttp3.OkHttpClient;
@@ -152,22 +153,23 @@ public class CmBehaviorRecordService extends CrudService<CmBehaviorRecordDao, Cm
         cmBehaviorRecord.setPage(page);
 
         // 机构用户行为详情
-        List<CmBehaviorRecord> behaviorAgencyList = cmBehaviorRecordDao.behaviorAgency(cmBehaviorRecord);
-
-        for (CmBehaviorRecord record: behaviorAgencyList) {
-            record.setProductImage(AppUtils.getImageURL("product", record.getProductImage(), 0, ""));
-            String time = calculationTime(record.getAccessDuration());
-            record.setAccessDuration(time);
-            String decode = null;
-            try {
-                decode = URLDecoder.decode(record.getPagePath(),"UTF-8");
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
+        if (StringUtils.isNotBlank(cmBehaviorRecord.getIP())) {
+            List<CmBehaviorRecord> behaviorAgencyList = cmBehaviorRecordDao.behaviorAgency(cmBehaviorRecord);
+
+            for (CmBehaviorRecord record : behaviorAgencyList) {
+                record.setProductImage(AppUtils.getImageURL("product", record.getProductImage(), 0, ""));
+                String time = calculationTime(record.getAccessDuration());
+                record.setAccessDuration(time);
+                String decode = null;
+                try {
+                    decode = URLDecoder.decode(record.getPagePath(), "UTF-8");
+                } catch (UnsupportedEncodingException e) {
+                    e.printStackTrace();
+                }
+                record.setPagePath(decode);
             }
-            record.setPagePath(decode);
+            page.setList(behaviorAgencyList);
         }
-
-        page.setList(behaviorAgencyList);
         return page;
     }
 

+ 10 - 4
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -1245,23 +1245,25 @@ private VisitRemarkDao visitRemarkDao;
             }
         }
         Page<CmBehaviorRecord> page = cmBehaviorRecordService.behaviorAgencyPage(new Page<>(request, response), record);
+        String masBehavior = "";
         List<CmBehaviorRecord> list = page.getList();
         for (int i = 0; i <= list.size()-1; i++) {
-            describe += list.get(i).getPageLabel();
+            masBehavior += list.get(i).getPageLabel();
             if (list.size()-1 != i) {
-                describe += ",";
+                masBehavior += ",";
             }
         }
         model.addAttribute("page",page);
         model.addAttribute("link",link);
         model.addAttribute("linkage",linkage);
         model.addAttribute("describe",describe);
+        model.addAttribute("masBehavior",masBehavior);
         model.addAttribute("clubId", clubId);
         return "modules/userNew/recordLinkageForm";
     }
 
     @RequestMapping("recordLinkageSave")
-    public String RecordLinkageSave(String describe,String link,Integer clubId,HttpServletRequest request, HttpServletResponse response, Model model,RedirectAttributes redirectAttributes) {
+    public String RecordLinkageSave(String describe,String masBehavior,String link,Integer clubId,HttpServletRequest request, HttpServletResponse response, Model model,RedirectAttributes redirectAttributes) {
         model.addAttribute("clubId", clubId);
 
         if(domain.contains("-b")){
@@ -1272,7 +1274,11 @@ private VisitRemarkDao visitRemarkDao;
             link="http://localhost:8081/clubinfo.html?clubId="+clubId;
         }
 //        StringSelection stsel = new StringSelection(link);
-        newCmClubDao.addRecordLinkage(describe,link,clubId);
+        String replace = describe;
+        if (describe.contains(masBehavior)) {
+            replace = describe.replace(masBehavior, "");
+        }
+        newCmClubDao.addRecordLinkage(replace,link,clubId);
         logger.info(">>>>>>>>>>>生成记录链接");
         addMessage(redirectAttributes, "链接已生成并自动复制,可直接粘贴");
 //        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stsel, stsel);

+ 96 - 4
src/main/resources/mappings/modules/coupon/CmCouponMapper.xml

@@ -168,7 +168,8 @@
 			moneyCouponPrice,
 			moneyCouponFlag,
 			moneyCouponType,
-			delFlag
+			delFlag,
+			configure
 		) VALUES (
 			#{name},
 		    #{couponPayWay},
@@ -194,7 +195,8 @@
 		    #{moneyCouponPrice},
 		    #{moneyCouponFlag},
 			#{moneyCouponType},
-			#{delFlag}
+			#{delFlag},
+		    #{configure}
 		)
 	</insert>
 
@@ -221,7 +223,8 @@
 			categoryType = #{categoryType},
 			couponsMode = #{couponsMode},
 			moneyCouponPrice = #{moneyCouponPrice},
-			moneyCouponType = #{moneyCouponType}
+			moneyCouponType = #{moneyCouponType},
+			configure = #{configure}
 		WHERE id = #{id}
 	</update>
 
@@ -569,4 +572,93 @@
 		  id = #{clubCouponId}
 	</update>
 
-</mapper>
+	<select id="selconfigure" resultType="com.caimei.modules.coupon.entity.CmCoupon">
+		SELECT <include refid="cmCouponColumns"/> FROM cm_coupon a WHERE configure = 1
+	</select>
+	<select id="selCouponId" resultType="integer">
+		SELECT cscm.id as id FROM cm_svip_coupon_month cscm LEFT JOIN cm_svip_coupon csc ON csc.montId = cscm.id WHERE csc.couponId = #{couponId}
+	</select>
+	<!--<insert id="insertConfigure">
+		INSERT INTO cm_coupon_configure(
+			name,
+			couponPayWay,
+			couponAmount,
+			touchPrice,
+			startDate,
+			endDate,
+			receivePeriod,
+			receiveFlag,
+			useTimeFlag,
+			usePeriod,
+			status,
+			couponType,
+			vipFlag,
+			userId,
+			shopId,
+			productType,
+			pcBanner,
+			appletsBanner,
+			categoryType,
+			couponsMode,
+			createDate,
+			moneyCouponPrice,
+			moneyCouponFlag,
+			moneyCouponType,
+			delFlag
+		) VALUES (
+			 #{name},
+			 #{couponPayWay},
+			 #{couponAmount},
+			 #{touchPrice},
+			 #{startDate},
+			 #{endDate},
+			 #{receivePeriod},
+			 #{receiveFlag},
+			 #{useTimeFlag},
+			 #{usePeriod},
+			 #{status},
+			 #{couponType},
+			 #{vipFlag},
+			 #{userId},
+			 #{shopId},
+			 #{productType},
+			 #{pcBanner},
+			 #{appletsBanner},
+			 #{categoryType},
+			 #{couponsMode},
+			 #{createDate},
+			 #{moneyCouponPrice},
+			 #{moneyCouponFlag},
+			 #{moneyCouponType},
+			 #{delFlag}
+		 )
+	</insert>
+	<update id="updateConfigure">
+		UPDATE cm_coupon_configure SET
+		 name = #{name},
+		 couponPayWay = #{couponPayWay},
+		 couponAmount = #{couponAmount},
+		 touchPrice = #{touchPrice},
+		 startDate = #{startDate},
+		 endDate = #{endDate},
+		 receivePeriod = #{receivePeriod},
+		 receiveFlag = #{receiveFlag},
+		 useTimeFlag = #{useTimeFlag},
+		 usePeriod = #{usePeriod},
+		 status = #{status},
+		 couponType = #{couponType},
+		 vipFlag = #{vipFlag},
+		 userId = #{userId},
+		 shopId = #{shopId},
+		 productType = #{productType},
+		 pcBanner = #{pcBanner},
+		 appletsBanner = #{appletsBanner},
+		 categoryType = #{categoryType},
+		 couponsMode = #{couponsMode},
+		 moneyCouponPrice = #{moneyCouponPrice},
+		 moneyCouponType = #{moneyCouponType}
+		WHERE id = #{id}
+	</update>-->
+
+
+</mapper>

+ 24 - 20
src/main/resources/mappings/modules/user/ClubTemporaryMapper.xml

@@ -1,7 +1,7 @@
 <?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.caimei.modules.user.dao.ClubTemporaryDao">
-    
+
 	<sql id="clubTemporaryColumns">
 		a.id AS "id",
 		a.userId AS "userId",
@@ -11,6 +11,7 @@
 		a.bindMobile AS "bindMobile",
 		a.contractEmail AS "contractEmail",
 		a.linkMan AS "linkMan",
+		a.linkManIdentity AS "linkManIdentity",
 		a.provinceId AS "provinceId",
 		a.cityId AS "cityId",
 		a.townId AS "townId",
@@ -28,14 +29,14 @@
 		IFNULL(s.name,s.linkMan) AS "spName",
         if(csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime,1,0) as svipUserFlag
 	</sql>
-	
+
 	<sql id="clubTemporaryJoins">
 		LEFT JOIN serviceprovider s ON s.userID = a.userId
         LEFT JOIN cm_svip_user csu ON csu.userId = a.userId
 	</sql>
-    
+
 	<select id="get" resultType="ClubTemporary">
-		SELECT 
+		SELECT
 			<include refid="clubTemporaryColumns"/>,
 		d.name AS "province",
 		c.name AS "city",
@@ -47,33 +48,33 @@
 		LEFT JOIN province d ON d.provinceID=c.provinceID
 		WHERE a.id = #{id}
 	</select>
-	
+
 	<select id="findList" resultType="ClubTemporary">
-		SELECT 
+		SELECT
 			<include refid="clubTemporaryColumns"/>
 		FROM club_temporary a
 		<include refid="clubTemporaryJoins"/>
 		<where>
 			<if test="name != null and name != ''">
-				AND a.name LIKE 
+				AND a.name LIKE
 					<if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
 					<if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
 			</if>
 			<if test="bindMobile != null and bindMobile != ''">
-				AND a.bindMobile LIKE 
+				AND a.bindMobile LIKE
 					<if test="dbName == 'oracle'">'%'||#{bindMobile}||'%'</if>
 					<if test="dbName == 'mssql'">'%'+#{bindMobile}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{bindMobile},'%')</if>
 			</if>
 			<if test="contractEmail != null and contractEmail != ''">
-				AND a.contractEmail LIKE 
+				AND a.contractEmail LIKE
 					<if test="dbName == 'oracle'">'%'||#{contractEmail}||'%'</if>
 					<if test="dbName == 'mssql'">'%'+#{contractEmail}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{contractEmail},'%')</if>
 			</if>
 			<if test="linkMan != null and linkMan != ''">
-				AND a.linkMan LIKE 
+				AND a.linkMan LIKE
 					<if test="dbName == 'oracle'">'%'||#{linkMan}||'%'</if>
 					<if test="dbName == 'mssql'">'%'+#{linkMan}+'%'</if>
 					<if test="dbName == 'mysql'">concat('%',#{linkMan},'%')</if>
@@ -94,15 +95,15 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<select id="findAllList" resultType="ClubTemporary">
-		SELECT 
+		SELECT
 			<include refid="clubTemporaryColumns"/>
 		FROM club_temporary a
 		<include refid="clubTemporaryJoins"/>
 		<where>
-			
-		</where>		
+
+		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
@@ -111,7 +112,7 @@
 			</otherwise>
 		</choose>
 	</select>
-	
+
 	<insert id="insert" parameterType="ClubTemporary"  keyProperty="id" useGeneratedKeys="true">
 		INSERT INTO club_temporary(
 			id,
@@ -121,6 +122,7 @@
 			bindMobile,
 			contractEmail,
 			linkMan,
+			linkManIdentity,
 			provinceId,
 			cityId,
 			townId,
@@ -143,6 +145,7 @@
 			#{bindMobile},
 			#{contractEmail},
 			#{linkMan},
+			#{linkManIdentity},
 			#{provinceId},
 			#{cityId},
 			#{townId},
@@ -159,9 +162,9 @@
 			#{addTime}
 		)
 	</insert>
-	
+
 	<update id="update">
-		UPDATE club_temporary SET 	
+		UPDATE club_temporary SET
 			userId = #{userId},
 			confirmUserId = #{confirmUserId},
 			name = #{name},
@@ -169,6 +172,7 @@
 			bindMobile = #{bindMobile},
 			contractEmail = #{contractEmail},
 			linkMan = #{linkMan},
+			linkManIdentity = #{linkManIdentity},
 			provinceId = #{provinceId},
 			cityId = #{cityId},
 			townId = #{townId},
@@ -185,7 +189,7 @@
 			addTime = #{addTime}
 		WHERE id = #{id}
 	</update>
-	
+
 	<delete id="delete">
 		DELETE FROM club_temporary
 		WHERE id = #{id}
@@ -232,5 +236,5 @@
 		<include refid="clubTemporaryJoins"/>
 		WHERE a.confirmUserId = #{userId}
 	</select>
-	
-</mapper>
+
+</mapper>

+ 8 - 8
src/main/webapp/WEB-INF/views/modules/super/cmSvipPackageForm.jsp

@@ -19,11 +19,11 @@
                         alert("套餐2售价应为正整数且不能为0,如100");
                         return false;
                     }
-                    var places3 = $(".input-xlarge3").val();
+                    /*var places3 = $(".input-xlarge3").val();
                     if (!(/(^[1-9]\d*$)/.test(places3))) {
                         alert("套餐3售价应为正整数且不能为0,如100");
                         return false;
-                    }
+                    }*/
                     var places4 = $(".input-xlarge4").val();
                     if (!(/(^[1-9]\d*$)/.test(places4))) {
                         alert("美豆比例应为正整数且不能为0,如100");
@@ -55,11 +55,11 @@
                 alert("套餐2售价应为正整数且不能为0,如100");
                 return false;
             }
-            var places3 = $(".input-xlarge3").val();
+            /*var places3 = $(".input-xlarge3").val();
             if (!(/(^[1-9]\d*$)/.test(places3))) {
                 alert("套餐3售价应为正整数且不能为0,如100");
                 return false;
-            }
+            }*/
             var places4 = $(".input-xlarge4").val();
             if (!(/(^[1-9]\d*$)/.test(places4))) {
                 alert("美豆比例应为正整数且不能为0,如100");
@@ -70,7 +70,7 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/super/cmSvipPackage/">超级会员套餐配置</a></li>
+    <li class="active"><a href="${ctx}/super/cmSvipPackage/">超级会员套餐配置</a></li>
 </ul>
 <br/>
 <form:form id="inputForm" modelAttribute="cmSvipPackage" action="${ctx}/super/cmSvipPackage/update" method="post"
@@ -97,12 +97,12 @@
         </div>
     </div>
 
-    <div class="control-group">
+    <%--<div class="control-group">
         <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>套餐3:</label>
         <div class="controls">
             1个月超级会员,售价:<form:input path="price3" htmlEscape="false" class="input-xlarge3" style="width: 60px" onblur="checkNum()"/>
         </div>
-    </div>
+    </div>--%>
     <div class="control-group">
         <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>采美豆兑换套餐:</label>
         <div class="controls">
@@ -114,4 +114,4 @@
     </div>
 </form:form>
 </body>
-</html>
+</html>

+ 980 - 0
src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponConfiguration.jsp

@@ -0,0 +1,980 @@
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<html>
+<head>
+    <title>专属优惠券配置</title>
+    <meta name="decorator" content="default"/>
+    <style>
+        .coupon-wrap {
+            border: 1px solid #aaa;
+            padding: 20px 20px 0;
+            margin-bottom: 20px;
+        }
+        .couponType {
+            margin-right: 15px;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            var dateList = [];
+            if (${not empty useDateList}) {
+                <c:forEach items="${useDateList}" var="date" varStatus="index">
+                dateList.push("${date}");
+                </c:forEach>
+            }
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    if (imageList1.length > 0) {
+                        var productInfo1 = JSON.stringify(imageList1);
+                        $('#productInfo1').val(productInfo1);
+                    }
+                    if (imageList2.length > 0) {
+                        var productInfo2 = JSON.stringify(imageList2);
+                        $('#productInfo2').val(productInfo2);
+                    }
+                    if (imageList3.length > 0) {
+                        var productInfo3 = JSON.stringify(imageList3);
+                        $('#productInfo3').val(productInfo3);
+                    }
+                    if (imageList4.length > 0) {
+                        var productInfo4 = JSON.stringify(imageList4);
+                        $('#productInfo4').val(productInfo4);
+                    }
+                    var couponType1 = $("#couponType1").val();
+                    var shopId1 = $("#shopId1").val();
+                    if (couponType1 == 3) {
+                        if (shopId1 == "" || shopId1 == null) {
+                            alert("店铺券供应商不能为空 !");
+                            return false;
+                        }
+                    }
+                    /*var month = $("#month").val();
+                    // 判断月份 ...
+                    if (month == null || month == "") {
+                        alert("请选择生效时间! ");
+                        return false;
+                    }
+                    var vipId = $("#id").val();
+                    if (!vipId && dateList.indexOf(month)>=0){
+                        alert("已存在该月优惠券,请修改月份!");
+                        return false;
+                    }*/
+                    var couponAmount1 = $("#couponAmount1").val() * 1;
+                    var touchPrice1 = $("#touchPrice1").val() * 1;
+                    if (couponAmount1 == "") {
+                        alertx("【优惠券1】优惠券金额不能为空");
+                        return false;
+                    }
+                    if (touchPrice1 == "") {
+                        alertx("【优惠券1】优惠条件不能为空");
+                        return false;
+                    }
+                    if (couponAmount1 >= touchPrice1) {
+                        alertx("【优惠券1】优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var couponAmount2 = $("#couponAmount2").val() * 1;
+                    var touchPrice2 = $("#touchPrice2").val() * 1;
+                    if (couponAmount2 == "") {
+                        alertx("【优惠券2】优惠券金额不能为空");
+                        return false;
+                    }
+                    if (touchPrice2 == "") {
+                        alertx("【优惠券2】优惠条件不能为空");
+                        return false;
+                    }
+                    if (couponAmount2 >= touchPrice2) {
+                        alertx("【优惠券2】优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var couponAmount3 = $("#couponAmount3").val() * 1;
+                    var touchPrice3 = $("#touchPrice3").val() * 1;
+                    if (couponAmount3 == "") {
+                        alertx("【优惠券3】优惠券金额不能为空");
+                        return false;
+                    }
+                    if (touchPrice3 == "") {
+                        alertx("【优惠券3】优惠条件不能为空");
+                        return false;
+                    }
+                    if (couponAmount3 >= touchPrice3) {
+                        alertx("【优惠券3】优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    var couponAmount4 = $("#couponAmount4").val() * 1;
+                    var touchPrice4 = $("#touchPrice4").val() * 1;
+                    if (couponAmount4 == "") {
+                        alertx("【优惠券4】优惠券金额不能为空");
+                        return false;
+                    }
+                    if (touchPrice4 == "") {
+                        alertx("【优惠券4】优惠条件不能为空");
+                        return false;
+                    }
+                    if (couponAmount4 >= touchPrice4) {
+                        alertx("【优惠券4】优惠券金额必须小于优惠条件金额");
+                        return false;
+                    }
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/vip/cmCoupon/">超级会员专属优惠券</a></li>
+    <li class="active"><a href="${ctx}/vip/cmCoupon/configuration">专属优惠券配置</a></li>
+</ul>
+<form:form id="inputForm" modelAttribute="svipcouponForm" action="${ctx}/vip/cmCoupon/saveConfigure" method="post" class="form-horizontal">
+    <div style="height: 50px; background: #f5f5f5;">
+        <span style="color: red; line-height: 50px; font-size: 15px;">在本页面,对每三个月给超级会员自动发放的优惠券进行配置,配置完成后下一阶段才生效</span>
+    </div>
+    <sys:message content="${message}"/>
+    <form:hidden path="id" value="${cmVipCoupon.id}"/>
+    <div class="coupon-wrap" id="couponWrap1">
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font><b>优惠券1:</b></label>
+            <div class="controls">
+                <form:radiobutton path="couponType1" class="couponType" label="请选择" value="" checked="true"></form:radiobutton>
+                <form:radiobutton path="couponType1" class="couponType" label="活动券" value="0"></form:radiobutton>
+                <form:radiobutton path="couponType1" class="couponType" label="品类券" value="1" onclick="cType(1)"></form:radiobutton>
+                <form:radiobutton path="couponType1" class="couponType" label="店铺券" value="3" onclick="cType(1)"></form:radiobutton>
+            </div>
+        </div>
+        <form:hidden path="couponId1" id="couponId1"/>
+        <div class="control-group coupon-line l0" ${svipcouponForm.couponType1 ne '3' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>供应商:</label>
+            <div class="controls">
+                <a href="javascript:void(0);" onclick="showSelectShop(1)" id="chooseShop1">请选择供应商</a>
+                <form:hidden path="shopId1" id="shopId1"/>
+                <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchShop"></tbody>
+                </table>
+            </div>
+        </div>
+        <div class="control-group coupon-line l1" ${empty svipcouponForm.couponId1 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+            <div class="controls">
+                <form:input path="couponAmount1" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l2" ${empty svipcouponForm.couponId1 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠条件:</label>
+            <div class="controls"> 订单商品总额满
+                <form:input path="touchPrice1" htmlEscape="false" maxlength="20" class="input-medium required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l3" ${svipcouponForm.couponType1 ne '1' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠品类:</label>
+            <div class="controls">
+                <form:radiobutton path="categoryType1" value="1" label="产品"/>
+                <form:radiobutton path="categoryType1" value="2" label="仪器"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l4" ${svipcouponForm.couponType1 ne '0' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠商品:</label>
+            <div class="controls">
+                <form:radiobutton path="productType1" value="1" label="全商城商品" onclick="productShow(value,1)"/>
+                <form:radiobutton path="productType1" value="2" label="指定商品" onclick="productShow(value,1)"/>
+            </div>
+        </div>
+        <div class="productData1" hidden="hidden">
+            <form:hidden path="productInfo1" id="productInfo1"/>
+            <div class="control-group">
+                <input class="btn del" style="width: 50px" onclick="batchDeletion(1)" value="删除"/>
+                <input class="btn btn-primary" style="width: 50px" onclick="showSelectProduct(1)" value="添加"/>
+                <br><br>
+                <table class="contentTableProduct table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchProduct"></tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+
+    <div class="coupon-wrap" id="couponWrap2">
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font><b>优惠券2:</b></label>
+            <div class="controls">
+                <form:radiobutton path="couponType2" class="couponType" label="请选择" value="" checked="true"></form:radiobutton>
+                <form:radiobutton path="couponType2" class="couponType" label="活动券" value="0"></form:radiobutton>
+                <form:radiobutton path="couponType2" class="couponType" label="品类券" value="1" onclick="cType(2)"></form:radiobutton>
+                <form:radiobutton path="couponType2" class="couponType" label="店铺券" value="3" onclick="cType(2)"></form:radiobutton>
+            </div>
+        </div>
+        <form:hidden path="couponId2" id="couponId2"/>
+        <div class="control-group coupon-line l0" ${svipcouponForm.couponType2 ne '3' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>供应商:</label>
+            <div class="controls">
+                <a href="javascript:void(0);" onclick="showSelectShop(2)" id="chooseShop2">请选择供应商</a>
+                <form:hidden path="shopId2" id="shopId2"/>
+                <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchShop"></tbody>
+                </table>
+            </div>
+        </div>
+        <div class="control-group coupon-line l1"  ${empty svipcouponForm.couponId2 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+            <div class="controls">
+                <form:input path="couponAmount2" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l2" ${empty svipcouponForm.couponId2 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠条件:</label>
+            <div class="controls"> 订单商品总额满
+                <form:input path="touchPrice2" htmlEscape="false" maxlength="20" class="input-medium required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l3" ${svipcouponForm.couponType2 ne '1' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠品类:</label>
+            <div class="controls">
+                <form:radiobutton path="categoryType2" value="1" label="产品"/>
+                <form:radiobutton path="categoryType2" value="2" label="仪器"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l4" ${svipcouponForm.couponType2 ne '0' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠商品:</label>
+            <div class="controls">
+                <form:radiobutton path="productType2" value="1" label="全商城商品" onclick="productShow(value,2)"/>
+                <form:radiobutton path="productType2" value="2" label="指定商品" onclick="productShow(value,2)"/>
+            </div>
+        </div>
+        <div class="productData2" hidden="hidden">
+            <form:hidden path="productInfo2" id="productInfo2"/>
+            <div class="control-group">
+                <input class="btn del" style="width: 50px" onclick="batchDeletion(2)" value="删除"/>
+                <input class="btn btn-primary" style="width: 50px" onclick="showSelectProduct(2)" value="添加"/>
+                <br><br>
+                <table class="contentTableProduct table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchProduct"></tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+
+    <div class="coupon-wrap" id="couponWrap3">
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font><b>优惠券3:</b></label>
+            <div class="controls">
+                <form:radiobutton path="couponType3" class="couponType" label="请选择" value="" checked="true"></form:radiobutton>
+                <form:radiobutton path="couponType3" class="couponType" label="活动券" value="0"></form:radiobutton>
+                <form:radiobutton path="couponType3" class="couponType" label="品类券" value="1" onclick="cType(3)"></form:radiobutton>
+                <form:radiobutton path="couponType3" class="couponType" label="店铺券" value="3" onclick="cType(3)"></form:radiobutton>
+            </div>
+        </div>
+        <form:hidden path="couponId3" id="couponId3"/>
+        <div class="control-group coupon-line l0" ${svipcouponForm.couponType3 ne '3' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>供应商:</label>
+            <div class="controls">
+                <a href="javascript:void(0);" onclick="showSelectShop(3)" id="chooseShop3">请选择供应商</a>
+                <form:hidden path="shopId3" id="shopId3"/>
+                <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchShop"></tbody>
+                </table>
+            </div>
+        </div>
+        <div class="control-group coupon-line l1"  ${empty svipcouponForm.couponId3 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+            <div class="controls">
+                <form:input path="couponAmount3" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l2" ${empty svipcouponForm.couponId3 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠条件:</label>
+            <div class="controls"> 订单商品总额满
+                <form:input path="touchPrice3" htmlEscape="false" maxlength="20" class="input-medium required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l3" ${svipcouponForm.couponType3 ne '1' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠品类:</label>
+            <div class="controls">
+                <form:radiobutton path="categoryType3" value="1" label="产品"/>
+                <form:radiobutton path="categoryType3" value="2" label="仪器"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l4" ${svipcouponForm.couponType3 ne '0' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠商品:</label>
+            <div class="controls">
+                <form:radiobutton path="productType3" value="1" label="全商城商品" onclick="productShow(value,3)"/>
+                <form:radiobutton path="productType3" value="2" label="指定商品" onclick="productShow(value,3)"/>
+            </div>
+        </div>
+        <div class="productData3" hidden="hidden">
+            <form:hidden path="productInfo3" id="productInfo3"/>
+            <div class="control-group">
+                <input class="btn del" style="width: 50px" onclick="batchDeletion(3)" value="删除"/>
+                <input class="btn btn-primary" style="width: 50px" onclick="showSelectProduct(3)" value="添加"/>
+                <br><br>
+                <table class="contentTableProduct table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchProduct"></tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+
+    <div class="coupon-wrap" id="couponWrap4">
+        <div class="control-group">
+            <label class="control-label"><font color="red">*</font><b>优惠券4:</b></label>
+            <div class="controls">
+                <form:radiobutton path="couponType4" class="couponType" label="请选择" value="" checked="true"></form:radiobutton>
+                <form:radiobutton path="couponType4" class="couponType" label="活动券" value="0"></form:radiobutton>
+                <form:radiobutton path="couponType4" class="couponType" label="品类券" value="1" onclick="cType(1)"></form:radiobutton>
+                <form:radiobutton path="couponType4" class="couponType" label="店铺券" value="3" onclick="cType(1)"></form:radiobutton>
+            </div>
+        </div>
+        <form:hidden path="couponId4" id="couponId4"/>
+        <div class="control-group coupon-line l0" ${svipcouponForm.couponType4 ne '3' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>供应商:</label>
+            <div class="controls">
+                <a href="javascript:void(0);" onclick="showSelectShop(4)" id="chooseShop4">请选择供应商</a>
+                <form:hidden path="shopId4" id="shopId4"/>
+                <table class="contentTableShop table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchShop"></tbody>
+                </table>
+            </div>
+        </div>
+        <div class="control-group coupon-line l1" ${empty svipcouponForm.couponId4 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠券金额:</label>
+            <div class="controls">
+                <form:input path="couponAmount4" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l2" ${empty svipcouponForm.couponId4 ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠条件:</label>
+            <div class="controls"> 订单商品总额满
+                <form:input path="touchPrice4" htmlEscape="false" maxlength="20" class="input-medium required"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l3" ${svipcouponForm.couponType4 ne '1' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠品类:</label>
+            <div class="controls">
+                <form:radiobutton path="categoryType4" value="1" label="产品"/>
+                <form:radiobutton path="categoryType4" value="2" label="仪器"/>
+            </div>
+        </div>
+        <div class="control-group coupon-line l4" ${svipcouponForm.couponType4 ne '0' ? 'style="display:none"':''}>
+            <label class="control-label"><font color="red">*</font>优惠商品:</label>
+            <div class="controls">
+                <form:radiobutton path="productType4" value="1" label="全商城商品" onclick="productShow(value,4)"/>
+                <form:radiobutton path="productType4" value="2" label="指定商品" onclick="productShow(value,4)"/>
+            </div>
+        </div>
+        <div class="productData4" hidden="hidden">
+            <form:hidden path="productInfo4" id="productInfo4"/>
+            <div class="control-group">
+                <input class="btn del" style="width: 50px" onclick="batchDeletion(4)" value="删除"/>
+                <input class="btn btn-primary" style="width: 50px" onclick="showSelectProduct(4)" value="添加"/>
+                <br><br>
+                <table class="contentTableProduct table table-striped table-bordered table-condensed" hidden="hidden">
+                    <thead></thead>
+                    <tbody class="hotSearchProduct"></tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+<script type="text/javascript">
+    $(".contentTableShop thead").html('<tr><th>供应商名称</th><th>供应商简称</th><th>联系人</th><th>手机号</th><th>操作</th></tr>');
+    $(".contentTableProduct thead").html('<tr><th style="width:20px;"><input class="check-all" type="checkbox" onclick="clickAllSelect(this)"/>全选</th>' +
+        '<th>商品图片</th><th>商品名称</th><th>供应商</th><th>网站状态</th><th>小程序状态</th><th>排序</th><th>添加时间</th><th>操作</th></tr>');
+
+    var productIds1 = '';
+    var productIds2 = '';
+    var productIds3 = '';
+    var productIds4 = '';
+    var imageList1 = [];
+    var imageList2 = [];
+    var imageList3 = [];
+    var imageList4 = [];
+
+    //店铺券供应商回显
+    if (${not empty svipcouponForm.shop1}) {
+        var shop = {
+            "shopId": "${svipcouponForm.shop1.shopID}",
+            "name": "${svipcouponForm.shop1.name}",
+            "sname": "${svipcouponForm.shop1.sname}",
+            "linkMan": "${svipcouponForm.shop1.linkMan}",
+            "contractMobile": "${svipcouponForm.shop1.contractMobile}"
+        }
+        appendShopOrderHead(shop, 1);
+    }
+    if (${not empty svipcouponForm.shop2}) {
+        var shop = {
+            "shopId": "${svipcouponForm.shop2.shopID}",
+            "name": "${svipcouponForm.shop2.name}",
+            "sname": "${svipcouponForm.shop2.sname}",
+            "linkMan": "${svipcouponForm.shop2.linkMan}",
+            "contractMobile": "${svipcouponForm.shop2.contractMobile}"
+        }
+        appendShopOrderHead(shop, 2);
+    }
+    if (${not empty svipcouponForm.shop3}) {
+        var shop = {
+            "shopId": "${svipcouponForm.shop3.shopID}",
+            "name": "${svipcouponForm.shop3.name}",
+            "sname": "${svipcouponForm.shop3.sname}",
+            "linkMan": "${svipcouponForm.shop3.linkMan}",
+            "contractMobile": "${svipcouponForm.shop3.contractMobile}"
+        }
+        appendShopOrderHead(shop, 3);
+    }
+    if (${not empty svipcouponForm.shop4}) {
+        var shop = {
+            "shopId": "${svipcouponForm.shop4.shopID}",
+            "name": "${svipcouponForm.shop4.name}",
+            "sname": "${svipcouponForm.shop4.sname}",
+            "linkMan": "${svipcouponForm.shop4.linkMan}",
+            "contractMobile": "${svipcouponForm.shop4.contractMobile}"
+        }
+        appendShopOrderHead(shop, 4);
+    }
+    //产品回显
+    if (${not empty svipcouponForm.associateList1}) {
+        <c:forEach items="${svipcouponForm.associateList1}" var="associate" varStatus="index">
+        imageList1.push({
+            id: "${associate.id}",
+            productId: "${empty associate.productId ? "":associate.productId}",
+            image: "${associate.image}",
+            productName: "${associate.productName}",
+            shopName: "${associate.shopName}",
+            sort: "${associate.sort}",
+            pcStatus: "${associate.pcStatus}",
+            appletsStatus: "${associate.appletsStatus}",
+            addTime: "<fmt:formatDate value="${associate.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+        });
+        </c:forEach>
+        if (imageList1.length > 0) {
+            $('#couponWrap1').find('.contentTableProduct').show();
+            batchSaveSort(1);
+            productShow(2,1);
+        }
+    }
+    if (${not empty svipcouponForm.associateList2}) {
+        <c:forEach items="${svipcouponForm.associateList2}" var="associate" varStatus="index">
+        imageList2.push({
+            id: "${associate.id}",
+            productId: "${empty associate.productId ? "":associate.productId}",
+            image: "${associate.image}",
+            productName: "${associate.productName}",
+            shopName: "${associate.shopName}",
+            sort: "${associate.sort}",
+            pcStatus: "${associate.pcStatus}",
+            appletsStatus: "${associate.appletsStatus}",
+            addTime: "<fmt:formatDate value="${associate.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+        });
+        </c:forEach>
+        if (imageList2.length > 0) {
+            $('#couponWrap2').find('.contentTableProduct').show();
+            batchSaveSort(2);
+            productShow(2,2);
+        }
+    }
+    if (${not empty svipcouponForm.associateList3}) {
+        <c:forEach items="${svipcouponForm.associateList3}" var="associate" varStatus="index">
+        imageList3.push({
+            id: "${associate.id}",
+            productId: "${empty associate.productId ? "":associate.productId}",
+            image: "${associate.image}",
+            productName: "${associate.productName}",
+            shopName: "${associate.shopName}",
+            sort: "${associate.sort}",
+            pcStatus: "${associate.pcStatus}",
+            appletsStatus: "${associate.appletsStatus}",
+            addTime: "<fmt:formatDate value="${associate.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+        });
+        </c:forEach>
+        if (imageList3.length > 0) {
+            $('#couponWrap3').find('.contentTableProduct').show();
+            batchSaveSort(3);
+            productShow(2,3);
+        }
+    }
+    if (${not empty svipcouponForm.associateList4}) {
+        <c:forEach items="${svipcouponForm.associateList4}" var="associate" varStatus="index">
+        imageList4.push({
+            id: "${associate.id}",
+            productId: "${empty associate.productId ? "":associate.productId}",
+            image: "${associate.image}",
+            productName: "${associate.productName}",
+            shopName: "${associate.shopName}",
+            sort: "${associate.sort}",
+            pcStatus: "${associate.pcStatus}",
+            appletsStatus: "${associate.appletsStatus}",
+            addTime: "<fmt:formatDate value="${associate.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
+        });
+        </c:forEach>
+        if (imageList4.length > 0) {
+            $('#couponWrap4').find('.contentTableProduct').show();
+            batchSaveSort(4);
+            productShow(2,4);
+        }
+    }
+
+    $("body").on("change", ".couponType", function () {
+        var value = $(this).parent().find('input.couponType:checked').val() * 1;
+        $(this).parents(".coupon-wrap").find(".coupon-line").hide();
+        if (0 === value) {
+            $(this).parents(".coupon-wrap").find(".coupon-line.l1").show();
+            $(this).parents(".coupon-wrap").find(".coupon-line.l2").show();
+            $(this).parents(".coupon-wrap").find(".coupon-line.l4").show();
+        } else if (1 === value) {
+            $(this).parents(".coupon-wrap").find(".coupon-line.l1").show();
+            $(this).parents(".coupon-wrap").find(".coupon-line.l2").show();
+            $(this).parents(".coupon-wrap").find(".coupon-line.l3").show();
+        } else if (3 === value) {
+            $(this).parents(".coupon-wrap").find(".coupon-line.l0").show();
+            $(this).parents(".coupon-wrap").find(".coupon-line.l1").show();
+            $(this).parents(".coupon-wrap").find(".coupon-line.l2").show();
+        }
+    });
+
+    function cType(id) {
+        $("#couponWrap" + id).find(".productData" + id).hide();
+    }
+
+    // 点击添加供应商
+    function showSelectShop(id) {
+        var url = "${ctx}/coupon/cmCoupon/toAddShop";
+        var title = '';
+        title = "选择供应商";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 400,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    console.log(items);
+                    appendShopOrderHead(items, id);
+                }
+                return true;
+            }
+        });
+    }
+
+    function productShow(value, id) {
+        if (value == 2) {
+            $(".productData" + id).show();
+        } else {
+            $(".productData" + id).hide();
+        }
+    }
+
+    //点击添加
+    function showSelectProduct(id) {
+        var url = "${ctx}/coupon/cmCoupon/toAddProduct?productIds=";
+        if (id * 1 === 1) {
+            url += productIds1;
+        }
+        if (id * 1 === 2) {
+            url += productIds2;
+        }
+        if (id * 1 === 3) {
+            url += productIds3;
+        }
+        if (id * 1 === 4) {
+            url += productIds4;
+        }
+        var title = '';
+        title = "选择商品";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 400,
+            height: $(top.document).height() - 160,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    console.log(items);
+                    console.log(items[0]);
+                    for (var i = 0; i < items.length; i++) {
+                        console.log(items[i]);
+                        if (id * 1 === 1) {
+                            imageList1.push(items[i]);
+                        }
+                        if (id * 1 === 2) {
+                            imageList2.push(items[i]);
+                        }
+                        if (id * 1 === 3) {
+                            imageList3.push(items[i]);
+                        }
+                        if (id * 1 === 4) {
+                            imageList4.push(items[i]);
+                        }
+                        $("#couponWrap" + id).find(".contentTableProduct").show();
+                        $(".del").removeAttr("disabled");
+                        batchSaveSort(id);
+                    }
+                    ;
+                }
+                return true;
+            }
+        });
+    }
+
+    //一键排序
+    function batchSaveSort(id) {
+        if (id * 1 === 1) {
+            imageList1.sort(sort);
+            insertHtmlProduct(imageList1, id);
+        }
+        if (id * 1 === 2) {
+            imageList2.sort(sort);
+            insertHtmlProduct(imageList2, id);
+        }
+        if (id * 1 === 3) {
+            imageList3.sort(sort);
+            insertHtmlProduct(imageList3, id);
+        }
+        if (id * 1 === 4) {
+            imageList4.sort(sort);
+            insertHtmlProduct(imageList4, id);
+        }
+
+    }
+
+    //根据sort值 从小到大排序
+    function sort(a, b) {
+        return a.sort - b.sort;
+    }
+
+    //相关图片列表数据
+    function appendProductOrderHead(data, index, id) {
+        var html = '<tr id ="ai' + index + '">' +
+            '<td>' +
+            '<input class="check-item" type="checkbox" name="info" value="' + index + '"/>' + (index + 1) +
+            '</td>' +
+            '<td>' +
+            '<img src="' + data.image + '" width="60px" border="none" title="启用">' +
+            '</td>' +
+            '<td>' +
+            data.productName +
+            '</td>' +
+            '<td>' +
+            data.shopName +
+            '</td>' +
+            '<td>' +
+            (data.pcStatus == 1 ? (
+                '<font color="green">已启用</font>' +
+                '<a href="javascript:void(0);" onclick="updatePcStatus(0,' + index + ',' + id + ');" >' +
+                '停用</a>'
+            ) : (
+                '<font color="red">已停用</font>' +
+                '<a href="javascript:void(0)" onclick="updatePcStatus(1,' + index + ',' + id + ');">' +
+                '启用</a>'
+            )) +
+            '</td>' +
+            '<td>' +
+            (data.appletsStatus == 1 ? (
+                '<font color="green">已启用</font>' +
+                '<a href="javascript:void(0);" onclick="updateAppletsStatus(0,' + index + ',' + id + ');" >' +
+                '停用</a>'
+            ) : (
+                '<font color="red">已停用</font>' +
+                '<a href="javascript:void(0)" onclick="updateAppletsStatus(1,' + index + ',' + id + ');">' +
+                '启用</a>'
+            )) +
+            '</td>' +
+            '<td>' +
+            '<input name="sort" style="width:50px;" value="' + data.sort + '"  onkeyup="onlynum(this)"  onchange="changeSort(' + index + ',this,' + id + ')"></td>' +
+            '</td>' +
+            '<td>' +
+            (data.addTime == '' ? (
+                '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>'
+            ) : (
+                data.addTime
+            )) +
+            '</td>' +
+            '<td>' +
+            '<a href="javascript:;" onclick="delect(' + index + ',' + id + ')">删除</a>' +
+            '</td>' +
+            '</tr>';
+        return html;
+    }
+
+    function insertHtmlProduct(list, id) {
+        var html = '';
+        tempIds = '';
+        if (list && list.length > 0) {
+            list.forEach(function (item, index) {
+                html += appendProductOrderHead(item, index, id);
+                tempIds += "," + item.productId;
+            });
+        }
+        if (id * 1 === 1) {
+            productIds1 = tempIds;
+        }
+        if (id * 1 === 2) {
+            productIds2 = tempIds;
+        }
+        if (id * 1 === 3) {
+            productIds3 = tempIds;
+        }
+        if (id * 1 === 4) {
+            productIds4 = tempIds;
+        }
+        $("#couponWrap" + id).find(".hotSearchProduct").html(html);
+    }
+
+    function changeSort(index, sortThis, id) {
+        var sort = sortThis.value;
+        if (sort > 0) {
+            var image;
+            if (id * 1 === 1) {
+                image = imageList1[index];
+            }
+            if (id * 1 === 2) {
+                image = imageList2[index];
+            }
+            if (id * 1 === 3) {
+                image = imageList3[index];
+            }
+            if (id * 1 === 4) {
+                image = imageList4[index];
+            }
+            if (image) {
+                image.sort = sort;
+            }
+        }
+    }
+
+    function updatePcStatus(status, index, id) {
+        var image;
+        if (id * 1 === 1) {
+            image = imageList1[index];
+        }
+        if (id * 1 === 2) {
+            image = imageList2[index];
+        }
+        if (id * 1 === 3) {
+            image = imageList3[index];
+        }
+        if (id * 1 === 4) {
+            image = imageList4[index];
+        }
+        if (image) {
+            confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
+                image.pcStatus = status;
+                batchSaveSort(id);
+            });
+        }
+    }
+
+    function updateAppletsStatus(status, index, id) {
+        var image;
+        if (id * 1 === 1) {
+            image = imageList1[index];
+        }
+        if (id * 1 === 2) {
+            image = imageList2[index];
+        }
+        if (id * 1 === 3) {
+            image = imageList3[index];
+        }
+        if (id * 1 === 4) {
+            image = imageList4[index];
+        }
+        if (image) {
+            confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
+                image.appletsStatus = status;
+                batchSaveSort(id);
+            });
+        }
+    }
+
+    /**
+     * 批量删除
+     */
+    function batchDeletion(id) {
+        var index = -1;
+        var i = 1;
+        return confirmx("确定删除吗?", function () {
+            $('input[name="info"]:checked').each(function () {
+                var thisIndex = $(this).val();
+                if (index >= 0 && index < thisIndex) {
+                    thisIndex = thisIndex - i;
+                    i++;
+                } else {
+                    index = thisIndex;
+                }
+                var image, tempList;
+                if (id * 1 === 1) {
+                    image = imageList1[index];
+                    if (image.productId != '') {
+                        productIds1 = productIds1.replace(image.productId, "");
+                    }
+                    imageList1.splice(thisIndex, 1);
+                    tempList = imageList1;
+                }
+                if (id * 1 === 2) {
+                    image = imageList2[index];
+                    if (image.productId != '') {
+                        productIds2 = productIds2.replace(image.productId, "");
+                    }
+                    imageList2.splice(thisIndex, 1);
+                    tempList = imageList2;
+                }
+                if (id * 1 === 3) {
+                    image = imageList3[index];
+                    if (image.productId != '') {
+                        productIds3 = productIds3.replace(image.productId, "");
+                    }
+                    imageList3.splice(thisIndex, 1);
+                    tempList = imageList3;
+                }
+                if (id * 1 === 4) {
+                    image = imageList4[index];
+                    if (image.productId != '') {
+                        productIds4 = productIds4.replace(image.productId, "");
+                    }
+                    imageList4.splice(thisIndex, 1);
+                    tempList = imageList4;
+                }
+                insertHtmlProduct(tempList, id);
+                if (tempList.length == 0) {
+                    $("#couponWrap" + id).find('.contentTableProduct').hide();
+                    $(".del").attr("disabled", "disabled");
+                }
+            });
+        });
+    }
+
+    function appendShopOrderHead(data, id) {
+        var html = '<tr>' +
+            '<td>' +
+            data.name +
+            '</td>' +
+            '<td>' +
+            data.sname +
+            '</td>' +
+            '<td>' +
+            data.linkMan +
+            '</td>' +
+            '<td>' +
+            data.contractMobile +
+            '</td>' +
+            '<td>' +
+            '<a href="javascript:;" onclick="delectShop(' + id + ')">删除</a>' +
+            '</td>' +
+            '</tr>';
+        $("#couponWrap" + id).find(".hotSearchShop").html(html);
+        $("#chooseShop" + id).hide();
+        $("#couponWrap" + id).find(".contentTableShop").show();
+        $("#shopId" + id).val(data.shopId);
+    }
+
+    function delectShop(id) {
+        return confirmx("确定删除吗?", function () {
+            $("#chooseShop" + id).show();
+            $("#couponWrap" + id).find(".contentTableShop").hide();
+            $("#shopId" + id).val("");
+        });
+    }
+
+    /**
+     * 删除操作
+     */
+    function delect(index, id) {
+        return confirmx("确定删除吗?", function () {
+            var image;
+            if (id * 1 === 1) {
+                image = imageList1[index];
+                if (image.productId != '') {
+                    productIds1 = productIds1.replace(image.productId, "");
+                }
+                imageList1.splice(index, 1);
+                insertHtmlProduct(imageList1, id);
+                if (imageList1.length == 0) {
+                    $("#couponWrap" + id).find('#contentTableProduct').hide();
+                    $(".del").attr("disabled", "disabled");
+                }
+            }
+            if (id * 1 === 2) {
+                image = imageList2[index];
+                if (image.productId != '') {
+                    productIds2 = productIds2.replace(image.productId, "");
+                }
+                imageList2.splice(index, 1);
+                insertHtmlProduct(imageList2, id);
+                if (imageList2.length == 0) {
+                    $("#couponWrap" + id).find('#contentTableProduct').hide();
+                    $(".del").attr("disabled", "disabled");
+                }
+            }
+            if (id * 1 === 3) {
+                image = imageList3[index];
+                if (image.productId != '') {
+                    productIds3 = productIds3.replace(image.productId, "");
+                }
+                imageList3.splice(index, 1);
+                insertHtmlProduct(imageList3, id);
+                if (imageList3.length == 0) {
+                    $("#couponWrap" + id).find('#contentTableProduct').hide();
+                    $(".del").attr("disabled", "disabled");
+                }
+            }
+            if (id * 1 === 4) {
+                image = imageList4[index];
+                if (image.productId != '') {
+                    productIds4 = productIds4.replace(image.productId, "");
+                }
+                imageList4.splice(index, 1);
+                insertHtmlProduct(imageList4, id);
+                if (imageList4.length == 0) {
+                    $("#couponWrap" + id).find('#contentTableProduct').hide();
+                    $(".del").attr("disabled", "disabled");
+                }
+            }
+        });
+    }
+
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+
+</script>
+</body>
+</html>

+ 9 - 2
src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponForm.jsp

@@ -55,6 +55,11 @@
                     alert("请选择生效时间! ");
                     return false;
                 }
+                var endMonth = $("#endMonth").val();
+                if (endMonth < month) {
+                    $.jBox.alert('优惠月份设置错误','提示');
+                    return false;
+                }
                 var vipId = $("#id").val();
                 if (!vipId && dateList.indexOf(month)>=0){
                     alert("已存在该月优惠券,请修改月份!");
@@ -135,7 +140,7 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/vip/cmCoupon/">超级会员专属优惠券</a></li>
-    <li class="active"><a href="${ctx}/vip/cmCoupon/form?id=${cmVipCoupon.id}">${not empty cmVipCoupon.id?'编辑':'添加'}</a>
+    <li class="active"><a href="${ctx}/vip/cmCoupon/form?id=${cmVipCoupon.id}&endTime=${cmVipCoupon.endTime}">${not empty cmVipCoupon.id?'编辑':'添加'}</a>
     </li>
 </ul><br>
 <form:form id="inputForm" modelAttribute="svipcouponForm" action="${ctx}/vip/cmCoupon/save" method="post" class="form-horizontal">
@@ -145,6 +150,8 @@
         <label class="control-label"><font color="red">*</font>优惠月份:</label>
         <div class="controls">
             <form:input path="month" type="text" maxlength="20" class="input-medium Wdate" value="${useTime}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM',isShowClear:false});"/>&nbsp;&nbsp; —— &nbsp;&nbsp;
+            <form:input path="endMonth" type="text" maxlength="20" class="input-medium Wdate" value="${endMonth}" disabled="true"
                         onclick="WdatePicker({dateFmt:'yyyy-MM',isShowClear:false});"/>
         </div>
     </div>
@@ -983,4 +990,4 @@
 
 </script>
 </body>
-</html>
+</html>

+ 4 - 3
src/main/webapp/WEB-INF/views/modules/svip/cmSvipCouponList.jsp

@@ -21,6 +21,7 @@
 <body>
 <ul class="nav nav-tabs">
     <li class="active"><a href="${ctx}/vip/cmCoupon/">超级会员专属优惠券</a></li>
+    <li><a href="${ctx}/vip/cmCoupon/configuration">专属优惠券配置</a></li>
 </ul>
 <form:form id="searchForm" modelAttribute="cmVipCoupon" action="${ctx}/vip/cmCoupon" method="post" class="breadcrumb form-search">
     <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
@@ -57,7 +58,7 @@
             </div>
             <div class="item">
                 <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" />
-                <input class="btn btn-primary" onclick="window.location='${ctx}/vip/cmCoupon/form'" value="添加优惠券"/>
+<%--                <input class="btn btn-primary" onclick="window.location='${ctx}/vip/cmCoupon/form'" value="添加优惠券"/>--%>
             </div>
         </div>
     </div>
@@ -75,7 +76,7 @@
     <tbody>
     <c:forEach items="${page.list}" var="vip">
         <tr>
-            <td><label>${vip.useTime}</label></td>
+            <td><label>${vip.useTime} &nbsp;&nbsp;--&nbsp;&nbsp; ${vip.endTime}</label></td>
             <td>
                 <c:forEach items="${vip.couponList}" var="cmCoupon" varStatus="index">
                 <p>优惠券${index.index+1}:
@@ -108,7 +109,7 @@
                 </c:if>
             </td>
             <td>
-                <a href="${ctx}/vip/cmCoupon/form?id=${vip.id}">编辑</a>
+                <a href="${ctx}/vip/cmCoupon/form?id=${vip.id}&endTime=${vip.endTime}">编辑</a>
                 <c:if test="${vip.status ne '2'}">
                     <a href="${ctx}/vip/cmCoupon/close?id=${vip.id}"
                        onclick="return confirmx('确定关闭该该月份的优惠券吗?关闭后该月份将不赠送优惠券?', this.href)">关闭</a>

+ 8 - 1
src/main/webapp/WEB-INF/views/modules/user/clubTemporaryForm.jsp

@@ -419,7 +419,14 @@
 				<form:input path="linkMan" htmlEscape="false" maxlength="20" class="input-medium required"/>
 			</td>
 			<th width="12%"><font color="red">*</font> 手机号:</th>
-			<td colspan="3"><form:input path="bindMobile" htmlEscape="false" maxlength="20" class="input-medium required"  onchange="checkMobile()"/></td>
+			<td width="13%"><form:input path="bindMobile" htmlEscape="false" maxlength="20" class="input-medium required"  onchange="checkMobile()"/></td>
+			<th width="12%"><font color="red">*</font> 联系人身份:</th>
+			<td width="13%">
+				<form:radiobutton path="linkManIdentity" name="linkManIdentity" class="required" value="1" label="老板"/>
+				<form:radiobutton path="linkManIdentity" name="linkManIdentity" class="required" value="2" label="采购"/>
+				<form:radiobutton path="linkManIdentity" name="linkManIdentity" class="required" value="3" label="运营"/>
+				<form:radiobutton path="linkManIdentity" name="linkManIdentity" class="required" value="4" label="其他"/>
+			</td>
 		</tr>
 	</table>
 </div>

+ 6 - 2
src/main/webapp/WEB-INF/views/modules/userNew/recordLinkageForm.jsp

@@ -128,14 +128,17 @@
 		<div class="control-group">
 			<label class="control-label"><font color="red">*</font>描述:</label>
             <textarea id='describe' <c:if test="${empty describe}">placeholder="请输入该用户的行为信息,例如查看了什么商品或者文章,以及任何需要销售人员注意的信息"</c:if>
-					  name='describe' rows='5' cols='12' style="width: 700px" maxlength="200"><c:if test="${not empty describe}">${describe}</c:if></textarea>
-		</div>
+					  name='describe' rows='5' cols='12' style="width: 700px" maxlength="200"><c:if test="${not empty describe}">${describe}</c:if><c:if test="${masBehavior ne ''}">,${masBehavior}</c:if></textarea>
+			<textarea hidden id="masBehavior" path="masBehavior"  name="masBehavior" style="width: 700px; visibility: hidden" maxlength="200"><c:if test="${masBehavior ne ''}">,${masBehavior}</c:if></textarea>
+		</div><%--<c:if test="${masBehavior ne ''}">,${masBehavior}</c:if>--%>
+
 	<div class="control-label">链接:</div><span id='link' name='link'>${link}</span>
 		<div class="form-actions">
 			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
 			<input id="btnSubmit" class="btn btn-primary"  type="submit" value="确定并生成链接"/>
 		</div>
 	</form:form>
+<c:if test="${masBehavior ne ''}">
 <form:form id="searchForm" modelAttribute="cmBehaviorRecord" action="${ctx}/new/user/agency/recordLinkage?clubId=${clubId}" method="post" class="breadcrumb form-search">
 	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
@@ -187,6 +190,7 @@
 	</C:forEach>
 	</tbody>
 </table>
+</c:if>
 <div class="pagination">${page}</div>
 
 	<script type="text/javascript">