浏览代码

支付采美后台part1

Aslee 3 年之前
父节点
当前提交
50a3e41677
共有 27 个文件被更改,包括 662 次插入572 次删除
  1. 3 2
      src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java
  2. 2 0
      src/main/java/com/caimei/modules/order/dao/CmDiscernReceiptDao.java
  3. 0 2
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  4. 9 0
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  5. 1 1
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  6. 18 0
      src/main/java/com/caimei/modules/order/entity/ReceiptOrderInfoVo.java
  7. 45 0
      src/main/java/com/caimei/modules/order/entity/ShopOrderReturned.java
  8. 10 0
      src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java
  9. 0 10
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  10. 6 0
      src/main/java/com/caimei/modules/order/service/CmReturnedPurchaseService.java
  11. 279 279
      src/main/java/com/caimei/modules/order/service/SplitAccountService.java
  12. 0 4
      src/main/java/com/caimei/modules/order/web/CmPayShopController.java
  13. 70 70
      src/main/java/com/caimei/modules/order/web/SplitAccountController.java
  14. 13 0
      src/main/resources/mappings/modules/order/CmDiscernReceiptMapper.xml
  15. 1 0
      src/main/resources/mappings/modules/order/OrderMapper.xml
  16. 1 7
      src/main/resources/mappings/modules/order/ShopOrderMapper.xml
  17. 30 38
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp
  18. 20 37
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp
  19. 14 32
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReturnRecord.jsp
  20. 19 36
      src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp
  21. 16 1
      src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptForm.jsp
  22. 7 6
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp
  23. 10 10
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp
  24. 7 6
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp
  25. 13 12
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp
  26. 7 6
      src/main/webapp/WEB-INF/views/modules/order/cmRefundShopDetail.jsp
  27. 61 13
      src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp

+ 3 - 2
src/main/java/com/caimei/modules/bulkpurchase/web/CmRefundsProductController.java

@@ -273,7 +273,7 @@ public class CmRefundsProductController extends BaseController {
             //是否可以线上退回
             boolean returnOnline = false;
             if (cmDiscernReceipt != null && "1".equals(cmDiscernReceipt.getPayWay())) {
-                Date splitTime = cmDiscernReceiptDao.findSplitTime(newOrder.getOrderID());
+                /*Date splitTime = cmDiscernReceiptDao.findSplitTime(newOrder.getOrderID());
                 if (splitTime != null) {
                     Calendar calendar = Calendar.getInstance();
                     calendar.setTime(splitTime);
@@ -284,7 +284,8 @@ public class CmRefundsProductController extends BaseController {
                     }
                 } else {
                     returnOnline = true;
-                }
+                }*/
+                returnOnline = true;
             }
             Integer lastReceiptDetailId = cmDiscernReceiptDao.findOrderLastReceiptDetailId(newOrder.getOrderID().toString());
             model.addAttribute("lastReceiptDetailId", lastReceiptDetailId);

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

@@ -97,4 +97,6 @@ public interface CmDiscernReceiptDao extends CrudDao<CmDiscernReceipt> {
     List<CmMainReceiptExport> secondReceipt(CmDiscernReceipt cmDiscernReceipt);
 
     ReceipCouponInfoVo getCouponInfo(String receiptID);
+
+    List<NewShopOrder> getShopOrderInfos(@Param("shopOrderId") String shopOrderId,@Param("orderId") String orderId);
 }

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

@@ -17,8 +17,6 @@ import java.util.List;
 @MyBatisDao
 public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
 
-    Double promotionFull(CmPayShop cmPayShop);
-
     String getProductOrder(Integer orderid);
 
     List<String> getOpenidListByPermission(@Param("userid")Integer userid,@Param("unionid") String unionid);

+ 9 - 0
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -70,6 +70,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private String splitFlag; // 订单能否拆分 1 为可拆分, 0为不可拆分
     private String closeReason; //订单取消原因
     private String invoiceFlag;      //是否开发票 0 不开 1 开发票
+    private Double discountAmount;  // 优惠金额:经理折扣+促销优惠+优惠券抵扣金额
     // ---------------- v5.0.0 新加
     private String receiptStatus; //(收款买家)收款状态:1待收款、2部分收款、3已收款
     private String payStatus; //(付款供应商)付款状态:1待付款、2部分付款、3已付款
@@ -1129,5 +1130,13 @@ public class NewOrder extends DataEntity<NewOrder> {
     public void setReductionTouchPrice(Double reductionTouchPrice) {
         this.reductionTouchPrice = reductionTouchPrice;
     }
+
+    public Double getDiscountAmount() {
+        return discountAmount;
+    }
+
+    public void setDiscountAmount(Double discountAmount) {
+        this.discountAmount = discountAmount;
+    }
 }
 

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

@@ -44,7 +44,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Integer status;//     int(11) comment '订单状态:见表c_orderstatus或枚举OrderStatus'   v5.0版本已废弃只有主订单状态,
     private Integer refundStatus;//    int(11),
     private BigInteger deliveryTimeMills;//   bigint(20) comment '发货时间(时间戳)',
-    private Double needPayAmount;//   decimal(20,2) comment '实付金额',
+    private Double needPayAmount;//   decimal(20,2) comment '实付金额(未减去优惠金额)',
     private Double realPay;     // 实际支付金额
     private Double eachDiscount;        // 分摊优惠金额
     private Double receiptAmount;       // 已付金额

+ 18 - 0
src/main/java/com/caimei/modules/order/entity/ReceiptOrderInfoVo.java

@@ -18,6 +18,8 @@ public class ReceiptOrderInfoVo {
     private String orderTime;//下单时间
     private String relationType;        // 关系类型:1返佣订单(返佣款或供应商退款)、2非返佣订单(订单款或者非订单款)、3超级会员款
     private Integer userID;     //订单用户id
+    private Integer onlinePayFlag;      // 是否能走线上支付:0可以,1不可以
+    private List<NewShopOrder> shopOrderInfos;  // 子订单信息
 
     //----------------返佣款项   是根据子订单再去关联的主订单
     private String shopOrderNo;
@@ -199,4 +201,20 @@ public class ReceiptOrderInfoVo {
     public void setRefundsAmount(Double refundsAmount) {
         this.refundsAmount = refundsAmount;
     }
+
+    public Integer getOnlinePayFlag() {
+        return onlinePayFlag;
+    }
+
+    public void setOnlinePayFlag(Integer onlinePayFlag) {
+        this.onlinePayFlag = onlinePayFlag;
+    }
+
+    public List<NewShopOrder> getShopOrderInfos() {
+        return shopOrderInfos;
+    }
+
+    public void setShopOrderInfos(List<NewShopOrder> shopOrderInfos) {
+        this.shopOrderInfos = shopOrderInfos;
+    }
 }

+ 45 - 0
src/main/java/com/caimei/modules/order/entity/ShopOrderReturned.java

@@ -15,6 +15,11 @@ public class ShopOrderReturned {
     private Double productAmount;//总金额 = 订单商品totalAmount
     private String commercialCode;      //分账方,子商户商编
     private List<CmReturnedPurchaseProduct> cmReturnedPurchaseProductList;
+    private Integer shopReceiptStatus;      // 子订单收款状态:1待收款,2部分收款,3已收款
+    private Double eachDiscount;        // 分摊优惠金额
+    private Double receiptAmount;       // 已付金额
+    private Double restAmount;      // 待付金额
+    private Double realPay;     // 实际支付金额
 
     public String getShopName() {
         return shopName;
@@ -111,4 +116,44 @@ public class ShopOrderReturned {
     public void setCommercialCode(String commercialCode) {
         this.commercialCode = commercialCode;
     }
+
+    public Integer getShopReceiptStatus() {
+        return shopReceiptStatus;
+    }
+
+    public void setShopReceiptStatus(Integer shopReceiptStatus) {
+        this.shopReceiptStatus = shopReceiptStatus;
+    }
+
+    public Double getEachDiscount() {
+        return eachDiscount;
+    }
+
+    public void setEachDiscount(Double eachDiscount) {
+        this.eachDiscount = eachDiscount;
+    }
+
+    public Double getReceiptAmount() {
+        return receiptAmount;
+    }
+
+    public void setReceiptAmount(Double receiptAmount) {
+        this.receiptAmount = receiptAmount;
+    }
+
+    public Double getRestAmount() {
+        return restAmount;
+    }
+
+    public void setRestAmount(Double restAmount) {
+        this.restAmount = restAmount;
+    }
+
+    public Double getRealPay() {
+        return realPay;
+    }
+
+    public void setRealPay(Double realPay) {
+        this.realPay = realPay;
+    }
 }

+ 10 - 0
src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java

@@ -156,12 +156,22 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
                         BigDecimal refundsAmount = MathUtil.add(roi.getRefundsAmount(), shopRefundAmount);
                         roi.setRefundsAmount(refundsAmount.doubleValue());*/
                     }
+                    if (0 == roi.getOnlinePayFlag()) {
+                        // 可以线上支付,查询子订单信息
+                        List<NewShopOrder> shopOrderInfos = cmDiscernReceiptDao.getShopOrderInfos(relation.getOrderID(), null);
+                        roi.setShopOrderInfos(shopOrderInfos);
+                    }
                 }
             }
             if ("2".equals(relation.getRelationType())) { // relation.orderID 指的是主订单id
                 roi = cmDiscernReceiptDao.getOrderInfoByOrderID(relation.getOrderID());
                 if (null != roi) {
                     roi.setRelationType("2");
+                    if (0 == roi.getOnlinePayFlag()) {
+                        // 可以线上支付,查询子订单信息
+                        List<NewShopOrder> shopOrderInfos = cmDiscernReceiptDao.getShopOrderInfos(null, relation.getOrderID());
+                        roi.setShopOrderInfos(shopOrderInfos);
+                    }
                 }
             }
             if (null != roi) {

+ 0 - 10
src/main/java/com/caimei/modules/order/service/CmPayShopService.java

@@ -65,12 +65,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
     private CmRefundShopDao cmRefundShopDao;
 
 
-//获取主订单满减数据
-    public Double promotionFull(CmPayShop cmPayShop){
-
-        return newShopOrderDao.promotionFull(cmPayShop);
-    }
-
     public List<CmPayShop> exports(Page<CmPayShop> cmPayShopPage, CmPayShop cmPayShop) {
         Page<CmPayShop> result = super.findPage(cmPayShopPage, cmPayShop);
         List<CmPayShop> list = result.getList();
@@ -271,8 +265,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 //主订单总佣金
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
                 so.setIncome(income);
-                //主订单满减活动
-                so.setPromotionFullReduction(newOrder.getPromotionFullReduction());
             }
             cmPayShop.setTotalAmount(totalAmount);
             cmPayShop.setBalancePayFee(0D);
@@ -359,8 +351,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 //主订单总佣金
                 Double income = newShopOrderDao.findIncome(so.getOrderID());
                 so.setIncome(income);
-                //主订单满减活动
-                so.setPromotionFullReduction(newOrder.getPromotionFullReduction());
             }
             cmPayShop.setShopOrders(csos);
         }

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

