Browse Source

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

kaick 1 year ago
parent
commit
2628235daf
66 changed files with 1603 additions and 2588 deletions
  1. 1 0
      src/main/java/com/caimei/modules/coupon/web/CmCouponController.java
  2. 2 0
      src/main/java/com/caimei/modules/order/dao/CmPayShopDao.java
  3. 5 0
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  4. 10 0
      src/main/java/com/caimei/modules/order/entity/ChangePayShopOther.java
  5. 10 0
      src/main/java/com/caimei/modules/order/entity/CmPayShop.java
  6. 2 2
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  7. 4 371
      src/main/java/com/caimei/modules/order/entity/ShopOrderVo.java
  8. 81 14
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  9. 16 0
      src/main/java/com/caimei/modules/order/service/CmRefundShopService.java
  10. 25 20
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  11. 3 3
      src/main/java/com/caimei/modules/order/service/NewShopOrderService.java
  12. 6 0
      src/main/java/com/caimei/modules/order/service/SplitAccountService.java
  13. 48 4
      src/main/java/com/caimei/modules/order/web/CmPayShopController.java
  14. 2 1
      src/main/java/com/caimei/modules/order/web/NewOrderController.java
  15. 2 0
      src/main/java/com/caimei/modules/product/dao/CmPromotionDao.java
  16. 0 8
      src/main/java/com/caimei/modules/product/dao/ProductDao.java
  17. 5 1482
      src/main/java/com/caimei/modules/product/entity/Product.java
  18. 3 1
      src/main/java/com/caimei/modules/product/entity/Shop.java
  19. 21 1
      src/main/java/com/caimei/modules/product/service/CmPromotionService.java
  20. 0 4
      src/main/java/com/caimei/modules/product/service/ProductService.java
  21. 21 24
      src/main/java/com/caimei/modules/product/web/CmPromotionController.java
  22. 0 5
      src/main/java/com/caimei/modules/product/web/ProductController.java
  23. 12 12
      src/main/java/com/caimei/modules/user/service/ClubPortraitService.java
  24. 80 0
      src/main/resources/mappings/modules/order/CmPayShopMapper.xml
  25. 5 3
      src/main/resources/mappings/modules/order/OrderMapper.xml
  26. 17 4
      src/main/resources/mappings/modules/order/ShopOrderMapper.xml
  27. 1 3
      src/main/resources/mappings/modules/product/CmProductCombinationMapper.xml
  28. 11 3
      src/main/resources/mappings/modules/product/CmPromotionMapper.xml
  29. 232 213
      src/main/resources/mappings/modules/product/ProductMapper.xml
  30. 5 1
      src/main/resources/mappings/modules/product/ProductNewMapper.xml
  31. 17 14
      src/main/resources/mappings/modules/user/CmPortraitMapper.xml
  32. 9 9
      src/main/webapp/WEB-INF/views/modules/coupon/MoneyCouponForm.jsp
  33. 1 1
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponForm.jsp
  34. 3 3
      src/main/webapp/WEB-INF/views/modules/coupon/cmCouponList.jsp
  35. 3 3
      src/main/webapp/WEB-INF/views/modules/coupon/couponShopList.jsp
  36. 4 4
      src/main/webapp/WEB-INF/views/modules/coupon/redemptionCodeCouponForm.jsp
  37. 2 2
      src/main/webapp/WEB-INF/views/modules/order/checkPaymentOrder.jsp
  38. 72 57
      src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptList.jsp
  39. 1 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayFormList.jsp
  40. 263 0
      src/main/webapp/WEB-INF/views/modules/order/cmPayList.jsp
  41. 10 0
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopChange.jsp
  42. 29 13
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp
  43. 26 10
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp
  44. 26 10
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp
  45. 30 14
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp
  46. 4 3
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopList.jsp
  47. 10 4
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherCheck.jsp
  48. 6 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherEdit.jsp
  49. 7 2
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherForm.jsp
  50. 10 4
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherPrintDetail.jsp
  51. 16 6
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopPrintDetail.jsp
  52. 4 1
      src/main/webapp/WEB-INF/views/modules/order/cmRebateRecordForm.jsp
  53. 23 10
      src/main/webapp/WEB-INF/views/modules/order/cmRefundShopDetail.jsp
  54. 22 9
      src/main/webapp/WEB-INF/views/modules/order/cmRefundShopForm.jsp
  55. 1 0
      src/main/webapp/WEB-INF/views/modules/order/cmSettlementList.jsp
  56. 1 0
      src/main/webapp/WEB-INF/views/modules/order/cmSplitAccountList.jsp
  57. 1 1
      src/main/webapp/WEB-INF/views/modules/order/newOrderList.jsp
  58. 6 2
      src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp
  59. 4 3
      src/main/webapp/WEB-INF/views/modules/order/paidShopOrderList.jsp
  60. 1 0
      src/main/webapp/WEB-INF/views/modules/order/payThirdParties.jsp
  61. 4 4
      src/main/webapp/WEB-INF/views/modules/order/shopOtherFeeForm.jsp
  62. 131 93
      src/main/webapp/WEB-INF/views/modules/product-new/multiPromotionForm.jsp
  63. 26 26
      src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp
  64. 9 4
      src/main/webapp/WEB-INF/views/modules/product-new/promotionSelectProducts.jsp
  65. 129 75
      src/main/webapp/WEB-INF/views/modules/product-new/shopPromotionForm.jsp
  66. 62 20
      src/main/webapp/WEB-INF/views/modules/product-new/singlePromotionForm.jsp

+ 1 - 0
src/main/java/com/caimei/modules/coupon/web/CmCouponController.java

@@ -183,6 +183,7 @@ public class CmCouponController extends BaseController {
      */
     @RequestMapping(value = "toAddProduct")
     public String toAddProduct(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        //todo 当前版本限制死为仅选取综合供应商的商品
         Page<Product> page = cmCouponService.findProductList(new Page<Product>(request, response), product);
         model.addAttribute("page", page);
         model.addAttribute("productIds", product.getProductIds());

+ 2 - 0
src/main/java/com/caimei/modules/order/dao/CmPayShopDao.java

@@ -33,4 +33,6 @@ public interface CmPayShopDao extends CrudDao<CmPayShop> {
     List<CmDiscernReceipt> getDiscernReceipts(Integer shopOrderId);
 
     List<Product> priceNum(@Param("orderNo") String orderNo);
+
+    List<CmPayShop> payThirdParties(CmPayShop cmPayShop);
 }

+ 5 - 0
src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java

@@ -2,6 +2,7 @@ package com.caimei.modules.order.dao;
 
 import com.caimei.modules.order.entity.NewShopOrder;
 import com.caimei.modules.order.entity.SettleRecord;
+import com.caimei.modules.product.entity.Shop;
 import com.caimei.po.neworder.CmShopOrder;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
@@ -30,6 +31,10 @@ public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
 
     List<NewShopOrder> findListByOrderID(@Param("orderID") Integer orderID);
 
+    Double getFreightAmount(Integer productId);
+
+    Shop getShopOrderId(@Param("shopId") Integer shopId);
+
     List<String> findCommercialCode(@Param("orderID") Integer orderID);
 
     String FromUnionId(Integer orderId);

+ 10 - 0
src/main/java/com/caimei/modules/order/entity/ChangePayShopOther.java

@@ -99,6 +99,8 @@ public class ChangePayShopOther implements Serializable {
      */
     private Integer payShopId;
 
+    private Integer redirectType;
+
     public Integer getId() {
         return id;
     }
@@ -250,4 +252,12 @@ public class ChangePayShopOther implements Serializable {
     public void setPayShopId(Integer payShopId) {
         this.payShopId = payShopId;
     }
+
+    public Integer getRedirectType() {
+        return redirectType;
+    }
+
+    public void setRedirectType(Integer redirectType) {
+        this.redirectType = redirectType;
+    }
 }

+ 10 - 0
src/main/java/com/caimei/modules/order/entity/CmPayShop.java

@@ -69,6 +69,8 @@ public class CmPayShop extends DataEntity<CmPayShop> {
     //  付款账号的类型 0公账, 1私账
     private String typeStr;
 
+    private Integer redirectType;
+
     public String getRebateFee() {
         return rebateFee;
     }
@@ -460,4 +462,12 @@ public class CmPayShop extends DataEntity<CmPayShop> {
     public void setPaymentType(Integer paymentType) {
         this.paymentType = paymentType;
     }
+
+    public Integer getRedirectType() {
+        return redirectType;
+    }
+
+    public void setRedirectType(Integer redirectType) {
+        this.redirectType = redirectType;
+    }
 }

+ 2 - 2
src/main/java/com/caimei/modules/order/entity/NewShopOrder.java

@@ -15,7 +15,7 @@ import java.util.List;
  */
 public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Integer onlineFlag;    //是否线上支付过1是,0否
-    private Double couponAmount;   //订单使用优惠券金额
+    private Double couponAmount;   //订单使用优惠券金额
     private Integer shopOrderID;//        int(11) not null auto_increment comment '子订单ID',
     private Integer organizeID;//        组织Id
     private String shopOrderNo;//       varchar(30) comment '子订单编号',
@@ -156,7 +156,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private String clubName; //会所名称
     private Integer orderArchiveId; //订单资料id
     private String rebateFee; //主订单返佣服务费
-    private String shopPostFlag; //免邮标志 运费:-1到付,0包邮,1需要运费,-2仪器到付其它包邮
+    private String shopPostFlag; //免邮标志 运费:2到付,0包邮,1需要运费,-2仪器到付其它包邮
     private String postageInfo; //运费字符串
 
     /**  */

+ 4 - 371
src/main/java/com/caimei/modules/order/entity/ShopOrderVo.java

@@ -1,6 +1,8 @@
 package com.caimei.modules.order.entity;
 
 
+import lombok.Data;
+
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.List;
@@ -11,9 +13,11 @@ import java.util.List;
  * @author : Charles
  * @date : 2021/7/20
  */
+@Data
 public class ShopOrderVo implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    private Double couponAmount;
     private Integer organizeId;
     /**
      * 子订单ID
@@ -196,375 +200,4 @@ public class ShopOrderVo implements Serializable {
      */
     private String splitCode;
 
-    public Integer getOrganizeId() {
-        return organizeId;
-    }
-
-    public void setOrganizeId(Integer organizeId) {
-        this.organizeId = organizeId;
-    }
-
-    public String getSplitCode() {
-        return splitCode;
-    }
-
-    public void setSplitCode(String splitCode) {
-        this.splitCode = splitCode;
-    }
-
-    public static long getSerialVersionUID() {
-        return serialVersionUID;
-    }
-
-    public Integer getShopOrderId() {
-        return shopOrderId;
-    }
-
-    public void setShopOrderId(Integer shopOrderId) {
-        this.shopOrderId = shopOrderId;
-    }
-
-    public String getShopOrderNo() {
-        return shopOrderNo;
-    }
-
-    public void setShopOrderNo(String shopOrderNo) {
-        this.shopOrderNo = shopOrderNo;
-    }
-
-    public Integer getOrderId() {
-        return orderId;
-    }
-
-    public void setOrderId(Integer orderId) {
-        this.orderId = orderId;
-    }
-
-    public String getOrderNo() {
-        return orderNo;
-    }
-
-    public void setOrderNo(String orderNo) {
-        this.orderNo = orderNo;
-    }
-
-    public Integer getShopId() {
-        return shopId;
-    }
-
-    public void setShopId(Integer shopId) {
-        this.shopId = shopId;
-    }
-
-    public String getShopName() {
-        return shopName;
-    }
-
-    public void setShopName(String shopName) {
-        this.shopName = shopName;
-    }
-
-    public String getShopLogo() {
-        return shopLogo;
-    }
-
-    public void setShopLogo(String shopLogo) {
-        this.shopLogo = shopLogo;
-    }
-
-    public String getNote() {
-        return note;
-    }
-
-    public void setNote(String note) {
-        this.note = note;
-    }
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public Integer getClubId() {
-        return clubId;
-    }
-
-    public void setClubId(Integer clubId) {
-        this.clubId = clubId;
-    }
-
-    public Integer getSpId() {
-        return spId;
-    }
-
-    public void setSpId(Integer spId) {
-        this.spId = spId;
-    }
-
-    public Integer getOrderPromotionsId() {
-        return orderPromotionsId;
-    }
-
-    public void setOrderPromotionsId(Integer orderPromotionsId) {
-        this.orderPromotionsId = orderPromotionsId;
-    }
-
-    public Double getPromotionFullReduction() {
-        return promotionFullReduction;
-    }
-
-    public void setPromotionFullReduction(Double promotionFullReduction) {
-        this.promotionFullReduction = promotionFullReduction;
-    }
-
-    public Double getSvipShopReduction() {
-        return svipShopReduction;
-    }
-
-    public void setSvipShopReduction(Double svipShopReduction) {
-        this.svipShopReduction = svipShopReduction;
-    }
-
-    public Integer getPayStatus() {
-        return payStatus;
-    }
-
-    public void setPayStatus(Integer payStatus) {
-        this.payStatus = payStatus;
-    }
-
-    public Double getPayedShopAmount() {
-        return payedShopAmount;
-    }
-
-    public void setPayedShopAmount(Double payedShopAmount) {
-        this.payedShopAmount = payedShopAmount;
-    }
-
-    public Double getBrokerage() {
-        return brokerage;
-    }
-
-    public void setBrokerage(Double brokerage) {
-        this.brokerage = brokerage;
-    }
-
-    public Double getCanRefundAmount() {
-        return canRefundAmount;
-    }
-
-    public void setCanRefundAmount(Double canRefundAmount) {
-        this.canRefundAmount = canRefundAmount;
-    }
-
-    public Integer getItemCount() {
-        return itemCount;
-    }
-
-    public void setItemCount(Integer itemCount) {
-        this.itemCount = itemCount;
-    }
-
-    public Double getTotalAmount() {
-        return totalAmount;
-    }
-
-    public void setTotalAmount(Double totalAmount) {
-        this.totalAmount = totalAmount;
-    }
-
-    public Double getProductAmount() {
-        return productAmount;
-    }
-
-    public void setProductAmount(Double productAmount) {
-        this.productAmount = productAmount;
-    }
-
-    public Double getNeedPayAmount() {
-        return needPayAmount;
-    }
-
-    public void setNeedPayAmount(Double needPayAmount) {
-        this.needPayAmount = needPayAmount;
-    }
-
-    public Double getShopProductAmount() {
-        return shopProductAmount;
-    }
-
-    public void setShopProductAmount(Double shopProductAmount) {
-        this.shopProductAmount = shopProductAmount;
-    }
-
-    public Double getShopPostFee() {
-        return shopPostFee;
-    }
-
-    public void setShopPostFee(Double shopPostFee) {
-        this.shopPostFee = shopPostFee;
-    }
-
-    public Double getShopTaxFee() {
-        return shopTaxFee;
-    }
-
-    public void setShopTaxFee(Double shopTaxFee) {
-        this.shopTaxFee = shopTaxFee;
-    }
-
-    public Double getShouldPayShopAmount() {
-        return shouldPayShopAmount;
-    }
-
-    public void setShouldPayShopAmount(Double shouldPayShopAmount) {
-        this.shouldPayShopAmount = shouldPayShopAmount;
-    }
-
-    public Integer getOutStoreNum() {
-        return outStoreNum;
-    }
-
-    public void setOutStoreNum(Integer outStoreNum) {
-        this.outStoreNum = outStoreNum;
-    }
-
-    public Integer getOutStoreTimes() {
-        return outStoreTimes;
-    }
-
-    public void setOutStoreTimes(Integer outStoreTimes) {
-        this.outStoreTimes = outStoreTimes;
-    }
-
-    public Integer getSendOutStatus() {
-        return sendOutStatus;
-    }
-
-    public void setSendOutStatus(Integer sendOutStatus) {
-        this.sendOutStatus = sendOutStatus;
-    }
-
-    public Integer getPresentNum() {
-        return presentNum;
-    }
-
-    public void setPresentNum(Integer presentNum) {
-        this.presentNum = presentNum;
-    }
-
-    public String getOrderTime() {
-        return orderTime;
-    }
-
-    public void setOrderTime(String orderTime) {
-        this.orderTime = orderTime;
-    }
-
-    public Integer getOrderSubmitType() {
-        return orderSubmitType;
-    }
-
-    public void setOrderSubmitType(Integer orderSubmitType) {
-        this.orderSubmitType = orderSubmitType;
-    }
-
-    public Integer getSplitFlag() {
-        return splitFlag;
-    }
-
-    public void setSplitFlag(Integer splitFlag) {
-        this.splitFlag = splitFlag;
-    }
-
-    public Double getShopOtherFee() {
-        return shopOtherFee;
-    }
-
-    public void setShopOtherFee(Double shopOtherFee) {
-        this.shopOtherFee = shopOtherFee;
-    }
-
-    public PromotionsVo getShopPromotion() {
-        return shopPromotion;
-    }
-
-    public void setShopPromotion(PromotionsVo shopPromotion) {
-        this.shopPromotion = shopPromotion;
-    }
-
-    public List<OrderProductVo> getOrderProductList() {
-        return orderProductList;
-    }
-
-    public void setOrderProductList(List<OrderProductVo> orderProductList) {
-        this.orderProductList = orderProductList;
-    }
-
-    public List<LogisticsRecordVo> getLogisticsRecordList() {
-        return logisticsRecordList;
-    }
-
-    public void setLogisticsRecordList(List<LogisticsRecordVo> logisticsRecordList) {
-        this.logisticsRecordList = logisticsRecordList;
-    }
-
-    public OrderUserinfoVo getUserInfo() {
-        return userInfo;
-    }
-
-    public void setUserInfo(OrderUserinfoVo userInfo) {
-        this.userInfo = userInfo;
-    }
-
-    public Integer getReceiptStatus() {
-        return receiptStatus;
-    }
-
-    public void setReceiptStatus(Integer receiptStatus) {
-        this.receiptStatus = receiptStatus;
-    }
-
-    public BigDecimal getShopRefundAmount() {
-        return shopRefundAmount;
-    }
-
-    public void setShopRefundAmount(BigDecimal shopRefundAmount) {
-        this.shopRefundAmount = shopRefundAmount;
-    }
-
-    public String getHaveReturning() {
-        return haveReturning;
-    }
-
-    public void setHaveReturning(String haveReturning) {
-        this.haveReturning = haveReturning;
-    }
-
-    public Integer getReceiptedFlag() {
-        return receiptedFlag;
-    }
-
-    public void setReceiptedFlag(Integer receiptedFlag) {
-        this.receiptedFlag = receiptedFlag;
-    }
-
-    public Integer getReceiptedType() {
-        return receiptedType;
-    }
-
-    public void setReceiptedType(Integer receiptedType) {
-        this.receiptedType = receiptedType;
-    }
-
-    public OrderVo getMainOrder() {
-        return mainOrder;
-    }
-
-    public void setMainOrder(OrderVo mainOrder) {
-        this.mainOrder = mainOrder;
-    }
 }

+ 81 - 14
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -189,6 +189,44 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         return page1.setList(list);
     }
 
+    public Page<CmPayShop> payThirdPage(Page<CmPayShop> page, CmPayShop cmPayShop) {
+        cmPayShop.setPage(page);
+        List<CmPayShop> payList = cmPayShopDao.payThirdParties(cmPayShop);
+
+        for (CmPayShop payShop : payList) {
+            List<NewShopOrder> newShopOrders = cmPayShopDao.orderList(payShop.getId());
+            payShop.setShopOrders(newShopOrders);
+            if (payShop.getStatus().equals("2")) {
+                List<Integer> ids = new ArrayList<>();
+                for (NewShopOrder newShopOrder : newShopOrders) {
+                    ids.add(newShopOrder.getShopOrderID());
+                }
+                List<Integer> id = cmPayShopDao.hasReapply(payShop.getId(), ids);
+                if (id.isEmpty()) {
+                    //可以重申
+                    payShop.setRePayment("1");
+                } else {
+                    //不能重申
+                    payShop.setRePayment("2");
+                }
+            }
+            newShopOrders.forEach(shopOrder -> {
+                if (null != shopOrder) {
+                    NewOrder order = newOrderDao.findByOrderID(shopOrder.getOrderID());
+                    if (null != order && "2".equals(order.getOrderType())) {
+                        //呵呵商城订单
+                        shopOrder.setOrderType(2);
+                        if (StringUtils.isBlank(shopOrder.getClubName())) {
+                            String name = heHeNewOrderDao.findHeUser(order.getUserID());
+                            shopOrder.setClubName(name);
+                        }
+                    }
+                }
+            });
+        }
+        return page.setList(payList);
+    }
+
     @Transactional(readOnly = false)
     public void save(CmPayShop cmPayShop) {
         super.save(cmPayShop);
@@ -236,6 +274,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                  */
 
                 Integer returnNum = 0;
+                Double returnNumAmount = 0d;
                 // 平台服务费
                 Double allServeAmount = 0d;
                 Double brokerage = 0d;
@@ -250,14 +289,34 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     p.setNewCostPrice(newCostPrice);*/
 
                     p.setOldDiscountPrice(p.getDiscountPrice());
-                    if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
+                    /*if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
-                    }
+                    }*/
                     // 付采美总金额
                     allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
                     // 子订单利润
-
-                    brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(),p.getNum())).doubleValue();
+                    if (p.getReturnedNum().equals(p.getNum())) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else if (p.getReturnedNum() < p.getNum()) {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), MathUtil.sub(p.getNum(), p.getReturnedNum()))).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    } else {
+                        if (p.getProductType() == 0) {
+                            brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                        } else {
+                            brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                        }
+                    }
+                    allServeAmount = MathUtil.sub(allServeAmount, MathUtil.mul(returnNum, p.getCmCostPrice())).doubleValue();
+                    // 应退的成本
+                    returnNumAmount = MathUtil.mul(returnNum, p.getCostPrice()).doubleValue();
                 }
                 so.setBrokerage(brokerage);
                 so.setAllServeAmount(allServeAmount);
@@ -270,6 +329,9 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     BigDecimal waitPayShop = MathUtil.sub(so.getWaitPayShop(), so.getDifferencePrice());
                     so.setWaitPayShop(waitPayShop.doubleValue());
                 }
+                so.setWaitPayShop(MathUtil.sub(so.getWaitPayShop(), returnNumAmount).doubleValue());
+                so.setShopProductAmount(MathUtil.sub(so.getShopProductAmount(), returnNumAmount).doubleValue());
+                so.setShouldPayShopAmount(MathUtil.sub(so.getShouldPayShopAmount(), returnNumAmount).doubleValue());
 
                 //统计该子订单的主的收款金额和收款状态
                 NewOrder newOrder = newOrderDao.get(so.getOrderID().toString());
@@ -341,8 +403,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     } else {
                         so.setBrokerage(null);
                     }*/
-                } else {
-                    so.setBrokerage(null);
                 }
                 //要是不大于成本默认显示
 
@@ -408,12 +468,16 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     p.setCostPrice(MathUtil.div(p.getCostPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100),100)).doubleValue());
                     p.setNewCostPrice(newCostPrice);*/
                     p.setOldDiscountPrice(p.getDiscountPrice());
-                    if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
+                    /*if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
-                    }
+                    }*/
                     // 付采美总金额
                     allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
-                    brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(),p.getNum())).doubleValue();
+                    if (p.getProductType() == 0) {
+                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                    } else {
+                        brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    }
                 }
                 so.setBrokerage(brokerage);
                 so.setAllServeAmount(allServeAmount);
@@ -697,10 +761,10 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 NewShopOrder shopOrder = newShopOrderDao.get(record.getShopOrderID());
                 Double wipePayment = cmPayShopRecordDao.sumWipePaymentNoStatus(Integer.valueOf(record.getShopOrderID()));
                 wipePayment = wipePayment != null ? wipePayment : 0d;
-                // 本次付款金额 + 抹平金额 + 原来已经付过的金额
-                BigDecimal payedFee = MathUtil.add(MathUtil.add(record.getPayAmount(), wipePayment), shopOrder.getPayedShopAmount());
+                // 本次付款金额 + 抹平金额 + 原来已经付过的金额 - 付第三方
+                BigDecimal payedFee = MathUtil.add(MathUtil.sub(MathUtil.add(record.getPayAmount(), wipePayment), shopOrder.getShopOtherFee()), shopOrder.getPayedShopAmount());
                 // 总共要付的金额
-                BigDecimal shouldPayFee = BigDecimal.valueOf(shopOrder.getShouldPayShopAmount());
+                BigDecimal shouldPayFee = MathUtil.sub(shopOrder.getShouldPayShopAmount(), shopOrder.getShopOtherFee());
                 //判断是否有差价金额
                 if (shopOrder.getDifferenceType() != null && shopOrder.getDifferenceType() == 1) {
                     shouldPayFee = MathUtil.add(shouldPayFee, shopOrder.getDifferencePrice());
@@ -720,7 +784,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                     logger.info("check ----> 付款金额异常, 付款金额大于待付款金额");
                     throw new Exception("付款金额异常, 付款金额大于待付款金额");
                 }
-                shopOrder.setPayedShopAmount(shopOrder.getPayedShopAmount() == null ? 0D : shopOrder.getPayedShopAmount() + record.getPayAmount());
+                shopOrder.setPayedShopAmount(shopOrder.getPayedShopAmount() == null ? 0D : MathUtil.add(shopOrder.getPayedShopAmount(), MathUtil.sub(record.getPayAmount(), shopOrder.getShopOtherFee())).doubleValue());
                 shopOrder.setPaying("0"); //退出付款进行状态
                 newShopOrderDao.update(shopOrder);
                 record.setStatus("1");
@@ -845,7 +909,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
             //修改每一条子订单的已付款金额
             for (CmPayShopRecord record : records) {
                 NewShopOrder shopOrder = newShopOrderDao.get(record.getShopOrderID());
-                shopOrder.setPayedShopAmount(shopOrder.getPayedShopAmount() - record.getPayAmount());
+                shopOrder.setPayedShopAmount(shopOrder.getPayedShopAmount() - record.getPayAmount() + shopOrder.getShopOtherFee());
                 if (shopOrder.getPayedShopAmount() == 0D) {
                     // 本次付款金额 + 原来已经付过的金额  < 总共要付的金额
                     shopOrder.setPayStatus("1");
@@ -1013,6 +1077,9 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
             payShop.setApplyTime(format);
             payShop.setReviewTime(format);
             status = "1";
+            //已付第三方金额
+            BigDecimal shopOtherFee = cmPayShopRecordDao.findPayShopOtherFee(payShopOther.getShopOrderId());
+            newShopOrderDao.updateByShopOtherFee(MathUtil.add(shopOtherFee, payShopOther.getShopOtherFee()), payShopOther.getShopOrderId());
         } else {
             payShop.setBankAccountName(payShopOther.getBankAccountName());
             payShop.setBankAccount(payShopOther.getBankAccount());

+ 16 - 0
src/main/java/com/caimei/modules/order/service/CmRefundShopService.java

@@ -180,11 +180,19 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                  1. 若发生退货,数量要减去已退货和已取消的数量
                  2. 有赠品的商品只能全退
                  */
+                Double brokerage = 0d;
                 for (NewOrderProduct p : orderProductList) {
                     Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
                     returnNum = returnNum == null ? 0 : returnNum;
                     p.setReturnedNum(returnNum);
+                    // 子订单利润
+                    if (p.getProductType() == 0) {
+                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                    } else {
+                        brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    }
                 }
+                so.setBrokerage(brokerage);
                 so.setNewOrderProducts(orderProductList);
                 //主订单退款(退货)总金额
                 so.setReturnedPurchaseTotalFee(newShopOrderService.getOrderReturnedPurchaseFee(so));
@@ -247,11 +255,19 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                  1. 若发生退货,数量要减去已退货和已取消的数量
                  2. 有赠品的商品只能全退
                  */
+                Double brokerage = 0d;
                 for (NewOrderProduct p : orderProductList) {
                     Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
                     returnNum = returnNum == null ? 0 : returnNum;
                     p.setReturnedNum(returnNum);
+                    // 子订单利润
+                    if (p.getProductType() == 0) {
+                        brokerage = MathUtil.add(brokerage, MathUtil.mul(p.getBrokerage(), p.getNum())).doubleValue();
+                    } else {
+                        brokerage = MathUtil.add(brokerage, 0).doubleValue();
+                    }
                 }
+                so.setBrokerage(brokerage);
                 so.setNewOrderProducts(orderProductList);
                 so.setRefundAmount(record.getRefundAmount());
                 //主订单退款(退货)总金额

+ 25 - 20
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -3,7 +3,6 @@ package com.caimei.modules.order.service;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei.constants.UserType;
-import com.caimei.exception.BusinessException;
 import com.caimei.modules.bulkpurchase.dao.OrderInvoiceDao;
 import com.caimei.modules.bulkpurchase.entity.OrderInvoice;
 import com.caimei.modules.bulkpurchase.service.OrderInvoiceService;
@@ -1342,23 +1341,10 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                         }
                     }
                     //拼接运费
-                    Double ColdChina = Double.valueOf(700);
-                    String shopPostFlag = shopOrder.getShopPostFlag()!=null?shopOrder.getShopPostFlag():"-2";
+                    String shopPostFlag = shopOrder.getShopPostFlag()!=null?shopOrder.getShopPostFlag():"0";
                     String PostageInfo = null;
-                    if (null != shopOrder.getIsColdChina() && shopOrder.getIsColdChina() == 1) {
-                        if ("2" == shopOrder.getShopPostFlag()) {
-                            // 到付
-                            PostageInfo = "¥" + ColdChina + "(" + (shopOrder.getIsColdChina() == 1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: 到付)";
-                        } else if ("0" == shopOrder.getShopPostFlag()) {
-                            // 包邮
-                            PostageInfo = "¥" + ColdChina + "(" + (shopOrder.getIsColdChina() == 1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: 包邮)";
-                        } else {
-                            // 有运费
-                            PostageInfo = "¥" + MathUtil.add(shopOrder.getShopPostFee(), ColdChina) + "(" + (shopOrder.getIsColdChina() == 1 ? "冷链费: ¥" + ColdChina + "," : "") + "其他: ¥" + shopOrder.getShopPostFee() + ")";
-                        }
-                    } else {
-                        PostageInfo = shopPostFlag.equals("2") ? "到付" : shopPostFlag.equals("0") ? "包邮" : "¥" + shopOrder.getShopPostFee();
-                    }
+
+                    PostageInfo = shopPostFlag.equals("2") ? "到付" : shopPostFlag.equals("0") ? "包邮" : "¥" + shopOrder.getShopPostFee();
 
                     //支付凭证
                     List<CmOrderPaymentVoucherVo> voucherVo = newOrderService.findVoucherVoOrderID(shopOrder.getShopOrderID() );