@@ -389,6 +389,12 @@ public class CmReturnedPurchaseService extends CrudService<CmReturnedPurchaseDao
                             shopOrderReturned.setPayStatus(shopOrder.getPayStatus());
                             shopOrderReturned.setSendOutStatus(shopOrder.getSendOutStatus());
                             shopOrderReturned.setShopOrderNo(shopOrder.getShopOrderNo());
+                            shopOrderReturned.setShopReceiptStatus(shopOrder.getShopReceiptStatus());
+                            shopOrderReturned.setNeedPayAmount(shopOrder.getNeedPayAmount());
+                            shopOrderReturned.setEachDiscount(shopOrder.getEachDiscount());
+                            shopOrderReturned.setRealPay(shopOrder.getRealPay());
+                            shopOrderReturned.setReceiptAmount(shopOrder.getReceiptAmount());
+                            shopOrderReturned.setRestAmount(shopOrder.getRestAmount());
                         }
                     }
                     shopOrderReturnedList.add(shopOrderReturned);

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

@@ -20,284 +20,284 @@ import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
-@Service
-@Transactional(readOnly = true)
-public class SplitAccountService {
-
-    /**
-     * 日志对象
-     */
-    protected Logger logger = LoggerFactory.getLogger(getClass());
-
-    @Resource
-    private NewOrderDao newOrderDao;
-    @Resource
-    private RedisService redisService;
-
-    @Transactional(readOnly = false)
-    public void SplitAccount() {
-        logger.info("【手动分账开始】>>>>>>>>>>手动分账");
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(new Date());
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String currentTime = format.format(calendar.getTime());
-        // 查询未分账已支付收款
-        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
-        if (null != orderRelations && orderRelations.size() > 0) {
-            for (OrderReceiptRelationPo orderRelation : orderRelations) {
-                logger.info("【分账】>>>>>>>>>>子订单id:" + orderRelation.getShopOrderId() + "进入分账");
-                // 收款对应的订单信息
-                OrderVo order = orderCommonMapper.getOrderByOrderId(orderRelation.getOrderId());
-                PayParamBo payParam = new PayParamBo();
-                //支付金额
-                payParam.setPayAmount(MathUtil.mul(orderRelation.getAssociateAmount(), 100).intValue());
-                if (12 == orderRelation.getPayType()) {
-                    // 网银支付
-                    payParam.setPayWay("UNIONPAY");
-                }
-                if (17 == orderRelation.getPayType()) {
-                    //b2c网银
-                    payParam.setPayWay("B2C");
-                }
-                //微信0.65%手续费
-                if (8 == orderRelation.getPayType() || 13 == orderRelation.getPayType() || 15 == orderRelation.getPayType()) {
-                    payParam.setPayWay("WX");
-                }
-                List<SplitAccountPo> splitBillDetail = setSplitAccountDetail(order, payParam);
-                List<Map<String, String>> maps = new ArrayList<>();
-                List<ShopOrderVo> shopOrderList = orderCommonMapper.getShopOrderListByOrderId(order.getOrderId());
-                for (ShopOrderVo shopOrder : shopOrderList) {
-                    double shopTotalAmount = 0.00;
-                    String subUserNo = "";
-                    for (SplitAccountPo account : splitBillDetail) {
-                        //供应商有支付平台账户type=4
-                        if (null != account.getType() && 4 == account.getType() && shopOrder.getShopId().equals(account.getShopId())) {
-                            shopTotalAmount = MathUtil.add(shopTotalAmount, account.getSplitAccount()).doubleValue();
-                            subUserNo = account.getSubUserNo();
-                        }
-                    }
-//                    addMaps(maps, shopTotalAmount, subUserNo);
-                }
-                if (null == splitBillDetail || splitBillDetail.size() == 0) {
-                    log.info("无满足条件分账单号");
-                    return;
-                }
-                //公账-专票总金额,私账-无票总金额,公账-普票总金额
-                //Type2,3奥泰,1,5信息
-                //todo 正式改
-                String sp1 = "";
-                BigDecimal totalAmount1 = BigDecimal.ZERO;
-                String sp2 = "";
-                BigDecimal totalAmount2 = BigDecimal.ZERO;
-                for (SplitAccountPo account : splitBillDetail) {
-                    if (1 == account.getType() || 5 == account.getType()) {
-                        totalAmount1 = MathUtil.add(totalAmount1, account.getSplitAccount());
-                        sp1 = account.getSubUserNo();
-                    }
-                    if (2 == account.getType() || 3 == account.getType()) {
-                        totalAmount2 = MathUtil.add(totalAmount2, account.getSplitAccount());
-                        sp2 = account.getSubUserNo();
-                    }
-                }
-                ArrayList<AccountPayOrder.AccountPayOrderExt.SplitBillRule> splitBillRules = new ArrayList<>();
-                if (MathUtil.compare(totalAmount1, 0.01) > 0) {
-                    AccountPayOrder.AccountPayOrderExt.SplitBillRule splitBillRule = new AccountPayOrder.AccountPayOrderExt.SplitBillRule();
-                    splitBillRule.setSplitBillAmount(totalAmount1);
-                    splitBillRule.setSplitBillMerchantNo(sp1);
-                    splitBillRules.add(splitBillRule);
-                }
-                if (MathUtil.compare(totalAmount2, 0.01) > 0) {
-                    AccountPayOrder.AccountPayOrderExt.SplitBillRule splitBillRule = new AccountPayOrder.AccountPayOrderExt.SplitBillRule();
-                    splitBillRule.setSplitBillAmount(totalAmount2);
-                    splitBillRule.setSplitBillMerchantNo(sp2);
-                    splitBillRules.add(splitBillRule);
-                }
-                //第三方分账接口
-                try {
-                    AccountPayOrder accountPayOrder = new AccountPayOrder();
-                    accountPayOrder.setP1_bizType("AccountPaySub");
-                    accountPayOrder.setP2_signType("MD5");
-                    String format1 = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
-                    accountPayOrder.setP3_timestamp(format1);
-                    String substring = format1.substring(20);
-                    // fz+当前微秒时间+原唯一订单号
-                    accountPayOrder.setP4_orderId("FZ" + substring + orderRelation.getOrderRequestNo());
-                    //todo 付款账户商编暂用网络
-                    accountPayOrder.setP5_customerNumber(Constant.CUSTOMERNUM2);
-                    AccountPayOrder.AccountPayOrderExt accountPayOrderExt = new AccountPayOrder.AccountPayOrderExt();
-                    //收款账户商编  填写splitBillRules时候不填写MerchantNo,Amount并且即使填写这两个参数不生效!!
-//                    accountPayOrderExt.setInMerchantNo(splitMoneyVo.getName());
-                    accountPayOrderExt.setOrderType(AccountPayOrderType.TRANSFER);
-//                    accountPayOrderExt.setAmount(splitMoneyVo.getSplitMoney());
-                    accountPayOrderExt.setServerCallbackUrl(callUrl);
-                    accountPayOrderExt.setGoodsName("分账");
-
-                    if (null != splitBillRules && splitBillRules.size() > 0) {
-                        accountPayOrderExt.setSplitBillRules(splitBillRules);
-                    }
-                    String ext = JSON.toJSONString(accountPayOrderExt);
-                    log.info("分账规则串json串:" + ext);
-                    accountPayOrder.setP6_ext(ext);
-                    // 生成签名
-                    StringBuilder builder = new StringBuilder();
-                    builder.append(SPLIT)
-                            .append(accountPayOrder.getP1_bizType()).append(SPLIT)
-                            .append(accountPayOrder.getP2_signType()).append(SPLIT)
-                            .append(accountPayOrder.getP3_timestamp()).append(SPLIT)
-                            .append(accountPayOrder.getP4_orderId()).append(SPLIT)
-                            .append(accountPayOrder.getP5_customerNumber()).append(SPLIT)
-                            .append(accountPayOrder.getP6_ext()).append(SPLIT)
-                            .append(XUNI);
-                    String sign = Disguiser.disguiseMD5(builder.toString().trim());
-                    Map<String, String> bean = convertBean(accountPayOrder);
-                    log.info("--------------------> 发送分账参数:  " + bean);
-                    Map<String, String> map = postForm(bean, Constant.FZ, sign, Map.class);
-                    log.info("----------------分账返回数据: " + map.toString());
-                    if (map != null) {
-                        String code = map.get("rt5_retCode");
-                        if (!"0000".equals(code)) {
-                            String msg = map.get("rt6_retMsg");
-                            log.info("【延时分账】>>>>>>>>>>第三方延迟分账失败>>>>>>>msg:" + msg);
-                        } else {
-                            for (SplitAccountPo splitAccount : splitBillDetail) {
-                                splitAccount.setMbOrderId(orderRelation.getMbOrderId());
-                                splitAccount.setOrderRequestNo(substring + orderRelation.getOrderRequestNo());
-                                splitAccount.setPayStatus(1);
-                                // 保存分账详情
-                                payOrderMapper.insertSplitAccount(splitAccount);
-                            }
-                            log.info("【延时分账】>>>>>>>>>>此订单分账结束");
-                        }
-                    }
-                } catch (Exception e) {
-                    log.error("【延时分账】>>>>>>>>>>错误信息", e);
-                }
-
-            }
-        }
-    }
-
-    private List<SplitAccountPo> setSplitAccountDetail(OrderVo order, PayParamBo payParam) {
-        List<SplitAccountPo> list = new ArrayList<>();
-        // 本次支付金额,单位/元
-        double payAmount = MathUtil.div(payParam.getPayAmount(), 100).doubleValue();
-        // 待分账总金额
-        double splitAmount = payAmount;
-        // 总手续费
-        double procedureFee;
-        if ("UNIONPAY".equals(payParam.getPayWay())) {
-            procedureFee = 10.00;
-        } else if ("B2C".equals(payParam.getPayWay())) {
-            //b2c 0.2%
-            procedureFee = MathUtil.mul(payAmount, 0.002, 2).doubleValue();
-            //b2c最低手续费0.1
-            if (procedureFee < 0.1) {
-                procedureFee = 0.1;
-            }
-        } else if ("WX".equals(payParam.getPayWay())) {
-            //微信0.65%
-            procedureFee = MathUtil.mul(payAmount, 0.0065, 2).doubleValue();
-        } else {
-            //手续费 其他0.25%
-            procedureFee = MathUtil.mul(payAmount, 0.0025, 2).doubleValue();
-        }
-        if (MathUtil.compare(procedureFee, 0.01) <= 0) {
-            procedureFee = 0.01;
-        }
-        //减去收款手续费
-        splitAmount = MathUtil.sub(splitAmount, procedureFee).doubleValue();
-        //分账手续费0.1%
-        Double amount = Math.max(MathUtil.mul(splitAmount, 0.001, 2).doubleValue(), 0.01);
-        splitAmount = MathUtil.sub(splitAmount, amount).doubleValue();
-        if (splitAmount <= 0) {
-            return null;
-        }
-        // 商品数据
-        List<OrderProductVo> orderProductList = orderCommonMapper.getOrderProductByOrderId(order.getOrderId());
-        for (OrderProductVo orderProduct : orderProductList) {
-            //成本价*数量
-            double costPrice = MathUtil.mul(orderProduct.getCostPrice(), orderProduct.getNum()).doubleValue();
-            // 不含税能开发票
-            if (Integer.valueOf(0).equals(orderProduct.getIncludedTax()) && !Integer.valueOf(3).equals(orderProduct.getInvoiceType())) {
-                //应付总税费
-                Double payableTax = MathUtil.mul(orderProduct.getSingleShouldPayTotalTax(), orderProduct.getNum()).doubleValue();
-                //成本+税费
-                costPrice = MathUtil.add(costPrice, payableTax).doubleValue();
-            }
-            // 判断是否支付过
-            Double paidAmount = payOrderMapper.getOrderProductPaidAmount(orderProduct.getOrderProductId());
-            // 支付过金额大于0
-            if (paidAmount != null && MathUtil.compare(paidAmount, 0) > 0) {
-                //成本-支付过的金额
-                costPrice = MathUtil.sub(costPrice, paidAmount).doubleValue();
-            }
-            // 没支付过或者支付过的金额-成本<0(成本还没分够)
-            if (paidAmount == null || MathUtil.compare(paidAmount, costPrice) < 0) {
-                // 待分账金额>=本次待分账金额(还要分账的成本)
-                if (MathUtil.compare(splitAmount, costPrice) > 0) {
-                    // 待分账金额=待分账金额-成本
-                    splitAmount = MathUtil.sub(splitAmount, costPrice).doubleValue();
-                } else {
-                    // 待分账金额小于成本
-                    costPrice = splitAmount;
-                    splitAmount = 0.00;
-                }
-            }
-
-        }
-
-        // 还有钱就付供应商运费
-        // 付供应商运费,是以供应商为单位的
-        if (MathUtil.compare(splitAmount, 0) > 0) {
-            List<ShopOrderVo> shopOrderList = orderCommonMapper.getShopOrderListByOrderId(order.getOrderId());
-            for (ShopOrderVo shopOrder : shopOrderList) {
-                // 运费
-                Double shopPostFee = shopOrder.getShopPostFee();
-                if (MathUtil.compare(shopPostFee, 0) > 0) {
-                    // 查询已支付运费
-                    Double shipping = payOrderMapper.getPaidShipping(order.getOrderId(), shopOrder.getShopId());
-                    shopPostFee = MathUtil.sub(shopPostFee, shipping).doubleValue();
-                    if (MathUtil.compare(splitAmount, shopPostFee) > -1) {
-                        //减去运费
-                        splitAmount = MathUtil.sub(splitAmount, shopPostFee).doubleValue();
-                    } else {
-                        //钱不够运费就分剩余
-                        shopPostFee = splitAmount;
-                        splitAmount = 0.00;
-                    }
-                    //todo 暂不考虑供应商有商户号,有分给供应商,没有进私账
-                    SplitAccountPo splitAccount = new SplitAccountPo();
-                    splitAccount.setOrderId(order.getOrderId());
-                    splitAccount.setShopId(shopOrder.getShopId());
-                    splitAccount.setSplitAccount(shopPostFee);
-                    splitAccount.setProductType(2);
-                    splitAccount.setType(2);
-                    //todo 私账-无票,子商户商编 测试暂入奥泰
-                    splitAccount.setSubUserNo(CUSTOMERNUM3);
-                    if (splitAccount.getSplitAccount() > 0) {
-                        log.info("============设置付供应商运费分账详情对象: " + splitAccount.toString());
-                        list.add(splitAccount);
-                    }
-                }
-            }
-        }
-        // 如果还有钱则为佣金,分到采美网络
-        if (MathUtil.compare(splitAmount, 0) > 0) {
-            SplitAccountPo splitAccount = new SplitAccountPo();
-            splitAccount.setOrderId(order.getOrderId());
-            splitAccount.setSplitAccount(splitAmount);
-            splitAccount.setProductType(3);
-            splitAccount.setType(5);
-            //todo 佣金应入采美网络,测试暂入信息
-            splitAccount.setSubUserNo(Constant.CUSTOMERNUM);
-            if (splitAccount.getSplitAccount() > 0) {
-                log.info("============设置佣金分账详情对象: " + splitAccount.toString());
-                list.add(splitAccount);
-            }
-        }
-        return list;
-    }
-
+//@Service
+//@Transactional(readOnly = true)
+//public class SplitAccountService {
+//
+//    /**
+//     * 日志对象
+//     */
+//    protected Logger logger = LoggerFactory.getLogger(getClass());
+//
+//    @Resource
+//    private NewOrderDao newOrderDao;
+//    @Resource
+//    private RedisService redisService;
+//
+//    @Transactional(readOnly = false)
+//    public void SplitAccount() {
+//        logger.info("【手动分账开始】>>>>>>>>>>手动分账");
+//        Calendar calendar = Calendar.getInstance();
+//        calendar.setTime(new Date());
+//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        String currentTime = format.format(calendar.getTime());
+//        // 查询未分账已支付收款
+//        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
+//        if (null != orderRelations && orderRelations.size() > 0) {
+//            for (OrderReceiptRelationPo orderRelation : orderRelations) {
+//                logger.info("【分账】>>>>>>>>>>子订单id:" + orderRelation.getShopOrderId() + "进入分账");
+//                // 收款对应的订单信息
+//                OrderVo order = orderCommonMapper.getOrderByOrderId(orderRelation.getOrderId());
+//                PayParamBo payParam = new PayParamBo();
+//                //支付金额
+//                payParam.setPayAmount(MathUtil.mul(orderRelation.getAssociateAmount(), 100).intValue());
+//                if (12 == orderRelation.getPayType()) {
+//                    // 网银支付
+//                    payParam.setPayWay("UNIONPAY");
+//                }
+//                if (17 == orderRelation.getPayType()) {
+//                    //b2c网银
+//                    payParam.setPayWay("B2C");
+//                }
+//                //微信0.65%手续费
+//                if (8 == orderRelation.getPayType() || 13 == orderRelation.getPayType() || 15 == orderRelation.getPayType()) {
+//                    payParam.setPayWay("WX");
+//                }
+//                List<SplitAccountPo> splitBillDetail = setSplitAccountDetail(order, payParam);
+//                List<Map<String, String>> maps = new ArrayList<>();
+//                List<ShopOrderVo> shopOrderList = orderCommonMapper.getShopOrderListByOrderId(order.getOrderId());
+//                for (ShopOrderVo shopOrder : shopOrderList) {
+//                    double shopTotalAmount = 0.00;
+//                    String subUserNo = "";
+//                    for (SplitAccountPo account : splitBillDetail) {
+//                        //供应商有支付平台账户type=4
+//                        if (null != account.getType() && 4 == account.getType() && shopOrder.getShopId().equals(account.getShopId())) {
+//                            shopTotalAmount = MathUtil.add(shopTotalAmount, account.getSplitAccount()).doubleValue();
+//                            subUserNo = account.getSubUserNo();
+//                        }
+//                    }
+////                    addMaps(maps, shopTotalAmount, subUserNo);
+//                }
+//                if (null == splitBillDetail || splitBillDetail.size() == 0) {
+//                    log.info("无满足条件分账单号");
+//                    return;
+//                }
+//                //公账-专票总金额,私账-无票总金额,公账-普票总金额
+//                //Type2,3奥泰,1,5信息
+//                //todo 正式改
+//                String sp1 = "";
+//                BigDecimal totalAmount1 = BigDecimal.ZERO;
+//                String sp2 = "";
+//                BigDecimal totalAmount2 = BigDecimal.ZERO;
+//                for (SplitAccountPo account : splitBillDetail) {
+//                    if (1 == account.getType() || 5 == account.getType()) {
+//                        totalAmount1 = MathUtil.add(totalAmount1, account.getSplitAccount());
+//                        sp1 = account.getSubUserNo();
+//                    }
+//                    if (2 == account.getType() || 3 == account.getType()) {
+//                        totalAmount2 = MathUtil.add(totalAmount2, account.getSplitAccount());
+//                        sp2 = account.getSubUserNo();
+//                    }
+//                }
+//                ArrayList<AccountPayOrder.AccountPayOrderExt.SplitBillRule> splitBillRules = new ArrayList<>();
+//                if (MathUtil.compare(totalAmount1, 0.01) > 0) {
+//                    AccountPayOrder.AccountPayOrderExt.SplitBillRule splitBillRule = new AccountPayOrder.AccountPayOrderExt.SplitBillRule();
+//                    splitBillRule.setSplitBillAmount(totalAmount1);
+//                    splitBillRule.setSplitBillMerchantNo(sp1);
+//                    splitBillRules.add(splitBillRule);
+//                }
+//                if (MathUtil.compare(totalAmount2, 0.01) > 0) {
+//                    AccountPayOrder.AccountPayOrderExt.SplitBillRule splitBillRule = new AccountPayOrder.AccountPayOrderExt.SplitBillRule();
+//                    splitBillRule.setSplitBillAmount(totalAmount2);
+//                    splitBillRule.setSplitBillMerchantNo(sp2);
+//                    splitBillRules.add(splitBillRule);
+//                }
+//                //第三方分账接口
+//                try {
+//                    AccountPayOrder accountPayOrder = new AccountPayOrder();
+//                    accountPayOrder.setP1_bizType("AccountPaySub");
+//                    accountPayOrder.setP2_signType("MD5");
+//                    String format1 = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
+//                    accountPayOrder.setP3_timestamp(format1);
+//                    String substring = format1.substring(20);
+//                    // fz+当前微秒时间+原唯一订单号
+//                    accountPayOrder.setP4_orderId("FZ" + substring + orderRelation.getOrderRequestNo());
+//                    //todo 付款账户商编暂用网络
+//                    accountPayOrder.setP5_customerNumber(Constant.CUSTOMERNUM2);
+//                    AccountPayOrder.AccountPayOrderExt accountPayOrderExt = new AccountPayOrder.AccountPayOrderExt();
+//                    //收款账户商编  填写splitBillRules时候不填写MerchantNo,Amount并且即使填写这两个参数不生效!!
+////                    accountPayOrderExt.setInMerchantNo(splitMoneyVo.getName());
+//                    accountPayOrderExt.setOrderType(AccountPayOrderType.TRANSFER);
+////                    accountPayOrderExt.setAmount(splitMoneyVo.getSplitMoney());
+//                    accountPayOrderExt.setServerCallbackUrl(callUrl);
+//                    accountPayOrderExt.setGoodsName("分账");
+//
+//                    if (null != splitBillRules && splitBillRules.size() > 0) {
+//                        accountPayOrderExt.setSplitBillRules(splitBillRules);
+//                    }
+//                    String ext = JSON.toJSONString(accountPayOrderExt);
+//                    log.info("分账规则串json串:" + ext);
+//                    accountPayOrder.setP6_ext(ext);
+//                    // 生成签名
+//                    StringBuilder builder = new StringBuilder();
+//                    builder.append(SPLIT)
+//                            .append(accountPayOrder.getP1_bizType()).append(SPLIT)
+//                            .append(accountPayOrder.getP2_signType()).append(SPLIT)
+//                            .append(accountPayOrder.getP3_timestamp()).append(SPLIT)
+//                            .append(accountPayOrder.getP4_orderId()).append(SPLIT)
+//                            .append(accountPayOrder.getP5_customerNumber()).append(SPLIT)
+//                            .append(accountPayOrder.getP6_ext()).append(SPLIT)
+//                            .append(XUNI);
+//                    String sign = Disguiser.disguiseMD5(builder.toString().trim());
+//                    Map<String, String> bean = convertBean(accountPayOrder);
+//                    log.info("--------------------> 发送分账参数:  " + bean);
+//                    Map<String, String> map = postForm(bean, Constant.FZ, sign, Map.class);
+//                    log.info("----------------分账返回数据: " + map.toString());
+//                    if (map != null) {
+//                        String code = map.get("rt5_retCode");
+//                        if (!"0000".equals(code)) {
+//                            String msg = map.get("rt6_retMsg");
+//                            log.info("【延时分账】>>>>>>>>>>第三方延迟分账失败>>>>>>>msg:" + msg);
+//                        } else {
+//                            for (SplitAccountPo splitAccount : splitBillDetail) {
+//                                splitAccount.setMbOrderId(orderRelation.getMbOrderId());
+//                                splitAccount.setOrderRequestNo(substring + orderRelation.getOrderRequestNo());
+//                                splitAccount.setPayStatus(1);
+//                                // 保存分账详情
+//                                payOrderMapper.insertSplitAccount(splitAccount);
+//                            }
+//                            log.info("【延时分账】>>>>>>>>>>此订单分账结束");
+//                        }
+//                    }
+//                } catch (Exception e) {
+//                    log.error("【延时分账】>>>>>>>>>>错误信息", e);
+//                }
+//
+//            }
+//        }
+//    }
+//
+//    private List<SplitAccountPo> setSplitAccountDetail(OrderVo order, PayParamBo payParam) {
+//        List<SplitAccountPo> list = new ArrayList<>();
+//        // 本次支付金额,单位/元
+//        double payAmount = MathUtil.div(payParam.getPayAmount(), 100).doubleValue();
+//        // 待分账总金额
+//        double splitAmount = payAmount;
+//        // 总手续费
+//        double procedureFee;
+//        if ("UNIONPAY".equals(payParam.getPayWay())) {
+//            procedureFee = 10.00;
+//        } else if ("B2C".equals(payParam.getPayWay())) {
+//            //b2c 0.2%
+//            procedureFee = MathUtil.mul(payAmount, 0.002, 2).doubleValue();
+//            //b2c最低手续费0.1
+//            if (procedureFee < 0.1) {
+//                procedureFee = 0.1;
+//            }
+//        } else if ("WX".equals(payParam.getPayWay())) {
+//            //微信0.65%
+//            procedureFee = MathUtil.mul(payAmount, 0.0065, 2).doubleValue();
+//        } else {
+//            //手续费 其他0.25%
+//            procedureFee = MathUtil.mul(payAmount, 0.0025, 2).doubleValue();
+//        }
+//        if (MathUtil.compare(procedureFee, 0.01) <= 0) {
+//            procedureFee = 0.01;
+//        }
+//        //减去收款手续费
+//        splitAmount = MathUtil.sub(splitAmount, procedureFee).doubleValue();
+//        //分账手续费0.1%
+//        Double amount = Math.max(MathUtil.mul(splitAmount, 0.001, 2).doubleValue(), 0.01);
+//        splitAmount = MathUtil.sub(splitAmount, amount).doubleValue();
+//        if (splitAmount <= 0) {
+//            return null;
+//        }
+//        // 商品数据
+//        List<OrderProductVo> orderProductList = orderCommonMapper.getOrderProductByOrderId(order.getOrderId());
+//        for (OrderProductVo orderProduct : orderProductList) {
+//            //成本价*数量
+//            double costPrice = MathUtil.mul(orderProduct.getCostPrice(), orderProduct.getNum()).doubleValue();
+//            // 不含税能开发票
+//            if (Integer.valueOf(0).equals(orderProduct.getIncludedTax()) && !Integer.valueOf(3).equals(orderProduct.getInvoiceType())) {
+//                //应付总税费
+//                Double payableTax = MathUtil.mul(orderProduct.getSingleShouldPayTotalTax(), orderProduct.getNum()).doubleValue();
+//                //成本+税费
+//                costPrice = MathUtil.add(costPrice, payableTax).doubleValue();
+//            }
+//            // 判断是否支付过
+//            Double paidAmount = payOrderMapper.getOrderProductPaidAmount(orderProduct.getOrderProductId());
+//            // 支付过金额大于0
+//            if (paidAmount != null && MathUtil.compare(paidAmount, 0) > 0) {
+//                //成本-支付过的金额
+//                costPrice = MathUtil.sub(costPrice, paidAmount).doubleValue();
+//            }
+//            // 没支付过或者支付过的金额-成本<0(成本还没分够)
+//            if (paidAmount == null || MathUtil.compare(paidAmount, costPrice) < 0) {
+//                // 待分账金额>=本次待分账金额(还要分账的成本)
+//                if (MathUtil.compare(splitAmount, costPrice) > 0) {
+//                    // 待分账金额=待分账金额-成本
+//                    splitAmount = MathUtil.sub(splitAmount, costPrice).doubleValue();
+//                } else {
+//                    // 待分账金额小于成本
+//                    costPrice = splitAmount;
+//                    splitAmount = 0.00;
+//                }
+//            }
+//
+//        }
+//
+//        // 还有钱就付供应商运费
+//        // 付供应商运费,是以供应商为单位的
+//        if (MathUtil.compare(splitAmount, 0) > 0) {
+//            List<ShopOrderVo> shopOrderList = orderCommonMapper.getShopOrderListByOrderId(order.getOrderId());
+//            for (ShopOrderVo shopOrder : shopOrderList) {
+//                // 运费
+//                Double shopPostFee = shopOrder.getShopPostFee();
+//                if (MathUtil.compare(shopPostFee, 0) > 0) {
+//                    // 查询已支付运费
+//                    Double shipping = payOrderMapper.getPaidShipping(order.getOrderId(), shopOrder.getShopId());
+//                    shopPostFee = MathUtil.sub(shopPostFee, shipping).doubleValue();
+//                    if (MathUtil.compare(splitAmount, shopPostFee) > -1) {
+//                        //减去运费
+//                        splitAmount = MathUtil.sub(splitAmount, shopPostFee).doubleValue();
+//                    } else {
+//                        //钱不够运费就分剩余
+//                        shopPostFee = splitAmount;
+//                        splitAmount = 0.00;
+//                    }
+//                    //todo 暂不考虑供应商有商户号,有分给供应商,没有进私账
+//                    SplitAccountPo splitAccount = new SplitAccountPo();
+//                    splitAccount.setOrderId(order.getOrderId());
+//                    splitAccount.setShopId(shopOrder.getShopId());
+//                    splitAccount.setSplitAccount(shopPostFee);
+//                    splitAccount.setProductType(2);
+//                    splitAccount.setType(2);
+//                    //todo 私账-无票,子商户商编 测试暂入奥泰
+//                    splitAccount.setSubUserNo(CUSTOMERNUM3);
+//                    if (splitAccount.getSplitAccount() > 0) {
+//                        log.info("============设置付供应商运费分账详情对象: " + splitAccount.toString());
+//                        list.add(splitAccount);
+//                    }
+//                }
+//            }
+//        }
+//        // 如果还有钱则为佣金,分到采美网络
+//        if (MathUtil.compare(splitAmount, 0) > 0) {
+//            SplitAccountPo splitAccount = new SplitAccountPo();
+//            splitAccount.setOrderId(order.getOrderId());
+//            splitAccount.setSplitAccount(splitAmount);
+//            splitAccount.setProductType(3);
+//            splitAccount.setType(5);
+//            //todo 佣金应入采美网络,测试暂入信息
+//            splitAccount.setSubUserNo(Constant.CUSTOMERNUM);
+//            if (splitAccount.getSplitAccount() > 0) {
+//                log.info("============设置佣金分账详情对象: " + splitAccount.toString());
+//                list.add(splitAccount);
+//            }
+//        }
+//        return list;
+//    }
+//
 
 
 //    //正式
@@ -532,4 +532,4 @@ public class SplitAccountService {
 //        return list;
 //    }
 
-}
+//}

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

@@ -586,12 +586,8 @@ public class CmPayShopController extends BaseController {
     @RequestMapping("applyEdit")
     public String applyEdit(CmPayShop cmPayShop, String[] shopOrderIDs, Model model) {
         try {
-            Double promotionFull=cmPayShopService.promotionFull(cmPayShop);
-
             cmPayShopService.applyEdit(cmPayShop, shopOrderIDs);
-
             model.addAttribute("cmPayShop", cmPayShop);
-            model.addAttribute("promotionFull", promotionFull);
         } catch (Exception e) {
             logger.info(e.getMessage());
             e.printStackTrace();

+ 70 - 70
src/main/java/com/caimei/modules/order/web/SplitAccountController.java

@@ -1,70 +1,70 @@
-package com.caimei.modules.order.web;
-
-import com.caimei.modules.order.dao.NewOrderDao;
-import com.caimei.modules.order.dao.NewShopOrderDao;
-import com.caimei.modules.order.entity.NewShopOrder;
-import com.caimei.modules.order.entity.OrderReceiptRelationPo;
-import com.caimei.modules.order.service.SplitAccountService;
-import com.caimei.redis.RedisService;
-import com.thinkgem.jeesite.common.config.Global;
-import com.thinkgem.jeesite.common.persistence.Page;
-import com.thinkgem.jeesite.common.web.BaseController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.Model;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-@Controller
-@RequestMapping(value = "${adminPath}/splitAccount/")
-public class SplitAccountController extends BaseController {
-
-    @Resource
-    private SplitAccountService splitAccountService;
-
-    @Resource
-    private NewOrderDao newOrderDao;
-
-    @Resource
-    private RedisService redisService;
-
-    @RequestMapping("split")
-    public String SplitAccount(RedirectAttributes redirectAttributes) {
-        Integer xsfzmds = (Integer) redisService.get("XSFZMDS");
-        //验锁
-        if (null != xsfzmds && xsfzmds > 0) {
-            addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
-            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
-        }
-        //设置分账间隔,2-3分钟,禁止重复分账
-        Date splitTime = newOrderDao.findSplitTime();
-        if (null != splitTime) {
-            addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
-            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
-        }
-        //查询是否有账单可分账,没有return
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(new Date());
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String currentTime = format.format(calendar.getTime());
-        // 查询未分账已支付收款
-        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
-        if (null != orderRelations && orderRelations.size() > 0) {
-            //设锁
-            redisService.set("XSFZMDS", 1, 120L);
-            splitAccountService.SplitAccount();
-            addMessage(redirectAttributes, "分账成功!");
-        } else {
-            addMessage(redirectAttributes, "暂无收款金额可进行分账!");
-        }
-        return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
-    }
-}
+//package com.caimei.modules.order.web;
+//
+//import com.caimei.modules.order.dao.NewOrderDao;
+//import com.caimei.modules.order.dao.NewShopOrderDao;
+//import com.caimei.modules.order.entity.NewShopOrder;
+//import com.caimei.modules.order.entity.OrderReceiptRelationPo;
+//import com.caimei.modules.order.service.SplitAccountService;
+//import com.caimei.redis.RedisService;
+//import com.thinkgem.jeesite.common.config.Global;
+//import com.thinkgem.jeesite.common.persistence.Page;
+//import com.thinkgem.jeesite.common.web.BaseController;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Controller;
+//import org.springframework.ui.Model;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+//
+//import javax.annotation.Resource;
+//import javax.servlet.http.HttpServletRequest;
+//import javax.servlet.http.HttpServletResponse;
+//import java.text.SimpleDateFormat;
+//import java.util.Calendar;
+//import java.util.Date;
+//import java.util.List;
+//
+//@Controller
+//@RequestMapping(value = "${adminPath}/splitAccount/")
+//public class SplitAccountController extends BaseController {
+//
+//    @Resource
+//    private SplitAccountService splitAccountService;
+//
+//    @Resource
+//    private NewOrderDao newOrderDao;
+//
+//    @Resource
+//    private RedisService redisService;
+//
+//    @RequestMapping("split")
+//    public String SplitAccount(RedirectAttributes redirectAttributes) {
+//        Integer xsfzmds = (Integer) redisService.get("XSFZMDS");
+//        //验锁
+//        if (null != xsfzmds && xsfzmds > 0) {
+//            addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
+//            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+//        }
+//        //设置分账间隔,2-3分钟,禁止重复分账
+//        Date splitTime = newOrderDao.findSplitTime();
+//        if (null != splitTime) {
+//            addMessage(redirectAttributes, "请勿短时间内重复分账,等待支付公司返回分账结果!");
+//            return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+//        }
+//        //查询是否有账单可分账,没有return
+//        Calendar calendar = Calendar.getInstance();
+//        calendar.setTime(new Date());
+//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        String currentTime = format.format(calendar.getTime());
+//        // 查询未分账已支付收款
+//        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
+//        if (null != orderRelations && orderRelations.size() > 0) {
+//            //设锁
+//            redisService.set("XSFZMDS", 1, 120L);
+//            splitAccountService.SplitAccount();
+//            addMessage(redirectAttributes, "分账成功!");
+//        } else {
+//            addMessage(redirectAttributes, "暂无收款金额可进行分账!");
+//        }
+//        return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList/?repage";
+//    }
+//}

+ 13 - 0
src/main/resources/mappings/modules/order/CmDiscernReceiptMapper.xml

@@ -561,6 +561,7 @@
 			cso.orderID AS orderID,
 			co.payTotalFee AS orderAmount,
 			co.payableAmount AS payableAmount,
+		    co.onlinePayFlag,
 			(select
 			 sum(o.needPayAmount)
 			 from  cm_receipt_order_relation cror
@@ -593,6 +594,7 @@
 			co.orderID AS orderID,
 			co.payTotalFee AS orderAmount,
 			co.payableAmount AS payableAmount,
+            co.onlinePayFlag,
 			(select
 			 sum(cror.associateAmount)
 			 from cm_receipt_order_relation cror
@@ -972,4 +974,15 @@
                  LEFT JOIN cm_coupon cc ON ccb.couponId=cc.id
         WHERE receiptID = #{receiptID}
     </select>
+    <select id="getShopOrderInfos" resultType="com.caimei.modules.order.entity.NewShopOrder">
+        select cso.shopOrderNo,shopOrderID,cso.realPay,cso.receiptAmount,cso.receiptStatus as shopReceiptStatus from cm_order co left join cm_shop_order cso on co.orderID = cso.orderID
+        <where>
+            <if test="shopOrderId != null and shopOrderId != ''">
+                and cso.shopOrderID = #{shopOrderId}
+            </if>
+            <if test="orderId != null and orderId != ''">
+                and co.orderId = #{orderId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 1 - 0
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -58,6 +58,7 @@
 		a.organizeStoreId as organizeStoreId,
 		a.couponAmount as couponAmount,
         a.svipFullReduction as svipFullReduction,
+        (a.discountFee + a.promotionFullReduction + a.couponAmount) as discountAmount,
         if(chcm.id is not null,1,0) as collageFlag,
         chc.status as collageStatus
     </sql>

+ 1 - 7
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -1135,13 +1135,7 @@
     <select id="getProductOrder" resultType="java.lang.String">
         SELECT productID
         FROM `cm_order_product`
-        WHERE orderId = #{orderid}
-    </select>
-
-    <select id="promotionFull" resultType="java.lang.Double">
-        SELECT promotionFullReduction
-        FROM `cm_order`
-        WHERE orderId = #{orderid}
+        WHERE orderID = #{orderid}
     </select>
 
 </mapper>

+ 30 - 38
src/main/webapp/WEB-INF/views/modules/bulkpurchase/applyRefoundForm.jsp

@@ -286,12 +286,8 @@
                 <c:if test="${order.receiptStatus eq 1}">无支付无退款</c:if>
                 <c:if test="${order.receiptStatus ne 1}">
                     <c:if test="${returnOnline}">
-                        <input class="check-item-review refundOnlineFee" type="radio"   name="returnedWay" value='2'/>
+                        <input class="check-item-review refundOnlineFee" type="radio" checked name="returnedWay" value='2'/>
                         线上退回
-                        <c:if test="${empty order.rechargeGoods}">
-                            <input class="check-item-review refundBalanceFee" type="radio"  name="returnedWay" value='1'/>
-                            账户余额
-                        </c:if>
                     </c:if>
                     <c:if test="${!returnOnline}">
                         <input class="check-item-review refundOfflineFee" type="checkbox"   name="returnedWay" value='3' onclick="showBankInfo()"/>
@@ -492,7 +488,7 @@
                             子订单金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount}" pattern="0.00" maxFractionDigits="2" />
                         </td>
                         <td>
-                            收款状态:${fns:getDictLabel(shopOrder.receiptStatus,'receiptStatus' ,'' )}
+                            收款状态:${fns:getDictLabel(shopOrder.shopReceiptStatus,'receiptStatus' ,'' )}
                         </td>
                         <td>
                             发货状态:${fns:getDictLabel(shopOrder.sendOutStatus,'sendOutStatus' ,'' )}
@@ -507,40 +503,25 @@
                             </c:if>
                         </td>
                     </tr>
-                    <tr>
-                        <td style="width: 300px;">
-                           商品总额:${shopOrder.totalAmount}
-                        </td>
-                        <td  style="width: 275px;">
-                            优惠:¥<fmt:formatNumber type="number" value="${shopOrder.preferential}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <td>
-                           余额抵扣:¥<fmt:formatNumber type="number" value="${shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount <= 0}">
+                    <c:if test="${order.onlinePayFlag eq 0}">
+                        <tr>
                             <td>
-                                应付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
+                                商品总额:¥<fmt:formatNumber type="number" value="${shopOrder.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
+                            </td>
+                            <td colspan="2">
+                                优惠:¥<fmt:formatNumber type="number" value="${shopOrder.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
                             </td>
-                        </c:if>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount >= 0}">
                             <td>
-                                应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
+                                应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.realPay}" pattern="0.00" maxFractionDigits="2" />
                             </td>
-                        </c:if>
-                        <td>
-                            已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount <= 0}">
                             <td>
-                                待付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
+                                已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
                             </td>
-                        </c:if>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount >= 0}">
                             <td>
-                                待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
+                                待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.restAmount}" pattern="0.00" maxFractionDigits="2" />
                             </td>
-                        </c:if>
-                    </tr>
+                        </tr>
+                    </c:if>
                         <c:forEach items="${shopOrder.newOrderProducts}" var="newOrderProduct" varStatus="productStatus">
                     <tr>
                             <td colspan="5">
@@ -581,14 +562,14 @@
                                         <input type="hidden" id="returning${status.index}${productStatus.index}" value="${newOrderProduct.returningPurchaseProductNum}"/>
                                         <%--已退货=所有退货数量总和--%>
                                         <td><font color="red"><span>已退货:<span id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore -newOrderProduct.returnedPurchaseProductNum }" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
+                                        <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or shopOrder.shopID eq 998?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${shopOrder.shopID eq 998?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore -newOrderProduct.returnedPurchaseProductNum) }" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
                                     </tr>
                                     <tr>
                                         <%--待发货=未出库数量-取消数量--%>
                                         <td><font color="red">待发货:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font></td>
                                         <%--已取消数量=所有已取消数量总和--%>
                                         <td><font color="red">已取消:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
+                                        <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or shopOrder.shopID eq 998?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${shopOrder.shopID eq 998?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
                                         <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID" value="${newOrderProduct.shopOrderID}"/>
                                         <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID" value="${newOrderProduct.productID}"/>
                                         <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID" value="${newOrderProduct.orderProductID}"/>
@@ -660,12 +641,12 @@
                                         <td><font color="red">已发货:<span id="shipped${status.index}${productStatus.index}">${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore}</span></font></td>
                                         <input type="hidden" id="returning${status.index}${productStatus.index}" value="${newOrderProduct.returningPurchaseProductNum}"/>
                                         <td><font color="red"><span>已退货:<span id="returned${status.index}${productStatus.index}">${newOrderProduct.returnedPurchaseProductNum}</span></span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput1 shopOrderInput1 refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore - newOrderProduct.returnedPurchaseProductNum}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