@@ -1457,6 +1443,25 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                             shopOrder.setRestAmount(0d);
                         }
                     }
+                    // 子订单来自采美平台的第三方供应商的线下转账账号为空或者为采美账号
+                    Shop shop = newShopOrderDao.getShopOrderId(shopOrder.getShopID());
+                    boolean flag = null == shop.getBankAccount() || 0 == shop.getAccountOwnership();
+                    // 订单收款路径 线上、 线下
+                    Integer discernPayWay = cmReceiptOrderRelationDao.getDiscernPayWay(shopOrder.getOrderID());
+                    /** 排除以下情况的订单
+                     * (1)采美自营供应商(综合供应商)的子订单
+                     * (2)颜选商城的子订单
+                     * (3)来自采美平台的第三方供应商的线下转账账号为空或者为采美账号的子订单
+                     * (4)商品分账号是采美信息的商品的子订单(走了线上支付才排除)
+                     */
+                    if ((1161 != shopOrder.getShopID() || 2 != shopOrder.getOrderType() || !flag ||
+                            (!"E1807059160".equals(shopOrder.getSplitCode()) &&  null != discernPayWay && 1 == discernPayWay))) {
+                        // 线下支付的订单
+                        if (null != discernPayWay && 1 != discernPayWay) {
+                            // 订单下线收款, 付款状态与收款状态同步显示
+                            shopOrder.setPayStatus(shopOrder.getReceiptStatus());
+                        }
+                    }
                     // 订单已收款才会出现抹平或者多收退余额,(已收再退款或者撤销退款订单即使存在抹平也需要当未抹平重新计算付款)
                     String receiptStatus = shopOrder.getReceiptStatus();
                     if (StringUtils.equals("3", receiptStatus)) {
@@ -1648,7 +1653,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         Double balancePayFee = order.getNewShopOrders().get(0).getAccountAmount();
         //修改子订单状态(余额抵扣)
         if (order.getNewShopOrders().get(0).getUseBalanceFlag() !=null&&order.getNewShopOrders().get(0).getUseBalanceFlag() == 1) {
-            if ( balancePayFee != null && balancePayFee ==order.getNewShopOrders().get(0).getRealPay()) {
+            if ( balancePayFee != null && balancePayFee .equals(order.getNewShopOrders().get(0).getRealPay())) {
                 order.getNewShopOrders().get(0).setReceiptStatus("3");
             } else if ( balancePayFee != null && balancePayFee <order.getNewShopOrders().get(0).getRealPay()) {
                 order.getNewShopOrders().get(0).setReceiptStatus("2");
@@ -2383,7 +2388,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 //通过子订单ID查询子订单信息
                 NewShopOrder newShopOrder = newShopOrderDao.get(String.valueOf(shopOrderID));
                 if (null != newShopOrder) {
-                    shopOrderNoAndId += "<b style=\"font-size: 17px;\">"+newShopOrder.getShopOrderID()+"</b>"+"("+newShopOrder.getShopOrderNo()+")<br>";
+                    shopOrderNoAndId += "<b style=\"font-size: 15px;\">"+newShopOrder.getShopOrderID()+"</b>"+"("+newShopOrder.getShopOrderNo()+")<br>";
                     shopOrder.setFee(newShopOrder.getFee());
                     shopOrder.setShouldPayProduct(newShopOrder.getShouldPayProduct());
                     List<NewOrderProduct> pList = newOrderProductDao.findListByShopOrderID(shopOrderID);
@@ -2445,7 +2450,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     }
 
     /**
-     * 判断是否是游客
+     * 判断是否是游客b
      *
      * @param userId
      * @return

+ 3 - 3
src/main/java/com/caimei/modules/order/service/NewShopOrderService.java

@@ -366,9 +366,9 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
                 p.setCostPrice(MathUtil.div(p.getCostPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100),100)).doubleValue());
                 p.setNewCostPrice(newCostPrice);*/
                 p.setOldDiscountPrice(p.getDiscountPrice());
-                if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
+                /*if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
                     p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
-                }
+                }*/
             }
             if (so.getShopPostFee() == null) so.setShopPostFee(0D);
             if (so.getShopTaxFee() == null) so.setShopTaxFee(0D);
@@ -964,7 +964,7 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             }
         }
         //拼接运费
-        Double ColdChina = Double.valueOf(700);
+        Double ColdChina = 700d;
         String shopPostFlag = shopOrder.getShopPostFlag() != null ? shopOrder.getShopPostFlag() : "-2";
         String PostageInfo = null;
         if (null != shopOrder.getIsColdChina() && shopOrder.getIsColdChina() == 1) {

+ 6 - 0
src/main/java/com/caimei/modules/order/service/SplitAccountService.java

@@ -65,6 +65,12 @@ public class SplitAccountService extends BaseService {
                 logger.info("【分账】>>>>>>>>>>子订单id:" + orderRelation.getShopOrderId() + "进入分账");
                 setSplitAccountDetail(costPrice, organizeCostPrice, cmCostPrice, total, shopOrder, orderRelation);
             }
+            /** todo
+             *  当前版本优惠券和促销活动为商家承担
+             */
+            if (shopOrder.getCouponAmount() > 0 || shopOrder.getPromotionFullReduction() > 0) {
+                costPrice.set(MathUtil.sub(costPrice, MathUtil.add(shopOrder.getCouponAmount(), shopOrder.getPromotionFullReduction())).doubleValue());
+            }
             if (MathUtil.compare(total, MathUtil.add(MathUtil.add(costPrice, cmCostPrice), organizeCostPrice)) <= 0) {
                 logger.info("收款总金额不足分帐------------->total: " + total.get()
                         + "costPrice: " + costPrice.get() + "----------"

+ 48 - 4
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -112,6 +112,33 @@ public class CmPayShopController extends BaseController {
         return "modules/order/cmPayFormList";
     }
 
+    @RequiresPermissions("order:cmPayShop:view")
+    @RequestMapping(value = "payList")
+    public String payList(CmPayShop cmPayShop, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (null != cmPayShop.getStartTime() && !"".equals(cmPayShop.getStartTime()) && !cmPayShop.getStartTime().endsWith("00:00:00")) {
+            model.addAttribute("startTime", cmPayShop.getStartTime());
+            cmPayShop.setStartTime(cmPayShop.getStartTime().trim() + " 00:00:00");
+        }
+        if (null != cmPayShop.getEndTime() && !"".equals(cmPayShop.getEndTime()) && !cmPayShop.getEndTime().endsWith("23:59:59")) {
+            model.addAttribute("endTime", cmPayShop.getEndTime());
+            cmPayShop.setEndTime(cmPayShop.getEndTime().trim() + " 23:59:59");
+        }
+        if (null != cmPayShop.getStartTime2() && !"".equals(cmPayShop.getStartTime2()) && !cmPayShop.getStartTime2().endsWith("00:00:00")) {
+            model.addAttribute("startTime2", cmPayShop.getStartTime2());
+            cmPayShop.setStartTime2(cmPayShop.getStartTime2().trim() + " 00:00:00");
+        }
+        if (null != cmPayShop.getEndTime2() && !"".equals(cmPayShop.getEndTime2()) && !cmPayShop.getEndTime2().endsWith("23:59:59")) {
+            model.addAttribute("endTime2", cmPayShop.getEndTime2());
+            cmPayShop.setEndTime2(cmPayShop.getEndTime2().trim() + " 23:59:59");
+        }
+        Page<CmPayShop> page = cmPayShopService.payThirdPage(new Page<CmPayShop>(request, response), cmPayShop);
+        //获取组织列表
+        List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
+        model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
+        model.addAttribute("page", page);
+        return "modules/order/cmPayList";
+    }
+
     @RequiresPermissions("order:cmPayShop:view")
     @RequestMapping(value = "form")
     public String form(CmPayShop cmPayShop, Model model) {
@@ -170,6 +197,10 @@ public class CmPayShopController extends BaseController {
 
     @RequestMapping("saveChangePayShopAmount")
     public String saveChangePayShopAmount(NewShopOrder newShopOrder) {
+        /**
+         * couponAmount 优惠券优惠金额
+         * promotionFullReduction   促销满减优惠(不考虑凑单促销)
+         */
         String shopOrderID = newShopOrder.getId();
         Double freight = newShopOrder.getShopPostFee();
         Double thirdPartyFee = newShopOrder.getShopOtherFee() == null ? 0d : newShopOrder.getShopOtherFee();
@@ -361,8 +392,10 @@ public class CmPayShopController extends BaseController {
                 cmChangePayShopProduct.setSingleShouldPayTotalTax(product.getSingleShouldPayTotalTax());
                 cmChangePayShopProductService.save(cmChangePayShopProduct);
             }
-            shopOrder.setShopTaxFee(totalTaxesFee); //总税费
-            shopOrder.setShopProductAmount(totalCostFee); //商品费
+            //总税费
+            shopOrder.setShopTaxFee(totalTaxesFee);
+            //商品费
+            shopOrder.setShopProductAmount(totalCostFee);
         //}
         // 比例成本
         /*if ("2".equals(costType)) {
@@ -502,7 +535,8 @@ public class CmPayShopController extends BaseController {
         double shouldPayShopAmount = shopOrder.getShopProductAmount() + shopOrder.getShopPostFee(); // + shopOrder.getShopTaxFee();
         if (shopOrder.getPayedShopAmount() != null && shouldPayShopAmount == shopOrder.getPayedShopAmount())
             shopOrder.setPayStatus("3");
-        shopOrder.setShouldPayShopAmount(shouldPayShopAmount);
+        // 付供应商 - 优惠券 - 促销满减优惠
+        shopOrder.setShouldPayShopAmount(MathUtil.sub(shouldPayShopAmount , MathUtil.add(shopOrder.getCouponAmount(), shopOrder.getPromotionFullReduction())).doubleValue());
         newShopOrderService.modifyPayShopAmount(shopOrder, orderProducts);
 
         /*if(shopOrder.getShopReceiptStatus()==1){
@@ -980,6 +1014,9 @@ public class CmPayShopController extends BaseController {
             logger.info(e.getMessage());
             e.printStackTrace();
         }
+        if (null != cmPayShop.getRedirectType() && 2 == cmPayShop.getRedirectType()) {
+            return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/payList?repage";
+        }
         return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/?repage";
     }
 
@@ -1004,7 +1041,11 @@ public class CmPayShopController extends BaseController {
                 addMessage(redirectAttributes, e.getMessage());
             }
         }
+        if (null != cmPayShop.getRedirectType() && 2 == cmPayShop.getRedirectType()) {
+            return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/payList?repage";
+        }
         return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/?repage";
+
     }
 
     /**
@@ -1032,7 +1073,10 @@ public class CmPayShopController extends BaseController {
     public String saveShopOtherFee(ChangePayShopOther payShopOther, RedirectAttributes redirectAttributes) {
         cmPayShopService.saveShopOtherFee(payShopOther);
         addMessage(redirectAttributes, "保存成功");
-        return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/";
+        if ((null != payShopOther.getPayType() && 2 == payShopOther.getPayType()) || 2 == payShopOther.getRedirectType() ) {
+            return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/payList?repage";
+        }
+        return "redirect:" + Global.getAdminPath() + "/order/cmPayShop/?repage";
     }
 
     /**

+ 2 - 1
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -1221,7 +1221,8 @@ public class NewOrderController extends BaseController {
     @RequestMapping("detail")
     public String detail(NewOrder order, Model model) {
         if(order.getShopOrderID()!=null){
-            List<NewShopOrder>  newShopOrders= order.getNewShopOrders().stream().filter(newShopOrder -> newShopOrder.getShopOrderID().equals(order.getShopOrderID())).collect(Collectors.toList());
+            List<NewShopOrder>  newShopOrders= order.getNewShopOrders().stream()
+                    .filter(newShopOrder -> newShopOrder.getShopOrderID().equals(order.getShopOrderID())).collect(Collectors.toList());
             order.setNewShopOrders(newShopOrders);
         }
         BpClause bpClause = new BpClause();

+ 2 - 0
src/main/java/com/caimei/modules/product/dao/CmPromotionDao.java

@@ -111,4 +111,6 @@ public interface CmPromotionDao extends CrudDao<CmPromotion> {
     void deleteOldTouchPrice(String promotionId);
 
     void insertNewTouchPrice(@Param("skuId")Integer skuId,@Param("touchPrice") Double touchPrice,@Param("promotionId")  String promotionId);
+
+    Integer findShopId(Integer productID);
 }

+ 0 - 8
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -59,14 +59,6 @@ public interface ProductDao extends CrudDao<Product> {
      */
      List<GiftProduct> getGiftProductInfo(GiftProduct giftProduct);
 
-    /**
-     * 后去商品购买库存
-     *
-     * @param productId
-     * @return
-     */
-     Sku getProductSku(@Param("productId") Integer productId);
-
     /**
      * 更新赠送
      *

+ 5 - 1482
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -4,6 +4,7 @@ import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.po.ProductLadderPrice;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
+import lombok.Data;
 
 import java.beans.Transient;
 import java.math.BigDecimal;
@@ -11,6 +12,7 @@ import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
+@Data
 public class Product extends DataEntity<Product> {
     private String name;
     private String shopName;//供应商名称
@@ -116,7 +118,9 @@ public class Product extends DataEntity<Product> {
     private Double sqlSupplierTaxPoint;//供应商开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
     private Integer giftNumber;//赠品数量
     private BigDecimal reducedPrice;//优惠价格
-    private String promotionType;//促销类型
+    private String promotionType;//促销类型 1单品促销,2凑单促销,3店铺促销
+
+    private Integer promotionMode;//    促销方式:1优惠,2满减,3满赠
     private String delProductIds;//删除商品id
     private List<Integer> delIdList;//删除商品
     private String sold;//是否已售:0和空未出售,1已出售
@@ -300,1486 +304,5 @@ public class Product extends DataEntity<Product> {
     private Integer orderProductID;
     //税率
     private Double taxRate;
-    public List<CmOrganizeProductInfo> getCmOrganizeProductInfos() {
-        return cmOrganizeProductInfos;
-    }
-
-    public void setCmOrganizeProductInfos(List<CmOrganizeProductInfo> cmOrganizeProductInfos) {
-        this.cmOrganizeProductInfos = cmOrganizeProductInfos;
-    }
-    public String getOrganizeNameValidFlag() {
-        return organizeNameValidFlag;
-    }
-
-    public void setOrganizeNameValidFlag(String organizeNameValidFlag) {
-        this.organizeNameValidFlag = organizeNameValidFlag;
-    }
-
-    public String getLabelIds() {
-        return labelIds;
-    }
-
-    public void setLabelIds(String labelIds) {
-        this.labelIds = labelIds;
-    }
-
-    public String getRelatedLabels() {
-        return relatedLabels;
-    }
-
-    public void setRelatedLabels(String relatedLabels) {
-        this.relatedLabels = relatedLabels;
-    }
-
-    public Integer getSkuId() {
-        return skuId;
-    }
-
-    public void setSkuId(Integer skuId) {
-        this.skuId = skuId;
-    }
-
-    public List<CmSku> getSkuList() {
-        return skuList;
-    }
-
-    public void setSkuList(List<CmSku> skuList) {
-        this.skuList = skuList;
-    }
-
-    public List<CmSku> getMallSkuList() {
-        return mallSkuList;
-    }
-
-    public void setMallSkuList(List<CmSku> mallSkuList) {
-        this.mallSkuList = mallSkuList;
-    }
-
-    public String[] getValidFlagString() {
-        return validFlagString;
-    }
-
-    public void setValidFlagString(String[] validFlagString) {
-        this.validFlagString = validFlagString;
-    }
-
-    public String getQualificationNo() {
-        return qualificationNo;
-    }
-
-    public void setQualificationNo(String qualificationNo) {
-        this.qualificationNo = qualificationNo;
-    }
-
-    public String getProductName() {
-        return productName;
-    }
-
-    public void setProductName(String productName) {
-        this.productName = productName;
-    }
-
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    public String getQualificationTime() {
-        return qualificationTime;
-    }
-
-    public void setQualificationTime(String qualificationTime) {
-        this.qualificationTime = qualificationTime;
-    }
-
-    public String getQualificationLink() {
-        return qualificationLink;
-    }
-
-    public void setQualificationLink(String qualificationLink) {
-        this.qualificationLink = qualificationLink;
-    }
-
-    public Integer getNewProductType() {
-        return newProductType;
-    }
-
-    public void setNewProductType(Integer newProductType) {
-        this.newProductType = newProductType;
-    }
-
-    public Integer getShowFlag() {
-        return showFlag;
-    }
-
-    public void setShowFlag(Integer showFlag) {
-        this.showFlag = showFlag;
-    }
-
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    public String getShowTime() {
-        return showTime;
-    }
-
-    public void setShowTime(String showTime) {
-        this.showTime = showTime;
-    }
-
-
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    public String getNewshowTime() {
-        return newshowTime;
-    }
-
-    public void setNewshowTime(String newshowTime) {
-        this.newshowTime = newshowTime;
-    }
-
-    public Integer getRecommend() {
-        return recommend;
-    }
-
-    public void setRecommend(Integer recommend) {
-        this.recommend = recommend;
-    }
-
-    public Integer getNewvalidFlag() {
-        return newvalidFlag;
-    }
-
-    public void setNewvalidFlag(Integer newvalidFlag) {
-        this.newvalidFlag = newvalidFlag;
-    }
-
-    public String getBeautyActFlag() {
-        return beautyActFlag;
-    }
-
-    public void setBeautyActFlag(String beautyActFlag) {
-        this.beautyActFlag = beautyActFlag;
-    }
-
-    public Integer getAnnounType() {
-        return announType;
-    }
-
-    public void setAnnounType(Integer announType) {
-        this.announType = announType;
-    }
-
-    public Double getSqlShopPercent() {
-        return sqlShopPercent;
-    }
-
-    public void setSqlShopPercent(Double sqlShopPercent) {
-        this.sqlShopPercent = sqlShopPercent;
-    }
-
-    public Double getSqlTaxPoint() {
-        return sqlTaxPoint;
-    }
-
-    public void setSqlTaxPoint(Double sqlTaxPoint) {
-        this.sqlTaxPoint = sqlTaxPoint;
-    }
-
-    public Double getSqlCostPrice() {
-        return SqlCostPrice;
-    }
-
-    public void setSqlCostPrice(Double sqlCostPrice) {
-        SqlCostPrice = sqlCostPrice;
-    }
-
-    public Integer getShopType() {
-        return shopType;
-    }
-
-    public void setShopType(Integer shopType) {
-        this.shopType = shopType;
-    }
-
-    public Double getSqlSupplierTaxPoint() {
-        return sqlSupplierTaxPoint;
-    }
-
-    public void setSqlSupplierTaxPoint(Double sqlSupplierTaxPoint) {
-        this.sqlSupplierTaxPoint = sqlSupplierTaxPoint;
-    }
-
-    public String getCompanyName() {
-        return companyName;
-    }
-
-    public void setCompanyName(String companyName) {
-        this.companyName = companyName;
-    }
-
-    public String getImage1() {
-        return image1;
-    }
-
-    public void setImage1(String image1) {
-        this.image1 = image1;
-    }
-
-    public String getImage2() {
-        return image2;
-    }
-
-    public void setImage2(String image2) {
-        this.image2 = image2;
-    }
-
-    public String getImage3() {
-        return image3;
-    }
-
-    public void setImage3(String image3) {
-        this.image3 = image3;
-    }
-
-    public String getImage4() {
-        return image4;
-    }
-
-    public void setImage4(String image4) {
-        this.image4 = image4;
-    }
-
-    public String getImage5() {
-        return image5;
-    }
-
-    public void setImage5(String image5) {
-        this.image5 = image5;
-    }
-
-    public String getSplitCode() {
-        return splitCode;
-    }
-
-    public void setSplitCode(String splitCode) {
-        this.splitCode = splitCode;
-    }
-
-    public Integer getPublishIdentity() {
-        return publishIdentity;
-    }
-
-    public void setPublishIdentity(Integer publishIdentity) {
-        this.publishIdentity = publishIdentity;
-    }
-
-    public String getProductDescribe() {
-        return productDescribe;
-    }
-
-    public void setProductDescribe(String productDescribe) {
-        this.productDescribe = productDescribe;
-    }
-
-    public String getProductDetail() {
-        return productDetail;
-    }
-
-    public void setProductDetail(String productDetail) {
-        this.productDetail = productDetail;
-    }
-
-    public String getCommonDetailInfo() {
-        return commonDetailInfo;
-    }
-
-    public void setCommonDetailInfo(String commonDetailInfo) {
-        this.commonDetailInfo = commonDetailInfo;
-    }
-
-    public List<ProductLadderPrice> getLadderPriceList() {
-        return ladderPriceList;
-    }
-
-    public void setLadderPriceList(List<ProductLadderPrice> ladderPriceList) {
-        this.ladderPriceList = ladderPriceList;
-    }
-
-    public String getProductIds() {
-        return productIds;
-    }
-
-    public void setProductIds(String productIds) {
-        this.productIds = productIds;
-    }
-
-    public String getGroundMall() {
-        return groundMall;
-    }
-
-    public void setGroundMall(String groundMall) {
-        this.groundMall = groundMall;
-    }
-
-    public List<String> getOrganizeNames() {
-        return organizeNames;
-    }
-
-    public void setOrganizeNames(List<String> organizeNames) {
-        this.organizeNames = organizeNames;
-    }
-
-    public BigDecimal getActivityPrice() {
-        return activityPrice;
-    }
-
-    public void setActivityPrice(BigDecimal activityPrice) {
-        this.activityPrice = activityPrice;
-    }
-
-    public boolean isStoreStatus() {
-        return storeStatus;
-    }
-
-    public void setStoreStatus(boolean storeStatus) {
-        this.storeStatus = storeStatus;
-    }
-
-    public String getItemsList() {
-        return itemsList;
-    }
-
-    public void setItemsList(String itemsList) {
-        this.itemsList = itemsList;
-    }
-
-    public List<Integer> getIds() {
-        return ids;
-    }
-
-    public void setIds(List<Integer> ids) {
-        this.ids = ids;
-    }
-
-    private static final long serialVersionUID = 1L;
-
-    public String getDetailInfo() {
-        return detailInfo;
-    }
-
-    public void setDetailInfo(String detailInfo) {
-        this.detailInfo = detailInfo;
-    }
-
-    public String getServiceInfo() {
-        return serviceInfo;
-    }
-
-    public void setServiceInfo(String serviceInfo) {
-        this.serviceInfo = serviceInfo;
-    }
-
-    public String getOrderInfo() {
-        return orderInfo;
-    }
-
-    public void setOrderInfo(String orderInfo) {
-        this.orderInfo = orderInfo;
-    }
-
-    public Product() {
-        super();
-    }
-
-    public Product(String id) {
-        super(id);
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getValidFlag() {
-        return validFlag;
-    }
-
-    public void setValidFlag(String validFlag) {
-        this.validFlag = validFlag;
-    }
-
-    public String getDisplayOnCRMFlag() {
-        return displayOnCRMFlag;
-    }
-
-    public void setDisplayOnCRMFlag(String displayOnCRMFlag) {
-        this.displayOnCRMFlag = displayOnCRMFlag;
-    }
-
-    public Integer getProductID() {
-        return productID;
-    }
-
-    public void setProductID(Integer productID) {
-        this.productID = productID;
-    }
-
-    public Integer getBrandID() {
-        return brandID;
-    }
-
-    public void setBrandID(Integer brandID) {
-        this.brandID = brandID;
-    }
-
-    public Integer getTinyTypeID() {
-        return tinyTypeID;
-    }
-
-    public void setTinyTypeID(Integer tinyTypeID) {
-        this.tinyTypeID = tinyTypeID;
-    }
-
-    public Integer getShopID() {
-        return shopID;
-    }
-
-    public void setShopID(Integer shopID) {
-        this.shopID = shopID;
-    }
-
-    public String getSearchKey() {
-        return searchKey;
-    }
-
-    public void setSearchKey(String searchKey) {
-        this.searchKey = searchKey;
-    }
-
-    public String getPriceFlag() {
-        return priceFlag;
-    }
-
-    public void setPriceFlag(String priceFlag) {
-        this.priceFlag = priceFlag;
-    }
-
-
-    public String getLadderPriceFlag() {
-        return ladderPriceFlag;
-    }
-
-    public void setLadderPriceFlag(String ladderPriceFlag) {
-        this.ladderPriceFlag = ladderPriceFlag;
-    }
-
-    public String getStock() {
-        return stock;
-    }
-
-    public void setStock(String stock) {
-        this.stock = stock;
-    }
-
-    public String getHasSkuFlag() {
-        return hasSkuFlag;
-    }
-
-    public void setHasSkuFlag(String hasSkuFlag) {
-        this.hasSkuFlag = hasSkuFlag;
-    }
-
-    public String getMainImage() {
-        return mainImage;
-    }
-
-    public void setMainImage(String mainImage) {
-        this.mainImage = mainImage;
-    }
-
-    public String getPropertiesInfo() {
-        return propertiesInfo;
-    }
-
-    public void setPropertiesInfo(String propertiesInfo) {
-        this.propertiesInfo = propertiesInfo;
-    }
-
-    public String getAddTime() {
-        return addTime;
-    }
-
-    public void setAddTime(String addTime) {
-        this.addTime = addTime;
-    }
-
-    public String getUpdateTime() {
-        return updateTime;
-    }
-
-    public void setUpdateTime(String updateTime) {
-        this.updateTime = updateTime;
-    }
-
-    public String getSellNumber() {
-        return sellNumber;
-    }
-
-    public void setSellNumber(String sellNumber) {
-        this.sellNumber = sellNumber;
-    }
-
-    public String getBeforeValidFlag() {
-        return beforeValidFlag;
-    }
-
-    public void setBeforeValidFlag(String beforeValidFlag) {
-        this.beforeValidFlag = beforeValidFlag;
-    }
-
-    public String getFavoriteTimes() {
-        return favoriteTimes;
-    }
-
-    public void setFavoriteTimes(String favoriteTimes) {
-        this.favoriteTimes = favoriteTimes;
-    }
-
-    public String getCommentScore() {
-        return commentScore;
-    }
-
-    public void setCommentScore(String commentScore) {
-        this.commentScore = commentScore;
-    }
-
-    public String getCommentTimes() {
-        return commentTimes;
-    }
-
-    public void setCommentTimes(String commentTimes) {
-        this.commentTimes = commentTimes;
-    }
-
-    public String getSortIndex() {
-        return sortIndex;
-    }
-
-    public void setSortIndex(String sortIndex) {
-        this.sortIndex = sortIndex;
-    }
-
-    public String getFeaturedFlag() {
-        return featuredFlag;
-    }
-
-    public void setFeaturedFlag(String featuredFlag) {
-        this.featuredFlag = featuredFlag;
-    }
-
-    public String getFeaturedSortIndex() {
-        return featuredSortIndex;
-    }
-
-    public void setFeaturedSortIndex(String featuredSortIndex) {
-        this.featuredSortIndex = featuredSortIndex;
-    }
-
-    public String getProductCode() {
-        return productCode;
-    }
-
-    public void setProductCode(String productCode) {
-        this.productCode = productCode;
-    }
-
-    public String getUnit() {
-        return unit;
-    }
-
-    public void setUnit(String unit) {
-        this.unit = unit;
-    }
-
-    public String getAllAreaFlag() {
-        return allAreaFlag;
-    }
-
-    public void setAllAreaFlag(String allAreaFlag) {
-        this.allAreaFlag = allAreaFlag;
-    }
-
-    public String getProvinceIDs() {
-        return provinceIDs;
-    }
-
-    public void setProvinceIDs(String provinceIDs) {
-        this.provinceIDs = provinceIDs;
-    }
-
-    public String getServiceNumber() {
-        return serviceNumber;
-    }
-
-    public void setServiceNumber(String serviceNumber) {
-        this.serviceNumber = serviceNumber;
-    }
-
-    public String getMaxBuyNumber() {
-        return maxBuyNumber;
-    }
-
-    public void setMaxBuyNumber(String maxBuyNumber) {
-        this.maxBuyNumber = maxBuyNumber;
-    }
-
-    public String getMinBuyNumber() {
-        return minBuyNumber;
-    }
-
-    public void setMinBuyNumber(String minBuyNumber) {
-        this.minBuyNumber = minBuyNumber;
-    }
-
-    public String getPackageCount() {
-        return packageCount;
-    }
-
-    public void setPackageCount(String packageCount) {
-        this.packageCount = packageCount;
-    }
-
-    public String getByFlag() {
-        return byFlag;
-    }
-
-    public void setByFlag(String byFlag) {
-        this.byFlag = byFlag;
-    }
-
-    public String getNormalProductFlag() {
-        return normalProductFlag;
-    }
-
-    public void setNormalProductFlag(String normalProductFlag) {
-        this.normalProductFlag = normalProductFlag;
-    }
-
-    public String getStep() {
-        return step;
-    }
-
-    public void setStep(String step) {
-        this.step = step;
-    }
-
-    public String getActFlag() {
-        return actFlag;
-    }
-
-    public void setActFlag(String actFlag) {
-        this.actFlag = actFlag;
-    }
-
-    public String getActType() {
-        return actType;
-    }
-
-    public void setActType(String actType) {
-        this.actType = actType;
-    }
-
-    public Date getOnlineTime() {
-        return onlineTime;
-    }
-
-    public void setOnlineTime(Date onlineTime) {
-        this.onlineTime = onlineTime;
-    }
-
-    public Date getDownlineTime() {
-        return downlineTime;
-    }
-
-    public void setDownlineTime(Date downlineTime) {
-        this.downlineTime = downlineTime;
-    }
-
-    public String getFreePostFlag() {
-        return freePostFlag;
-    }
-
-    public void setFreePostFlag(String freePostFlag) {
-        this.freePostFlag = freePostFlag;
-    }
-
-    public String getCostPrice() {
-        return costPrice;
-    }
-
-    public void setCostPrice(String costPrice) {
-        this.costPrice = costPrice;
-    }
-
-    public String getShopPercent() {
-        return shopPercent;
-    }
-
-    public void setShopPercent(String shopPercent) {
-        this.shopPercent = shopPercent;
-    }
-
-    public String getCostCheckFlag() {
-        return costCheckFlag;
-    }
-
-    public void setCostCheckFlag(String costCheckFlag) {
-        this.costCheckFlag = costCheckFlag;
-    }
-
-    public String getMallCostCheckFlag() {
-        return mallCostCheckFlag;
-    }
-
-    public void setMallCostCheckFlag(String mallCostCheckFlag) {
-        this.mallCostCheckFlag = mallCostCheckFlag;
-    }
-
-    public String getPrecisehKey() {
-        return precisehKey;
-    }
-
-    public void setPrecisehKey(String precisehKey) {
-        this.precisehKey = precisehKey;
-    }
-
-    public String getShopName() {
-        return shopName;
-    }
-
-    public void setShopName(String shopName) {
-        this.shopName = shopName;
-    }
-
-    public String getGiftFlag() {
-        return giftFlag;
-    }
-
-    public void setGiftFlag(String giftFlag) {
-        this.giftFlag = giftFlag;
-    }
-
-    public Double getNormalPrice() {
-        return normalPrice;
-    }
-
-    public void setNormalPrice(Double normalPrice) {
-        this.normalPrice = normalPrice;
-    }
-
-    public Double getPrice() {
-        return price;
-    }
-
-    public void setPrice(Double price) {
-        this.price = price;
-    }
-
-    public String getBeginTimeStr() {
-        return beginTimeStr;
-    }
-
-    public void setBeginTimeStr(String beginTimeStr) {
-        this.beginTimeStr = beginTimeStr;
-    }
-
-    public String getEndTimeStr() {
-        return endTimeStr;
-    }
-
-    public void setEndTimeStr(String endTimeStr) {
-        this.endTimeStr = endTimeStr;
-    }
-
-    public String getActStatus() {
-        return actStatus;
-    }
-
-    public void setActStatus(String actStatus) {
-        this.actStatus = actStatus;
-    }
-
-    @Transient
-    public boolean isCustomClass() {
-        return customClass;
-    }
-
-    public void setCustomClass(boolean customClass) {
-        this.customClass = customClass;
-    }
-
-    @Transient
-    public String getBrandName() {
-        return brandName;
-    }
-
-    public void setBrandName(String brandName) {
-        this.brandName = brandName;
-    }
-
-    public String getOtherBrandName() {
-        return otherBrandName;
-    }
-
-    public void setOtherBrandName(String otherBrandName) {
-        this.otherBrandName = otherBrandName;
-    }
-
-    @Transient
-    public String getDefaultType() {
-        return defaultType;
-    }
-
-    public void setDefaultType(String defaultType) {
-        this.defaultType = defaultType;
-    }
-
-    @Transient
-    public String getDefaultTypeName() {
-        return defaultTypeName;
-    }
-
-    public void setDefaultTypeName(String defaultTypeName) {
-        this.defaultTypeName = defaultTypeName;
-    }
-
-    public String getActSort() {
-        return actSort;
-    }
-
-    public void setActSort(String actSort) {
-        this.actSort = actSort;
-    }
-
-    public Integer getBigTypeID() {
-        return bigTypeID;
-    }
-
-    public void setBigTypeID(Integer bigTypeID) {
-        this.bigTypeID = bigTypeID;
-    }
-
-    public Integer getSmallTypeID() {
-        return smallTypeID;
-    }
-
-    public void setSmallTypeID(Integer smallTypeID) {
-        this.smallTypeID = smallTypeID;
-    }
-
-    public String getActTime() {
-        return actTime;
-    }
-
-    public void setActTime(String actTime) {
-        this.actTime = actTime;
-    }
-
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    public Date getActCreateTime() {
-        return actCreateTime;
-    }
-
-    public void setActCreateTime(Date actCreateTime) {
-        this.actCreateTime = actCreateTime;
-    }
-
-    public String getActCreateTimeStr() {
-        return actCreateTimeStr;
-    }
-
-    public void setActCreateTimeStr(String actCreateTimeStr) {
-        this.actCreateTimeStr = actCreateTimeStr;
-    }
-
-    public String getRecommendType() {
-        return recommendType;
-    }
-
-    public void setRecommendType(String recommendType) {
-        this.recommendType = recommendType;
-    }
-
-    public String getSort() {
-        return sort;
-    }
-
-    public void setSort(String sort) {
-        this.sort = sort;
-    }
-
-    public Integer getRecommendProductId() {
-        return recommendProductId;
-    }
-
-    public void setRecommendProductId(Integer recommendProductId) {
-        this.recommendProductId = recommendProductId;
-    }
-
-    public String getExistsFlag() {
-        return existsFlag;
-    }
-
-    public void setExistsFlag(String existsFlag) {
-        this.existsFlag = existsFlag;
-    }
-
-    public Integer getPreferredFlag() {
-        return preferredFlag;
-    }
-
-    public void setPreferredFlag(Integer preferredFlag) {
-        this.preferredFlag = preferredFlag;
-    }
-
-    public String getAliasName() {
-        return aliasName;
-    }
-
-    public void setAliasName(String aliasName) {
-        this.aliasName = aliasName;
-    }
-
-    public String getVisibility() {
-        return visibility;
-    }
-
-    public void setVisibility(String visibility) {
-        this.visibility = visibility;
-    }
-
-    public String getCommodityDetailsFlag() {
-        return commodityDetailsFlag;
-    }
-
-    public void setCommodityDetailsFlag(String commodityDetailsFlag) {
-        this.commodityDetailsFlag = commodityDetailsFlag;
-    }
-
-    public String getTags() {
-        return tags;
-    }
-
-    public void setTags(String tags) {
-        this.tags = tags;
-    }
-
-    public String getMachineType() {
-        return machineType;
-    }
-
-    public void setMachineType(String machineType) {
-        this.machineType = machineType;
-    }
-
-    public Integer getCombinationID() {
-        return combinationID;
-    }
-
-    public void setCombinationID(Integer combinationID) {
-        this.combinationID = combinationID;
-    }
-
-    public Integer getCombinationSort() {
-        return combinationSort;
-    }
-
-    public void setCombinationSort(Integer combinationSort) {
-        this.combinationSort = combinationSort;
-    }
-
-    public String getProductRemarks() {
-        return productRemarks;
-    }
-
-    public void setProductRemarks(String productRemarks) {
-        this.productRemarks = productRemarks;
-    }
-
-    public List<String> getSearchKeyList() {
-        return searchKeyList;
-    }
-
-    public void setSearchKeyList(List<String> searchKeyList) {
-        this.searchKeyList = searchKeyList;
-    }
-
-    public List<ProductParameters> getProductParametersList() {
-        return productParametersList;
-    }
-
-    public String getProductType() {
-        return productType;
-    }
-
-    public void setProductType(String productType) {
-        this.productType = productType;
-    }
-
-    public void setProductParametersList(List<ProductParameters> productParametersList) {
-        this.productParametersList = productParametersList;
-    }
-
-    public String getQualificationImg() {
-        return qualificationImg;
-    }
-
-    public void setQualificationImg(String qualificationImg) {
-        this.qualificationImg = qualificationImg;
-    }
-
-    public String getIncludedTax() {
-        return includedTax;
-    }
-
-    public void setIncludedTax(String includedTax) {
-        this.includedTax = includedTax;
-    }
-
-    public String getInvoiceType() {
-        return invoiceType;
-    }
-
-    public void setInvoiceType(String invoiceType) {
-        this.invoiceType = invoiceType;
-    }
-
-    public String getTaxPoint() {
-        return taxPoint;
-    }
-
-    public void setTaxPoint(String taxPoint) {
-        this.taxPoint = taxPoint;
-    }
-
-    public String getSupplierTaxPoint() {
-        return supplierTaxPoint;
-    }
-
-    public void setSupplierTaxPoint(String supplierTaxPoint) {
-        this.supplierTaxPoint = supplierTaxPoint;
-    }
-
-    public String getSearchName() {
-        return searchName;
-    }
-
-    public void setSearchName(String searchName) {
-        this.searchName = searchName;
-    }
-
-    public String getSearchShopName() {
-        return searchShopName;
-    }
-
-    public void setSearchShopName(String searchShopName) {
-        this.searchShopName = searchShopName;
-    }
-
-    public Integer getSearchShopID() {
-        return searchShopID;
-    }
-
-    public void setSearchShopID(Integer searchShopID) {
-        this.searchShopID = searchShopID;
-    }
-
-    public String getSearchCommodityType() {
-        return searchCommodityType;
-    }
-
-    public void setSearchCommodityType(String searchCommodityType) {
-        this.searchCommodityType = searchCommodityType;
-    }
-
-    public Integer getSearchBigTypeID() {
-        return searchBigTypeID;
-    }
-
-    public void setSearchBigTypeID(Integer searchBigTypeID) {
-        this.searchBigTypeID = searchBigTypeID;
-    }
-
-    public Integer getSearchSmallTypeID() {
-        return searchSmallTypeID;
-    }
-
-    public void setSearchSmallTypeID(Integer searchSmallTypeID) {
-        this.searchSmallTypeID = searchSmallTypeID;
-    }
-
-    public Integer getSearchTinyTypeID() {
-        return searchTinyTypeID;
-    }
-
-    public void setSearchTinyTypeID(Integer searchTinyTypeID) {
-        this.searchTinyTypeID = searchTinyTypeID;
-    }
-
-    public String getSearchValidFlag() {
-        return searchValidFlag;
-    }
-
-    public void setSearchValidFlag(String searchValidFlag) {
-        this.searchValidFlag = searchValidFlag;
-    }
-
-    public String getSearchActStatus() {
-        return searchActStatus;
-    }
-
-    public void setSearchActStatus(String searchActStatus) {
-        this.searchActStatus = searchActStatus;
-    }
-
-    public String getSearchProductType() {
-        return searchProductType;
-    }
-
-    public void setSearchProductType(String searchProductType) {
-        this.searchProductType = searchProductType;
-    }
-
-    public Integer getSearchBrandID() {
-        return searchBrandID;
-    }
-
-    public void setSearchBrandID(Integer searchBrandID) {
-        this.searchBrandID = searchBrandID;
-    }
-
-    public Integer getSearchPreferredFlag() {
-        return searchPreferredFlag;
-    }
-
-    public void setSearchPreferredFlag(Integer searchPreferredFlag) {
-        this.searchPreferredFlag = searchPreferredFlag;
-    }
-
-    public CmBrand getBrand() {
-        return brand;
-    }
-
-    public void setBrand(CmBrand brand) {
-        this.brand = brand;
-    }
-
-    public String getProductCategory() {
-        return productCategory;
-    }
-
-    public void setProductCategory(String productCategory) {
-        this.productCategory = productCategory;
-    }
-
-    public String getSecondHandType() {
-        return secondHandType;
-    }
-
-    public void setSecondHandType(String secondHandType) {
-        this.secondHandType = secondHandType;
-    }
-
-    public String getInstrumentType() {
-        return instrumentType;
-    }
-
-    public void setInstrumentType(String instrumentType) {
-        this.instrumentType = instrumentType;
-    }
-
-    public String getSearchProductCategory() {
-        return searchProductCategory;
-    }
-
-    public void setSearchProductCategory(String searchProductCategory) {
-        this.searchProductCategory = searchProductCategory;
-    }
-
-    public String getEditFlag() {
-        return editFlag;
-    }
-
-    public void setEditFlag(String editFlag) {
-        this.editFlag = editFlag;
-    }
-
-    public Integer getGiftNumber() {
-        return giftNumber;
-    }
-
-    public void setGiftNumber(Integer giftNumber) {
-        this.giftNumber = giftNumber;
-    }
-
-    public BigDecimal getReducedPrice() {
-        return reducedPrice;
-    }
-
-    public void setReducedPrice(BigDecimal reducedPrice) {
-        this.reducedPrice = reducedPrice;
-    }
-
-    public String getPromotionType() {
-        return promotionType;
-    }
-
-    public void setPromotionType(String promotionType) {
-        this.promotionType = promotionType;
-    }
-
-    public String getDelProductIds() {
-        return delProductIds;
-    }
-
-    public void setDelProductIds(String delProductIds) {
-        this.delProductIds = delProductIds;
-    }
-
-    public List<Integer> getDelIdList() {
-        return delIdList;
-    }
-
-    public void setDelIdList(List<Integer> delIdList) {
-        this.delIdList = delIdList;
-    }
-
-    public String getSold() {
-        return sold;
-    }
-
-    public void setSold(String sold) {
-        this.sold = sold;
-    }
-
-    public String getPayStatus() {
-        return payStatus;
-    }
-
-    public void setPayStatus(String payStatus) {
-        this.payStatus = payStatus;
-    }
-
-    public String getContactName() {
-        return contactName;
-    }
-
-    public void setContactName(String contactName) {
-        this.contactName = contactName;
-    }
-
-    public BigDecimal getOriginalPrice() {
-        return originalPrice;
-    }
-
-    public void setOriginalPrice(BigDecimal originalPrice) {
-        this.originalPrice = originalPrice;
-    }
-
-    public String getSubmitDate() {
-        return submitDate;
-    }
-
-    public void setSubmitDate(String submitDate) {
-        this.submitDate = submitDate;
-    }
-
-    public String getReviewedDate() {
-        return reviewedDate;
-    }
-
-    public void setReviewedDate(String reviewedDate) {
-        this.reviewedDate = reviewedDate;
-    }
-
-    public String getOnLineDate() {
-        return onLineDate;
-    }
-
-    public void setOnLineDate(String onLineDate) {
-        this.onLineDate = onLineDate;
-    }
-
-    public String getPublisher() {
-        return publisher;
-    }
-
-    public void setPublisher(String publisher) {
-        this.publisher = publisher;
-    }
-
-    public String getCommodityType() {
-        return commodityType;
-    }
-
-    public void setCommodityType(String commodityType) {
-        this.commodityType = commodityType;
-    }
-
-    public String getSource() {
-        return source;
-    }
-
-    public void setSource(String source) {
-        this.source = source;
-    }
-
-    public Integer getOrganizeId() {
-        return organizeId;
-    }
-
-    public void setOrganizeId(Integer organizeId) {
-        this.organizeId = organizeId;
-    }
-
-    public String getProductIdStr() {
-        return productIdStr;
-    }
-
-    public void setProductIdStr(String productIdStr) {
-        this.productIdStr = productIdStr;
-    }
-
-    public String getDockingPeopleName() {
-        return dockingPeopleName;
-    }
-
-    public void setDockingPeopleName(String dockingPeopleName) {
-        this.dockingPeopleName = dockingPeopleName;
-    }
-
-    public Integer getFloorId() {
-        return floorId;
-    }
-
-    public void setFloorId(Integer floorId) {
-        this.floorId = floorId;
-    }
-
-    public Integer getTrainingMethod() {
-        return trainingMethod;
-    }
-
-    public void setTrainingMethod(Integer trainingMethod) {
-        this.trainingMethod = trainingMethod;
-    }
-
-    public Integer getTrainingType() {
-        return trainingType;
-    }
-
-    public void setTrainingType(Integer trainingType) {
-        this.trainingType = trainingType;
-    }
-
-    public BigDecimal getTrainingFee() {
-        return trainingFee;
-    }
-
-    public void setTrainingFee(BigDecimal trainingFee) {
-        this.trainingFee = trainingFee;
-    }
-
-    public Integer getSvipFlag() {
-        return svipFlag;
-    }
-
-    public void setSvipFlag(Integer svipFlag) {
-        this.svipFlag = svipFlag;
-    }
-
-    public Integer getSearchType() {
-        return searchType;
-    }
-
-    public void setSearchType(Integer searchType) {
-        this.searchType = searchType;
-    }
-
-    public String getMobile() {
-        return mobile;
-    }
-
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public String getReceiptID() {
-        return receiptID;
-    }
-
-    public void setReceiptID(String receiptID) {
-        this.receiptID = receiptID;
-    }
-
-    public Integer getShopOrderID() {
-        return shopOrderID;
-    }
-
-    public void setShopOrderID(Integer shopOrderID) {
-        this.shopOrderID = shopOrderID;
-    }
-
-    public Integer getOrderProductID() {
-        return orderProductID;
-    }
-
-    public void setOrderProductID(Integer orderProductID) {
-        this.orderProductID = orderProductID;
-    }
-
-    public Double getTaxRate() {
-        return taxRate;
-    }
-
-    public void setTaxRate(Double taxRate) {
-        this.taxRate = taxRate;
-    }
-
-    public Integer getReturnGoodsStutas() {
-        return returnGoodsStutas;
-    }
-
-    public void setReturnGoodsStutas(Integer returnGoodsStutas) {
-        this.returnGoodsStutas = returnGoodsStutas;
-    }
-
-    public Integer getInsertStatus() {
-        return insertStatus;
-    }
-
-    public void setInsertStatus(Integer insertStatus) {
-        this.insertStatus = insertStatus;
-    }
-
-    public Integer getIsRelevance() {
-        return isRelevance;
-    }
-
-    public void setIsRelevance(Integer isRelevance) {
-        this.isRelevance = isRelevance;
-    }
-
-    public String getKeywords() {
-        return keywords;
-    }
 
-    public void setKeywords(String keywords) {
-        this.keywords = keywords;
-    }
 }

+ 3 - 1
src/main/java/com/caimei/modules/product/entity/Shop.java

@@ -82,6 +82,8 @@ public class Shop extends DataEntity<Shop> {
 	private String cooperateFlag; //
 	private String businessScope; //
 	private Integer bail; // 是否已缴纳保证金(0 没有,1 有)
+	private Integer AccountOwnership; // 账号归属 0采美 1 供应商
+	private String bankAccount;	//收款卡号
 	private List<ShopCert> shopCertList;//商品资质认证
 	private String shopIds;	//商店id,","隔开
 	private List<Integer> ids; //商店id列表
@@ -89,4 +91,4 @@ public class Shop extends DataEntity<Shop> {
 	private String delShopIds;//删除的商店id,以,隔开
 	private List<Integer> delShopIdList;//删除的商品id列表
 	private Integer shopType;
-}
+}

+ 21 - 1
src/main/java/com/caimei/modules/product/service/CmPromotionService.java

@@ -49,7 +49,7 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
         List<Shop> promotionShops = new ArrayList<>();
         if (CollectionUtils.isNotEmpty(promotionList)) {
             for (CmPromotion promotion : promotionList) {
-                if("1".equals(promotion.getMode())){
+                if ("1".equals(promotion.getMode())) {
                     promotion.setSkus(productDao.findSkuByPromotion(promotion.getId()));
                 }
                 if (StringUtils.isNotBlank(cmPromotion.getProductName())) {
@@ -192,6 +192,25 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
      * 查询促销可用商品
      */
     public Page findProductPage(Page<Product> productPage, Product product) {
+        /**
+         * 单品促销
+         * 满赠时,赠品只能选择和该促销单品相同供应商的商品
+         * 凑单促销
+         * 1.满赠时,凑单商品和赠品都只能选择[综合供应商]的商品
+         * 店铺促销
+         * 1.赠品只能在已选好的供应商的商品内选择
+         */
+        if ("1".equals(product.getPromotionType())) {
+            // 单品满赠
+            if (null != product.getPromotionMode() && 3 == product.getPromotionMode()) {
+                Integer shopId = null != product.getShopID() ? product.getShopID() : (cmPromotionDao.findShopId(product.getProductID()));
+                product.setShopID(shopId);
+                product.setProductID(null);
+            }
+        } else if ("2".equals(product.getPromotionType())) {
+            // 凑单
+            product.setShopID(1161);
+        }
         product.setPage(productPage);
         List<Integer> list = new ArrayList<>();
         //已添加的商品id不能被查询到
@@ -331,6 +350,7 @@ public class CmPromotionService extends CrudService<CmPromotionDao, CmPromotion>
                 //赠品改为skuId
                 String giftId = (String) map.get("skuId");
                 Integer number = Integer.parseInt(map.get("number").toString());
+                logger.info("giftId------------------" + giftId);
                 cmPromotionDao.insertGiftProduct(promotionId, giftId, number);
             }
         }

+ 0 - 4
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -97,10 +97,6 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productDao.getGiftProductInfo(giftProduct);
     }
 
-    public Sku getProductSku(Integer productId) {
-        return productDao.getProductSku(productId);
-    }
-
     /**
      * 更新赠送
      *

+ 21 - 24
src/main/java/com/caimei/modules/product/web/CmPromotionController.java

@@ -7,9 +7,7 @@ import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
 import com.caimei.modules.opensearch.CoreServiceUitls;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.modules.product.dao.CmPromotionDao;
-import com.caimei.modules.product.entity.CmPromotion;
-import com.caimei.modules.product.entity.Product;
-import com.caimei.modules.product.entity.Shop;
+import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.service.CmPromotionService;
 import com.caimei.modules.product.service.ProductService;
 import com.caimei.redis.RedisService;
@@ -122,10 +120,10 @@ public class CmPromotionController extends BaseController {
 
     @RequestMapping(value = "delPromotion")
     @ResponseBody
-    public Map<String, Object> delPromotion(@RequestParam("id") String id,@RequestParam("skuId")Integer skuId, HttpServletRequest request) {
+    public Map<String, Object> delPromotion(@RequestParam("id") String id, @RequestParam("skuId") Integer skuId, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
         try {
-            cmPromotionService.delPromotion(id,skuId);
+            cmPromotionService.delPromotion(id, skuId);
             map.put("success", "true");
             map.put("msg", "删除成功");
         } catch (Exception e) {
@@ -142,11 +140,11 @@ public class CmPromotionController extends BaseController {
     @RequestMapping(value = "form")
     public String form(CmPromotion cmPromotion, Model model) {
         if (cmPromotion != null) {
-            if("1".equals(cmPromotion.getType())&&"1".equals(cmPromotion.getMode())){
-                if(StringUtils.isNotBlank(cmPromotion.getId())){
+            if ("1".equals(cmPromotion.getType()) && "1".equals(cmPromotion.getMode())) {
+                if (StringUtils.isNotBlank(cmPromotion.getId())) {
                     //单品优惠价的时候给优惠商品的skus赋值
                     cmPromotion.setSkus(cmPromotionDao.getPromotionSkus(cmPromotion.getId()));
-                }else{
+                } else {
                     //新增单品促销的时候没有id
                     cmPromotion.setSkus(cmPromotionDao.getPromotionSkusByProduct(cmPromotion.getProductIds()));
                 }
@@ -185,18 +183,18 @@ public class CmPromotionController extends BaseController {
                     String[] split = cmPromotion.getProductIds().split(",");
                     for (String productId : split) {
                         if (StringUtil.isNotBlank(productId)) {
-                            if(StringUtils.isNotBlank(cmPromotion.getType()) && "2".equals(cmPromotion.getType())){
+                            if (StringUtils.isNotBlank(cmPromotion.getType()) && "2".equals(cmPromotion.getType())) {
                                 //凑单促销的时候取的是skuId
-                                productId=productService.getProductIdBySku(productId);
+                                productId = productService.getProductIdBySku(productId);
                             }
                             Product product = productService.get(productId);
                             promotionProducts.add(product);
                         }
                     }
                 } else {
-                    if(StringUtils.isNotBlank(cmPromotion.getType()) && "2".equals(cmPromotion.getType())){
+                    if (StringUtils.isNotBlank(cmPromotion.getType()) && "2".equals(cmPromotion.getType())) {
                         //凑单促销的时候取的是skuId
-                       String productId=productService.getProductIdBySku(cmPromotion.getProductIds());
+                        String productId = productService.getProductIdBySku(cmPromotion.getProductIds());
                         cmPromotion.setProductIds(productId);
                     }
                     Product product = productService.get(cmPromotion.getProductIds());
@@ -209,13 +207,13 @@ public class CmPromotionController extends BaseController {
                     String[] split = cmPromotion.getGiftIds().split(",");
                     for (String skuId : split) {
                         if (StringUtil.isNotBlank(skuId)) {
-                            Product product = productService.getBySku(skuId);
-                            giftProducts.add(product);
+                                Product product = productService.getBySku(skuId);
+                                giftProducts.add(product);
                         }
                     }
                 } else {
-                    Product product = productService.getBySku(cmPromotion.getGiftIds());
-                    giftProducts.add(product);
+                        Product product = productService.getBySku(cmPromotion.getGiftIds());
+                        giftProducts.add(product);
                 }
             }
             if (StringUtil.isNotBlank(cmPromotion.getShopIds())) {
@@ -337,11 +335,6 @@ public class CmPromotionController extends BaseController {
             cmPromotion.setGiftProducts(giftProducts);
             cmPromotion.setPromotionShops(promotionShops);
             model.addAttribute("cmPromotion", cmPromotion);
-            if (cmPromotion.getPromotionProducts().size() > 0) {
-                model.addAttribute("price1", cmPromotion.getPromotionProducts().get(0).getPrice());
-            } else {
-                model.addAttribute("price1", 0);
-            }
             if ("1".equals(cmPromotion.getType())) {
                 return "modules/product-new/singlePromotionForm";
             } else if ("2".equals(cmPromotion.getType())) {
@@ -352,7 +345,6 @@ public class CmPromotionController extends BaseController {
         } else {
             return null;
         }
-
     }
 
     /**
@@ -405,6 +397,7 @@ public class CmPromotionController extends BaseController {
         cleanRedisCache();
         return map;
     }
+
     //更新促销索引
     private void updateIndex(CmPromotion cmPromotion) {
         List<Integer> productIdsByPromotion = new ArrayList<>();
@@ -415,8 +408,8 @@ public class CmPromotionController extends BaseController {
             productIdByPromotion = cmPromotionDao.findProductIdByPromotion(cmPromotion.getId());
         }
         // 更新索引
-        productIdsByPromotion.forEach(p->coreServiceUitls.updateProductIndex(p));
-        productIdByPromotion.forEach(p->coreServiceUitls.updateProductIndex(p));
+        productIdsByPromotion.forEach(p -> coreServiceUitls.updateProductIndex(p));
+        productIdByPromotion.forEach(p -> coreServiceUitls.updateProductIndex(p));
     }
 
     /**
@@ -425,12 +418,16 @@ public class CmPromotionController extends BaseController {
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = "findProductPage")
     public String findProductPage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        //todo 非单品促销的时候当前版本限制死仅可选择综合供应商,赠品仅可选择和促销商品同一供应商
         Page page = cmPromotionService.findProductPage(new Page<Product>(request, response), product);
         model.addAttribute("page", page);
         model.addAttribute("promotionType", product.getPromotionType());
         model.addAttribute("ids", product.getIds());
         model.addAttribute("delProductIds", product.getDelProductIds());
         if ("1".equals(product.getPromotionType())) {
+            if (null != product.getPromotionMode() && 3 == product.getPromotionMode()) {
+                return "modules/product-new/promotionSelectProducts";
+            }
             return "modules/product-new/promotionSelectSingleProduct";
         } else {
             return "modules/product-new/promotionSelectProducts";

+ 0 - 5
src/main/java/com/caimei/modules/product/web/ProductController.java

@@ -269,12 +269,7 @@ public class ProductController extends BaseController{
                     if(null != productInfo){
                         gp.setProductImage(AppUtils.getImageURL("product", productInfo.getMainImage(), 0,""));
                         gp.setProductCode(productInfo.getProductCode());
-                        //获取购买最大库存
-                        Sku productSku = productService.getProductSku(gp.getGiftProductId());
                         Integer sku = 0;//默认库存
-                        if(null != productSku){
-                            sku = productSku.getStock();
-                        }
                         gp.setProductSku(sku);
                     }
                 }

+ 12 - 12
src/main/java/com/caimei/modules/user/service/ClubPortraitService.java

@@ -131,24 +131,24 @@ public class ClubPortraitService {
                     // 普通订单
                     if (("0".equals(order.getSecondHandOrderFlag()) || StringUtils.isEmpty(order.getSecondHandOrderFlag()))
                             && (!"1".equals(order.getRebateFlag()) || "".equals(order.getRebateFlag()) || StringUtils.isEmpty(order.getRebateFlag()))
-                            && ((!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType())) || "".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType()))
-                            && !"6".equals(order.getStatus())) {
+                            && (!"2".equals(order.getRefundType()) || "".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType()))
+                            && !"4".equals(order.getStatus())) {
                         ordinary++;
                     }
                     // 二手订单
                     if ("1".equals(order.getSecondHandOrderFlag()) && !"1".equals(order.getRebateFlag())
-                            && (!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType())) && !"6".equals(order.getStatus())) {
+                            && (!"2".equals(order.getRefundType())) && !"4".equals(order.getStatus())) {
                         secondHand++;
                     }
                     // 返佣订单
-                    if ("1".equals(order.getRebateFlag()) &&
-                            (!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType())) && !"6".equals(order.getStatus())) {
+                    /*if ("1".equals(order.getRebateFlag()) &&
+                            (!"2".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType())) && !"4".equals(order.getStatus())) {
                         rebate++;
-                    }
+                    }*/
                     // 部分退款
-                    if ("1".equals(order.getRefundType()) && !"6".equals(order.getStatus())) {
+                    /*if ("1".equals(order.getRefundType()) && !"4".equals(order.getStatus())) {
                         partialRefund++;
-                    }
+                    }*/
                     // 全部退款
                     /*if ("2".equals(order.getRefundType()) && !"6".equals(order.getStatus())) {
                         fullRefund++;
@@ -179,22 +179,22 @@ public class ClubPortraitService {
                     orderPortrait.setName("二手订单 【 0 %】 【" + secondHand + "个】");
                 }
                 orderPortraits.add(orderPortrait);
-                orderPortrait = new OrderPortrait();
+                /*orderPortrait = new OrderPortrait();
                 orderPortrait.setValue(rebate);
                 if (rebate != 0) {
                     orderPortrait.setName("返佣订单 【" + instance.format((float) rebate / (float) length * 100) + "%】 【" + rebate + "个】");
                 } else {
                     orderPortrait.setName("返佣订单 【 0 %】 【" + rebate + "个】");
                 }
-                orderPortraits.add(orderPortrait);
-                orderPortrait = new OrderPortrait();
+                orderPortraits.add(orderPortrait);*/
+                /*orderPortrait = new OrderPortrait();
                 orderPortrait.setValue(partialRefund);
                 if (partialRefund != 0) {
                     orderPortrait.setName("部分退款订单 【" + instance.format((float) partialRefund / (float) length * 100) + "%】 【" + partialRefund + "个】");
                 } else {
                     orderPortrait.setName("部分退款订单 【 0 %】 【" + partialRefund + "个】");
                 }
-                orderPortraits.add(orderPortrait);
+                orderPortraits.add(orderPortrait);*/
                 /*orderPortrait = new OrderPortrait();
                 orderPortrait.setValue(fullRefund);
                 if (fullRefund != 0) {

+ 80 - 0
src/main/resources/mappings/modules/order/CmPayShopMapper.xml

@@ -133,6 +133,86 @@
 			</otherwise>
 		</choose>
 
+	</select>
+	<select id="payThirdParties" resultType="CmPayShop">
+		SELECT
+		<include refid="cmPayShopColumns"/>,
+		u1.name AS applicantName,
+		u2.name AS reviewerName,
+		s.name AS shopName,
+		(SELECT paymentType FROM cm_pay_shop_record WHERE payShopID = a.id LIMIT 1) AS paymentType
+		FROM cm_pay_shop a
+		left join sys_user u1 on u1.id = a.applicant
+		left join sys_user u2 on u2.id = a.reviewer
+		left join shop s on s.shopID = a.shopID
+		LEFT JOIN cm_pay_shop_record psr ON psr.payShopID = a.id
+		LEFT JOIN cm_shop_order so ON so.shopOrderID = psr.shopOrderID
+		LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = so.orderId
+		LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
+		<where>
+			s.name NOT LIKE '%综合供应商%'
+			AND s.AccountOwnership = 1
+			AND cdr.payWay = 2
+			AND so.receiptStatus != 1
+			<if test="id != null and id != ''">
+				and a.id = #{id}
+			</if>
+			<if test="shopName != null and shopName != ''">
+				and s.name like concat('%', #{shopName}, '%')
+			</if>
+			<if test="name != null and name != ''">
+				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="startTime != null and startTime != ''">
+				AND a.applyTime <![CDATA[  >=  ]]> #{startTime}
+			</if>
+			<if test="endTime != null and endTime != ''">
+				AND a.applyTime <![CDATA[   <=  ]]> #{endTime}
+			</if>
+			<if test="startTime2 != null and startTime2 != ''">
+				AND a.payTime <![CDATA[  >=  ]]> #{startTime2}
+			</if>
+			<if test="endTime2 != null and endTime2 != ''">
+				AND a.payTime <![CDATA[   <=  ]]> #{endTime2}
+			</if>
+			<if test="status != null and status != ''">
+				AND a.status = #{status}
+			</if>
+			<if test="shopOrderNo != null and shopOrderNo != ''">
+				AND a.id in (select cpsr.payShopID from cm_pay_shop_record cpsr where cpsr.shopOrderNo like concat('%',#{shopOrderNo},'%'))
+			</if>
+			<if test="shopOrderID != null and shopOrderID != ''">
+				AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record cpsr WHERE cpsr.shopOrderID=#{shopOrderID})
+			</if>
+			<if test="orderID != null and orderID != ''">
+				AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record  cpsr LEFT JOIN cm_shop_order so ON so.shopOrderID=cpsr.shopOrderID WHERE so.orderID=#{orderID})
+			</if>
+			<if test='organizeID != null and organizeID != "" and organizeID != "9999"'>
+				AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record  cpsr LEFT JOIN cm_shop_order so ON so.shopOrderID=cpsr.shopOrderID WHERE so.organizeID = #{organizeID})
+			</if>
+			<if test='organizeID == "9999"'>
+				AND a.id IN (SELECT cpsr.payShopID FROM cm_pay_shop_record  cpsr LEFT JOIN cm_shop_order so ON so.shopOrderID=cpsr.shopOrderID WHERE so.orderType = 2)
+			</if>
+			<if test="orderNo != null and orderNo != ''">
+				AND a.id in (SELECT cpsr.payShopID FROM cm_pay_shop_record  cpsr LEFT JOIN cm_shop_order so ON so.shopOrderID=cpsr.shopOrderID WHERE so.orderNo LIKE CONCAT('%',#{orderNo},'%'))
+			</if>
+			<if test="paymentType != null">
+				AND a.id IN(SELECT payShopID FROM cm_pay_shop_record WHERE paymentType = #{paymentType} AND delFlag = 0)
+			</if>
+		</where>
+		GROUP BY a.id
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.id desc
+			</otherwise>
+		</choose>
+
 	</select>
 
 	<select id="findAllList" resultType="CmPayShop">

+ 5 - 3
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -1157,7 +1157,7 @@
                productAmount,
                needPayAmount,
                shopProductAmount,
-               shopPostFee,
+               ifnull(shopPostFee, 0) as shopPostFee,
                shopTaxFee,
                shouldPayShopAmount,
                orderTime,
@@ -1166,7 +1166,9 @@
                sendOutStatus,
                splitFlag,
                splitCode,
-               organizeId
+               organizeId,
+               ifnull(promotionFullReduction,0) as promotionFullReduction,
+               ifnull(couponAmount,0) as couponAmount
         FROM cm_shop_order
         WHERE delFlag = 0
           AND shopOrderID = #{shopOrderId}
@@ -1329,7 +1331,7 @@
                productAmount,
                needPayAmount,
                shopProductAmount,
-               shopPostFee,
+               ifnull(shopPostFee, 0) as shopPostFee,
                shopTaxFee,
                shouldPayShopAmount,
                orderTime,

+ 17 - 4
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -4,7 +4,6 @@
 
     <sql id="shopOrderColumns">
         co.rebateFee as rebateFee,
-        co.couponAmount as couponAmount,
 			co.userBeans as userBeans,
 			a.shopOrderID AS shopOrderID,
 			a.shopStatus AS status,
@@ -69,7 +68,7 @@
     		a.payStatus AS payStatus,
     		a.sendOutStatus AS sendOutStatus,
     		a.shopProductAmount AS shopProductAmount,
-    		a.shopPostFee AS shopPostFee,
+    		ifnull(a.shopPostFee, 0) AS shopPostFee,
     		a.shopTaxFee AS shopTaxFee,
     		a.shouldPayShopAmount AS shouldPayShopAmount,
     		a.payedShopAmount AS payedShopAmount,
@@ -82,7 +81,8 @@
     		a.differenceType AS differenceType,
     		a.differencePrice AS differencePrice,
     		a.proportional AS proportional,
-    		a.promotionFullReduction As promotionFullReduction,
+    		ifnull(a.promotionFullReduction, 0) As promotionFullReduction,
+    		ifnull(a.couponAmount, 0) As couponAmount,
     		a.zeroCostFlag AS zeroCostFlag
     </sql>
 
@@ -271,7 +271,8 @@
         SELECT<include refid="shopOrderColumns"/>,
         b.name as shopName,
         oa.id as orderArchiveId,
-        co.receiptStatus
+        co.receiptStatus,
+        (SELECT SUM(num) FROM cm_order_product WHERE shoporderid=29760 AND productType = 2) as presentNum
         FROM cm_shop_order a
         left join shop b on a.shopID = b.shopID
         left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
@@ -279,6 +280,18 @@
         WHERE a.orderID = #{orderID} ORDER BY a.shopOrderNo DESC
     </select>
 
+    <select id="getFreightAmount" resultType="java.lang.Double">
+        SELECT ifnull(SUM(cfr.freightAmount), 0)
+        FROM cm_freight_rule cfr
+                 LEFT JOIN cm_freight_template cft ON cft.id = cfr.freightId
+                 LEFT JOIN product p ON p.freightTemplateId = cft.id
+        WHERE productId = #{productId} and cft.delFlag = 0
+    </select>
+
+    <select id="getShopOrderId" resultType="com.caimei.modules.product.entity.Shop">
+        select shopId, AccountOwnership, bankAccount from shop where shopId = #{shopId}
+    </select>
+
     <select id="findCommercialCode" resultType="String">
         select commercialCode
         FROM cm_shop_order a

+ 1 - 3
src/main/resources/mappings/modules/product/CmProductCombinationMapper.xml

@@ -130,7 +130,7 @@
 		left join cm_organize_product_info copi on copi.productId = a.productID
 		left join shop s on a.shopId = s.shopID
 		<where>
-
+			copi.validFlag in (2,3,9)
 			<if test="productID !=null and productID !=''">
 				AND a.productID=#{productID}
 			</if>
@@ -146,8 +146,6 @@
 				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
 				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
 			</if>
--- 			AND a.validFlag in (2,3,9)
-			 copi.validFlag in (2,3,9)
 			and a.combinationID is null
 			and a.productCategory = 1
 		</where>

+ 11 - 3
src/main/resources/mappings/modules/product/CmPromotionMapper.xml

@@ -128,7 +128,7 @@
                  LEFT JOIN shop s ON s.shopID = p.shopID
         WHERE cp.id = #{id} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
           and p.productCategory = 1
-        group by p.productID
+        group by cpg.skuId
     </select>
 
     <select id="findGiftPurchaseProduct" resultType="com.caimei.modules.bulkpurchase.entity.PurchaseProduct">
@@ -165,7 +165,7 @@
     </select>
 
     <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
-        SELECT
+        SELECT distinct
         p.productId as productID,
         p.mainImage as mainImage,
         p.name as name,
@@ -187,6 +187,9 @@
             <if test="shopName != null and shopName != ''">
                 AND s.name LIKE concat('%',#{shopName},'%')
             </if>
+            <if test="shopID !=null and shopID != ''">
+                AND s.shopID = #{shopID}
+            </if>
             <if test="ids != null and ids.size > 0">
                 AND p.productID NOT IN
                 <foreach collection="ids" open="(" close=")" item="id" separator=",">
@@ -472,7 +475,8 @@
                  LEFT JOIN cm_promotions_product cpp ON cp.id = cpp.promotionsId
                  LEFT JOIN cm_sku cs ON cpp.productId = cs.productId
                  LEFT JOIN cm_promotion_sku cps ON cs.skuId = cps.skuId
-        WHERE cp.id = #{id} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+        WHERE cp.id = #{id} and cps.promotionId = #{id}
+          and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
     </select>
 
     <select id="getPromotionSkusByProduct" resultType="com.caimei.modules.product.entity.CmSku">
@@ -487,6 +491,10 @@
         WHERE cs.productId = #{productIds} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
     </select>
 
+    <select id="findShopId" resultType="java.lang.Integer">
+        select shopId from product where productId = #{productID}
+    </select>
+
     <delete id="deletePromotion">
         delete
         from cm_promotions_gift

+ 232 - 213
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -99,10 +99,13 @@
     <sql id="ActivityJoins">
         LEFT JOIN shop s on s.shopID = a.shopID
     </sql>
-    <insert id="insertMallProduct" keyColumn="id" keyProperty="id" useGeneratedKeys="true" parameterType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
-        INSERT INTO cm_mall_organize_products (organizeID, productID, shopId, normalPrice, costPrice, ladderPriceFlag, minBuyNumber,
+    <insert id="insertMallProduct" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
+            parameterType="com.caimei.modules.weisha.entity.CmOrganizeProduct">
+        INSERT INTO cm_mall_organize_products (organizeID, productID, shopId, normalPrice, costPrice, ladderPriceFlag,
+                                               minBuyNumber,
                                                validFlag, addTime, updateTime, delFlag)
-        VALUES (#{organizeId}, #{productId}, #{shopId}, #{normalPrice}, #{costPrice}, #{ladderPriceFlag}, #{minBuyNumber},
+        VALUES (#{organizeId}, #{productId}, #{shopId}, #{normalPrice}, #{costPrice}, #{ladderPriceFlag},
+                #{minBuyNumber},
                 #{validFlag}, #{addTime}, #{updateTime}, #{delFlag})
     </insert>
     <update id="saveSort">
@@ -123,8 +126,10 @@
     <select id="get" resultType="Product">
         SELECT
         <include refid="productColumns"/>,
-        (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 0 ) as costCheckFlag,
-        (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 4 ) as mallCostCheckFlag
+        (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 0 ) as
+        costCheckFlag,
+        (select costCheckFlag from cm_organize_product_info where productId = #{id} and organizeId = 4 ) as
+        mallCostCheckFlag
         FROM product a
         <include refid="productJoins"/>
         WHERE a.productID = #{id}
@@ -356,7 +361,7 @@
         bigTypeID,
         smallTypeID,
         tinyTypeID,
---         selfTypeID,
+        -- selfTypeID,
         shopID,
         aliasName,
         name,
@@ -368,28 +373,28 @@
         propertiesInfo,
         addTime,
         updateTime,
---         weekSellNumber,
+        -- weekSellNumber,
         beforeValidFlag,
         validFlag,
         favoriteTimes,
         commentScore,
         commentTimes,
---         selfRecommendFlag,
---         sysRecommendFlag,
+        -- selfRecommendFlag,
+        -- sysRecommendFlag,
         sortIndex,
         featuredFlag,
         featuredSortIndex,
         productCode,
---         synToERPFlag,
+        -- synToERPFlag,
         allAreaFlag,
         provinceIDs,
         serviceNumber,
         packageCount,
         byFlag,
         normalProductFlag,
---         wholeSaleProductFlag,
---         promotionProductFlag,
---         groupBuyProductFlag,
+        -- wholeSaleProductFlag,
+        -- promotionProductFlag,
+        -- groupBuyProductFlag,
         step,
         actFlag,
         actType,
@@ -397,7 +402,7 @@
         onlineTime,
         downlineTime,
         freePostFlag,
---         precisehKey,
+        -- precisehKey,
         visibility,
         commodityDetailsFlag,
         productType,
@@ -436,7 +441,7 @@
         #{bigTypeID},
         #{smallTypeID},
         #{tinyTypeID},
---         #{selfTypeID},
+        -- #{selfTypeID},
         #{shopID},
         #{aliasName},
         #{name},
@@ -448,28 +453,28 @@
         #{propertiesInfo},
         #{addTime},
         #{updateTime},
---         #{weekSellNumber},
+        -- #{weekSellNumber},
         #{beforeValidFlag},
         #{validFlag},
         #{favoriteTimes},
         #{commentScore},
         #{commentTimes},
---         #{selfRecommendFlag},
---         #{sysRecommendFlag},
+        -- #{selfRecommendFlag},
+        -- #{sysRecommendFlag},
         #{sortIndex},
         #{featuredFlag},
         #{featuredSortIndex},
         #{productCode},
---         #{synToERPFlag},
+        -- #{synToERPFlag},
         #{allAreaFlag},
         #{provinceIDs},
         #{serviceNumber},
         #{packageCount},
         #{byFlag},
         #{normalProductFlag},
---         #{wholeSaleProductFlag},
---         #{promotionProductFlag},
---         #{groupBuyProductFlag},
+        -- #{wholeSaleProductFlag},
+        -- #{promotionProductFlag},
+        -- #{groupBuyProductFlag},
         #{step},
         #{actFlag},
         #{actType},
@@ -477,7 +482,7 @@
         #{onlineTime},
         #{downlineTime},
         #{freePostFlag},
---         #{precisehKey},
+        -- #{precisehKey},
         #{visibility},
         #{commodityDetailsFlag},
         #{productType},
@@ -515,51 +520,51 @@
 
     <update id="update">
         UPDATE product
-        SET productID            = #{id},
-            brandID              = #{brandID},
-            tinyTypeID           = #{tinyTypeID},
+        SET productID         = #{id},
+            brandID           = #{brandID},
+            tinyTypeID        = #{tinyTypeID},
 --             selfTypeID           = #{selfTypeID},
-            shopID               = #{shopID},
-            name                 = #{name},
-            searchKey            = #{searchKey},
-            priceFlag            = #{priceFlag},
-            beautyActFlag        = #{beautyActFlag},
-            hasSkuFlag           = #{hasSkuFlag},
-            mainImage            = #{mainImage},
-            propertiesInfo       = #{propertiesInfo},
-            addTime              = #{addTime},
-            updateTime           = #{updateTime},
-            sellNumber           = #{sellNumber},
+            shopID            = #{shopID},
+            name              = #{name},
+            searchKey         = #{searchKey},
+            priceFlag         = #{priceFlag},
+            beautyActFlag     = #{beautyActFlag},
+            hasSkuFlag        = #{hasSkuFlag},
+            mainImage         = #{mainImage},
+            propertiesInfo    = #{propertiesInfo},
+            addTime           = #{addTime},
+            updateTime        = #{updateTime},
+            sellNumber        = #{sellNumber},
 --             weekSellNumber       = #{weekSellNumber},
-            beforeValidFlag      = #{beforeValidFlag},
-            validFlag            = #{validFlag},
-            favoriteTimes        = #{favoriteTimes},
-            commentScore         = #{commentScore},
-            commentTimes         = #{commentTimes},
+            beforeValidFlag   = #{beforeValidFlag},
+            validFlag         = #{validFlag},
+            favoriteTimes     = #{favoriteTimes},
+            commentScore      = #{commentScore},
+            commentTimes      = #{commentTimes},
 --             selfRecommendFlag    = #{selfRecommendFlag},
 --             sysRecommendFlag     = #{sysRecommendFlag},
-            sortIndex            = #{sortIndex},
-            featuredFlag         = #{featuredFlag},
-            featuredSortIndex    = #{featuredSortIndex},
-            productCode          = #{productCode},
+            sortIndex         = #{sortIndex},
+            featuredFlag      = #{featuredFlag},
+            featuredSortIndex = #{featuredSortIndex},
+            productCode       = #{productCode},
 --             synToERPFlag         = #{synToERPFlag},
-            allAreaFlag          = #{allAreaFlag},
-            provinceIDs          = #{provinceIDs},
-            serviceNumber        = #{serviceNumber},
-            packageCount         = #{packageCount},
-            byFlag               = #{byFlag},
-            normalProductFlag    = #{normalProductFlag},
+            allAreaFlag       = #{allAreaFlag},
+            provinceIDs       = #{provinceIDs},
+            serviceNumber     = #{serviceNumber},
+            packageCount      = #{packageCount},
+            byFlag            = #{byFlag},
+            normalProductFlag = #{normalProductFlag},
 --             wholeSaleProductFlag = #{wholeSaleProductFlag},
 --             promotionProductFlag = #{promotionProductFlag},
 --             groupBuyProductFlag  = #{groupBuyProductFlag},
-            step                 = #{step},
-            actFlag              = #{actFlag},
-            actType              = #{actType},
-            onlineTime           = #{onlineTime},
-            downlineTime         = #{downlineTime},
-            freePostFlag         = #{freePostFlag},
+            step              = #{step},
+            actFlag           = #{actFlag},
+            actType           = #{actType},
+            onlineTime        = #{onlineTime},
+            downlineTime      = #{downlineTime},
+            freePostFlag      = #{freePostFlag},
 --             precisehKey          = #{precisehKey},
-            actSort              = #{actSort},
+            actSort           = #{actSort},
             newProductType=#{newProductType}
 
         WHERE productID = #{id}
@@ -688,17 +693,6 @@
         </where>
     </select>
 
-    <select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
-        SELECT
-        *
-        FROM
-        sku
-        <where>
-            productID = #{productId}
-            AND validFlag = 1
-        </where>
-    </select>
-
     <select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
         SELECT
         tb.name
@@ -891,7 +885,7 @@
             `productCategory`,
         </if>
         `preferredFlag`,
---         `selfTypeID`,
+        -- `selfTypeID`,
         `shopID`,
         `name`,
         `aliasName`,
@@ -904,28 +898,28 @@
         `propertiesInfo`,
         `addTime`,
         `updateTime`,
---         `weekSellNumber`,
+        -- `weekSellNumber`,
         `beforeValidFlag`,
         `validFlag`,
         `favoriteTimes`,
         `commentScore`,
         `commentTimes`,
---         `selfRecommendFlag`,
---         `sysRecommendFlag`,
+        -- `selfRecommendFlag`,
+        -- `sysRecommendFlag`,
         `sortIndex`,
         `featuredFlag`,
         `featuredSortIndex`,
         `productCode`,
---         `synToERPFlag`,
+        -- `synToERPFlag`,
         `allAreaFlag`,
         `provinceIDs`,
         `serviceNumber`,
         `packageCount`,
         `byFlag`,
         `normalProductFlag`,
---         `wholeSaleProductFlag`,
---         `promotionProductFlag`,
---         `groupBuyProductFlag`,
+        -- `wholeSaleProductFlag`,
+        -- `promotionProductFlag`,
+        -- `groupBuyProductFlag`,
         `step`,
         `actFlag`,
         `actStatus`,
@@ -935,7 +929,7 @@
         `onlineTime`,
         `downlineTime`,
         `freePostFlag`,
---         `precisehKey`,
+        -- `precisehKey`,
         `tags`,
         `productType`,
         `machineType`,
@@ -956,7 +950,7 @@
             #{productCategory},
         </if>
         #{preferredFlag},
---         #{selfTypeID},
+        -- #{selfTypeID},
         #{shopID},
         #{name},
         #{aliasName},
@@ -969,28 +963,28 @@
         #{propertiesInfo},
         #{addTime},
         #{updateTime},
---         #{weekSellNumber},
+        -- #{weekSellNumber},
         #{beforeValidFlag},
         #{validFlag},
         #{favoriteTimes},
         #{commentScore},
         #{commentTimes},
---         #{selfRecommendFlag},
---         #{sysRecommendFlag},
+        -- #{selfRecommendFlag},
+        -- #{sysRecommendFlag},
         #{sortIndex},
         #{featuredFlag},
         #{featuredSortIndex},
         #{productCode},
---         #{synToERPFlag},
+        -- #{synToERPFlag},
         #{allAreaFlag},
         #{provinceIDs},
         #{serviceNumber},
         #{packageCount},
         #{byFlag},
         #{normalProductFlag},
---         #{wholeSaleProductFlag},
---         #{promotionProductFlag},
---         #{groupBuyProductFlag},
+        -- #{wholeSaleProductFlag},
+        -- #{promotionProductFlag},
+        -- #{groupBuyProductFlag},
         #{step},
         #{actFlag},
         #{actStatus},
@@ -1000,7 +994,7 @@
         #{onlineTime},
         #{downlineTime},
         #{freePostFlag},
---         #{precisehKey},
+        -- #{precisehKey},
         #{tags},
         #{productType},
         #{machineType},
@@ -1050,59 +1044,60 @@
             useGeneratedKeys="true">
         insert into cm_sku
         (productId,
-         normalPrice,
-         price,
-         ladderPriceFlag,
-         <if test="costPrice != null">
+        normalPrice,
+        price,
+        ladderPriceFlag,
+        <if test="costPrice != null">
             costprice,
-         </if>
-         <if test="organizeCostPrice != null">
+        </if>
+        <if test="organizeCostPrice != null">
             organizeCostPrice,
-         </if>
-         <if test="cmCostPrice != null">
+        </if>
+        <if test="cmCostPrice != null">
             cmCostPrice,
-         </if>
-         stock,
-         <if test="shopPercent != null">
+        </if>
+        stock,
+        <if test="shopPercent != null">
             shopPercent,
-         </if>
-         <if test="organizePercent != null">
+        </if>
+        <if test="organizePercent != null">
             organizePercent,
-         </if>
-         <if test="cmPercent != null">
+        </if>
+        <if test="cmPercent != null">
             cmPercent,
-         </if>
-         organizeId,
-         minBuyNumber,
-         unit)
+        </if>
+        organizeId,
+        minBuyNumber,
+        unit)
         values (#{productId},
-                #{normalPrice},
-                #{price},
-                #{ladderPriceFlag},
-                <if test="costPrice != null">
-                    #{costPrice},
-                </if>
-                <if test="organizeCostPrice != null">
-                    #{organizeCostPrice},
-                </if>
-                <if test="cmCostPrice != null">
-                    #{cmCostPrice},
-                </if>
-                #{stock},
-                <if test="shopPercent != null">
-                    #{shopPercent},
-                </if>
-                <if test="organizePercent != null">
-                    #{organizePercent},
-                </if>
-                <if test="cmPercent != null">
-                    #{cmPercent},
-                </if>
-                #{organizeId},
-                #{minBuyNumber},
-                #{unit})
+        #{normalPrice},
+        #{price},
+        #{ladderPriceFlag},
+        <if test="costPrice != null">
+            #{costPrice},
+        </if>
+        <if test="organizeCostPrice != null">
+            #{organizeCostPrice},
+        </if>
+        <if test="cmCostPrice != null">
+            #{cmCostPrice},
+        </if>
+        #{stock},
+        <if test="shopPercent != null">
+            #{shopPercent},
+        </if>
+        <if test="organizePercent != null">
+            #{organizePercent},
+        </if>
+        <if test="cmPercent != null">
+            #{cmPercent},
+        </if>
+        #{organizeId},
+        #{minBuyNumber},
+        #{unit})
     </insert>
-    <insert id="insertOrganizeSku" keyColumn="id" keyProperty="id" parameterType="com.caimei.modules.product.entity.CmSku"
+    <insert id="insertOrganizeSku" keyColumn="id" keyProperty="id"
+            parameterType="com.caimei.modules.product.entity.CmSku"
             useGeneratedKeys="true">
         insert into cm_mall_product_sku
         (productId,
@@ -1220,7 +1215,8 @@
         select productId
         from cm_sku cs
         where skuId = #{productId}
-        and  cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=#{productId})
+        #暂时写死0
+        and  cs.organizeId = 0 limit 1
     </select>
 
     <select id="toAddProductList" resultType="product">
@@ -1513,15 +1509,15 @@
             <if test="updateTime != null and updateTime !=''">
                 updateTime = #{updateTime},
             </if>
-<!--            <if test="weekSellNumber != null and weekSellNumber !=''">-->
-<!--                weekSellNumber = #{weekSellNumber},-->
-<!--            </if>-->
+            <!--            <if test="weekSellNumber != null and weekSellNumber !=''">-->
+            <!--                weekSellNumber = #{weekSellNumber},-->
+            <!--            </if>-->
             <if test="beforeValidFlag != null and beforeValidFlag !=''">
                 beforeValidFlag = #{beforeValidFlag},
             </if>
-<!--            <if test="validFlag != null and validFlag !=''">-->
-<!--                validFlag = #{validFlag},-->
-<!--            </if>-->
+            <!--            <if test="validFlag != null and validFlag !=''">-->
+            <!--                validFlag = #{validFlag},-->
+            <!--            </if>-->
             <if test="favoriteTimes != null and favoriteTimes !=''">
                 favoriteTimes = #{favoriteTimes},
             </if>
@@ -1531,12 +1527,12 @@
             <if test="commentTimes != null and commentTimes !=''">
                 commentTimes = #{commentTimes},
             </if>
-<!--            <if test="selfRecommendFlag != null and selfRecommendFlag !=''">-->
-<!--                selfRecommendFlag = #{selfRecommendFlag},-->
-<!--            </if>-->
-<!--            <if test="sysRecommendFlag != null and sysRecommendFlag !=''">-->
-<!--                sysRecommendFlag = #{sysRecommendFlag},-->
-<!--            </if>-->
+            <!--            <if test="selfRecommendFlag != null and selfRecommendFlag !=''">-->
+            <!--                selfRecommendFlag = #{selfRecommendFlag},-->
+            <!--            </if>-->
+            <!--            <if test="sysRecommendFlag != null and sysRecommendFlag !=''">-->
+            <!--                sysRecommendFlag = #{sysRecommendFlag},-->
+            <!--            </if>-->
             <if test="sortIndex != null and sortIndex != ''">
                 sortIndex = #{sortIndex},
             </if>
@@ -1549,9 +1545,9 @@
             <if test="productCode != null and productCode !=''">
                 productCode = #{productCode},
             </if>
-<!--            <if test="synToERPFlag != null and synToERPFlag !=''">-->
-<!--                synToERPFlag = #{synToERPFlag},-->
-<!--            </if>-->
+            <!--            <if test="synToERPFlag != null and synToERPFlag !=''">-->
+            <!--                synToERPFlag = #{synToERPFlag},-->
+            <!--            </if>-->
             <if test="allAreaFlag != null and allAreaFlag !=''">
                 allAreaFlag = #{allAreaFlag},
             </if>
@@ -1570,15 +1566,15 @@
             <if test="normalProductFlag != null and normalProductFlag !=''">
                 normalProductFlag = #{normalProductFlag},
             </if>
-<!--            <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">-->
-<!--                wholeSaleProductFlag = #{wholeSaleProductFlag},-->
-<!--            </if>-->
-<!--            <if test="promotionProductFlag != null and promotionProductFlag !=''">-->
-<!--                promotionProductFlag = #{promotionProductFlag},-->
-<!--            </if>-->
-<!--            <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">-->
-<!--                groupBuyProductFlag = #{groupBuyProductFlag},-->
-<!--            </if>-->
+            <!--            <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">-->
+            <!--                wholeSaleProductFlag = #{wholeSaleProductFlag},-->
+            <!--            </if>-->
+            <!--            <if test="promotionProductFlag != null and promotionProductFlag !=''">-->
+            <!--                promotionProductFlag = #{promotionProductFlag},-->
+            <!--            </if>-->
+            <!--            <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">-->
+            <!--                groupBuyProductFlag = #{groupBuyProductFlag},-->
+            <!--            </if>-->
             <if test="step != null and step !=''">
                 step = #{step},
             </if>
@@ -1600,9 +1596,9 @@
             <if test="freePostFlag != null and freePostFlag !=''">
                 freePostFlag = #{freePostFlag},
             </if>
-<!--            <if test="precisehKey != null and precisehKey !=''">-->
-<!--                precisehKey = #{precisehKey},-->
-<!--            </if>-->
+            <!--            <if test="precisehKey != null and precisehKey !=''">-->
+            <!--                precisehKey = #{precisehKey},-->
+            <!--            </if>-->
             <if test="visibility != null and visibility !=''">
                 visibility = #{visibility},
             </if>
@@ -1736,31 +1732,31 @@
     <update id="updateCmSku">
         update cm_sku
         set productId=#{productId},
-            ladderPriceFlag=#{ladderPriceFlag},
-            normalPrice=#{normalPrice},
-            price=#{price},
-            organizeId=#{organizeId},
-            <if test="shopPercent != null">
-                shopPercent=#{shopPercent},
-            </if>
-            <if test="organizePercent != null">
-                organizePercent=#{organizePercent},
-            </if>
-            <if test="cmPercent != null">
-                cmPercent=#{cmPercent},
-            </if>
-            <if test="costPrice != null">
-                costPrice=#{costPrice},
-            </if>
-            <if test="organizeCostPrice != null">
-                organizeCostPrice = #{organizeCostPrice},
-            </if>
-            <if test="cmCostPrice != null">
-                cmCostPrice = #{cmCostPrice},
-            </if>
-            stock=#{stock},
-            unit=#{unit},
-            minBuyNumber=#{minBuyNumber}
+        ladderPriceFlag=#{ladderPriceFlag},
+        normalPrice=#{normalPrice},
+        price=#{price},
+        organizeId=#{organizeId},
+        <if test="shopPercent != null">
+            shopPercent=#{shopPercent},
+        </if>
+        <if test="organizePercent != null">
+            organizePercent=#{organizePercent},
+        </if>
+        <if test="cmPercent != null">
+            cmPercent=#{cmPercent},
+        </if>
+        <if test="costPrice != null">
+            costPrice=#{costPrice},
+        </if>
+        <if test="organizeCostPrice != null">
+            organizeCostPrice = #{organizeCostPrice},
+        </if>
+        <if test="cmCostPrice != null">
+            cmCostPrice = #{cmCostPrice},
+        </if>
+        stock=#{stock},
+        unit=#{unit},
+        minBuyNumber=#{minBuyNumber}
         where skuId = #{skuId}
     </update>
     <update id="updateOrganizeSku">
@@ -2021,7 +2017,9 @@
                unit,
                normalPrice,
                stock,
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
                shopPercent,
                costPrice,
                price,
@@ -2035,10 +2033,13 @@
                  left join cm_promotion_sku cps on cs.skuId = cps.skuId
                  left join cm_svip_product_sku csps on cs.skuId = csps.skuId
         where cs.productId = #{productID}
-          and  cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=#{productID})
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = #{productID})
     </select>
     <select id="getCostCheckFlag" resultType="java.lang.Integer">
-        select costCheckFlag from cm_organize_product_info where productId = #{productId} and organizeId = #{organizeId}
+        select costCheckFlag
+        from cm_organize_product_info
+        where productId = #{productId}
+          and organizeId = #{organizeId}
     </select>
     <select id="findSkuListProduct" resultType="com.caimei.modules.product.entity.CmSku">
         select cs.skuId,
@@ -2047,7 +2048,9 @@
                unit,
                normalPrice,
                stock,
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
                shopPercent,
                organizePercent,
                cmPercent,
@@ -2062,7 +2065,9 @@
                csps.priceType
         from cm_sku cs
                  left join cm_svip_product_sku csps on cs.skuId = csps.skuId
-        where cs.organizeId=0 and  cs.productId = #{productID}
+        where cs.organizeId = 0
+          and cs.productId = #{productID}
+        order by cs.price asc
     </select>
     <select id="findSkuOrganizeList" resultType="com.caimei.modules.product.entity.CmSku">
         select cs.skuId,
@@ -2071,8 +2076,10 @@
                cs.unit,
                cs.normalPrice,
                cs.stock,
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
-               cs.shopPercent as shopPercent,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
+               cs.shopPercent                                                  as shopPercent,
                cs.costPrice,
                cs.organizeCostPrice,
                cs.cmCostPrice,
@@ -2082,7 +2089,8 @@
                cs.shopPercent,
                cs.cmPercent
         from cm_sku cs
-        where cs.organizeId = 4  and cs.productId = #{productID}
+        where cs.organizeId = 4
+          and cs.productId = #{productID}
     </select>
     <select id="findLadderPriceBySku" resultType="com.caimei.modules.product.entity.CmLadderPrice">
         select skuId, productId, userType, ladderNum, buyNum, buyPrice, delFlag
@@ -2113,7 +2121,8 @@
         FROM product a
         <include refid="productJoins"/>
         left join cm_sku cs on cs.productId=a.productID and copi.organizeId= cs.organizeId
-        WHERE cs.skuId = #{skuId} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+        WHERE cs.skuId = #{skuId} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE
+        productID=cs.productId)
     </select>
     <select id="findHeHeSku" resultType="com.caimei.modules.product.entity.CmSku">
         select cs.skuId,
@@ -2121,16 +2130,18 @@
                cs.organizeId,
                cs.unit,
                cs.stock,
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
                cs.costPrice,
-               ifnull(cs.shopPercent, 0) as shopPercent,
-               ifnull(cs.organizePercent, 0) as organizePercent,
-               ifnull(cs.cmPercent, 0) as cmPercent,
+               ifnull(cs.shopPercent, 0)                                       as shopPercent,
+               ifnull(cs.organizePercent, 0)                                   as organizePercent,
+               ifnull(cs.cmPercent, 0)                                         as cmPercent,
                chs.price
         from cm_sku cs
                  left join cm_hehe_sku chs on cs.skuId = chs.skuId
         where cs.productId = #{productID}
-          and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
     </select>
     <select id="findSkuId" resultType="java.lang.Integer">
         select skuId
@@ -2139,26 +2150,30 @@
     </select>
     <select id="findSku" resultType="com.caimei.modules.product.entity.CmSku">
         select cs.price,
-               ifnull(cs.costPrice, 0) as costPrice,
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               ifnull(cs.costPrice, 0)                                         as costPrice,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
                cs.shopPercent,
                cs.normalPrice
         from cm_sku cs
         where cs.productId = #{productId}
-          and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
         order by cs.price asc
         limit 1
     </select>
     <select id="findOrganizeSku" resultType="com.caimei.modules.product.entity.CmSku">
         SELECT cs.price,
                ifnull(cs.costPrice, 0),
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
-               cs.shopPercent AS shopPercent,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
+               cs.shopPercent                                                  AS shopPercent,
                cs.normalPrice,
                cs.organizeId
         FROM cm_sku cs
         WHERE cs.productId = #{productId}
-          and cs.organizeId=4
+          and cs.organizeId = 4
         ORDER BY cs.price ASC
         LIMIT 1
     </select>
@@ -2166,13 +2181,15 @@
         select cs.skuId,
                cs.price,
                cs.costPrice,
-               (select costCheckFlag from cm_organize_product_info where productId = cs.productId and organizeId = cs.organizeId ) as costCheckFlag,
+               (select costCheckFlag
+                from cm_organize_product_info
+                where productId = cs.productId and organizeId = cs.organizeId) as costCheckFlag,
                cs.shopPercent,
                cs.unit,
                cs.organizeId
         from cm_sku cs
         where cs.skuId = #{skuId}
-          and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
     </select>
     <select id="findSkuIdByPromotionsId" resultType="java.lang.Integer">
         select skuId
@@ -2185,19 +2202,21 @@
         where skuId = #{skuId}
     </select>
     <select id="findSkuByPromotion" resultType="com.caimei.modules.product.entity.CmSku">
-        SELECT cs.price, cps.skuId, cps.touchPrice
-                       , cs.unit
-                       , cs.organizeId
+        SELECT cs.price
+             , cps.skuId
+             , cps.touchPrice
+             , cs.unit
+             , cs.organizeId
         FROM cm_promotion_sku cps
                  LEFT JOIN cm_sku cs ON cps.skuId = cs.skuId
         WHERE promotionId = #{id}
-          and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
     </select>
     <select id="getSkuByPromotionId" resultType="com.caimei.modules.product.entity.CmSku">
         SELECT cs.price, cpp.productId, cs.skuId, cs.unit
         FROM cm_promotions_product cpp
                  LEFT JOIN cm_sku cs ON cpp.productId = cs.productId
         WHERE promotionsId = #{id}
-          and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
+          and cs.organizeId = (SELECT SUBSTRING(groundMall, 1, 1) FROM product WHERE productID = cs.productId)
     </select>
 </mapper>

+ 5 - 1
src/main/resources/mappings/modules/product/ProductNewMapper.xml

@@ -148,7 +148,7 @@
         LEFT JOIN cm_svip_product csp on a.productID = csp.productId
         left join (select * from cm_organize_product_info ) copi on copi.productId = a.productID
         <where>
-              copi.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=a.productID)
+
             <if test="id !=null and id !=''">
                 AND a.productID=#{id}
             </if>
@@ -166,6 +166,10 @@
             </if>
             <if test="groundMall != null and groundMall != ''">
                 AND a.groundMall like concat('%',#{groundMall},'%')
+                and copi.organizeId = #{groundMall}
+            </if>
+            <if test="groundMall == null">
+                copi.organizeId = 0
             </if>
             <if test="productCategory != null and productCategory != ''">
                 AND a.productCategory = #{productCategory}

+ 17 - 14
src/main/resources/mappings/modules/user/CmPortraitMapper.xml

@@ -4,8 +4,8 @@
 
     <select id="selTotal" resultType="com.caimei.modules.user.entity.CmPortrait">
         SELECT
-                (SELECT COUNT(orderID) FROM cm_order WHERE clubID = #{clubID} AND STATUS != 6 AND STATUS != 7 AND refundType != 2 AND orderTime <![CDATA[ < ]]> now()) AS orderTotal,
-                (SELECT SUM(payTotalFee) FROM cm_order WHERE clubID = #{clubID} AND STATUS != 6 AND STATUS != 7 AND refundType != 2 AND orderTime <![CDATA[ < ]]> now()) AS orderTotalAmount,
+                (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubID} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
+                (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubID} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
                 (SELECT COUNT(cbr.recordID) FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID WHERE cbr.pageType IN (8, 9) AND c.clubID = #{clubID} AND cbr.accessDate <![CDATA[ < ]]> now()) AS totalkeywords ,
                 (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubID} AND addTime <![CDATA[ < ]]> now()) AS remarksTotal
     </select>
@@ -47,20 +47,23 @@
 
     <select id="selOrderList" resultType="com.caimei.modules.order.entity.NewOrder">
         SELECT
-               (SELECT COUNT(orderID) FROM cm_order WHERE clubID = #{clubID} AND STATUS != 6 AND STATUS != 7 AND refundType != 2) as numbers,
-                (SELECT SUM(payTotalFee) FROM cm_order WHERE clubID = #{clubID} AND STATUS != 6 AND STATUS != 7 AND refundType != 2) as totalMoney,
-               clubID,
-               secondHandOrderFlag,
-               rebateFlag,
-               refundType,
-               payTotalFee,
-               STATUS,
-               orderTime
-        FROM cm_order
+        DISTINCT cso.shopOrderId as shopOrderID,
+        (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubID} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
+        (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubID} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
+        cso.clubID,
+        co.secondHandOrderFlag,
+        co.rebateFlag,
+        cso.totalAmount AS payTotalFee,
+        ifnull(cso.refundStatus,1) as refundType,
+        cso.shopStatus AS STATUS,
+        cso.orderTime
+        FROM cm_shop_order cso
+        LEFT JOIN cm_order co ON cso.orderId = co.orderId
+        LEFT JOIN cm_order_product cop ON cso.shopOrderId = cop.shopOrderId
         <where>
-             clubID = #{clubID} AND STATUS != 6 AND STATUS != 7 AND refundType != 2
+            cso.clubID = #{clubID} AND cso.shopStatus != 4 AND cso.shopStatus != 5 AND cso.refundStatus != 2 AND cop.productId != 999
              <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
-                 AND orderTime <![CDATA[ >= ]]> #{startTime} AND orderTime <![CDATA[ <= ]]> #{endTime}
+                 AND cso.orderTime <![CDATA[ >= ]]> #{startTime} AND cso.orderTime <![CDATA[ <= ]]> #{endTime}
              </if>
         </where>
     </select>

+ 9 - 9
src/main/webapp/WEB-INF/views/modules/coupon/MoneyCouponForm.jsp

@@ -247,12 +247,12 @@
         <div class="controls">
             <form:radiobutton name="hdq" path="couponType" value="0" label="活动券" class="required"
                               onclick="couponShow()"/>
-            <form:radiobutton id="plq" path="couponType" value="1"
-                              style="display:${cmCoupon.moneyCouponType eq 2 ? 'none':''}" label="品类券" class="required"
-                              onclick="couponShow()"/>
-            <form:radiobutton id="zxq" path="couponType" value="2"
-                              style="display:${cmCoupon.moneyCouponType eq 2 ? 'none':''}" label="用户专享券"
-                              class="required" onclick="couponShow()"/>
+<%--            <form:radiobutton id="plq" path="couponType" value="1"--%>
+<%--                              style="display:${cmCoupon.moneyCouponType eq 2 ? 'none':''}" label="品类券" class="required"--%>
+<%--                              onclick="couponShow()"/>--%>
+<%--            <form:radiobutton id="zxq" path="couponType" value="2"--%>
+<%--                              style="display:${cmCoupon.moneyCouponType eq 2 ? 'none':''}" label="用户专享券"--%>
+<%--                              class="required" onclick="couponShow()"/>--%>
             <form:radiobutton id="dpq" path="couponType" value="3"
                               style="display:${cmCoupon.moneyCouponType eq 2 ? 'none':''}" label="店铺券" class="required"
                               onclick="couponShow()"/>
@@ -262,9 +262,9 @@
         <div class="control-group">
             <label class="control-label"><font color="red">*</font>优惠商品:</label>
             <div class="controls">
-                <form:radiobutton id="qsc" path="productType" value="1" label="全商城商品"
-                                  style="display: ${cmCoupon.moneyCouponType eq 2 ? 'none':''}" onclick="productShow()"
-                                  checked="${empty cmCoupon.productType ? true:false}"/>
+<%--                <form:radiobutton id="qsc" path="productType" value="1" label="全商城商品"--%>
+<%--                                  style="display: ${cmCoupon.moneyCouponType eq 2 ? 'none':''}" onclick="productShow()"--%>
+<%--                                  checked="${empty cmCoupon.productType ? true:false}"/>--%>
                 <form:radiobutton path="productType" value="2" label="指定商品" onclick="productShow()"/>
             </div>
         </div>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponForm.jsp

@@ -194,7 +194,7 @@
 		<div class="control-group">
 			<label class="control-label"><font color="red">*</font>优惠商品:</label>
 			<div class="controls">
-				<form:radiobutton path="productType" value="1" label="全商城商品" onclick="productShow()" checked ="${empty cmCoupon.productType ? true:false}"/>
+<%--				<form:radiobutton path="productType" value="1" label="全商城商品" onclick="productShow()" checked ="${empty cmCoupon.productType ? true:false}"/>--%>
 				<form:radiobutton path="productType" value="2" label="指定商品" onclick="productShow()"/>
 			</div>
 		</div>

+ 3 - 3
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponList.jsp

@@ -23,10 +23,10 @@
 <body>
 	<ul class="nav nav-tabs">
 		<li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=0&&moneyCouponFlag=2">活动券</a></li>
-		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=1&&moneyCouponFlag=2">品类券</a></li>
-		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=2&&moneyCouponFlag=2">用户专享券</a></li>
+<%--		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=1&&moneyCouponFlag=2">品类券</a></li>--%>
+<%--		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=2&&moneyCouponFlag=2">用户专享券</a></li>--%>
 		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=3&&moneyCouponFlag=2">店铺券</a></li>
-		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=4&&moneyCouponFlag=2">新用户券</a></li>
+<%--		<li><a href="${ctx}/coupon/cmCoupon/list?couponType=4&&moneyCouponFlag=2">新用户券</a></li>--%>
 	</ul>
 	<form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
 		<input type="hidden" name="couponType" value="0"/>

+ 3 - 3
src/main/webapp/WEB-INF/views/modules/coupon/couponShopList.jsp

@@ -23,10 +23,10 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/coupon/cmCoupon/list?couponType=0&&moneyCouponFlag=2">活动券</a></li>
-    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=1&&moneyCouponFlag=2">品类券</a></li>
-    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2&&moneyCouponFlag=2">用户专享券</a></li>
+<%--    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=1&&moneyCouponFlag=2">品类券</a></li>--%>
+<%--    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=2&&moneyCouponFlag=2">用户专享券</a></li>--%>
     <li class="active"><a href="${ctx}/coupon/cmCoupon/list?couponType=3&&moneyCouponFlag=2">店铺券</a></li>
-    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=4&&moneyCouponFlag=2">新用户券</a></li>
+<%--    <li><a href="${ctx}/coupon/cmCoupon/list?couponType=4&&moneyCouponFlag=2">新用户券</a></li>--%>
 </ul>
 <form:form id="searchForm" modelAttribute="cmCoupon" action="${ctx}/coupon/cmCoupon/" method="post" class="breadcrumb form-search">
     <input type="hidden" name="couponType" value="3"/>

+ 4 - 4
src/main/webapp/WEB-INF/views/modules/coupon/redemptionCodeCouponForm.jsp

@@ -185,17 +185,17 @@
         <label class="control-label"><font color="red">*</font>优惠券类型:</label>
         <div class="controls">
             <form:radiobutton path="couponType" value="0" label="活动券" class="required" onclick="couponShow()"/>
-            <form:radiobutton path="couponType" value="1" label="品类券" class="required" onclick="couponShow()"/>
-            <form:radiobutton path="couponType" value="2" label="用户专享券" class="required" onclick="couponShow()"/>
+<%--            <form:radiobutton path="couponType" value="1" label="品类券" class="required" onclick="couponShow()"/>--%>
+<%--            <form:radiobutton path="couponType" value="2" label="用户专享券" class="required" onclick="couponShow()"/>--%>
             <form:radiobutton path="couponType" value="3" label="店铺券" class="required" onclick="couponShow()"/>
-            <form:radiobutton path="couponType" value="4" label="新用户券" class="required" onclick="couponShow()"/>
+<%--            <form:radiobutton disabled="true" path="couponType" value="4" label="新用户券" class="required" onclick="couponShow()"/>--%>
         </div>
     </div>
     <div id="eventVoucher" hidden="hidden">
         <div class="control-group">
             <label class="control-label"><font color="red">*</font>优惠商品:</label>
             <div class="controls">
-                <form:radiobutton path="productType" value="1" label="全商城商品" onclick="productShow()" checked ="${empty cmCoupon.productType ? true:false}"/>
+<%--                <form:radiobutton path="productType" value="1" label="全商城商品" onclick="productShow()" checked ="${empty cmCoupon.productType ? true:false}"/>--%>
                 <form:radiobutton path="productType" value="2" label="指定商品" onclick="productShow()"/>
             </div>
         </div>

+ 2 - 2
src/main/webapp/WEB-INF/views/modules/order/checkPaymentOrder.jsp

@@ -428,7 +428,7 @@
                     <th>退款状态</th>
                     <th>退款金额</th>
                     <th>优惠券</th>
-                    <th>经理折扣</th>
+                    <th>促销满减</th>
                 </tr>
                 <tr>
                     <td rowspan="0" class="item0">${(page.pageNo-1)*page.pageSize+sIndex.index+1}</td>
@@ -499,7 +499,7 @@
                     <td>
                         <fmt:formatNumber value="${s.couponAmount}" type="number" pattern="#,##0.00"/>
                     </td>
-                    <td><fmt:formatNumber value="${s.discountFee}" type="number" pattern="#,##0.00"/></td>
+                    <td><fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/></td>
                 </tr>
                 <tr class="t2">
                     <th colspan="3">机构</th>

+ 72 - 57
src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptList.jsp

@@ -46,10 +46,21 @@
         .check-btn-wrapper input:last-child {
             margin-left: 10px;
         }
+
         .select-ele input-medium:hover .options {
             display: block;
         }
-        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+
+        .weishaIcon {
+            background: darkorange;
+            color: white;
+            margin: 0 0px;
+            padding: 0 3px;
+            font-style: normal;
+            font-size: 12px;
+            display: inline-block;
+            border-radius: 2px
+        }
     </style>
     <script type="text/javascript">
         $(document).ready(function () {
@@ -60,12 +71,12 @@
                 $(".secondType").hide();
             }
         });
-            $("#receipt").hover(function(){
-                console.log(1);
-                $("#mark-info").show();
-            },function(){
-                $("#mark-info").hide();
-            })
+        $("#receipt").hover(function () {
+            console.log(1);
+            $("#mark-info").show();
+        }, function () {
+            $("#mark-info").hide();
+        })
 
         function page(n, s) {
             $("#pageNo").val(n);
@@ -90,9 +101,9 @@
         }
 
 
-        function changeReceiptType(){
+        function changeReceiptType() {
             var receiptType = $("#receiptType").val();
-            var newReceiptType=$("#newReceiptType");
+            var newReceiptType = $("#newReceiptType");
             if (receiptType == 2) {
                 $(".secondType").show();
             } else {
@@ -117,7 +128,8 @@
             <label>收款ID:</label>
             <form:input path="id" htmlEscape="false" maxlength="20" class="input-medium" onchange="onlynum(this)"/>
             <label>子订单ID:</label>
-            <form:input path="shopOrderId" htmlEscape="false" maxlength="20" class="input-medium" onchange="onlynum(this)"/>
+            <form:input path="shopOrderId" htmlEscape="false" maxlength="20" class="input-medium"
+                        onchange="onlynum(this)"/>
             <label>子订单编号:</label>
             <form:input path="shopOrderNo" htmlEscape="false" maxlength="50" class="input-medium"/>
             <label>机构名称:</label>
@@ -157,19 +169,19 @@
             <label>收款账号:</label>
             <form:select path="payType" class="select-ele input-medium">
                 <form:option value="" label="全部"/>
-<%--                <c:forEach items="${offlineCollections}" var="offlineCollections" varStatus="index">--%>
-                    <form:options items="${cmReceiTypes}" itemLabel="type" itemValue="id"
-                                  htmlEscape="false"/>
-<%--                </c:forEach>--%>
+                <%--                <c:forEach items="${offlineCollections}" var="offlineCollections" varStatus="index">--%>
+                <form:options items="${cmReceiTypes}" itemLabel="type" itemValue="id"
+                              htmlEscape="false"/>
+                <%--                </c:forEach>--%>
             </form:select>
         </div>
         <div>
-<%--            <label>收款进度:</label>--%>
-<%--            <form:select path="receiptProgress" class="select-ele input-medium">--%>
-<%--                <form:option value="" label="全部"/>--%>
-<%--                <form:options items="${fns:getDictList('receiptProgress')}" itemLabel="label" itemValue="value"--%>
-<%--                              htmlEscape="false"/>--%>
-<%--            </form:select>--%>
+                <%--            <label>收款进度:</label>--%>
+                <%--            <form:select path="receiptProgress" class="select-ele input-medium">--%>
+                <%--                <form:option value="" label="全部"/>--%>
+                <%--                <form:options items="${fns:getDictList('receiptProgress')}" itemLabel="label" itemValue="value"--%>
+                <%--                              htmlEscape="false"/>--%>
+                <%--            </form:select>--%>
             <label>订单类型:</label>
             <form:select path="receiptOrderType" class="select-ele input-medium">
                 <form:option value="" label="全部"/>
@@ -233,20 +245,20 @@
             <td><fmt:formatNumber type="number" pattern="#,##0.00"
                                   value="${cmDiscernReceipt.receiptAmount}"/></td>
             <c:if test="${cmDiscernReceipt.receiptType != 2}">
-            <td>
-                <c:if test="${cmDiscernReceipt.payWay == '1'}">
-                    线上
-                </c:if>
-                <c:if test="${cmDiscernReceipt.payWay == '2'}">
-                    线下
-                </c:if>
-                <c:if test="${cmDiscernReceipt.payWay == '3'}">
-                    余额抵扣
-                </c:if>
-                <c:if test="${cmDiscernReceipt.payWay != '1' && cmDiscernReceipt.payWay != '2'&& cmDiscernReceipt.payWay != '3'}">
-                    ---
-                </c:if>
-            </td>
+                <td>
+                    <c:if test="${cmDiscernReceipt.payWay == '1'}">
+                        线上
+                    </c:if>
+                    <c:if test="${cmDiscernReceipt.payWay == '2'}">
+                        线下
+                    </c:if>
+                    <c:if test="${cmDiscernReceipt.payWay == '3'}">
+                        余额抵扣
+                    </c:if>
+                    <c:if test="${cmDiscernReceipt.payWay != '1' && cmDiscernReceipt.payWay != '2'&& cmDiscernReceipt.payWay != '3'}">
+                        ---
+                    </c:if>
+                </td>
             </c:if>
             <c:if test="${cmDiscernReceipt.receiptType == 2}">
                 <td>
@@ -263,21 +275,21 @@
             </c:if>
             <td>
                     ${fns:getDictLabel(cmDiscernReceipt.receiptType, 'receiptType', null)}
-                        <c:if test="${cmDiscernReceipt.receiptType eq 2 or cmDiscernReceipt.receiptType eq 9}">
-                <c:if test="${cmDiscernReceipt.newReceiptType eq 1}">-上架费</c:if>
-                        <c:if test="${cmDiscernReceipt.newReceiptType eq 2}">-服务返佣</c:if>
-                        <c:if test="${cmDiscernReceipt.newReceiptType eq 3}">-认证通会员</c:if>
-                        <c:if test="${cmDiscernReceipt.receiptType eq 9}">认证通会员</c:if>
-                        <c:if test="${cmDiscernReceipt.newReceiptType eq 4}">-认证通企划</c:if>
-                        <c:if test="${cmDiscernReceipt.newReceiptType eq 5}">-其他</c:if>
-                        </c:if>
+                <c:if test="${cmDiscernReceipt.receiptType eq 2 or cmDiscernReceipt.receiptType eq 9}">
+                    <c:if test="${cmDiscernReceipt.newReceiptType eq 1}">-上架费</c:if>
+                    <c:if test="${cmDiscernReceipt.newReceiptType eq 2}">-服务返佣</c:if>
+                    <c:if test="${cmDiscernReceipt.newReceiptType eq 3}">-认证通会员</c:if>
+                    <c:if test="${cmDiscernReceipt.receiptType eq 9}">认证通会员</c:if>
+                    <c:if test="${cmDiscernReceipt.newReceiptType eq 4}">-认证通企划</c:if>
+                    <c:if test="${cmDiscernReceipt.newReceiptType eq 5}">-其他</c:if>
+                </c:if>
             </td>
             <td>
                 <c:if test="${cmDiscernReceipt.organizeID == 1||cmDiscernReceipt.organizeID == 4}">
-               线下凭证
+                    线下凭证
                 </c:if>
                 <c:if test="${!(cmDiscernReceipt.organizeID == 1||cmDiscernReceipt.organizeID == 4)}">
-              ${cmDiscernReceipt.bankNameType}
+                    ${cmDiscernReceipt.bankNameType}
                 </c:if>
             </td>
             <td>
@@ -308,6 +320,9 @@
                 <c:if test="${cmDiscernReceipt.payWay == '1' && empty cmDiscernReceipt.shopName}">
                     采美
                 </c:if>
+                <c:if test="${cmDiscernReceipt.payWay == '2' && (cmDiscernReceipt.receiptType== 10 || cmDiscernReceipt.receiptType== 11)}">
+                    采美
+                </c:if>
             </td>
             <td>
                 <c:if test="${cmDiscernReceipt.organizeID == 1}">
@@ -329,21 +344,21 @@
             </td>
             <td>
                     ${cmDiscernReceipt.orderType}
-<%--                <c:if test="${cmDiscernReceipt.receiptType != 6}">${cmDiscernReceipt.orderType}</c:if>--%>
-<%--                <c:if test="${cmDiscernReceipt.receiptType == 6}">-----</c:if>--%>
-<%--                <c:if test="${cmDiscernReceipt.receiptType == 7}">-----</c:if>--%>
-<%--                <c:if test="${cmDiscernReceipt.receiptType == 8}">-----</c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType != 6}">${cmDiscernReceipt.orderType}</c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType == 6}">-----</c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType == 7}">-----</c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType == 8}">-----</c:if>--%>
             </td>
-           <td>   <%--  <a href="${ctx}/order/detail?id=${cmDiscernReceipt.orderID}">${cmDiscernReceipt.shopOrderNo}(${cmDiscernReceipt.orderID})</a>--%>
-<%--                <c:if test="${cmDiscernReceipt.newReceiptType eq 2 && not empty cmDiscernReceipt.shopOrderNo}"><a href="${ctx}/order/detail?id=${cmDiscernReceipt.orderID}">${cmDiscernReceipt.shopOrderNo}(${cmDiscernReceipt.shopOrderId})</a></c:if>--%>
-<%--                <c:if test="${cmDiscernReceipt.receiptType != 6}">${cmDiscernReceipt.orders}</c:if>--%>
-<%--                <c:if test="${cmDiscernReceipt.receiptType == 6}">-----</c:if>--%>
-<%--                <c:if test="${cmDiscernReceipt.receiptType == 7}">-----</c:if>--%>
+            <td>   <%--  <a href="${ctx}/order/detail?id=${cmDiscernReceipt.orderID}">${cmDiscernReceipt.shopOrderNo}(${cmDiscernReceipt.orderID})</a>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.newReceiptType eq 2 && not empty cmDiscernReceipt.shopOrderNo}"><a href="${ctx}/order/detail?id=${cmDiscernReceipt.orderID}">${cmDiscernReceipt.shopOrderNo}(${cmDiscernReceipt.shopOrderId})</a></c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType != 6}">${cmDiscernReceipt.orders}</c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType == 6}">-----</c:if>--%>
+                    <%--                <c:if test="${cmDiscernReceipt.receiptType == 7}">-----</c:if>--%>
                     ${cmDiscernReceipt.orders}
-                <%--<c:if test="${cmDiscernReceipt.shopOrderId == null}">-----</c:if>
-                <c:if test="${cmDiscernReceipt.shopOrderId != null}">
-                    <a href="${ctx}/order/detail?id=${cmDiscernReceipt.orderID}&shopOrderID=${cmDiscernReceipt.shopOrderId}">子订单${cmDiscernReceipt.shopOrderNo}(${cmDiscernReceipt.shopOrderId})</a>
-                </c:if>--%>
+                    <%--<c:if test="${cmDiscernReceipt.shopOrderId == null}">-----</c:if>
+                    <c:if test="${cmDiscernReceipt.shopOrderId != null}">
+                        <a href="${ctx}/order/detail?id=${cmDiscernReceipt.orderID}&shopOrderID=${cmDiscernReceipt.shopOrderId}">子订单${cmDiscernReceipt.shopOrderNo}(${cmDiscernReceipt.shopOrderId})</a>
+                    </c:if>--%>
             </td>
             <shiro:hasPermission name="order:cmDiscernReceipt:edit">
                 <td>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayFormList.jsp

@@ -230,7 +230,7 @@
 					</c:if>
 					<c:if test="${cmPayShop.payType ne '6' && cmPayShop.status == '1'}">
 						<shiro:hasPermission name="order:cmPayShop:rollBack">
-							<a class="td-a" href="${ctx}/order/cmPayShop/rollBackApply?id=${cmPayShop.id}"
+							<a class="td-a" href="${ctx}/order/cmPayShop/rollBackApply?id=${cmPayShop.id}&redirectType=1"
 							   onclick="return confirmx('确定要撤销审核流程,重新来过吗?', this.href)">撤销重来</a>
 						</shiro:hasPermission>
 					</c:if>

+ 263 - 0
src/main/webapp/WEB-INF/views/modules/order/cmPayList.jsp

@@ -0,0 +1,263 @@
+<%@ 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 type="text/css">
+        .table th{text-align:center}
+        .table td{text-align:center}
+        #searchForm{white-space:nowrap}
+        .ul-form{white-space:nowrap;margin-left:-10px !important}
+        .ul-form label{width:90px;text-align:left;margin-top:15px}
+        .time-space-symbols{width:100px;display:inline-block;text-align:center}
+        #btnSubmit{width:128px;margin-left:80%}
+        .td-a{width:100%;float:left;display:block;text-align:center}
+        @media screen and (max-width:1300px){#searchForm{width:1460px !important}
+            .nav-tabs,#contentTable{width:1490px !important}
+        }
+        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function() {
+
+        });
+        function page(n,s){
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+        $(function () {
+            $('#export').click(function () {
+                var formData = $('#searchForm').serialize();
+                window.location.href = "${ctx}/order/cmPayShop/export?" + formData;
+            });
+        })
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li class="active"><a href="${ctx}/order/cmPayShop/payList">付款列表</a></li>
+    <li><a href="${ctx}/shopOrder/payThirdParties">申请付第三方</a></li>
+    <shiro:hasPermission name="order:cmPayShop:split">
+        <li><a href="${ctx}/shopOrder/splitList">子订单手动分账</a></li>
+    </shiro:hasPermission>
+    <li><a href="${ctx}/shopOrder/settlement">子订单手动结算</a></li>
+</ul>
+<form:form id="searchForm" modelAttribute="cmPayShop" action="${ctx}/order/cmPayShop/payList" 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}"/>
+    <div class="ul-form">
+        <div>
+            <label>子订单ID:</label>
+            <form:input path="shopOrderID" htmlEscape="false" maxlength="20" class="input-medium"/>
+            <label>子订单编号:</label>
+            <form:input path="shopOrderNo" htmlEscape="false" maxlength="20" class="input-medium"/>
+            <label>订单ID:</label>
+            <form:input path="orderID" htmlEscape="false" maxlength="20" class="input-medium"/>
+            <label>订单编号:</label>
+            <form:input path="orderNo" htmlEscape="false" maxlength="20" class="input-medium"/>
+        </div>
+        <div>
+            <label>付款单ID:</label>
+            <form:input path="id" htmlEscape="false" maxlength="50" class="input-medium"/>
+            <label>供应商:</label>
+            <form:input path="shopName" htmlEscape="false" maxlength="50" class="input-medium"/>
+
+            <label>付款单名称:</label>
+            <form:input path="name" htmlEscape="false" maxlength="250" class="input-medium"/>
+            <label>付款审核状态:</label>
+            <form:select path="status" class="input-medium">
+                <form:option value="" label="所有"/>
+                <form:options items="${fns:getDictList('pay_shop_status')}" itemLabel="label" itemValue="value"
+                              htmlEscape="false"/>
+            </form:select>&nbsp;&nbsp;&nbsp;&nbsp;
+
+        </div>
+        <div>
+            <label>申请时间:</label>
+            <form:input path="startTime" type="text" maxlength="20" class="input-medium Wdate" value="${startTime}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+            <span class="time-space-symbols">至</span>
+            <form:input path="endTime" type="text" maxlength="20" class="input-medium Wdate" value="${endTime}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+            <label>付款时间:</label>
+            <form:input path="startTime2" type="text" maxlength="20" class="input-medium Wdate" value="${startTime2}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+            <span class="time-space-symbols">至</span>
+            <form:input path="endTime2" type="text" maxlength="20" class="input-medium Wdate" value="${endTime2}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+        </div>
+        <div>
+            <label>组织:</label>
+            <form:select path="organizeID" class="input-medium">
+                <form:option value="" label="请选择"/>
+                <form:option value="0" label="采美"/>
+                <form:option value="9999" label="呵呵商城"/>
+                <c:forEach items="${cmUserOrganizeList}" var="organize">
+                    <c:if test="${organize.id!=4}">
+                        <form:option value="${organize.id}" label="${organize.organizeName}"/>
+                    </c:if>
+                </c:forEach>
+                <%--					<form:options items="${cmUserOrganizeList}" itemLabel="organizeName" itemValue="id"--%>
+                <%--								  htmlEscape="false"/>--%>
+            </form:select>&nbsp;&nbsp;&nbsp;&nbsp;
+            <label>付款类型:</label>
+            <form:select path="paymentType" class="input-medium">
+                <form:option value="" label="请选择"/>
+                <form:option value="1" label="付款子订单"/>
+                <form:option value="2" label="供应商差价"/>
+                <form:option value="3" label="付第三方"/>
+            </form:select>
+            <label><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label><input id="export" class="btn btn-primary" value="导出筛选结果"/></label>
+        </div>
+
+
+        <div class="clearfix"></div>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr style="width:30%">
+        <th>付款单ID</th>
+        <th style="width:150px">付款单名称</th>
+        <th>付款类型</th>
+        <th>供应商</th>
+        <th>付款金额</th>
+        <th>子订单编号(ID)</th>
+        <th>订单编号(ID)</th>
+        <th>机构</th>
+        <th>申请人</th>
+        <th>申请日期</th>
+        <th>审核人</th>
+        <th>审核时间</th>
+        <th>付款审核状态</th>
+        <shiro:hasPermission name="order:cmPayShop:edit"><th>操作</th></shiro:hasPermission>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="cmPayShop">
+        <tr>
+            <td>${cmPayShop.id}</td>
+            <td>${cmPayShop.name}</td>
+            <td>
+                    ${cmPayShop.paymentType eq 2 ? "供应商差价":(cmPayShop.paymentType eq 3 ? "付第三方":"子订单付款")}
+            </td>
+            <td>${cmPayShop.shopName}</td>
+            <td>
+                <fmt:formatNumber value="${cmPayShop.totalAmount}" type="number" pattern="#,##0.00"/>
+                <c:if test="${cmPayShop.wipePayment > 0}">
+                    <br><font color="red">付款抹平¥<fmt:formatNumber value="${cmPayShop.wipePayment}" type="number" pattern="#,##0.00"/></font>
+                </c:if>
+            </td>
+            <td>
+                <c:forEach items="${cmPayShop.shopOrders}" var="shopOrder">
+                    <a href="${ctx}/order/detail?id=${shopOrder.orderID}">${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</a><br>
+                </c:forEach>
+            </td>
+            <td>
+                <c:forEach items="${cmPayShop.shopOrders}" var="shopOrder">
+                    <a href="${ctx}/order/detail?id=${shopOrder.orderID}">${shopOrder.orderNo}(${shopOrder.orderID})</a><br>
+                </c:forEach>
+            </td>
+            <td>
+                <c:forEach items="${cmPayShop.shopOrders}" var="shopOrder">
+                    <c:if test="${shopOrder.organizeID eq 1}">
+                        <span class="org-note">星范</span>
+                    </c:if>
+                    ${shopOrder.clubName}
+                    <c:if test="${shopOrder.orderType eq 2}">
+                        <span><font color="red">(呵呵商城)</font></span>
+                    </c:if>
+                    <c:if test="${shopOrder.organizeID == 3}">
+
+                    </c:if><br>
+                </c:forEach>
+            </td>
+
+            <td>
+                    ${cmPayShop.payType eq '6'? '系统自动':cmPayShop.applicantName}
+            </td>
+            <td>${cmPayShop.applyTime}</td>
+            <td>
+                    ${cmPayShop.payType eq '6'? '系统自动':cmPayShop.reviewerName}
+            </td>
+            <td>${cmPayShop.reviewTime}</td>
+            <td>
+                <c:if test="${cmPayShop.status == '0'}">
+                    <font color="red">
+                        <strong>待审核</strong>
+                    </font>
+                </c:if>
+                <c:if test="${cmPayShop.status == '1'}">
+                    审核通过
+                </c:if>
+                <c:if test="${cmPayShop.status == '2'}">
+                    审核不通过<br><font color="red">原因: ${cmPayShop.reason}</font>
+                </c:if>
+            </td>
+            <td>
+                <c:if test="${cmPayShop.payType ne '6' && cmPayShop.status == '1'}">
+                    <shiro:hasPermission name="order:cmPayShop:check">
+                        <a class="td-a" href="${ctx}/order/cmPayShop/applyCompile?id=${cmPayShop.id}&redirectType=2">编辑</a>
+                    </shiro:hasPermission>
+                </c:if>
+                <shiro:hasPermission name="order:cmPayShop:detail">
+                    <a class="td-a" href="${ctx}/order/cmPayShop/applyDetail?id=${cmPayShop.id}&redirectType=2">查看详情</a>
+                </shiro:hasPermission>
+                <c:if test="${cmPayShop.status == '0'}">
+                    <shiro:hasPermission name="order:cmPayShop:apply">
+                        <c:if test="${cmPayShop.paymentType ne 3 && cmPayShop.paymentType ne 2}">
+                            <a class="td-a" href="${ctx}/order/cmPayShop/applyEdit?id=${cmPayShop.id}&redirectType=2">申请付款</a>
+                        </c:if>
+                        <c:if test="${cmPayShop.paymentType eq 3 && cmPayShop.paymentType ne 2}">
+                            <a class="td-a" href="${ctx}/order/cmPayShop/shopOtherApplyEdit?payShopId=${cmPayShop.id}&redirectType=2">申请付款</a>
+                        </c:if>
+                    </shiro:hasPermission>
+                    <shiro:hasPermission name="order:cmPayShop:cancel">
+                        <a class="td-a" href="${ctx}/order/cmPayShop/cancel?id=${cmPayShop.id}&redirectType=2"
+                           onclick="return confirmx('确定要取消此次付款申请吗?', this.href)">取消付款</a>
+                    </shiro:hasPermission>
+                    <shiro:hasPermission name="order:cmPayShop:check">
+                        <a class="td-a" href="${ctx}/order/cmPayShop/toCheck?id=${cmPayShop.id}&redirectType=2">付款审核</a>
+                    </shiro:hasPermission>
+                </c:if>
+                <c:if test="${cmPayShop.payType ne '6' && cmPayShop.status == '1'}">
+                    <shiro:hasPermission name="order:cmPayShop:rollBack">
+                        <a class="td-a" href="${ctx}/order/cmPayShop/rollBackApply?id=${cmPayShop.id}&redirectType=2"
+                           onclick="return confirmx('确定要撤销审核流程,重新来过吗?', this.href)">撤销重来</a>
+                    </shiro:hasPermission>
+                </c:if>
+                <c:if test="${cmPayShop.status == '2'}">
+                    <shiro:hasPermission name="order:cmPayShop:apply">
+                        <c:if test="${cmPayShop.rePayment == '1' && cmPayShop.paymentType ne 2}">
+                            <c:if test="${cmPayShop.paymentType ne 3}">
+                                <a class="td-a" href="${ctx}/order/cmPayShop/applyEdit?id=${cmPayShop.id}&redirectType=2">重申付款</a>
+                            </c:if>
+                            <c:if test="${cmPayShop.paymentType eq 3}">
+                                <a class="td-a" href="${ctx}/order/cmPayShop/shopOtherApplyEdit?payShopId=${cmPayShop.id}&redirectType=2">重申付款</a>
+                            </c:if>
+                        </c:if>
+                        <c:if test="${cmPayShop.rePayment == '2'}">重申付款</c:if>
+                    </shiro:hasPermission>
+                    <shiro:hasPermission name="order:cmPayShop:cancel">
+                        <a class="td-a" href="${ctx}/order/cmPayShop/cancel?id=${cmPayShop.id}&redirectType=2"
+                           onclick="return confirmx('确定要取消此次付款申请吗?', this.href)">取消付款</a>
+                    </shiro:hasPermission>
+                </c:if>
+                <c:if test="${cmPayShop.status == '1'}">
+                    <shiro:hasPermission name="order:cmPayShop:detail">
+                        <a class="td-a" href="${ctx}/order/cmPayShop/printDetail?id=${cmPayShop.id}">打印</a>
+                    </shiro:hasPermission>
+                </c:if>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 10 - 0
src/main/webapp/WEB-INF/views/modules/order/cmPayShopChange.jsp

@@ -210,6 +210,8 @@
                 <input id="shopOrderID" type="hidden" name="shopOrderID" value="${newShopOrder.shopOrderID}">
                 <input id="orderID" type="hidden" name="orderID" value="${newShopOrder.orderID}">
                 <input id="productAmount" type="hidden" name="productAmount" value="${newShopOrder.productAmount}">
+                <input id="couponAmount" type="hidden" name="couponAmount" value="${newShopOrder.couponAmount}">
+                <input id="promotionFullReduction" type="hidden" name="promotionFullReduction" value="${newShopOrder.promotionFullReduction}">
                 <label style="color:red">注意:计算成本时请注意,含税商品的成本包括税费,无需另外计算税费</label>
                 <table class="table table-striped table-bordered table-condensed" style="width: 70%">
                     <tr>
@@ -471,6 +473,8 @@
             obj.value = 0;
         }
         var of = $("#shopOtherFee").val();
+        var couponAmount = $("#couponAmount").val();
+        var promotionFullReduction = $("#promotionFullReduction").val();
         console.log("of----------------" + of);
         if (of > 0) {
             var totalAmount = 0;
@@ -510,6 +514,8 @@
             console.log("shopPostFee----------" + shopPostFee);
             totalAmount += Number(shopPostFee);
             totalAmount -= Number(of);
+            totalAmount -= Number(couponAmount);
+            totalAmount -= Number(promotionFullReduction);
             $("#div-supplier-fee").text(totalAmount);
         }
     }
@@ -548,6 +554,8 @@
         //获取供应商层信息
         var shopPostFee = $("#shopPostFee").val();
         var shopOtherFee = $("#shopOtherFee").val();
+        var couponAmount = $("#couponAmount").val();
+        var promotionFullReduction = $("#promotionFullReduction").val();
         if (null == shopPostFee) shopPostFee = 0;
         // if(null == shopOtherFee)shopOtherFee = 0;
         /*var n = parseFloat(that.value);
@@ -586,6 +594,8 @@
         var of = $("#shopOtherFee").val();
         totalAmount += Number(shopPostFee);
         totalAmount -= Number(of);
+        totalAmount -= Number(couponAmount);
+        totalAmount -= Number(promotionFullReduction);
         // 四舍五入
         var s = totalAmount.toFixed(2);
         $("#div-supplier-fee").text(s);

+ 29 - 13
src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp

@@ -289,7 +289,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/toCheck?id=${cmPayShop.id}">付款审核</a></li>
 </ul>
 <br/>
@@ -329,7 +334,7 @@
                     <th>机构运费</th>
                     <th>收款状态</th>
                     <th colspan="3">收款金额</th>
-                    <th>经理折扣</th>
+                    <th>促销满减</th>
                     <th>优惠券</th>
                 <tr/>
                 <tr>
@@ -388,7 +393,8 @@
                            style="text-decoration: underline">${s.receiptTotalFee}</a>
                     </td>
                     <td>
-                        <label class="discountFee" style="display: none">
+                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                        <%--<label class="discountFee" style="display: none">
                             <c:choose>
                                 <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                     <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
@@ -418,7 +424,7 @@
                                 </span>
                             </c:if>
                         </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                     </td>
                     <td>${s.couponAmount} </td>
                     <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
@@ -458,13 +464,13 @@
                     <td colspan="3" class="supplier-fee">
                         <div><span class="nowrap">
                             <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
-                                应付:<fmt:formatNumber value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/>
+                                应付:<fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
                             </c:if>
 							<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已补差价:${s.differencePrice})</font>
                             </c:if>
 							<c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已退差价:${s.differencePrice})</font>
                             </c:if>
 							,</span>
                             <span class="nowrap">已付:${s.payedShopAmount},</span></div>
@@ -538,13 +544,23 @@
                         <td><fmt:formatNumber
                                 value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
                                 type="number" pattern="#,##0.00"/></td>
-                        <td><fmt:formatNumber
-                                value="${p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice}"
-                                pattern="#,##0.00"/></td>
+                        <td>
+                            <c:if test="${p.productType == 0}">
+                                <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                            </c:if>
+                            <c:if test="${p.productType != 0}">
+                                0.00
+                            </c:if>
+                        </td>
 
-                        <td class="payCm"><fmt:formatNumber
-                                value="${(p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice) * (p.num + p.presentNum - p.returnedNum)}"
-                                pattern="#,##0.00"/></td>
+                        <td class="payCm">
+                            <c:if test="${p.productType == 0}">
+                                <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                            </c:if>
+                            <c:if test="${p.productType != 0}">
+                                0.00
+                            </c:if>
+                        </td>
 
                         <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                         <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>

+ 26 - 10
src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp

@@ -297,7 +297,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款列表</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/applyDetail?id=${cmPayShop.id}">付款单详情</a></li>
 </ul>
 <br/>
@@ -343,7 +348,7 @@
                             <%--                        <th>机构运费</th>--%>
                         <th colspan="2">收款状态</th>
                         <th colspan="3">收款金额</th>
-                        <th colspan="2">经理折扣</th>
+                        <th colspan="2">促销满减</th>
                         <th colspan="2">优惠券</th>
                     <tr/>
                     <tr>
@@ -406,7 +411,8 @@
                                 <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                         </td>
                         <td colspan="2">
-                            <label class="discountFee">
+                            <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                            <%--<label class="discountFee">
                                 <c:choose>
                                     <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                         <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
@@ -436,7 +442,7 @@
                                 </span>
                                 </c:if>
                             </c:if>
-                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                         </td>
                         <td class="couponAmount" colspan="2">${s.couponAmount} </td>
                         <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
@@ -587,13 +593,23 @@
                             <td colspan="2"><fmt:formatNumber
                                     value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
                                     type="number" pattern="#,##0.00"/></td>
-                            <td><fmt:formatNumber
-                                    value="${p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice}"
-                                    pattern="#,##0.00"/></td>
+                            <td>
+                                <c:if test="${p.productType == 0}">
+                                    <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${p.productType != 0}">
+                                    0.00
+                                </c:if>
+                            </td>
 
-                            <td class="payCm"><fmt:formatNumber
-                                    value="${(p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice) * (p.num + p.presentNum - p.returnedNum)}"
-                                    pattern="#,##0.00"/></td>
+                            <td class="payCm">
+                                <c:if test="${p.productType == 0}">
+                                    <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${p.productType != 0}">
+                                    0.00
+                                </c:if>
+                            </td>
                             <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>

+ 26 - 10
src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp

@@ -51,7 +51,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款列表</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/applyCompile?id=${cmPayShop.id}">编辑</a></li>
 </ul>
 <br/>
@@ -93,7 +98,7 @@
                             <%--                        <th>机构运费</th>--%>
                         <th colspan="2">收款状态</th>
                         <th colspan="3">收款金额</th>
-                        <th colspan="2">经理折扣</th>
+                        <th colspan="2">促销满减</th>
                         <th colspan="2">优惠券</th>
                     <tr/>
                     <tr>
@@ -156,7 +161,8 @@
                             <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                         </td>
                         <td colspan="2">
-                            <label class="discountFee">
+                            <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                            <%--<label class="discountFee">
                                 <c:choose>
                                     <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                         <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
@@ -186,7 +192,7 @@
                                 </span>
                                 </c:if>
                             </c:if>
-                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                         </td>
                         <td class="couponAmount" colspan="2">${s.couponAmount} </td>
                         <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
@@ -337,13 +343,23 @@
                             <td colspan="2"><fmt:formatNumber
                                     value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
                                     type="number" pattern="#,##0.00"/></td>
-                            <td><fmt:formatNumber
-                                    value="${p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice}"
-                                    pattern="#,##0.00"/></td>
+                            <td>
+                                <c:if test="${p.productType == 0}">
+                                    <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${p.productType != 0}">
+                                    0.00
+                                </c:if>
+                            </td>
 
-                            <td class="payCm"><fmt:formatNumber
-                                    value="${(p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice) * (p.num + p.presentNum - p.returnedNum)}"
-                                    pattern="#,##0.00"/></td>
+                            <td class="payCm">
+                                <c:if test="${p.productType == 0}">
+                                    <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${p.productType != 0}">
+                                    0.00
+                                </c:if>
+                            </td>
                             <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>

+ 30 - 14
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -379,7 +379,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款列表</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a>提交付款单</a></li>
 </ul>
 <br/>
@@ -425,7 +430,7 @@
 <%--                        <th>机构运费</th>--%>
                         <th colspan="2">收款状态</th>
                         <th colspan="3">收款金额</th>
-                        <th colspan="2">经理折扣</th>
+                        <th colspan="2">促销满减</th>
                         <th colspan="2">优惠券</th>
                     <tr/>
                     <tr>
@@ -488,7 +493,8 @@
                                 <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                         </td>
                         <td colspan="2">
-                            <label class="discountFee">
+                            <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                            <%--<label class="discountFee">
                                 <c:choose>
                                     <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                         <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
@@ -518,7 +524,7 @@
                                 </span>
                                 </c:if>
                             </c:if>
-                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                         </td>
                         <td class="couponAmount" colspan="2">${s.couponAmount} </td>
                         <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
@@ -646,8 +652,8 @@
                                 <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
                             </td>
                             <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-                            <td colspan="2"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}"
-                                                              type="number" pattern="#,##0.00"/>
+                            <td colspan="2">
+                                <fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}" type="number" pattern="#,##0.00"/>
                                 <c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
                                     <label style="color: red">
                                         (${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
@@ -669,14 +675,24 @@
                             <td colspan="2"><fmt:formatNumber
                                     value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
                                     type="number" pattern="#,##0.00"/></td>
-                            <td><fmt:formatNumber
-                                    value="${p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice}"
-                                    pattern="#,##0.00"/></td>
-
-                            <td class="payCm"><fmt:formatNumber
-                                    value="${(p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice) * (p.num + p.presentNum - p.returnedNum)}"
-                                    pattern="#,##0.00"/></td>
-                            <td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td>
+                                <c:if test="${p.productType == 0}">
+                                    <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${p.productType != 0}">
+                                    0.00
+                                </c:if>
+                            </td>
+
+                            <td class="payCm">
+                                <c:if test="${p.productType == 0}">
+                                    <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${p.productType != 0}">
+                                    0.00
+                                </c:if>
+                            </td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.returnedNum ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>

+ 4 - 3
src/main/webapp/WEB-INF/views/modules/order/cmPayShopList.jsp

@@ -409,7 +409,7 @@
                     <th colspan="3">下单时间</th>
                     <th>收款状态</th>
                     <th>收款金额</th>
-                    <th colspan="3">经理折扣</th>
+                    <th colspan="3">促销满减</th>
                     <th colspan="2">优惠券</th>
 <%--                    <th>成本类型</th>--%>
                 </tr>
@@ -428,7 +428,8 @@
                         ${s.receiptAmount}
                         <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                     <td colspan="3">
-                        <c:if test="${s.discountTotalFee gt 0}">
+                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                        <%--<c:if test="${s.discountTotalFee gt 0}">
                             <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                 <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"
                                                   type="currency"/>
@@ -448,7 +449,7 @@
                                 </span>
                             </c:if>
                         </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                     </td>
                     <td colspan="2">
                             ${s.couponAmount}

+ 10 - 4
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherCheck.jsp

@@ -308,7 +308,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/toCheck?id=${cmPayShop.id}">付款审核</a></li>
 </ul><br/>
 <div class="payment-form">
@@ -347,7 +352,7 @@
                     <th>机构运费</th>
                     <th>收款状态</th>
                     <th colspan="3">收款金额</th>
-                    <th>经理折扣</th>
+                    <th>促销满减</th>
                     <th>优惠券</th>
                 <tr/>
                 <tr>
@@ -401,7 +406,8 @@
                            style="text-decoration: underline">${s.receiptTotalFee}</a>
                     </td>
                     <td>
-                        <label class="discountFee"  style="display: none">
+                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                        <%--<label class="discountFee"  style="display: none">
                             <c:choose>
                                 <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                     <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
@@ -431,7 +437,7 @@
                                 </span>
                             </c:if>
                         </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                     </td>
                     <td>${s.couponAmount} </td>
                 <tr/>

+ 6 - 1
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherEdit.jsp

@@ -38,7 +38,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款列表</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/applyCompile?id=${cmPayShop.id}">编辑</a></li>
 </ul><br/>
 <form:form id="inputForm" modelAttribute="cmPayShop" action="${ctx}/order/cmPayShop/applyCompileSave?id=${cmPayShop.id}" method="post" class="form-horizontal">

+ 7 - 2
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherForm.jsp

@@ -222,10 +222,15 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款列表</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a>提交付款单</a></li>
 </ul>
-<form:form id="inputForm" modelAttribute="payShopOther" action="${ctx}/order/cmPayShop/saveShopOtherFee" method="post" class="form-horizontal">
+<form:form id="inputForm" modelAttribute="payShopOther" action="${ctx}/order/cmPayShop/saveShopOtherFee?payType=1&redirectType=1" method="post" class="form-horizontal">
     <form:hidden path="shopOrderId"/>
     <form:hidden path="payShopId"/>
     <div class="payment-form">

+ 10 - 4
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherPrintDetail.jsp

@@ -452,7 +452,12 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop/">付款列表</a></li>
+    <c:if test="${cmPayShop.redirectType == 2}" >
+        <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
+    </c:if>
+    <c:if test="${cmPayShop.redirectType != 2}" >
+        <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
+    </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/applyDetail?id=${cmPayShop.id}">付款单详情</a></li>
 </ul>
 <br/>
@@ -498,7 +503,7 @@
                         <%--                        <th>机构运费</th>--%>
                     <th colspan="2">收款状态</th>
                     <th colspan="3">收款金额</th>
-                    <th colspan="2">经理折扣</th>
+                    <th colspan="2">促销满减</th>
                     <th colspan="2">付第三方</th>
                 </tr>
                 <tr>
@@ -516,7 +521,8 @@
                         <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                     </td>
                     <td colspan="2">
-                        <label class="discountFee">
+                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                        <%--<label class="discountFee">
                             <c:choose>
                                 <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                     <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
@@ -543,7 +549,7 @@
                                 </span>
                             </c:if>
                         </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                     </td>
                     <td colspan="2" class="third-party-fee"><fmt:formatNumber value="${s.shopOtherFee}" type="number"
                                                                               pattern="#,##0.00"/></td>

+ 16 - 6
src/main/webapp/WEB-INF/views/modules/order/cmPayShopPrintDetail.jsp

@@ -351,13 +351,23 @@
 								<td colspan="2"><fmt:formatNumber
 										value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
 										type="number" pattern="#,##0.00"/></td>
-								<td><fmt:formatNumber
-										value="${p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice}"
-										pattern="#,##0.00"/></td>
+								<td>
+									<c:if test="${p.productType == 0}">
+										<fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+									</c:if>
+									<c:if test="${p.productType != 0}">
+										0.00
+									</c:if>
+								</td>
 
-								<td class="payCm"><fmt:formatNumber
-										value="${(p.oldDiscountPrice - p.costPrice - p.cmCostPrice - p.organizeCostPrice) * (p.num + p.presentNum - p.returnedNum)}"
-										pattern="#,##0.00"/></td>
+								<td class="payCm">
+									<c:if test="${p.productType == 0}">
+										<fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+									</c:if>
+									<c:if test="${p.productType != 0}">
+										0.00
+									</c:if>
+								</td>
 								<td><fmt:formatNumber value="${p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
 								<td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
 								<td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>

+ 4 - 1
src/main/webapp/WEB-INF/views/modules/order/cmRebateRecordForm.jsp

@@ -44,7 +44,7 @@
 				<tr>
 					<td>${record.operatTime}</td>
 					<td>
-						<c:if test="${record.type == '1' || record.type == '3'}">
+						<c:if test="${record.type == '1' || record.type == '3' || record.type == '4'}">
 							收入
 						</c:if>
 						<c:if test="${record.type == '2'}">
@@ -62,6 +62,9 @@
 						<c:if test="${record.type == '3'}">
 							<a href="${ctx}/order/cmRefundShop/toRefund?id=${record.refundShopID}">供应商退款</a>
 						</c:if>
+						<c:if test="${record.type == '4'}">
+							<a href="${ctx}/order/cmDiscernReceipt/detail?id=${record.receiptID}&shopOrderId=${record.shopOrderId}">平台服务费欠款转移</a>
+						</c:if>
 					</td>
 				</tr>
 			</c:forEach>

+ 23 - 10
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopDetail.jsp

@@ -107,7 +107,10 @@
                             ${cs}<br/>
                         </c:forEach>
                     </td>
-                    <td>${s.income}</td>
+                    <td>
+                        <c:if test="${empty s.brokerage}">0.00</c:if>
+                        <c:if test="${not empty s.brokerage}">${s.brokerage}</c:if>
+                    </td>
                     <td>
                         <label class="clubFreight"  style="display: none">
                             <c:choose>
@@ -198,9 +201,9 @@
                 <tr>
                     <td>${s.shopOrderNo}(${s.shopOrderID})</td>
                     <td colspan="3">${s.shopName}</td>
-                    <td colspan="3" class="payCm-t">子订单佣金</td>
+                    <c:if test="${empty s.brokerage}"><td colspan="3" class="">0.00</td></c:if>
+                    <c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
                     <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
                     <td class="taxes">
                         <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
                     </td>
@@ -215,7 +218,7 @@
                         <c:if test="${s.payStatus == 3}"><font color="green">已付款</font></c:if>
                     </td>
                     <td colspan="3" class="supplier-fee">
-                        <div>应付:${s.shouldPayShopAmount}, 已付:<span class="payed">${s.payedShopAmount}</span>
+                        <div>应付:${s.shouldPayShopAmount-s.shopOtherFee}, 已付:<span class="payed">${s.payedShopAmount}</span>
                             <c:if test="${s.wipePayment > 0}"><font color="red">(付款抹平¥${s.wipePayment})</font></c:if>
                         </div>
                         <div>退款:${s.refundAmount}</div>
@@ -273,13 +276,23 @@
                         </c:choose></td>
                         <td><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
 
-                        <td><fmt:formatNumber
-                                value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax}"
-                                pattern="#,##0.00"/></td>
+                        <td>
+                            <c:if test="${p.productType == 0}">
+                                <fmt:formatNumber value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                            </c:if>
+                            <c:if test="${p.productType != 0}">
+                                0.00
+                            </c:if>
+                        </td>
 
-                        <td class="payCm"><fmt:formatNumber
-                                value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax) * (p.num + p.presentNum - p.returnedNum)}"
-                                pattern="#,##0.00"/></td>
+                        <td class="payCm">
+                            <c:if test="${p.productType == 0}">
+                                <fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                            </c:if>
+                            <c:if test="${p.productType != 0}">
+                                0.00
+                            </c:if>
+                        </td>
 
                         <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                         <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>

+ 22 - 9
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopForm.jsp

@@ -112,7 +112,10 @@
 								${cs}<br/>
 							</c:forEach>
 						</td>
-						<td>${s.income}</td>
+						<td>
+							<c:if test="${empty s.brokerage}">0.00</c:if>
+							<c:if test="${not empty s.brokerage}">${s.brokerage}</c:if>
+						</td>
 						<td>
 							<label class="clubFreight"  style="display: none">
 								<c:choose>
@@ -202,9 +205,9 @@
 					<tr>
 						<td>${s.shopOrderNo}(${s.shopOrderID})</td>
 						<td colspan="3">${s.shopName}</td>
-						<td colspan="3" class="payCm-t">子订单佣金</td>
+						<c:if test="${empty s.brokerage}"><td colspan="3" class="">0.00</td></c:if>
+						<c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
 						<td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
 						<td class="taxes">
 							<fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
 						</td>
@@ -280,13 +283,23 @@
 							</c:choose></td>
 							<td><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
 
-							<td><fmt:formatNumber
-									value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax}"
-									pattern="#,##0.00"/></td>
+							<td>
+								<c:if test="${p.productType == 0}">
+									<fmt:formatNumber value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+								</c:if>
+								<c:if test="${p.productType != 0}">
+									0.00
+								</c:if>
+							</td>
 
-							<td class="payCm"><fmt:formatNumber
-									value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax) * (p.num + p.presentNum - p.returnedNum)}"
-									pattern="#,##0.00"/></td>
+							<td class="payCm">
+								<c:if test="${p.productType == 0}">
+									<fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+								</c:if>
+								<c:if test="${p.productType != 0}">
+									0.00
+								</c:if>
+							</td>
 
 							<td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
 							<td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/order/cmSettlementList.jsp

@@ -292,6 +292,7 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
+    <li><a href="${ctx}/order/cmPayShop/payList">付款列表</a></li>
     <%--<li><a href="${ctx}/order/cmPayShop">付款列表</a></li>
     <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=1">申请付款</a></li>
     <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=3">已付款子订单</a></li>--%>

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/order/cmSplitAccountList.jsp

@@ -292,6 +292,7 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
+    <li><a href="${ctx}/order/cmPayShop/payList">付款列表</a></li>
      <%--<li><a href="${ctx}/order/cmPayShop">付款列表</a></li>
      <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=1">申请付款</a></li>
      <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=3">已付款子订单</a></li>--%>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/newOrderList.jsp

@@ -252,7 +252,7 @@
     <c:forEach items="${page.list}" var="order">
         <%--颜色区分分期不分期订单以及终止订单--%>
         <ul class="spileOrder" data-id="${order.orderNo}">
-            <li><b style="font-size: 17px;">${order.orderID}</b>(${order.orderNo})</li>
+            <li><b style="font-size: 15px;">${order.orderID}</b>(${order.orderNo})</li>
             <li style="position: relative">${order.shopOrderNoAndId}</li>
             <li>
                 <c:if test="${order.orderType == 1}">

+ 6 - 2
src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp

@@ -377,6 +377,7 @@
             display: inline-block;
             border-radius: 2px
         }
+        .acticer_span{display: inline-block;width: 14px;height: 14px;border-radius: 50%;box-sizing: border-box;border: 1px solid #999999;text-align: center;color: #333333;font-size: 12px;line-height: 14px;float: none;margin-left: 3px;}
     </style>
     <script type="text/javascript" src="${ctxStatic}/QRCode/jquery.qrcode.min.js"></script>
     <script type="text/javascript" src="static/common/clipboard.min.js"></script>
@@ -405,7 +406,7 @@
 <table class="order-details-heading">
     <tr>
         <td>下单时间: ${order.orderTime}</td>
-        <td>订单ID(订单编号): <b style="font-size: 17px;">${order.orderID}</b>(${order.orderNo})</td>
+        <td>订单ID(订单编号): <b style="font-size: 15px;">${order.orderID}</b>(${order.orderNo})</td>
         <td>返佣订单: ${(order.rebateOrder ne '0' || order.rebateFlag eq '1')?'是':'否'}</td>
     </tr>
     <tr>
@@ -827,7 +828,7 @@
 <c:forEach items="${order.newShopOrders}" var="shopOrder">
     <div class="order-rows">
         <span><label>下单时间:</label>${order.orderTime}</span>
-        <span><label>子订单ID(子订单编号):</label><b style="font-size: 17px;">${shopOrder.shopOrderID}</b>(${shopOrder.shopOrderNo})</span>
+        <span><label>子订单ID(子订单编号):</label><b style="font-size: 15px;">${shopOrder.shopOrderID}</b>(${shopOrder.shopOrderNo})</span>
         <span><label>子订单金额:</label><fmt:formatNumber
                 value="${order.onlinePayFlag eq 0?shopOrder.realPay:shopOrder.needPayAmount}" type="currency"/></span>
         <td style="position: relative;"><a class="operation-btn btn"
@@ -875,6 +876,9 @@
 
             </span>
         <span>待收金额:<fmt:formatNumber value="${shopOrder.restAmount}" type="currency"/></span>
+        <c:if test="${not empty shopOrder.couponAmount and shopOrder.couponAmount > 0}"> <span>优惠券:${shopOrder.couponAmount}</span> </c:if>
+        <c:if test="${not empty shopOrder.promotionFullReduction and shopOrder.promotionFullReduction > 0}"> <span>促销满减:${shopOrder.promotionFullReduction}</span> </c:if>
+        <c:if test="${not empty shopOrder.presentNum and shopOrder.presentNum > 0}"> <span>赠品数:${shopOrder.presentNum}</span> </c:if>
         <br/>
         <span>子订单状态:
  <c:if test="${shopOrder.status eq 11 || shopOrder.status eq 12 || shopOrder.status eq 13 ||shopOrder.status eq 21 ||shopOrder.status eq 22 ||

+ 4 - 3
src/main/webapp/WEB-INF/views/modules/order/paidShopOrderList.jsp

@@ -315,7 +315,7 @@
                     <th colspan="3">下单时间</th>
                     <th>收款状态</th>
                     <th>收款金额</th>
-                    <th colspan="3">经理折扣</th>
+                    <th colspan="3">促销满减</th>
                     <th>优惠券</th>
                     <th>成本类型</th>
                 </tr>
@@ -332,7 +332,8 @@
                     </td>
                     <td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline">${s.receiptTotalFee}</a></td>
                     <td colspan="3">
-                        <c:if test="${s.discountTotalFee gt 0}">
+                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                        <%--<c:if test="${s.discountTotalFee gt 0}">
                             <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                 <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"
                                                   type="currency"/>
@@ -352,7 +353,7 @@
                                 </span>
                             </c:if>
                         </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
+                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
                     </td>
                     <td>
                             ${s.couponAmount}

+ 1 - 0
src/main/webapp/WEB-INF/views/modules/order/payThirdParties.jsp

@@ -249,6 +249,7 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
+    <li><a href="${ctx}/order/cmPayShop/payList">付款列表</a></li>
     <li class="active tab-li"><a href="${ctx}/shopOrder/payThirdParties">申请付第三方</a></li>
     <shiro:hasPermission name="order:cmPayShop:split">
         <li><a href="${ctx}/shopOrder/splitList">子订单手动分账</a></li>

+ 4 - 4
src/main/webapp/WEB-INF/views/modules/order/shopOtherFeeForm.jsp

@@ -226,13 +226,13 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/cmPayShop">付款列表</a></li>
-    <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=1">申请付款</a></li>
-    <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=3">已付款子订单</a></li>
+    <li><a href="${ctx}/order/cmPayShop/payList">付款列表</a></li>
+    <%--<li><a href="${ctx}/shopOrder/payOrderList?operatingMode=1">申请付款</a></li>
+    <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=3">已付款子订单</a></li>--%>
     <li class="active"><a
             href="${ctx}/order/cmPayShop/shopOtherFeeForm?shopOrderId=${payShopOther.shopOrderId}&payType=${payType}">付第三方</a></li>
 </ul>
-<form:form id="inputForm" modelAttribute="payShopOther" action="${ctx}/order/cmPayShop/saveShopOtherFee?payType=${payType}" method="post"
+<form:form id="inputForm" modelAttribute="payShopOther" action="${ctx}/order/cmPayShop/saveShopOtherFee?payType=${payType}&redirectType=1" method="post"
            class="form-horizontal">
     <form:hidden path="shopOrderId"/>
     <input style="display: none" name="payType" value="${payType}"/>

+ 131 - 93
src/main/webapp/WEB-INF/views/modules/product-new/multiPromotionForm.jsp

@@ -1,20 +1,20 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<%@ page import="java.util.*"%>
-<%@ page import="java.text.*"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.text.*" %>
 <%
-    String datetime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); //获取系统时间
-    request.setAttribute("currentTime",datetime);
+    String datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); //获取系统时间
+    request.setAttribute("currentTime", datetime);
 %>
 <html>
 <head>
     <title>促销活动管理</title>
     <meta name="decorator" content="default"/>
     <script type="text/javascript">
-        $(document).ready(function() {
+        $(document).ready(function () {
             //$("#name").focus();
             $("#inputForm").validate({
-                submitHandler: function(form){
+                submitHandler: function (form) {
                     var isSubMitFlag = true, addProductArray = [], addGiftArray = [];
                     var mode = $("input[name='mode']:checked").val();
                     var status = $("input[name='status']:checked").val();
@@ -31,12 +31,12 @@
                     }
                     if (mode == "1") {
 
-                    }else if (mode == "2") {
+                    } else if (mode == "2") {
                         if ($("#touchPrice2").val() == '') {
                             alertx("请输入满减设定价");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#touchPrice2").val())||$("#touchPrice2").val().indexOf('0')==0){
+                        } else if (isNaN($("#touchPrice2").val()) || $("#touchPrice2").val().indexOf('0') == 0) {
                             alertx('请输入正确的满减设定价!');
                             isSubMitFlag = false;
                             return false;
@@ -45,7 +45,7 @@
                             alertx("请输入减免价格");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#reducedPrice").val())||$("#reducedPrice").val().indexOf('0')==0){
+                        } else if (isNaN($("#reducedPrice").val()) || $("#reducedPrice").val().indexOf('0') == 0) {
                             alertx('请输入正确的减免价格!');
                             isSubMitFlag = false;
                             return false;
@@ -55,19 +55,19 @@
                             isSubMitFlag = false;
                             return false;
                         }
-                    }else if (mode == "3") {
+                    } else if (mode == "3") {
                         if ($("#touchPrice3").val() == '') {
                             alertx("请输入满赠设定价");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#touchPrice3").val())||$("#touchPrice3").val().indexOf('0')==0){
+                        } else if (isNaN($("#touchPrice3").val()) || $("#touchPrice3").val().indexOf('0') == 0) {
                             alertx('请输入正确的满赠设定价!');
                             isSubMitFlag = false;
                             return false;
                         }
                     }
-                    if (mode=="3") {
-                        if(document.getElementById("contentTbody1").rows.length<1){
+                    if (mode == "3") {
+                        if (document.getElementById("contentTbody1").rows.length < 1) {
                             alertx("请至少选择1个赠送的商品");
                             isSubMitFlag = false;
                             return false;
@@ -86,12 +86,12 @@
                         var $this = $(this);
                         var $itemProductID = $this.find('input[name="gift"]').val();
                         var $giftNumber = $this.find('input[name="giftNumber"]').val();
-                        if ($giftNumber == null || $giftNumber == '' ) {
+                        if ($giftNumber == null || $giftNumber == '') {
                             alertx("请输入赠品数量");
                             isSubMitFlag = false;
                             return false;
                         }
-                        if ( $giftNumber <= 0 ) {
+                        if ($giftNumber <= 0) {
                             alertx("赠品数量必须大于0");
                             isSubMitFlag = false;
                             return false;
@@ -121,9 +121,9 @@
                     }
                 },
                 errorContainer: "#messageBox",
-                errorPlacement: function(error, element) {
+                errorPlacement: function (error, element) {
                     $("#messageBox").text("输入有误,请先更正。");
-                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                         error.appendTo(element.parent().parent());
                     } else {
                         error.insertAfter(element);
@@ -131,6 +131,7 @@
                 }
             });
         });
+
         //选择添加商品
         function showSelect(type) {
             var showSelectProductID = '';
@@ -149,12 +150,12 @@
                     var $itemProductID = $this.find('input[name="gift"]').val();
                     showSelectProductID += $itemProductID + ',';
                 });
-                url ="${ctx}/product/cmPromotions/findProductPage?productIds=" + showSelectProductID
+                url = "${ctx}/product/cmPromotions/findProductPage?promotionType=2&productIds=" + showSelectProductID
                 title = "选择凑单赠品";
             }
             showSelectProductID = showSelectProductID.slice(0, -1)
             console.log(showSelectProductID);
-            top.$.jBox("iframe:"+url, {
+            top.$.jBox("iframe:" + url, {
                 iframeScrolling: 'yes',
                 width: $(top.document).width() - 400,
                 height: $(top.document).height() - 160,
@@ -187,15 +188,15 @@
                                     var delGiftIds = $("#delGiftIds").val();
                                     var description = $("#description").val();
                                     //将选中商品id与原来的促销商品或赠品id拼接
-                                    if (type == 1 ) {
+                                    if (type == 1) {
                                         if (productIds != '') {
                                             items = items + ',' + productIds;
                                         }
                                         if (giftIds != '') {
                                             items1 = giftIds;
                                         }
-                                        window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + items + "&giftIds=" + items1 + "&mode=" + mode + "&description=" +description+
-                                            "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+
+                                        window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + items + "&giftIds=" + items1 + "&mode=" + mode + "&description=" + description +
+                                            "&delProductIds=" + delProductIds + "&delGiftIds=" + delGiftIds +
                                             "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
                                             "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";
                                     }
@@ -206,9 +207,9 @@
                                         if (productIds != '') {
                                             items1 = productIds;
                                         }
-                                        window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + items1 + "&giftIds=" + items + "&mode=" + mode + "&description=" +description+
-                                            "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+
-                                            "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
+                                        window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + items1 + "&giftIds=" + items + "&mode=" + mode + "&description=" + description +
+                                            "&delProductIds=" + delProductIds + "&delGiftIds=" + delGiftIds +
+                                            "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
                                             "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";
                                     }
                                     $.jBox.tip(data.msg, 'info');
@@ -227,40 +228,62 @@
             });
         }
 
-        function deleteProduct(obj,type) {
+        function deleteProduct(obj, type) {
+            debugger;
             //将该行数据取消勾选,若存在数据库中则将其存入delProductIds中
             $(".check-item[value=" + obj + "]").prop("checked", false);
-            if (type == 1) {
-                var product=$('#product'+obj);
+            var delProductIds = $("#delProductIds").val();
+            var delGiftIds = $("#delGiftIds").val();
+            if (1 === type) {
+                if (delProductIds != '') {
+                    delProductIds = delProductIds + "," + obj;
+                } else {
+                    delProductIds = obj;
+                }
+                $("#delProductIds").val(delProductIds);
+                var product = $('#product' + obj);
                 $(product).remove();
+                if ($('#contentTbody tr').size() < 1) {
+                    $("#productIds").val('');
+                    $("#giftIds").val('');
+                    var showSelectProductID = '';
+                    $('#contentTbody1 tr').each(function (index, item) {
+                        var $this = $(this);
+                        var $itemProductID = $this.find('input[name="gift"]').val();
+                        showSelectProductID += $itemProductID + ',';
+                    });
+                    $("#delGiftIds").val(showSelectProductID);
+                    var tbody = document.getElementById("contentTbody1");
+                    while (tbody.firstChild) {
+                        tbody.removeChild(tbody.firstChild);
+                    }
+                }
             }
-            if (type == 2) {
-                var gift= $('#gift'+obj);
+            if (2 === type) {
+                if (delGiftIds != '') {
+                    delGiftIds = delGiftIds + "," + obj;
+                } else {
+                    delGiftIds = obj;
+                }
+                $("#delGiftIds").val(delGiftIds);
+                var gift = $('#gift' + obj);
                 $(gift).remove();
+                if ($('#contentTbody1 tr').size < 1) {
+                    $("#giftIds").val('');
+                }
             }
 
-            $.ajax({
-                url: "${ctx}/product/cmPromotions/delPromotion",
-                data: {"id":"${cmPromotion.id || ''}","skuId":obj},
-                type: "POST",
-                async: false,
-                success: function(data){
-                    flag=data.success;
-                }
-            });
-            <%--var delProductIds = $("#delProductIds").val();--%>
-            <%--var delGiftIds = $("#delGiftIds").val();--%>
-            <%--if (storeStatus && type == 1) {--%>
-            <%--    if (delProductIds != '') {--%>
-            <%--        delProductIds = delProductIds + "," + obj;--%>
-            <%--    }else delProductIds = obj;--%>
-            <%--}--%>
-            <%--if (storeStatus && type == 2) {--%>
-            <%--    if (delGiftIds != '') {--%>
-            <%--        delGiftIds = delGiftIds + "," + obj;--%>
-            <%--    }else delGiftIds = obj;--%>
-            <%--}--%>
+            <%--$.ajax({--%>
+            <%--    url: "${ctx}/product/cmPromotions/delPromotion",--%>
+            <%--    data: {"id": "${cmPromotion.id || ''}", "skuId": obj},--%>
+            <%--    type: "POST",--%>
+            <%--    async: false,--%>
+            <%--    success: function (data) {--%>
+            <%--        flag = data.success;--%>
+            <%--    }--%>
+            <%--});--%>
             <%--window.setTimeout(function () {--%>
+            <%--    debugger;--%>
             <%--    var productItems = getCheckedItems(1);--%>
             <%--    var giftItems = getCheckedItems(2);--%>
             <%--    var mode = $("input[name='mode']:checked").val();--%>
@@ -273,15 +296,15 @@
             <%--    var delFlag1 = $("input[name='delFlag1']:checked").val();--%>
             <%--    var description = $("#description").val();--%>
             <%--    window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + productItems + "&giftIds=" + giftItems +--%>
-            <%--        "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+"&mode=" + mode + "&description=" +description+--%>
-            <%--        "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
+            <%--        "&delProductIds=" + delProductIds + "&delGiftIds=" + delGiftIds + "&mode=" + mode + "&description=" + description +--%>
+            <%--        "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
             <%--        "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";--%>
-            <%--},100)--%>
+            <%--}, 100)--%>
         }
 
         function getCheckedItems(type) {
             var items = new Array();
-            var $items = type==0? $('.check-item:checked'):type==1?$("#productCheckItem:checked"):$("#giftCheckItem:checked");
+            var $items = type == 0 ? $('.check-item:checked') : type == 1 ? $("#productCheckItem:checked") : $("#giftCheckItem:checked");
             $items.each(function () {
                 items.push($(this).val());
             });
@@ -292,9 +315,13 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/product/cmPromotions/list?type=2">凑单促销</a></li>
-    <li class="active"><a href="${ctx}/product/cmPromotions/form?id=${cmPromotion.id}&type=2">${not empty cmPromotion.id?'编辑':'添加'}凑单促销</a></li>
-</ul><br/>
-<form:form id="inputForm" modelAttribute="cmPromotion" action="${ctx}/product/cmPromotions/save" method="post" class="form-horizontal">
+    <li class="active"><a
+            href="${ctx}/product/cmPromotions/form?id=${cmPromotion.id}&type=2">${not empty cmPromotion.id?'编辑':'添加'}凑单促销</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmPromotion" action="${ctx}/product/cmPromotions/save" method="post"
+           class="form-horizontal">
     <form:hidden path="id"/>
     <form:hidden path="type"/>
     <form:hidden path="productIds" id="productIds"/>
@@ -324,8 +351,8 @@
                 <c:forEach items="${cmPromotion.promotionProducts}" var="product">
                     <tr id="product${product.productID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
-                                   name="info" ${product.storeStatus?'':'checked'}
-                                   value='${product.productID}'/></th>
+                                                name="info" checked
+                                                value='${product.productID}'/></th>
                         <td><img src="${product.mainImage}" width="50px" height="50px"></td>
                         <td>${product.name}</td>
                         <td>${product.shopName}</td>
@@ -343,22 +370,27 @@
 
     <div class="control-group" id="promotionType">
         <label>促销方式:</label>
-        <input type="radio"  id="promotionType2" name="mode" value="2" ${cmPromotion.mode == null ? "checked" :cmPromotion.mode == "2" ? "checked" : ""} />满减
-        <input type="radio" id="promotionType3"   name="mode" value="3" ${cmPromotion.mode == "3" ? "checked" : ""} />满赠
+        <input type="radio" id="promotionType2" name="mode"
+               value="2" ${cmPromotion.mode == null ? "checked" :cmPromotion.mode == "2" ? "checked" : ""} />满减
+        <input type="radio" id="promotionType3" name="mode" value="3" ${cmPromotion.mode == "3" ? "checked" : ""} />满赠
     </div>
 
     <div class="control-group">
         <label style="color: red">*</label>
         <label style="display: inline">优惠内容:</label>
-        <div id="discountContent2" style="display: ${cmPromotion.mode == null ? "inline" :cmPromotion.mode == "2" ? "inline" : "none"}">
+        <div id="discountContent2"
+             style="display: ${cmPromotion.mode == null ? "inline" :cmPromotion.mode == "2" ? "inline" : "none"}">
             <label>满</label>
-            <form:input path="touchPrice2" id="touchPrice2" htmlEscape="false" maxlength="7" class="input-xlarge" onkeyup="onlynum(this)"/>
+            <form:input path="touchPrice2" id="touchPrice2" htmlEscape="false" maxlength="7" class="input-xlarge"
+                        onkeyup="onlynum(this)"/>
             <label>减</label>
-            <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
         </div>
         <div id="discountContent3" style="display: ${cmPromotion.mode == "3" ? "inline" : "none"}">
             <label>满</label>
-            <form:input path="touchPrice3" id="touchPrice3" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="touchPrice3" id="touchPrice3" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
             <label><a href="JavaScript:;" onclick="showSelect(2)">请选择赠品</a></label>
             <c:if test="${cmPromotion.giftProducts !=null and cmPromotion.giftProducts.size()>0}">
                 <table id="contentTable" class="table table-striped table-bordered table-condensed">
@@ -402,11 +434,13 @@
 
     <div class="control-group">
         <label>促销时效:</label>
-        <input type="radio" name="status" value="1" ${cmPromotion.status == null ? "checked" : cmPromotion.status == "1"?"checked":""} />永久
+        <input type="radio" name="status"
+               value="1" ${cmPromotion.status == null ? "checked" : cmPromotion.status == "1"?"checked":""} />永久
         <input type="radio" name="status" value="2" ${cmPromotion.status == "2" ? "checked" : ""} />区间有效
     </div>
 
-    <div class="control-group" id="begin" style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}" >
+    <div class="control-group" id="begin"
+         style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}">
         <label>开始时间:</label>
         <input name="beginTime" type="text" readonly="readonly" maxlength="20"
                class="input-medium Wdate required" id="beginTime"
@@ -414,7 +448,8 @@
                onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
     </div>
 
-    <div class="control-group" id="end" style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}" >
+    <div class="control-group" id="end"
+         style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}">
         <label>结束时间:</label>
         <input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
                id="endTime"
@@ -424,46 +459,49 @@
 
     <div class="control-group" id="discount">
         <label>叠加优惠:</label>
-        <input type="radio" name="discount" value="1" ${cmPromotion.discount == null ? "checked" : cmPromotion.discount == "1"?"checked":""} />支持
+        <input type="radio" name="discount"
+               value="1" ${cmPromotion.discount == null ? "checked" : cmPromotion.discount == "1"?"checked":""} />支持
         <input type="radio" name="discount" value="2" ${cmPromotion.discount == "2" ? "checked" : ""} />不支持
     </div>
 
     <div class="control-group">
         <label>活动可见度:</label>
-        <input type="radio" name="seen" value="1" ${cmPromotion.seen == null ? "checked" : cmPromotion.seen == "1"?"checked":""}/>对所有人可见(含协销)
+        <input type="radio" name="seen"
+               value="1" ${cmPromotion.seen == null ? "checked" : cmPromotion.seen == "1"?"checked":""}/>对所有人可见(含协销)
         <input type="radio" name="seen" value="2" ${cmPromotion.seen == "2" ? "checked" : ""}/>仅对机构可见(不含协销)
     </div>
 
     <div class="control-group">
         <label style="display: inline">促销状态:</label>
-        <label style="display: inline;color: ${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"green":cmPromotion.delFlag1 == "0"?"red":cmPromotion.delFlag1 == "1"?"purple":cmPromotion.delFlag1 == "2"?"green":"orange"}" id="promotionStatus">${cmPromotion.delFlag1 == null?"进行中": cmPromotion.delFlag1 == "0"?"已关闭":cmPromotion.delFlag1 == "1"?"未开始":cmPromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
-        <input type="checkbox" name="delFlag1" value="close" ${cmPromotion.delFlag1 == null?"":cmPromotion.delFlag1 == "0" ? "checked" : ""} />关闭
+        <label style="display: inline;color: ${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"green":cmPromotion.delFlag1 == "0"?"red":cmPromotion.delFlag1 == "1"?"purple":cmPromotion.delFlag1 == "2"?"green":"orange"}"
+               id="promotionStatus">${cmPromotion.delFlag1 == null?"进行中": cmPromotion.delFlag1 == "0"?"已关闭":cmPromotion.delFlag1 == "1"?"未开始":cmPromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
+        <input type="checkbox" name="delFlag1"
+               value="close" ${cmPromotion.delFlag1 == null?"":cmPromotion.delFlag1 == "0" ? "checked" : ""} />关闭
     </div>
 
     <div class="form-actions">
         <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
-        <a href="${ctx}/product/cmPromotions/?type=2"><input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/></a>
+        <a href="${ctx}/product/cmPromotions/?type=2"><input id="btnCancel" class="btn" type="button" value="返 回"
+                                                             onclick="history.go(-1)"/></a>
     </div>
 </form:form>
 <script type="text/javascript">
-    $(function () {
-    })
 
     //促销方式修改
     $("input:radio[name='mode']").click(function () {
         var promotionType = $("input[name='mode']:checked").val();
         if ("1" == promotionType) {
-            $("#discountContent1").attr("style","display:inline");
-            $("#discountContent2").attr("style","display:none");
-            $("#discountContent3").attr("style","display:none");
-        }else if ("2" == promotionType) {
-            $("#discountContent1").attr("style","display:none");
-            $("#discountContent2").attr("style","display:inline");
-            $("#discountContent3").attr("style","display:none");
+            $("#discountContent1").attr("style", "display:inline");
+            $("#discountContent2").attr("style", "display:none");
+            $("#discountContent3").attr("style", "display:none");
+        } else if ("2" == promotionType) {
+            $("#discountContent1").attr("style", "display:none");
+            $("#discountContent2").attr("style", "display:inline");
+            $("#discountContent3").attr("style", "display:none");
         } else {
-            $("#discountContent1").attr("style","display:none");
-            $("#discountContent2").attr("style","display:none");
-            $("#discountContent3").attr("style","display:inline");
+            $("#discountContent1").attr("style", "display:none");
+            $("#discountContent2").attr("style", "display:none");
+            $("#discountContent3").attr("style", "display:inline");
         }
     })
     //促销时效修改
@@ -471,15 +509,15 @@
         var promotionStatus = $("input[name='status']:checked").val();
         var promotiondelFlag1 = $("input[name='delFlag1']:checked").val();
         if ("1" == promotionStatus) {
-            $("#begin").attr("style","display:none");
-            $("#end").attr("style","display:none");
+            $("#begin").attr("style", "display:none");
+            $("#end").attr("style", "display:none");
             if (null == promotiondelFlag1) {
                 $("#promotionStatus").text("进行中");
                 $("#promotionStatus").attr("style", "display: inline;color:green");
             }
-        }else if ("2" == promotionStatus) {
-            $("#begin").attr("style","");
-            $("#end").attr("style","");
+        } else if ("2" == promotionStatus) {
+            $("#begin").attr("style", "");
+            $("#end").attr("style", "");
             if (null == promotiondelFlag1) {
                 updateStatus();
             }
@@ -500,7 +538,7 @@
         if (promotiondelFlag1 != null) {
             $("#promotionStatus").text("已关闭");
             $("#promotionStatus").attr("style", "display: inline;color:red");
-        }else {
+        } else {
             var promotionStatus = $("input[name='status']:checked").val();
             if ("1" == promotionStatus) {
                 $("#promotionStatus").text("进行中");

+ 26 - 26
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp

@@ -761,32 +761,32 @@
                 <label><input type="radio" name="step" value="2"  ${product.step == "2" ? "checked" : ""}>以起订量增长</label>
             </td>
         </tr>
-        <tr>
-            <th><span class="red">*</span>运费:</th>
-                <%--<td colspan="3">
-                    <label><input type="radio" name="byFlag" value="0"  ${product.byFlag == "0" ? "checked" : ""}>买家承担<b class="line">|</b></label>
-                    <label><input type="radio" name="byFlag" value="1"  ${product.byFlag == "1" ? "checked" : ""}>卖家承担</label>
-                </td>--%>
-            <td colspan="3">
-                <label><input type="radio" name="freePostFlag"
-                              value="2"  ${(empty product.freePostFlag || product.freePostFlag eq "2") ? "checked" : ""}>默认(遵循运费规则)<b
-                        class="line">|</b></label>
-                <label><input type="radio" name="freePostFlag"
-                              value="0"  ${product.freePostFlag == "0" ? "checked" : ""}>包邮<b class="line">|</b></label>
-                <label><input type="radio" name="freePostFlag"
-                              value="1"  ${product.freePostFlag == "1" ? "checked" : ""}>到付</label>
-            </td>
-        </tr>
-        <tr>
-            <th><span class="red">*</span>销售区域:</th>
-            <td colspan="3">
-                <label><input type="radio" name="allAreaFlag" value="1"
-                              onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "checked" : ""}>全部区域<b
-                        class="line">|</b></label>
-                <label><input type="radio" name="allAreaFlag" value="0"
-                              onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "" : "checked"}>指定区域</label>
-            </td>
-        </tr>
+            <%--<tr>
+                <th><span class="red">*</span>运费:</th>
+                    <td colspan="3">
+                        <label><input type="radio" name="byFlag" value="0"  ${product.byFlag == "0" ? "checked" : ""}>买家承担<b class="line">|</b></label>
+                        <label><input type="radio" name="byFlag" value="1"  ${product.byFlag == "1" ? "checked" : ""}>卖家承担</label>
+                    </td>
+                <td colspan="3">
+                    <label><input type="radio" name="freePostFlag"
+                                  value="2"  ${(empty product.freePostFlag || product.freePostFlag eq "2") ? "checked" : ""}>默认(遵循运费规则)<b
+                            class="line">|</b></label>
+                    <label><input type="radio" name="freePostFlag"
+                                  value="0"  ${product.freePostFlag == "0" ? "checked" : ""}>包邮<b class="line">|</b></label>
+                    <label><input type="radio" name="freePostFlag"
+                                  value="1"  ${product.freePostFlag == "1" ? "checked" : ""}>到付</label>
+                </td>
+            </tr>
+            <tr>
+                <th><span class="red">*</span>销售区域:</th>
+                <td colspan="3">
+                    <label><input type="radio" name="allAreaFlag" value="1"
+                                  onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "checked" : ""}>全部区域<b
+                            class="line">|</b></label>
+                    <label><input type="radio" name="allAreaFlag" value="0"
+                                  onchange="changeAreaFlag()" ${product.allAreaFlag == "1" ? "" : "checked"}>指定区域</label>
+                </td>
+            </tr>--%>
         <tr>
             <th><span class="red">*</span>首页新品展示:</th>
             <td colspan="3">

+ 9 - 4
src/main/webapp/WEB-INF/views/modules/product-new/promotionSelectProducts.jsp

@@ -36,14 +36,16 @@
         });
 
         function checkSkuValue(index) {
-            var skus = JSON.parse($("#hideSku").val());
+            var sku = "#hideSku" + index;
+            var skus = JSON.parse($(sku).val());
             var price = "price" + index;//单价
             var chose = "#ints" + index;//选中的sku
             var skuStr = $(chose).val();
             var skuIndex = skuStr.split("/")[1];
             var skuId = skuStr.split("/")[0];
             document.getElementById(price).innerHTML = skus[skuIndex].price;
-            $("#skuId").val(skuId);
+            var checkSkuId = "#skuId" + index;
+            $(checkSkuId).val(skuId);
         }
     </script>
 </head>
@@ -54,6 +56,8 @@
     <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
     <form:hidden path="productIds"/>
     <form:hidden path="promotionType"/>
+    <form:hidden path="promotionMode"/>
+    <form:hidden path="shopID"/>
     <form:hidden path="ids"/>
     <form:hidden path="delProductIds"/>
     <div class="ul-form">
@@ -84,13 +88,14 @@
         <c:forEach items="${page.list}" var="item" varStatus="state">
             <tr id="${item.productID}" class="itemtr">
                 <th>
-                    <input id="skuId" class="check-item" type="checkbox" name="info" value='${item.skuList[0].skuId}'/>
+                    <input id="skuId${state.index}" class="check-item" type="checkbox" name="info"
+                           value='${item.skuList[0].skuId}'/>
                 </th>
                 <td>${item.productID}</td>
                 <td><img src="${item.mainImage}" width="50px" height="50px"></td>
                 <td>${item.name}</td>
                 <td>
-                    <input id="hideSku" value='${fns:toJson(item.skuList)}' hidden>
+                    <input id="hideSku${state.index}" value='${fns:toJson(item.skuList)}' hidden>
                     <select id="ints${state.index}" onchange="checkSkuValue(${state.index});">
                         <c:forEach items="${item.skuList}" var="skus" varStatus="ind">
                             <option value="${skus.skuId}/${ind.index}">${skus.unit}</option>

+ 129 - 75
src/main/webapp/WEB-INF/views/modules/product-new/shopPromotionForm.jsp

@@ -1,20 +1,20 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
-<%@ page import="java.util.*"%>
-<%@ page import="java.text.*"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.text.*" %>
 <%
-    String datetime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); //获取系统时间
-    request.setAttribute("currentTime",datetime);
+    String datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime()); //获取系统时间
+    request.setAttribute("currentTime", datetime);
 %>
 <html>
 <head>
     <title>促销活动管理</title>
     <meta name="decorator" content="default"/>
     <script type="text/javascript">
-        $(document).ready(function() {
+        $(document).ready(function () {
             $("#inputForm").validate({
-                submitHandler: function(form){
-                    var isSubMitFlag = true, addGiftArray = [] ,addShopId;
+                submitHandler: function (form) {
+                    var isSubMitFlag = true, addGiftArray = [], addShopId;
                     var mode = $("input[name='mode']:checked").val();
                     var status = $("input[name='status']:checked").val();
                     if (${cmPromotion.promotionShops==null or cmPromotion.promotionShops.size()==0}) {
@@ -29,12 +29,12 @@
                     }
                     if (mode == "1") {
 
-                    }else if (mode == "2") {
+                    } else if (mode == "2") {
                         if ($("#touchPrice2").val() == '') {
                             alertx("请输入满减设定价");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#touchPrice2").val())||$("#touchPrice2").val().indexOf('0')==0){
+                        } else if (isNaN($("#touchPrice2").val()) || $("#touchPrice2").val().indexOf('0') == 0) {
                             alertx('请输入正确的满减设定价!');
                             isSubMitFlag = false;
                             return false;
@@ -43,7 +43,7 @@
                             alertx("请输入减免价格");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#reducedPrice").val())||$("#reducedPrice").val().indexOf('0')==0){
+                        } else if (isNaN($("#reducedPrice").val()) || $("#reducedPrice").val().indexOf('0') == 0) {
                             alertx('请输入正确的减免价格!');
                             isSubMitFlag = false;
                             return false;
@@ -53,18 +53,18 @@
                             isSubMitFlag = false;
                             return false;
                         }
-                    }else if (mode == "3") {
+                    } else if (mode == "3") {
                         if ($("#touchPrice3").val() == '') {
                             alertx("请输入满赠设定价");
                             isSubMitFlag = false;
                             return false;
-                        }else if(isNaN($("#touchPrice3").val())||$("#touchPrice3").val().indexOf('0')==0){
+                        } else if (isNaN($("#touchPrice3").val()) || $("#touchPrice3").val().indexOf('0') == 0) {
                             alertx('请输入正确的满赠设定价!');
                             isSubMitFlag = false;
                             return false;
                         }
                     }
-                    if (mode=="3" &&( ${cmPromotion.giftProducts==null or cmPromotion.giftProducts.size()==0})) {
+                    if (mode == "3" && (${cmPromotion.giftProducts==null or cmPromotion.giftProducts.size()==0})) {
                         alertx("请至少选择1个赠送的商品");
                         isSubMitFlag = false;
                         return false;
@@ -79,12 +79,12 @@
                         var $this = $(this);
                         var $itemProductID = $this.find('input[name="gift"]').val();
                         var $giftNumber = $this.find('input[name="giftNumber"]').val();
-                        if ($giftNumber == null || $giftNumber == '' ) {
+                        if ($giftNumber == null || $giftNumber == '') {
                             alertx("请输入赠品数量");
                             isSubMitFlag = false;
                             return false;
                         }
-                        if ( $giftNumber <= 0 ) {
+                        if ($giftNumber <= 0) {
                             alertx("赠品数量必须大于0");
                             isSubMitFlag = false;
                             return false;
@@ -113,9 +113,9 @@
                     }
                 },
                 errorContainer: "#messageBox",
-                errorPlacement: function(error, element) {
+                errorPlacement: function (error, element) {
                     $("#messageBox").text("输入有误,请先更正。");
-                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                         error.appendTo(element.parent().parent());
                     } else {
                         error.insertAfter(element);
@@ -123,6 +123,7 @@
                 }
             });
         });
+
         //选择添加商品
         function showSelect(type) {
             var showSelectProductID = '';
@@ -135,16 +136,22 @@
                     var $itemProductID = $this.find('input[name="info"]').val();
                     showSelectProductID += $itemProductID + ',';
                 });
-                url = "${ctx}/product/cmPromotions/findSupplierPage?shopIds=" + showSelectProductID + "&delShopIds=" +delShopIds;
+                url = "${ctx}/product/cmPromotions/findSupplierPage?shopIds=" + showSelectProductID + "&delShopIds=" + delShopIds;
                 title = '选择促销店铺';
-            } else if (type == 2){
-                $('#contentTbody1 tr').each(function (index, item) {
-                    var $this = $(this);
-                    var $itemProductID = $this.find('input[name="gift"]').val();
-                    showSelectProductID += $itemProductID + ',';
-                });
-                url = "${ctx}/product/cmPromotions/findProductPage?productIds=" + showSelectProductID;
-                title = '选择促销赠品';
+            } else if (type == 2) {
+                var shopId = $("#productCheckItem").val();
+                if (shopId) {
+                    $('#contentTbody1 tr').each(function (index, item) {
+                        var $this = $(this);
+                        var $itemProductID = $this.find('input[name="gift"]').val();
+                        showSelectProductID += $itemProductID + ',';
+                    });
+                    url = "${ctx}/product/cmPromotions/findProductPage?promotionType=3&productIds=" + showSelectProductID + "&shopID=" + shopId;
+                    title = '选择促销赠品';
+                } else {
+                    top.$.jBox.tip("请先勾选供应商...");
+                    return false;
+                }
             }
             showSelectProductID = showSelectProductID.slice(0, -1);
             console.log(showSelectProductID);
@@ -181,15 +188,15 @@
                                     var delShopIds = $("#delShopIds").val();
                                     var delGiftIds = $("#delGiftIds").val();
                                     //将选中商品id与原来的促销商品或赠品id拼接
-                                    if (type == 1 ) {
+                                    if (type == 1) {
                                         items = items;
                                         if (giftIds != '') {
                                             items1 = giftIds;
                                         }
                                         window.location.href = "${ctx}/product/cmPromotions/form?type=3&shopIds=" + items + "&giftIds=" + items1 + "&mode=" + mode +
-                                            "&delShopIds="+delShopIds+"&delGiftIds="+delGiftIds+
+                                            "&delShopIds=" + delShopIds + "&delGiftIds=" + delGiftIds +
                                             "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
-                                            "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}"+
+                                            "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}" +
                                             "&searchDbFlag=0";
                                     }
                                     if (type == 2) {
@@ -200,8 +207,8 @@
                                             items1 = shopIds;
                                         }
                                         window.location.href = "${ctx}/product/cmPromotions/form?type=3&shopIds=" + items1 + "&giftIds=" + items + "&mode=" + mode +
-                                            "&delShopIds="+delShopIds+"&delGiftIds="+delGiftIds+
-                                            "&reducedPrice=" + reducedPrice  + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
+                                            "&delShopIds=" + delShopIds + "&delGiftIds=" + delGiftIds +
+                                            "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
                                             "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";
                                     }
                                     $.jBox.tip(data.msg, 'info');
@@ -223,22 +230,52 @@
         function deleteProduct(obj, type) {
             //将该行数据取消勾选,若存在数据库中则将其删除
             $(".check-item[value=" + obj + "]").prop("checked", false);
-            if (type == 3) {
-                var shop=$('#shop'+obj);
+            if (3 === type) {
+                var shopIds = '';
+                $('#contentTbody tr').each(function (index, item) {
+                    var $this = $(this);
+                    var $itemProductID = $this.find('input[name="info"]').val();
+                    shopIds += $itemProductID + ',';
+                });
+                $("#delShopIds").val(shopIds);
+                var shop = $('#shop' + obj);
                 $(shop).remove();
+                var showSelectProductID = '';
+                $('#contentTbody1 tr').each(function (index, item) {
+                    var $this = $(this);
+                    var $itemProductID = $this.find('input[name="gift"]').val();
+                    showSelectProductID += $itemProductID + ',';
+                });
+                $("#delGiftIds").val(showSelectProductID);
+                $("#shopIds").val('');
+                $("#giftIds").val('');
+                var tbody = document.getElementById("contentTbody1");
+                while (tbody.firstChild) {
+                    tbody.removeChild(tbody.firstChild);
+                }
             }
-            if (type == 2) {
-                var gift= $('#gift'+obj);
+            if (2 === type) {
+                if (delGiftIds != '') {
+                    delGiftIds = delGiftIds + "," + obj;
+                } else {
+                    delGiftIds = obj;
+                }
+                $("#delGiftIds").val(delGiftIds);
+                var gift = $('#gift' + obj);
                 $(gift).remove();
+                if ($('#contentTbody1 tr').size < 1) {
+                    $("#giftIds").val('');
+                }
             }
 
+
             $.ajax({
                 url: "${ctx}/product/cmPromotions/delPromotion",
-                data: {"id":"${cmPromotion.id || ''}","skuId":obj},
+                data: {"id": "${cmPromotion.id || ''}", "skuId": obj},
                 type: "POST",
                 async: false,
-                success: function(data){
-                    flag=data.success;
+                success: function (data) {
+                    flag = data.success;
                 }
             });
             <%--var delShopIds = $("#delShopIds").val();--%>
@@ -279,7 +316,7 @@
 
         function getCheckedItems(type) {
             var items = new Array();
-            var $items = type==0? $('.check-item:checked'):type==1?$("#productCheckItem:checked"):$("#giftCheckItem:checked");
+            var $items = type == 0 ? $('.check-item:checked') : type == 1 ? $("#productCheckItem:checked") : $("#giftCheckItem:checked");
             $items.each(function () {
                 items.push($(this).val());
             });
@@ -290,9 +327,13 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/product/cmPromotions/list?type=3">店铺促销</a></li>
-    <li class="active"><a href="${ctx}/product/cmPromotions/form?id=${cmPromotion.id}&type=3">${not empty cmPromotion.id?'编辑':'添加'}店铺促销</a></li>
-</ul><br/>
-<form:form id="inputForm" modelAttribute="cmPromotion" action="${ctx}/product/cmPromotions/save" method="post" class="form-horizontal">
+    <li class="active"><a
+            href="${ctx}/product/cmPromotions/form?id=${cmPromotion.id}&type=3">${not empty cmPromotion.id?'编辑':'添加'}店铺促销</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmPromotion" action="${ctx}/product/cmPromotions/save" method="post"
+           class="form-horizontal">
     <form:hidden path="id"/>
     <form:hidden path="type"/>
     <form:hidden path="productIds" id="productIds"/>
@@ -319,8 +360,8 @@
                 <c:forEach items="${cmPromotion.promotionShops}" var="shop">
                     <tr id="shop${shop.shopID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
-                                   name="info" ${shop.storeStatus?'':'checked'}
-                                   value='${shop.shopID}'/></th>
+                                                name="info" ${shop.storeStatus?'':'checked'}
+                                                value='${shop.shopID}'/></th>
                         <td>${shop.name}</td>
                         <td>${shop.sname}</td>
                         <td>${shop.linkMan}</td>
@@ -338,22 +379,27 @@
 
     <div class="control-group" id="promotionType">
         <label>促销方式:</label>
-        <input type="radio"  id="promotionType2" name="mode" value="2" ${cmPromotion.mode == null ? "checked" :cmPromotion.mode == "2" ? "checked" : ""} />满减
-        <input type="radio" id="promotionType3"   name="mode" value="3" ${cmPromotion.mode == "3" ? "checked" : ""} />满赠
+        <input type="radio" id="promotionType2" name="mode"
+               value="2" ${cmPromotion.mode == null ? "checked" :cmPromotion.mode == "2" ? "checked" : ""} />满减
+        <input type="radio" id="promotionType3" name="mode" value="3" ${cmPromotion.mode == "3" ? "checked" : ""} />满赠
     </div>
 
     <div class="control-group">
         <label style="color: red">*</label>
         <label style="display: inline">优惠内容:</label>
-        <div id="discountContent2" style="display: ${cmPromotion.mode == null ? "inline" : cmPromotion.mode == "2" ? "inline" : "none"}">
+        <div id="discountContent2"
+             style="display: ${cmPromotion.mode == null ? "inline" : cmPromotion.mode == "2" ? "inline" : "none"}">
             <label>满</label>
-            <form:input path="touchPrice2" id="touchPrice2" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="touchPrice2" id="touchPrice2" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
             <label>减</label>
-            <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="reducedPrice" id="reducedPrice" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
         </div>
         <div id="discountContent3" style="display: ${cmPromotion.mode == "3" ? "inline" : "none"}">
             <label>满</label>
-            <form:input path="touchPrice3" id="touchPrice3" htmlEscape="false" maxlength="7" class="input-xlarge " onkeyup="onlynum(this)"/>
+            <form:input path="touchPrice3" id="touchPrice3" htmlEscape="false" maxlength="7" class="input-xlarge "
+                        onkeyup="onlynum(this)"/>
             <label><a href="JavaScript:;" onclick="showSelect(2)">请选择商品</a></label>
             <c:if test="${cmPromotion.giftProducts !=null and cmPromotion.giftProducts.size()>0}">
                 <table id="contentTable" class="table table-striped table-bordered table-condensed">
@@ -397,11 +443,13 @@
 
     <div class="control-group">
         <label>促销时效:</label>
-        <input type="radio" name="status" value="1" ${cmPromotion.status == null ? "checked" : cmPromotion.status == "1"?"checked":""} />永久
+        <input type="radio" name="status"
+               value="1" ${cmPromotion.status == null ? "checked" : cmPromotion.status == "1"?"checked":""} />永久
         <input type="radio" name="status" value="2" ${cmPromotion.status == "2" ? "checked" : ""} />区间有效
     </div>
 
-    <div class="control-group" id="begin" style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}" >
+    <div class="control-group" id="begin"
+         style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}">
         <label>开始时间:</label>
         <input name="beginTime" type="text" readonly="readonly" maxlength="20"
                class="input-medium Wdate required" id="beginTime"
@@ -409,7 +457,8 @@
                onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
     </div>
 
-    <div class="control-group" id="end" style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}" >
+    <div class="control-group" id="end"
+         style="display: ${cmPromotion.status == null ? "none" : cmPromotion.status == "1"?"none":""}">
         <label>结束时间:</label>
         <input name="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate required"
                id="endTime"
@@ -419,25 +468,30 @@
 
     <div class="control-group" id="discount">
         <label>叠加优惠:</label>
-        <input type="radio" name="discount" value="1" ${cmPromotion.discount == null ? "checked" : cmPromotion.discount == "1"?"checked":""} />支持
+        <input type="radio" name="discount"
+               value="1" ${cmPromotion.discount == null ? "checked" : cmPromotion.discount == "1"?"checked":""} />支持
         <input type="radio" name="discount" value="2" ${cmPromotion.discount == "2" ? "checked" : ""} />不支持
     </div>
 
     <div class="control-group">
         <label>活动可见度:</label>
-        <input type="radio" name="seen" value="1" ${cmPromotion.seen == null ? "checked" : cmPromotion.seen == "1"?"checked":""}/>对所有人可见(含协销)
+        <input type="radio" name="seen"
+               value="1" ${cmPromotion.seen == null ? "checked" : cmPromotion.seen == "1"?"checked":""}/>对所有人可见(含协销)
         <input type="radio" name="seen" value="2" ${cmPromotion.seen == "2" ? "checked" : ""}/>仅对机构可见(不含协销)
     </div>
 
     <div class="control-group">
         <label style="display: inline">促销状态:</label>
-        <label style="display: inline;color: ${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"green":cmPromotion.delFlag1 == "0"?"red":cmPromotion.delFlag1 == "1"?"purple":cmPromotion.delFlag1 == "2"?"green":"orange"}" id="promotionStatus">${cmPromotion.delFlag1 == null?"进行中":cmPromotion.delFlag1 == "0"?"已关闭":cmPromotion.delFlag1 == "1"?"未开始":cmPromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
-        <input type="checkbox" name="delFlag1" value="close" ${cmPromotion.delFlag1 == null?"":cmPromotion.delFlag1 == "0" ? "checked" : ""} />关闭
+        <label style="display: inline;color: ${cmPromotion.delFlag1 == null || cmPromotion.delFlag1 == '' ?"green":cmPromotion.delFlag1 == "0"?"red":cmPromotion.delFlag1 == "1"?"purple":cmPromotion.delFlag1 == "2"?"green":"orange"}"
+               id="promotionStatus">${cmPromotion.delFlag1 == null?"进行中":cmPromotion.delFlag1 == "0"?"已关闭":cmPromotion.delFlag1 == "1"?"未开始":cmPromotion.delFlag1 == "2"?"进行中":"已结束"}</label>
+        <input type="checkbox" name="delFlag1"
+               value="close" ${cmPromotion.delFlag1 == null?"":cmPromotion.delFlag1 == "0" ? "checked" : ""} />关闭
     </div>
 
     <div class="form-actions">
         <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
-        <a href="${ctx}/product/cmPromotions/?type=3"><input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/></a>
+        <a href="${ctx}/product/cmPromotions/?type=3"><input id="btnCancel" class="btn" type="button" value="返 回"
+                                                             onclick="history.go(-1)"/></a>
     </div>
 </form:form>
 <script type="text/javascript">
@@ -448,17 +502,17 @@
     $("input:radio[name='mode']").click(function () {
         var promotionType = $("input[name='mode']:checked").val();
         if ("1" == promotionType) {
-            $("#discountContent1").attr("style","display:inline");
-            $("#discountContent2").attr("style","display:none");
-            $("#discountContent3").attr("style","display:none");
-        }else if ("2" == promotionType) {
-            $("#discountContent1").attr("style","display:none");
-            $("#discountContent2").attr("style","display:inline");
-            $("#discountContent3").attr("style","display:none");
+            $("#discountContent1").attr("style", "display:inline");
+            $("#discountContent2").attr("style", "display:none");
+            $("#discountContent3").attr("style", "display:none");
+        } else if ("2" == promotionType) {
+            $("#discountContent1").attr("style", "display:none");
+            $("#discountContent2").attr("style", "display:inline");
+            $("#discountContent3").attr("style", "display:none");
         } else {
-            $("#discountContent1").attr("style","display:none");
-            $("#discountContent2").attr("style","display:none");
-            $("#discountContent3").attr("style","display:inline");
+            $("#discountContent1").attr("style", "display:none");
+            $("#discountContent2").attr("style", "display:none");
+            $("#discountContent3").attr("style", "display:inline");
         }
     })
     //促销时效修改
@@ -466,15 +520,15 @@
         var promotionStatus = $("input[name='status']:checked").val();
         var promotiondelFlag1 = $("input[name='delFlag1']:checked").val();
         if ("1" == promotionStatus) {
-            $("#begin").attr("style","display:none");
-            $("#end").attr("style","display:none");
+            $("#begin").attr("style", "display:none");
+            $("#end").attr("style", "display:none");
             if (null == promotiondelFlag1) {
                 $("#promotionStatus").text("进行中");
                 $("#promotionStatus").attr("style", "display: inline;color:green");
             }
-        }else if ("2" == promotionStatus) {
-            $("#begin").attr("style","");
-            $("#end").attr("style","");
+        } else if ("2" == promotionStatus) {
+            $("#begin").attr("style", "");
+            $("#end").attr("style", "");
             if (null == promotiondelFlag1) {
                 updateStatus();
             }
@@ -495,7 +549,7 @@
         if (promotiondelFlag1 != null) {
             $("#promotionStatus").text("已关闭");
             $("#promotionStatus").attr("style", "display: inline;color:red");
-        }else {
+        } else {
             var promotionStatus = $("input[name='status']:checked").val();
             if ("1" == promotionStatus) {
                 $("#promotionStatus").text("进行中");

+ 62 - 20
src/main/webapp/WEB-INF/views/modules/product-new/singlePromotionForm.jsp

@@ -164,6 +164,13 @@
 
         //选择添加商品
         function showSelect(type) {
+            var productId = $("#productCheckItem").val();
+            if (2 == type) {
+                if (!productId) {
+                    alertx("请先选择促销商品!");
+                    return false;
+                }
+            }
             var showSelectProductID = '';
             var url = '';
             var title = '';
@@ -182,7 +189,7 @@
                     var $itemProductID = $this.find('input[name="gift"]').val();
                     showSelectProductID += $itemProductID + ',';
                 });
-                url = "${ctx}/product/cmPromotions/findProductPage?productIds=" + showSelectProductID
+                url = "${ctx}/product/cmPromotions/findProductPage?productIds=" + showSelectProductID + "&promotionType=1&promotionMode=3&productID=" + productId;
                 title = "选择促销赠品";
             }
             showSelectProductID = showSelectProductID.slice(0, -1)
@@ -262,31 +269,62 @@
         function deleteProduct(obj, type) {
             //将该行数据取消勾选,若存在数据库中则将其删除
             $(".check-item[value=" + obj + "]").prop("checked", false);
-            if (type == 1) {
+            var delProductIds = $("#delProductIds").val();
+            var delGiftIds = $("#delGiftIds").val();
+            if (1 === type) {
+                if (delProductIds != '') {
+                    delProductIds = delProductIds + "," + obj;
+                } else {
+                    delProductIds = obj;
+                }
+                $("#delProductIds").val(delProductIds);
                 var product = $('#product' + obj);
                 $(product).remove();
-            }
-            if (type == 2) {
+                if ($('#contentTbody tr').size() < 1) {
+                    $("#productIds").val('');
+                    $("#giftIds").val('');
+                    var showSelectProductID = '';
+                    $('#contentTbody1 tr').each(function (index, item) {
+                        var $this = $(this);
+                        var $itemProductID = $this.find('input[name="gift"]').val();
+                        showSelectProductID += $itemProductID + ',';
+                    });
+                    $("#delGiftIds").val(showSelectProductID);
+                    var tbody = document.getElementById("contentTbody1");
+                    while (tbody.firstChild) {
+                        tbody.removeChild(tbody.firstChild);
+                    }
+                }
+            } else if (2 === type) {
+                if (delGiftIds != '') {
+                    delGiftIds = delGiftIds + "," + obj;
+                } else {
+                    delGiftIds = obj;
+                }
+                $("#delGiftIds").val(delGiftIds);
                 var gift = $('#gift' + obj);
                 $(gift).remove();
+                if ($('#contentTbody1 tr').size < 1) {
+                    $("#giftIds").val('');
+                }
             }
 
-            $.ajax({
-                url: "${ctx}/product/cmPromotions/delPromotion",
-                data: {"id": "${cmPromotion.id || ''}", "skuId": obj},
-                type: "POST",
-                async: false,
-                success: function (data) {
-                    flag = data.success;
-                }
-            });
+
+            <%--$.ajax({--%>
+            <%--    url: "${ctx}/product/cmPromotions/delPromotion",--%>
+            <%--    data: {"id": "${cmPromotion.id || ''}", "skuId": obj},--%>
+            <%--    type: "POST",--%>
+            <%--    async: false,--%>
+            <%--    success: function (data) {--%>
+            <%--        flag = data.success;--%>
+            <%--    }--%>
+            <%--});--%>
 
             <%--window.setTimeout(function () {--%>
             <%--    var productItems = getCheckedItems(1);--%>
             <%--    var giftItems = getCheckedItems(2);--%>
             <%--    var mode = $("input[name='mode']:checked").val();--%>
             <%--    var reducedPrice = $("#reducedPrice").val();--%>
-            <%--    var touchPrice1 = $("#touchPrice1").val();--%>
             <%--    var touchPrice2 = $("#touchPrice2").val();--%>
             <%--    var touchPrice3 = $("#touchPrice3").val();--%>
             <%--    var status = $("input[name='status']:checked").val();--%>
@@ -294,11 +332,11 @@
             <%--    var endTime = $("#endTime").val();--%>
             <%--    var delFlag1 = $("input[name='delFlag1']:checked").val();--%>
             <%--    window.location.href = "${ctx}/product/cmPromotions/form?type=1&productIds=" + productItems + "&giftIds=" + giftItems +--%>
-            <%--        "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+ "&mode=" + mode +--%>
-            <%--        "&reducedPrice=" + reducedPrice + "&touchPrice1=" + touchPrice1 + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
+            <%--        "&delProductIds=" + delProductIds + "&delGiftIds=" + delGiftIds + "&mode=" + mode +--%>
+            <%--        "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
             <%--        "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}" +--%>
             <%--        "&searchDbFlag=0";--%>
-            <%--},100)--%>
+            <%--}, 100)--%>
         }
 
         function getCheckedItems(type) {
@@ -356,7 +394,7 @@
                 <c:forEach items="${cmPromotion.promotionProducts}" var="product">
                     <tr id="product${product.productID}">
                         <th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
-                                                name="info" ${product.storeStatus?'':'checked'}
+                                                name="info" checked
                                                 value='${product.productID}'/></th>
                         <td><img src="${product.mainImage}" width="50px" height="50px"></td>
                         <td>${product.skuId}${product.name}</td>
@@ -394,8 +432,12 @@
                     <tr>
                         <td hidden><input name="skus[${s.index}].skuId" value="${sku.skuId}"></td>
                         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;规格:${sku.unit}</td>
-                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;优惠价:<input class="required" name="skus[${s.index}].touchPrice" value="${sku.touchPrice}" type="number"/></td>
-                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;成本类型:${sku.costCheckFlag eq 1?'固定成本':'比例成本'}</td>
+                        <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;优惠价:<input class="required"
+                                                                                       name="skus[${s.index}].touchPrice"
+                                                                                       value="${sku.touchPrice}"
+                                                                                       type="number"/></td>
+                        <td>
+                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;成本类型:${sku.costCheckFlag eq 1?'固定成本':'比例成本'}</td>
                         <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                             <c:if test="${sku.costCheckFlag eq 1}">
                                 成本价格:¥${sku.costPrice}