+                                        <td colspan="4"><font color="red"><span>本次退货:<input ${newOrderProduct.presentNum>0 or shopOrder.shopID eq 998?"readonly":""} presentNum="${newOrderProduct.presentNum}" id="applicationReturnedNum${status.index}${productStatus.index}" class="refundGoodsInput1 shopOrderInput1 refundGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationReturnedNum" value="${shopOrder.shopID eq 998?0:(newOrderProduct.num + newOrderProduct.presentNum - newOrderProduct.notOutStore - newOrderProduct.returnedPurchaseProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input tuihuo" type="text" onchange="setApplicationReturnedNum(${status.index},${productStatus.index})"></span></font></td>
                                     </tr>
                                     <tr>
                                         <td><font color="red">待发货:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}</span></font></td>
                                         <td><font color="red">已取消:<span id="toBeShipped${status.index}${productStatus.index}">${newOrderProduct.cancelProductNum}</span></font></td>
-                                        <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${newOrderProduct.notOutStore - newOrderProduct.cancelProductNum}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
+                                        <td colspan="4"><font color="red"><span>本次取消:<input ${newOrderProduct.presentNum>0 or shopOrder.shopID eq 998?"readonly":""} id="applicationCancelNum${status.index}${productStatus.index}" class="cancelGoodsInput shopOrderInput" name="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].applicationCancelNum" value="${shopOrder.shopID eq 998?0:(newOrderProduct.notOutStore - newOrderProduct.cancelProductNum)}" oninput="this.value=this.value.replace(/\D/g,'').replace(/^0+(?=\d)/,1)" class="input cancel" type="text" onchange="setApplicationCancelNum(${status.index},${productStatus.index})"></span></font></td>
                                         <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].shopOrderID" value="${newOrderProduct.shopOrderID}"/>
                                         <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].productID" value="${newOrderProduct.productID}"/>
                                         <form:hidden path="cmReturnedPurchaseProductList[${status.index}][${productStatus.index}].orderProductID" value="${newOrderProduct.orderProductID}"/>
@@ -707,6 +688,11 @@
             $(".shopOrderInput").attr("readonly",true);
         }
 
+        // 有优惠不可修改,只能全退
+        if (${order.discountAmount > 0}){
+            $(".shopOrderInput").attr("readonly",true);
+        }
+
         if(orderStatus == "true"){
             $("#returnWayDiv").html("");
             $("#returnWayDiv").html("未支付无退款");
@@ -876,7 +862,6 @@
             })
             return originalAmount;
         }
-
     });
 
     (function(){
@@ -935,6 +920,10 @@
             alertx("退货数量不能大于已发货数量(之前已退不算)!");
             $("#applicationReturnedNum"+a+b).val(0)
         }
+        if (num !== max){
+            alertx("退货数量只能等于已发货数量(之前已退不算)!");
+            $("#applicationReturnedNum"+a+b).val(0)
+        }
 
     };
     function setApplicationCancelNum(a,b){
@@ -944,7 +933,10 @@
             alertx("取消数量不能大于待发数量,请重新填写!");
             $("#applicationCancelNum"+a+b).val(0)
         }
-
+        if (num !== max){
+            alertx("取消数量只能等于待发数量,请重新填写!");
+            $("#applicationCancelNum"+a+b).val(0)
+        }
     };
 </script>
 </body>

+ 20 - 37
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderConfirmReturnRecord.jsp

@@ -362,7 +362,6 @@
     <input type="hidden" id="shopOrderSize" value='${fns:listToJson(cmReturnedPurchase.shopOrderReturnedList)}'>
     <c:forEach items="${cmReturnedPurchase.shopOrderReturnedList}" var="shopOrderReturned"
                varStatus="shopOrderReturnedStatus">
-        <c:forEach items="${order.newShopOrders}" var="shopOrder" varStatus="status">
         <tr>
             <td colspan="7">
                 <table id="shopOrderReturnedTable${shopOrderReturnedStatus.index}"
@@ -373,7 +372,7 @@
                         </td>
                         <td style="width: 250px;">子订单金额:${shopOrderReturned.productAmount}</td>
                         <td>
-                            收款状态:${fns:getDictLabel(shopOrder.receiptStatus,'receiptStatus' ,'' )}
+                            收款状态:${fns:getDictLabel(shopOrderReturned.receiptStatus,'receiptStatus' ,'' )}
                         </td>
                         <td>发货状态:
                                 ${fns:getDictLabel(shopOrderReturned.sendOutStatus,'sendOutStatus' ,'' )}
@@ -388,41 +387,25 @@
                             </c:if>
                         </td>
                     </tr>
-            <tr>
-                <td style="width: 300px;">
-                    商品总额:${shopOrder.totalAmount}
-                </td>
-                <td  style="width: 275px;">
-                    优惠:¥<fmt:formatNumber type="number" value="${shopOrder.preferential}" pattern="0.00" maxFractionDigits="2" />
-                </td>
-                <td>
-                    余额抵扣:¥<fmt:formatNumber type="number" value="${shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
-                </td>
-                <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount <= 0}">
-                    <td>
-                        应付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
-                    </td>
-                </c:if>
-                <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount >= 0}">
-                    <td>
-                        应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
-                    </td>
-                </c:if>
-                <td>
-                    已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
-                </td>
-                <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount <= 0}">
-                    <td>
-                        待付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
-                    </td>
-                </c:if>
-                <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount >= 0}">
-                    <td>
-                        待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
-                    </td>
-                </c:if>
-            </tr>
-                    </c:forEach>
+                    <c:if test="${order.onlinePayFlag ne 1}">
+                        <tr>
+                            <td>
+                                商品总额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
+                            </td>
+                            <td>
+                                优惠:¥<fmt:formatNumber type="number" value="${shopOrderReturned.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
+                            </td>
+                            <td>
+                                应付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.realPay}" pattern="0.00" maxFractionDigits="2" />
+                            </td>
+                            <td>
+                                已付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
+                            </td>
+                            <td>
+                                待付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.restAmount}" pattern="0.00" maxFractionDigits="2" />
+                            </td>
+                        </tr>
+                    </c:if>
                     <c:forEach items="${shopOrderReturned.cmReturnedPurchaseProductList}"
                                var="cmReturnedPurchaseProduct" varStatus="cmReturnedPurchaseProductStatus">
                         <tr>

+ 14 - 32
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReturnRecord.jsp

@@ -504,8 +504,6 @@
 
         <table id="cmReturnedPurchaseTable" class="table table-striped table-bordered table-condensed">
                 <c:forEach items="${cmReturnedPurchase.shopOrderReturnedList}" var="shopOrderReturned" varStatus="shopOrderReturnedStatus">
-                    <c:forEach items="${order.newShopOrders}" var="shopOrder" varStatus="status" begin="1" end="18">
-
                     <tr>
                         <td colspan="7">
                             <table id="shopOrderReturnedTable${shopOrderReturnedStatus.index}" class="table table-striped table-bordered table-condensed">
@@ -513,7 +511,7 @@
                                     <td style="width: 300px;">子订单编号(ID):${shopOrderReturned.shopOrderNo}(${shopOrderReturned.shopOrderID})</td>
                                     <td  style="width: 250px;">子订单金额:${shopOrderReturned.productAmount}</td>
                                     <td>
-                                        收款状态:${fns:getDictLabel(shopOrder.receiptStatus,'receiptStatus' ,'' )}
+                                        收款状态:${fns:getDictLabel(shopOrderReturned.shopReceiptStatus,'receiptStatus' ,'' )}
                                     </td>
                                     <td>发货状态:
                                             ${fns:getDictLabel(shopOrderReturned.sendOutStatus,'sendOutStatus' ,'' )}
@@ -523,41 +521,25 @@
                                     </td>
                                     <td>供应商:${shopOrderReturned.shopName}</td>
                                 </tr>
-                                <tr>
-                                    <td style="width: 300px;">
-                                        商品总额:${shopOrder.totalAmount}
-                                    </td>
-                                    <td  style="width: 275px;">
-                                        优惠:¥<fmt:formatNumber type="number" value="${shopOrder.preferential}" pattern="0.00" maxFractionDigits="2" />
-                                    </td>
-                                    <td>
-                                        余额抵扣:¥<fmt:formatNumber type="number" value="${shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
-                                    </td>
-                                    <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount <= 0}">
+                                <c:if test="${order.onlinePayFlag eq 0}">
+                                    <tr>
                                         <td>
-                                            应付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
+                                            商品总额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
                                         </td>
-                                    </c:if>
-                                    <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount >= 0}">
                                         <td>
-                                            应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
+                                            优惠:¥<fmt:formatNumber type="number" value="${shopOrderReturned.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
                                         </td>
-                                    </c:if>
-                                    <td>
-                                        已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
-                                    </td>
-                                    <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount <= 0}">
-                                    <td>
-                                        待付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
-                                    </td>
-                                    </c:if>
-                                    <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount >= 0}">
                                         <td>
-                                            待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
+                                            应付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.realPay}" pattern="0.00" maxFractionDigits="2" />
                                         </td>
-                                    </c:if>
-                                </tr>
-                    </c:forEach>
+                                        <td>
+                                            已付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
+                                        </td>
+                                        <td>
+                                            待付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.restAmount}" pattern="0.00" maxFractionDigits="2" />
+                                        </td>
+                                    </tr>
+                                </c:if>
                                 <c:forEach items="${shopOrderReturned.cmReturnedPurchaseProductList}" var="cmReturnedPurchaseProduct" varStatus="cmReturnedPurchaseProductStatus">
                                     <tr>
                                         <td  rowspan="4" style="width: 295px;height: 125px">

+ 19 - 36
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderReviewReturnRecord.jsp

@@ -441,7 +441,6 @@
 <c:forEach items="${cmReturnedPurchaseList}" var="cmReturnedPurchase" varStatus="cmReturnedPurchaseStatus">
             <input type="hidden" id="shopOrderSize" value='${fns:listToJson(cmReturnedPurchase.shopOrderReturnedList)}'>
             <c:forEach items="${cmReturnedPurchase.shopOrderReturnedList}" var="shopOrderReturned" varStatus="shopOrderReturnedStatus">
-                <c:forEach items="${order.newShopOrders}" var="shopOrder" varStatus="status">
                 <tr>
                     <td colspan="7">
                     <table id="shopOrderReturnedTable${shopOrderReturnedStatus.index}" class="table table-striped table-bordered table-condensed">
@@ -449,7 +448,7 @@
                             <td style="width: 300px;">子订单编号(ID):${shopOrderReturned.shopOrderNo}(${shopOrderReturned.shopOrderID})</td>
                             <td  style="width: 250px;">子订单金额:${shopOrderReturned.productAmount}</td>
                             <td>
-                                收款状态:${fns:getDictLabel(shopOrder.receiptStatus,'receiptStatus' ,'' )}
+                                收款状态:${fns:getDictLabel(shopOrderReturned.shopReceiptStatus,'receiptStatus' ,'' )}
                             </td>
                             <td>发货状态:
                                     ${fns:getDictLabel(shopOrderReturned.sendOutStatus,'sendOutStatus' ,'' )}
@@ -464,41 +463,25 @@
                                 </c:if>
                             </td>
                         </tr>
-                    <tr>
-                        <td style="width: 300px;">
-                            商品总额:${shopOrder.totalAmount}
-                        </td>
-                        <td  style="width: 275px;">
-                            优惠:¥<fmt:formatNumber type="number" value="${shopOrder.preferential}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <td>
-                            余额抵扣:¥<fmt:formatNumber type="number" value="${shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount <= 0}">
-                            <td>
-                                应付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                        </c:if>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount >= 0}">
-                            <td>
-                                应付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                        </c:if>
-                        <td>
-                            已付金额:¥<fmt:formatNumber type="number" value="${shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
-                        </td>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount <= 0}">
-                            <td>
-                                待付金额:¥<fmt:formatNumber type="number" value="0.00" pattern="0.00" maxFractionDigits="2" />
-                            </td>
-                        </c:if>
-                        <c:if test="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount >= 0}">
-                            <td>
-                                待付金额:¥<fmt:formatNumber type="number" value="${shopOrder.totalAmount-shopOrder.preferential-shopOrder.discountAmount-shopOrder.payedShopAmount}" pattern="0.00" maxFractionDigits="2" />
-                            </td>
+                        <c:if test="${order.onlinePayFlag ne 1}">
+                            <tr>
+                                <td>
+                                    商品总额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.needPayAmount}" pattern="0.00" maxFractionDigits="2" />
+                                </td>
+                                <td>
+                                    优惠:¥<fmt:formatNumber type="number" value="${shopOrderReturned.eachDiscount}" pattern="0.00" maxFractionDigits="2" />
+                                </td>
+                                <td>
+                                    应付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.realPay}" pattern="0.00" maxFractionDigits="2" />
+                                </td>
+                                <td>
+                                    已付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.receiptAmount}" pattern="0.00" maxFractionDigits="2" />
+                                </td>
+                                <td>
+                                    待付金额:¥<fmt:formatNumber type="number" value="${shopOrderReturned.restAmount}" pattern="0.00" maxFractionDigits="2" />
+                                </td>
+                            </tr>
                         </c:if>
-                    </tr>
-                </c:forEach>
                         <c:forEach items="${shopOrderReturned.cmReturnedPurchaseProductList}" var="cmReturnedPurchaseProduct" varStatus="cmReturnedPurchaseProductStatus">
                             <tr>
                                 <td  rowspan="4" style="width: 295px;height: 125px">

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

@@ -257,10 +257,13 @@
                                 value="${orderInfo.orderAmount}"
                                 pattern="#0.00"/></span>
                         <span>
+                        <span><label>应收金额:</label>¥<fmt:formatNumber value="${orderInfo.payableAmount}"
+                                                                         pattern="#0.00"/></span>
+                        <span>
                         <label>已收金额:</label>¥<fmt:formatNumber
                                 value="${empty orderInfo.receiptAmount ? 0 : orderInfo.receiptAmount}"
                                 pattern="#0.00"/>
-                        <span>
+                            <span>
                                     <c:forEach items="${orderInfo.receiptRecordVo}" var="receiptRecord"
                                                varStatus="index">
                                         <c:if test="${receiptRecord.confirmType eq 1 || receiptRecord.confirmType eq  2 || receiptRecord.confirmType eq 3}">
@@ -325,6 +328,18 @@
                                         <c:if test="${orderInfo.orderType == 1}">自主订单</c:if></span>
                         <span><label>下单日期:</label>${orderInfo.orderTime}</span>
                     </div>
+                    <div class="shop-order-row">
+                        <c:forEach items="${orderInfo.shopOrderInfos}" var="shopOrder" varStatus="index">
+                            <span>子订单编号:${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</span>
+                            <span>子订单金额:¥<fmt:formatNumber value="${shopOrder.realPay}"
+                                                           pattern="#0.00"/></span>
+                            <span>子订单应收金额:¥<fmt:formatNumber value="${shopOrder.realPay}"
+                                                           pattern="#0.00"/></span>
+                            <span>子订单已收金额:¥<fmt:formatNumber value="${shopOrder.receiptAmount}"
+                                                           pattern="#0.00"/></span>
+                            <span>子订单收款状态:${fns:getDictLabel(shopOrder.shopReceiptStatus,'receiptStatus' ,'' )}</span>
+                        </c:forEach>
+                    </div>
                     <div class="receipt-order-row4">
                         <div><h5><label>订单收款记录:</label></h5></div>
                         <c:forEach items="${orderInfo.receiptRecordVo}" var="receiptRecord" varStatus="index">

+ 7 - 6
src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp

@@ -670,15 +670,16 @@
                 totalComissionVal = 0,
                 resVal = '';
             totalComissionEle = thisEle.find('.payCm'),
-                comissionEle = thisEle.find('.payCm-t'),
-                thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),
-                freightVal = thisEle.find('.freight').text().replace(',', ''),
-                clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
-                discountFee = Number(thisEle.find('.discountFee').text().replace(',',''));
+            comissionEle = thisEle.find('.payCm-t'),
+            thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),
+            freightVal = thisEle.find('.freight').text().replace(',', ''),
+            clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
+            discountFee = Number(thisEle.find('.discountFee').text().replace(',','')),
+            eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',',''));//分摊优惠
             totalComissionEle.each(function () {
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })
-            resVal = (totalComissionVal + clubFreight - discountFee - thirdPartyVal - freightVal).toFixed(2);
+            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
 

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

@@ -116,7 +116,7 @@
 								${cs}<br/>
 							</c:forEach>
 						</td>
-						<td>${s.income-s.discountTotalFee-s.couponAmount-s.promotionFullReduction}</td>
+						<td>${s.income}</td>
 						<td>
 							<label class="clubFreight"  style="display: none">
 								<c:choose>
@@ -206,9 +206,8 @@
 					<tr>
 						<td>${s.shopOrderNo}(${s.shopOrderID})</td>
 						<td colspan="3">${s.shopName}</td>
-						<td colspan="3" class="payCm-t">${s.income-s.shopPostFee-s.discountTotalFee-s.couponAmount-s.promotionFullReduction}</td>
+						<td colspan="3" class="payCm-t">子订单佣金</td>
 						<td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
 						<td class="taxes">
 							<fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
 						</td>
@@ -458,16 +457,17 @@
 			    var thisEle = $(this),
 					totalComissionVal = 0,
 					resVal = '';
-					totalComissionEle = thisEle.find('.payCm'),
-					comissionEle = thisEle.find('.payCm-t'),
-					thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',',''),
-					freightVal = thisEle.find('.freight').text().replace(',',''),
-					clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
-					discountFee = Number(thisEle.find('.discountFee').text().replace(',',''));
+				totalComissionEle = thisEle.find('.payCm'),
+				comissionEle = thisEle.find('.payCm-t'),
+				thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',',''),
+				freightVal = thisEle.find('.freight').text().replace(',',''),
+				clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
+				discountFee = Number(thisEle.find('.discountFee').text().replace(',','')),
+				eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',',''));//分摊优惠
                 totalComissionEle.each(function(){
                     totalComissionVal += Number($(this).text().replace(',',''));
 				})
-				resVal = (totalComissionVal + clubFreight - discountFee - thirdPartyVal - freightVal).toFixed(2);
+				resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
                 comissionEle.text(resVal);
 			})
 

+ 7 - 6
src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp

@@ -439,15 +439,16 @@
                 totalComissionVal = 0,
                 resVal = '';
             totalComissionEle = thisEle.find('.payCm'),
-                comissionEle = thisEle.find('.payCm-t'),
-                thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),
-                freightVal = thisEle.find('.freight').text().replace(',', ''),
-                clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
-                discountFee = Number(thisEle.find('.discountFee').text().replace(',',''));
+            comissionEle = thisEle.find('.payCm-t'),
+            thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),
+            freightVal = thisEle.find('.freight').text().replace(',', ''),
+            clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
+            discountFee = Number(thisEle.find('.discountFee').text().replace(',','')),
+            eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',',''));//分摊优惠
             totalComissionEle.each(function () {
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })
-            resVal = (totalComissionVal + clubFreight - discountFee - thirdPartyVal - freightVal).toFixed(2);
+            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
 

+ 13 - 12
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -413,7 +413,7 @@
         </div>
         <div class="payment-form-content">
             <c:forEach items="${cmPayShop.shopOrders}" var="s">
-               <input type="hidden" value="${promotionFull}" class="promotionFullReduction" ><%-- //满减优惠--%>
+               <input type="hidden" value="${eachDiscount}" class="eachDiscount" ><%-- //分摊优惠--%>
                 <table class="table table-striped table-bordered table-condensed pay-table">
                     <tr>
                         <th>订单编号(ID)</th>
@@ -426,7 +426,7 @@
                         <th>收款状态</th>
                         <th colspan="3">收款金额</th>
                         <th>经理折扣</th>
-                       <th>优惠券</th>
+                        <th>优惠券</th>
                     <tr/>
                     <tr>
                         <td> ${s.orderNo}(${s.orderID})</td>
@@ -528,7 +528,7 @@
                     <tr>
                         <td>${s.shopOrderNo}(${s.shopOrderID})</td>
                         <td colspan="3">${s.shopName}</td>
-                        <td colspan="3" class="payCm-t"></td> <%-- 子订单佣金=总金额-付第三方-供应商运费-分摊优惠--%>
+                        <td colspan="3" class="payCm-t"></td> <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
                         <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
 
                         <td class="taxes">
@@ -939,19 +939,20 @@
             var thisEle = $(this),
                 totalComissionVal = 0,
                 resVal = '';
-            totalComissionEle = thisEle.find('.payCm'),//总价
-                comissionEle = thisEle.find('.payCm-t'),//子订单佣金
-                thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),//付第三方
-                freightVal = thisEle.find('.freight').text().replace(',', ''),//供应商运费
-                couponAmount = Number(thisEle.find('.couponAmount').text().replace(',', '')),//优惠卷
-                discountFee = Number(thisEle.find('.discountFee').text().replace(',', ''));//经理折扣
-            promotionFullReduction=Number(thisEle.find('.promotionFullReduction').text().replace(',', ''));//满减优惠
+            totalComissionEle = thisEle.find('.payCm'),//单个商品总佣金
+            comissionEle = thisEle.find('.payCm-t'),//子订单佣金
+            thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),//付第三方
+            freightVal = thisEle.find('.freight').text().replace(',', ''),//供应商运费
+            clubFreight = Number(thisEle.find('.clubFreight').text().replace(',', '')),//机构运费
+            discountFee = Number(thisEle.find('.discountFee').text().replace(',', '')),//经理折扣
+            eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',',''));//分摊优惠
             totalComissionEle.each(function () {
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })
             alert(promotionFullReduction.toFixed(2));
-            resVal = (totalComissionVal - discountFee - thirdPartyVal - freightVal-couponAmount-promotionFullReduction).toFixed(2);
-            comissionEle.text(promotionFullReduction.toFixed(2)+""+couponAmount.toFixed(2));
+            // 子订单佣金=单个商品总佣金+机构运费-付第三方-供应商运费-子订单分摊优惠
+            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
+            comissionEle.text(resVal);
         })
 
         $('.apply-btn').on('click', function () {

+ 7 - 6
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopDetail.jsp

@@ -465,15 +465,16 @@
                 totalComissionVal = 0,
                 resVal = '';
             totalComissionEle = thisEle.find('.payCm'),
-                comissionEle = thisEle.find('.payCm-t'),
-                thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',',''),
-                freightVal = thisEle.find('.freight').text().replace(',',''),
-                clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
-                discountFee = Number(thisEle.find('.discountFee').text().replace(',',''));
+            comissionEle = thisEle.find('.payCm-t'),
+            thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',',''),
+            freightVal = thisEle.find('.freight').text().replace(',',''),
+            clubFreight = Number(thisEle.find('.clubFreight').text().replace(',','')),
+            discountFee = Number(thisEle.find('.discountFee').text().replace(',','')),
+            eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',',''));//分摊优惠
             totalComissionEle.each(function(){
                 totalComissionVal += Number($(this).text().replace(',',''));
             })
-            resVal = (totalComissionVal + clubFreight - discountFee - thirdPartyVal - freightVal).toFixed(2);
+            resVal = (totalComissionVal + clubFreight - thirdPartyVal - freightVal - eachDiscount).toFixed(2);
             comissionEle.text(resVal);
         })
     })()

+ 61 - 13
src/main/webapp/WEB-INF/views/modules/order/orderDetail.jsp

@@ -759,7 +759,7 @@
     <div class="order-rows">
         <span><label>下单时间:</label>${order.orderTime}</span>
         <span><label>子订单号(ID):</label>${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</span>
-        <span><label>子订单金额:</label><fmt:formatNumber value="${shopOrder.needPayAmount}" type="currency"/></span>
+        <span><label>子订单金额:</label><fmt:formatNumber value="${order.onlinePayFlag eq 0?shopOrder.realPay:shopOrder.needPayAmount}" type="currency"/></span>
         <c:if test="${shopOrder.postFeeCos eq '0'}">
             <div class="print-wrapper">
                 <a href="${ctx}/order/printOrder?shopOrderID=${shopOrder.shopOrderID}">打印</a>
@@ -771,8 +771,56 @@
                     <a href="${ctx}/archive/cmOrderArchive/form?id=${shopOrder.orderArchiveId}">查看订单资料</a>
                 </c:if>
             </div>
-            <c:if test="${order.status ne 0 && order.status ne 11}">
-                <div class="delivery-wrapper">
+        </c:if>
+        <c:if test="${order.onlinePayFlag eq 0}">
+            <br/>
+            <span>商品总额:<fmt:formatNumber value="${shopOrder.needPayAmount}" type="currency"/></span>
+            <span>优惠:<fmt:formatNumber value="${shopOrder.eachDiscount}" type="currency"/></span>
+            <span>应付金额:<fmt:formatNumber value="${shopOrder.realPay}" type="currency"/></span>
+            <span>已付金额:<fmt:formatNumber value="${shopOrder.receiptAmount}" type="currency"/></span>
+            <span>待付金额:<fmt:formatNumber value="${shopOrder.restAmount}" type="currency"/></span>
+            <br/>
+            <span>收款状态:
+                <c:if test="${shopOrder.shopReceiptStatus == 1}">
+                    <font color="red">待收款</font>
+                </c:if>
+                <c:if test="${shopOrder.shopReceiptStatus == 2}">
+                    <font color="#ff8c00">部分收款</font>
+                </c:if>
+                <c:if test="${shopOrder.shopReceiptStatus == 3}">
+                    <font color="green">已收款</font>
+                </c:if>
+            </span>
+            <span>付款状态:
+                <c:if test="${shopOrder.payStatus == 1}">
+                    <font color="red">待付款</font>
+                </c:if>
+                <c:if test="${shopOrder.payStatus == 2}">
+                    <font color="#ff8c00">部分付款</font>
+                </c:if>
+                <c:if test="${shopOrder.payStatus == 3}">
+                    <font color="green">已付款</font>
+                </c:if>
+            </span>
+            <span>发货状态:
+                <c:if test="${shopOrder.sendOutStatus == 1}">
+                    <font color="red">待发货</font>
+                </c:if>
+                <c:if test="${shopOrder.sendOutStatus == 2}">
+                    <font color="#ff8c00">部分发货</font>
+                </c:if>
+                <c:if test="${shopOrder.sendOutStatus == 3}">
+                    <font color="green">已发货</font>
+                </c:if>
+            </span>
+            <c:if test="${not empty shopOrder.note}">
+                <span>留言:${shopOrder.note}</span>
+            </c:if>
+        </c:if>
+        <c:if test="${order.onlinePayFlag ne 1}">
+            <c:if test="${shopOrder.postFeeCos eq '0'}">
+                <c:if test="${order.status ne 0 && order.status ne 11}">
+                    <div class="delivery-wrapper">
                         <span>发货状态:
                             <c:if test="${shopOrder.sendOutStatus == 1}">
                                 <font color="red">待发货</font>
@@ -784,27 +832,27 @@
                                 <font color="green">已发货</font>
                             </c:if>
                         </span>
-                    <span>付款状态:<c:if test="${shopOrder.payStatus == 1}">
-                        <font color="red">待付款</font>
-                    </c:if>
+                        <span>付款状态:<c:if test="${shopOrder.payStatus == 1}">
+                            <font color="red">待付款</font>
+                        </c:if>
                                         <c:if test="${shopOrder.payStatus == 2}">
                                             <font color="#ff8c00">部分付款</font>
                                         </c:if>
                                         <c:if test="${shopOrder.payStatus == 3}">
                                             <font color="green">已付款</font>
                                         </c:if></span>
-                    <c:if test="${shopOrder.payStatus == 3 or shopOrder.payStatus == 2}">
+                        <c:if test="${shopOrder.payStatus == 3 or shopOrder.payStatus == 2}">
                                 <span>已付金额: <fmt:formatNumber value="${shopOrder.payed}" type="currency"/>
                                 </span>
-                    </c:if>
-                </div>
-            </c:if>
-            <c:if test="${not empty shopOrder.note}">
-                <div><label>留言:</label>${shopOrder.note}</div>
+                        </c:if>
+                    </div>
+                </c:if>
+                <c:if test="${not empty shopOrder.note}">
+                    <div><label>留言:</label>${shopOrder.note}</div>
+                </c:if>
             </c:if>
         </c:if>
     </div>
-
     <div class="order-rows">
         <span><label>供应商:</label>${shopOrder.shopName}</span>
         <c:if test="${shopOrder.shopPromotion ne null && shopOrder.shopPromotion.type eq 3}">