Pārlūkot izejas kodu

Merge branch 'developer' into developerE

JiangChongBo 2 gadi atpakaļ
vecāks
revīzija
e99a4c884c

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

@@ -791,12 +791,15 @@ public class CmRefundsProductController extends BaseController {
                 }
             }
             List<SettleRecord> settleRecord = newOrderService.findSettleRecord(cmReturnedPurchase.getOrderID());
+            List<SplitAccountPo> splitRecord = newOrderService.findSplitRecord(cmReturnedPurchase.getOrderID());
             model.addAttribute("settleRecord", settleRecord);
             model.addAttribute("order", newOrder);
             model.addAttribute("receipt", listRelation);
             model.addAttribute("refundFee", refundFee);
             model.addAttribute("from", from);
             model.addAttribute("orderID", cmReturnedPurchase.getOrderID().toString());
+            model.addAttribute("pageType", cmReturnedPurchase.getPageType());
+            model.addAttribute("splitRecord", splitRecord);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 7 - 1
src/main/java/com/caimei/modules/order/dao/NewOrderDao.java

@@ -197,7 +197,7 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
      */
     void deleteCouponOrderRecord(Integer id);
 
-    List<OrderReceiptRelationPo> getUndividedPaidReceipt(String currentTime);
+    List<OrderReceiptRelationPo> getUndividedPaidReceipt(@Param("currentTime")String currentTime,@Param("shopOrderIds")String shopOrderIds);
 
     List<OrderReceiptRelationPo> getOnlineBalance(String currentTime);
 
@@ -262,4 +262,10 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
     Double findSettleAmount(Integer orderID);
 
     Integer findShopOrderSize(Integer orderID);
+
+    Integer findSplitCount(Integer orderID);
+
+    List<SplitAccountPo> getSplitRecord(Integer orderID);
+
+    Integer getSplitTime(Integer shopOrderId);
 }

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

@@ -75,8 +75,17 @@ public class CmReturnedPurchase extends DataEntity<CmReturnedPurchase> {
     private String endTime;        //时间结束  查询条件 申请时间
     private Integer onlineShopOrderId; //子订单id
 
+    private Integer pageType;   //1跳转结算记录页面2跳转分账记录页面
     private String bankNameType;
 
+    public Integer getPageType() {
+        return pageType;
+    }
+
+    public void setPageType(Integer pageType) {
+        this.pageType = pageType;
+    }
+
     public Integer getOnlineShopOrderId() {
         return onlineShopOrderId;
     }

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

@@ -111,6 +111,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer serviceProviderId;  //协销Id
     private Integer settleStatus;    //结算状态   1未结算2部分结算3已结算
     private Double settleAmount;   // 已结算金额
+    private Integer splitCount;  //分账记录数
 
     private String productName;     //商品名称(根据商品名称筛选订单)
     private List<NewOrderProduct> orderProduct;// 订单内的商品集合
@@ -165,6 +166,14 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer receiveCouponId;
     private CmHeheCouponOrderRecord heheCouponRecord;   //优惠券信息
 
+    public Integer getSplitCount() {
+        return splitCount;
+    }
+
+    public void setSplitCount(Integer splitCount) {
+        this.splitCount = splitCount;
+    }
+
     public String getRebateFee() {
         return rebateFee;
     }

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

@@ -115,7 +115,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private List<NewOrderProduct> snOrderProducts;//需要使用sn码的订单产品列表
     private Boolean defaultStatus;  //控制填写的默认状态(运费订单,部分收款订单 默认不能操作,)
     private CmPromotion shopPromotion;  //子订单对应的店铺促销活动
-
+    private String onlinePayWays; //线上支付渠道,收银台确定支付渠道1微信2支付宝3个人网银4企业网银
     //--------------- 付款列表展示数据 ------------
     private String paying;// 是否处于给供应商状态中   0不是的,  1是的
     private String refunding;// 是否处于供应商退款状态中   0不是的,  1是的
@@ -157,6 +157,14 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
 
     private boolean payShopOtherFee = true; //是否可以付第三方申请
 
+    public String getOnlinePayWays() {
+        return onlinePayWays;
+    }
+
+    public void setOnlinePayWays(String onlinePayWays) {
+        this.onlinePayWays = onlinePayWays;
+    }
+
     public String getRebateFee() {
         return rebateFee;
     }

+ 41 - 5
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -693,11 +693,27 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                             }
                             //有优惠金额,最高手续费=支付金额*0.65%>10取0.65,不大于取10(合利宝最高0.65%)
                             double realPay = shopOrder.getRealPay();
-                            double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
+//                            double charge = MathUtil.mul(realPay, 0.0065, 2).doubleValue() > 10 ? MathUtil.mul(realPay, 0.0065, 2).doubleValue() : 10;
                             //佣金>最高手续费可以线上,否则线下
                             double bro = MathUtil.sub(realPay, shopOrder.getShouldPayShopAmount()).doubleValue();
-                            if (bro < charge) {
-                                onlinePay = false;
+                            if (bro < 0) {
+                                onlinePay=false;
+                            } else {
+                                double WXCharge = MathUtil.mul(realPay, 0.0065, 2).doubleValue();
+                                double AliCharge = MathUtil.mul(realPay, 0.0025, 2).doubleValue();
+                                double B2CCharge = MathUtil.mul(realPay, 0.002, 2).doubleValue();
+                                //佣金和手续费比较,佣金>手续费则可以走当前支付渠道
+                                //支持子订单佣金小于最小手续费时,也能进行线上支付,此时不限制支付方式(佣金大于最大手续费或小于最小手续费支持全渠道付款)
+                                String payWays = "";
+                                payWays += bro >= WXCharge ? "1" : "";
+                                payWays += bro >= AliCharge ? ",2" : "";
+                                payWays += bro >= B2CCharge ? ",3" : "";
+                                payWays += bro >= 10 ? ",4" : "";
+                                //小于所有的情况下线下补手续费,开放所有渠道
+                                if ("".equals(payWays)) {
+                                    payWays = "1,2,3,4";
+                                }
+                                shopOrder.setOnlinePayWays(payWays);
                             }
                         }
                     } else {
@@ -711,8 +727,24 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                             double bro = shopOrder.getBrokerage();
                             shopOrder.setRealPay(realPay);
                             shopOrder.setEachDiscount(0d);
-                            if (bro < charge) {
-                                onlinePay = false;
+                            if (bro < 0) {
+                                onlinePay=false;
+                            } else {
+                                double WXCharge = MathUtil.mul(realPay, 0.0065, 2).doubleValue();
+                                double AliCharge = MathUtil.mul(realPay, 0.0025, 2).doubleValue();
+                                double B2CCharge = MathUtil.mul(realPay, 0.002, 2).doubleValue();
+                                //佣金和手续费比较,佣金>手续费则可以走当前支付渠道
+                                //支持子订单佣金小于最小手续费时,也能进行线上支付,此时不限制支付方式(佣金大于最大手续费或小于最小手续费支持全渠道付款)
+                                String payWays = "";
+                                payWays += bro >= WXCharge ? "1" : "";
+                                payWays += bro >= AliCharge ? ",2" : "";
+                                payWays += bro >= B2CCharge ? ",3" : "";
+                                payWays += bro >= 10 ? ",4" : "";
+                                //小于所有的情况下线下补手续费,开放所有渠道
+                                if ("".equals(payWays)) {
+                                    payWays = "1,2,3,4";
+                                }
+                                shopOrder.setOnlinePayWays(payWays);
                             }
                         }
                     }
@@ -2716,4 +2748,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
         newOrder.setRebateFlag("2");
         newOrderDao.update(newOrder);
     }
+
+    public List<SplitAccountPo> findSplitRecord(Integer orderID) {
+        return newOrderDao.getSplitRecord(orderID);
+    }
 }

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

@@ -448,9 +448,13 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             orderIds = cmDiscernReceiptDao.findRebateOrderID(orderList.stream().map(NewOrder::getOrderID).collect(Collectors.toList()));
         }
         for (NewOrder order : orderList) {
+            //结算记录
             List<SettleRecord> settleRecord = newOrderDao.findSettleRecord(order.getOrderID());
             Integer num = null == settleRecord ? 0 : settleRecord.size();
             order.setSettleRecordNum(num);
+            //分账记录数
+            Integer splitCount=newOrderDao.findSplitCount(order.getOrderID());
+            order.setSplitCount(splitCount);
             if ("0".equals(order.getOnlinePayFlag())) {
                 order.setSettleAmount(newOrderDao.findSettleAmount(order.getOrderID()));
             }

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

@@ -40,14 +40,14 @@ public class SplitAccountService extends BaseService {
     private NewShopOrderDao newShopOrderDao;
 
     @Transactional(readOnly = false,rollbackFor = Exception.class)
-    public void SplitAccount() {
+    public void SplitAccount(String shopOrderIds) {
         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);
+        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime,shopOrderIds);
         if (null != orderRelations && orderRelations.size() > 0) {
             for (OrderReceiptRelationPo orderRelation : orderRelations) {
                 logger.info("【分账】>>>>>>>>>>子订单id:" + orderRelation.getShopOrderId() + "进入分账");

+ 43 - 5
src/main/java/com/caimei/modules/order/web/CmPayShopController.java

@@ -34,7 +34,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
+import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
@@ -76,6 +78,8 @@ public class CmPayShopController extends BaseController {
     private NewOrderDao newOrderDao;
     @Resource
     private CmOfflineCollectionService cmOfflineCollectionService;
+    @Resource
+    private SplitAccountService splitAccountService;
 
     @ModelAttribute
     public CmPayShop get(@RequestParam(required = false) String id) {
@@ -394,7 +398,7 @@ public class CmPayShopController extends BaseController {
         shopOrder.setPayStatus(soZeroCostFlag ? "3" : "1");
         shopOrder.setZeroCostFlag(soZeroCostFlag ? 1 : 0);
         //当子订单0成本时,若主订单中其他子订单(除了运费子订单)都为0成本,设主订单为已付款,否则设为部分付款
-         NewOrder newOrder = newOrderService.get(shopOrder.getOrderID().toString());
+        NewOrder newOrder = newOrderService.get(shopOrder.getOrderID().toString());
         if (soZeroCostFlag) {
 
             AtomicReference<Boolean> zeroCostFlag = new AtomicReference<>(true);
@@ -430,7 +434,6 @@ public class CmPayShopController extends BaseController {
         }
 
 
-
         shopOrder.setShopPostFee(freight); //运费
         shopOrder.setShopOtherFee(thirdPartyFee); //付第三方
         shopOrder.setCostType(costType);
@@ -611,6 +614,29 @@ public class CmPayShopController extends BaseController {
         return res;
     }
 
+    @RequestMapping("settleTime")
+    @ResponseBody
+    public Map<String, Object> settleTime(@RequestParam("shopOrderId") Integer shopOrderId) {
+        Map<String, Object> map = new HashMap<>();
+        Calendar instance = Calendar.getInstance();
+        int flag = 0;
+        int weekIdx = instance.get(Calendar.DAY_OF_WEEK) - 1;
+        String format = new SimpleDateFormat("HH:mm:ss").format(new Date());
+        Integer substring = Integer.valueOf(format.substring(0, 2));
+        //当前时间周五下午到周日都返回1不能结算,其他时间看够不够24小时
+        if ((5 == weekIdx && substring > 14) || 6 == weekIdx || 7 == weekIdx) {
+            flag = 1;
+        } else {
+            Integer val = newOrderDao.getSplitTime(shopOrderId);
+            if (val <= 0) {
+                flag = 1;
+            }
+        }
+        map.put("flag", flag);
+        map.put("msg", "添加成功");
+        return map;
+    }
+
     /**
      * 发起付款申请  去付款单页面
      *
@@ -647,6 +673,17 @@ public class CmPayShopController extends BaseController {
         return "modules/order/cmSettlementForm";
     }
 
+    @RequestMapping("splitEdit")
+    public String splitEdit(String[] shopOrderIDs, RedirectAttributes redirectAttributes, Model model) {
+        splitAccountService.SplitAccount(shopOrderIDs[0]);
+
+//        Page<NewShopOrder> page = newShopOrderService.findSplitList(new Page<NewShopOrder>(),new NewShopOrder());
+//        model.addAttribute("page", page);
+        addMessage(redirectAttributes, "分账成功!");
+        return "redirect:" + Global.getAdminPath() + "/shopOrder/splitList";
+//        return "modules/order/cmSplitAccountList";
+    }
+
     /**
      * 去编辑页面 信息回显
      */
@@ -784,14 +821,15 @@ public class CmPayShopController extends BaseController {
      * @return
      */
     @RequestMapping("settlement")
-    public String settlement(Double settleAmount, String shopOrderId,RedirectAttributes redirectAttributes) throws Exception {
+    public String settlement(Double settleAmount, String shopOrderId, RedirectAttributes redirectAttributes) throws Exception {
         Double shouldPayShopAmount = newOrderDao.findShouldPayShopAmount(shopOrderId);
         Double settleSum = newOrderDao.findSettleSum(shopOrderId);
-        if(settleSum>=shouldPayShopAmount){
+        if (settleSum >= shouldPayShopAmount) {
             addMessage(redirectAttributes, "此订单已结算完毕!");
             return "redirect:" + Global.getAdminPath() + "/shopOrder/settlement";
         }
-        if(settleSum>=shouldPayShopAmount){}
+        if (settleSum >= shouldPayShopAmount) {
+        }
         Integer SDJSS = (Integer) redisService.get("SDJSS");
         //验锁
         if (null != SDJSS && SDJSS > 0) {

+ 7 - 4
src/main/java/com/caimei/modules/order/web/CmShopOrderController.java

@@ -109,20 +109,23 @@ public class CmShopOrderController extends BaseController {
 
     @RequiresPermissions("order:cmPayShop:split")
     @RequestMapping("splitList")
-    public String SplitAccount(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model){
+    public String SplitAccount(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model) {
         //1. 展示付款状态为待付款和部分付款状态的线上支付的子订单;
         //2. 子订单按下单时间降序排列
         //3. 手动分账页面需要只控制显示已收款的子订单
-        Page<NewShopOrder> page = newShopOrderService.findSplitList(new Page<>(request, response),newShopOrder);
+        if (null == newShopOrder) {
+            newShopOrder = new NewShopOrder();
+        }
+        Page<NewShopOrder> page = newShopOrderService.findSplitList(new Page<>(request, response), newShopOrder);
         model.addAttribute("page", page);
         return "modules/order/cmSplitAccountList";
     }
 
     @RequestMapping("settlement")
-    public String Settlement(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model){
+    public String Settlement(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model) {
         //1. 展示已分帐的线上子订单
         //2. 子订单按下单时间降序排列
-        Page<NewShopOrder> page = newShopOrderService.findSettlementList(new Page<>(request, response),newShopOrder);
+        Page<NewShopOrder> page = newShopOrderService.findSettlementList(new Page<>(request, response), newShopOrder);
         model.addAttribute("page", page);
         return "modules/order/cmSettlementList";
     }

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

@@ -49,11 +49,11 @@ public class SplitAccountController extends BaseController {
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String currentTime = format.format(calendar.getTime());
         // 查询未分账已支付收款
-        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime);
+        List<OrderReceiptRelationPo> orderRelations = newOrderDao.getUndividedPaidReceipt(currentTime,null);
         if (null != orderRelations && orderRelations.size() > 0) {
             //设锁
             redisService.set("XSFZMDS", 1, 120L);
-            splitAccountService.SplitAccount();
+            splitAccountService.SplitAccount(null);
             addMessage(redirectAttributes, "分账成功!");
         } else {
             addMessage(redirectAttributes, "暂无收款金额可进行分账!");

+ 1 - 0
src/main/resources/config/dev/caimei.properties

@@ -16,6 +16,7 @@ jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?useUnicode=true&characterEncoding
 jdbc.username=developer
 jdbc.password=J5p3tgOVazNl4ydf
 
+
 #jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #jdbc.username=developer
 #jdbc.password=J5p3tgOVazNl4ydf

+ 147 - 104
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -270,7 +270,7 @@
                     AND co.rebateFlag = '1'
                 </if>
                 <if test="rebateOrder == 0">
-                    AND  co.rebateFlag = '0'
+                    AND co.rebateFlag = '0'
                 </if>
             </if>
             <if test="serviceProviderId != null and serviceProviderId != 0">
@@ -315,25 +315,27 @@
     <select id="getShopOrders" parameterType="string" resultType="NewShopOrder">
         SELECT (SELECT IFNULL(sum(shouldPayFee), 0)
                 FROM cm_order_product
-                WHERE shopOrderID = cs.shopOrderID AND payStatus = 2)  AS
-                                                                          alreadyReceipt,
+                WHERE shopOrderID = cs.shopOrderID
+                  AND payStatus = 2)  AS
+                                         alreadyReceipt,
                (SELECT IFNULL(sum(shouldPayFee), 0)
                 FROM cm_order_product
-                WHERE shopOrderID = cs.shopOrderID AND payStatus != 2) AS unReceipt,
-               cs.shopOrderID                                          AS shopOrderID,
-               co.orderID                                              AS orderID,
-               cs.shopOrderNo                                          AS shopOrderNo,
-               co.orderNo                                              AS orderNo,
-               cs.shopOrderNo                                          AS shopOrderNo,
-               cs.itemCount                                            AS itemCount,
-               cs.needPayAmount                                        AS needPayAmount,
-               co.orderType                                            AS orderType,
-               s.name                                                  AS shopName,
-               bou.shouHuoRen                                          AS receiver,
-               u.name                                                  AS buyer,
-               co.orderSource                                          AS orderSource,
-               co.orderTotalFee                                        AS orderTotalFee,
-               co.orderTime                                            AS orderTime
+                WHERE shopOrderID = cs.shopOrderID
+                  AND payStatus != 2) AS unReceipt,
+               cs.shopOrderID         AS shopOrderID,
+               co.orderID             AS orderID,
+               cs.shopOrderNo         AS shopOrderNo,
+               co.orderNo             AS orderNo,
+               cs.shopOrderNo         AS shopOrderNo,
+               cs.itemCount           AS itemCount,
+               cs.needPayAmount       AS needPayAmount,
+               co.orderType           AS orderType,
+               s.name                 AS shopName,
+               bou.shouHuoRen         AS receiver,
+               u.name                 AS buyer,
+               co.orderSource         AS orderSource,
+               co.orderTotalFee       AS orderTotalFee,
+               co.orderTime           AS orderTime
         FROM cm_shop_order cs
                  LEFT JOIN cm_order co ON cs.orderNo = co.orderNo
                  LEFT JOIN shop s ON cs.shopID = s.shopID
@@ -632,7 +634,7 @@
 
     <update id="updateStatus" parameterType="NewOrder">
         UPDATE cm_order
-        SET status = #{status},
+        SET status    = #{status},
             closeTime = NOW()
         WHERE orderID = #{orderID}
     </update>
@@ -976,29 +978,35 @@
         WHERE orderID = #{orderId}
     </update>
     <update id="updateOnlinePayFlag">
-        update cm_order set onlinePayFlag = #{onlinePayFlag} where orderID = #{orderId}
+        update cm_order
+        set onlinePayFlag = #{onlinePayFlag}
+        where orderID = #{orderId}
     </update>
     <update id="updateShopOrderByPayStatus">
-        UPDATE cm_shop_order SET
-        payStatus = #{payStatus}, payedShopAmount = #{paidShop}
+        UPDATE cm_shop_order
+        SET payStatus       = #{payStatus},
+            payedShopAmount = #{paidShop}
         WHERE shopOrderID = #{shopOrderId}
     </update>
     <update id="updateOrderByPayStatus">
-        UPDATE cm_order SET
-            payStatus = #{payStatus}
+        UPDATE cm_order
+        SET payStatus = #{payStatus}
         WHERE orderID = #{orderId}
     </update>
     <update id="updateBySplitStatus">
-        UPDATE cm_receipt_order_relation SET splitStatus = 1 WHERE mbOrderId = #{mbOrderId}
+        UPDATE cm_receipt_order_relation
+        SET splitStatus = 1
+        WHERE mbOrderId = #{mbOrderId}
     </update>
     <update id="updateSettleStatus">
         update cm_split_account
         set settleStatus = 1
         where shopOrderId = #{shopOrderId}
-        and productType = #{productType}
+          and productType = #{productType}
     </update>
     <update id="updateShopOrderSettleStatus">
-        update cm_shop_order set settleStatus = #{settleStatus}
+        update cm_shop_order
+        set settleStatus = #{settleStatus}
         where shopOrderId = #{shopOrderId}
     </update>
     <delete id="deleteCouponOrderRecord">
@@ -1009,16 +1017,16 @@
 
     <select id="getUndividedPaidReceipt" resultType="com.caimei.modules.order.entity.OrderReceiptRelationPo">
         SELECT cror.id,
-               cror.relationType,
-               cror.receiptId,
-               cror.associateAmount,
-               cror.orderId,
-               cror.delFlag,
-               cror.mbOrderId,
-               cror.orderRequestNo,
-               cror.splitStatus,
-               cror.shopOrderId,
-               cdr.payType
+        cror.relationType,
+        cror.receiptId,
+        cror.associateAmount,
+        cror.orderId,
+        cror.delFlag,
+        cror.mbOrderId,
+        cror.orderRequestNo,
+        cror.splitStatus,
+        cror.shopOrderId,
+        cdr.payType
         FROM cm_receipt_order_relation cror
         LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
         LEFT JOIN cm_order co ON cror.orderID = co.orderID
@@ -1026,17 +1034,19 @@
         LEFT JOIN cm_order_product cop ON co.shopOrderIDs = cop.shopOrderID
         LEFT JOIN product p ON cop.productID = p.productID
         WHERE cror.relationType = 2
-          AND cso.receiptStatus=3
-          AND cror.delFlag = 0
-          AND cror.mbOrderId IS NOT NULL
-          AND cror.splitStatus = 0
-          AND cdr.payWay = 1
-          AND cdr.receiptDate <![CDATA[  <=  ]]> #{currentTime}
-          AND co.organizeID = 0
-          AND co.orderType != 2
-          AND co.refundType != 2
-          -- AND p.splitCode != 'E1807059160'
-          AND co.orderID NOT IN (SELECT orderID FROM cm_order_product cops LEFT JOIN product ps ON cops.productID = ps.productID WHERE ps.splitCode = 'E1807059160' AND cops.orderID = cop.orderID)
+        <if test="shopOrderIds !=null and shopOrderIds !=''">
+            and cror.shopOrderId=#{shopOrderIds}
+        </if>
+        AND cso.receiptStatus=3
+        AND cror.delFlag = 0
+        AND cror.mbOrderId IS NOT NULL
+        AND cror.splitStatus = 0
+        AND cdr.payWay = 1
+        AND cdr.receiptDate <![CDATA[  <=  ]]> #{currentTime}
+        AND co.organizeID = 0
+        AND co.orderType != 2
+        AND co.refundType != 2
+        AND p.splitCode != 'E1807059160'
     </select>
 
     <select id="getOnlineBalance" resultType="com.caimei.modules.order.entity.OrderReceiptRelationPo">
@@ -1236,9 +1246,10 @@
         LIMIT 1
     </select>
     <select id="findSupport" resultType="java.lang.Integer">
-        SELECT s.chargeSupport FROM shop s
-        LEFT JOIN cm_shop_order cso ON cso.shopId= s.shopId
-        WHERE cso.shopOrderId=#{shopOrderId}
+        SELECT s.chargeSupport
+        FROM shop s
+                 LEFT JOIN cm_shop_order cso ON cso.shopId = s.shopId
+        WHERE cso.shopOrderId = #{shopOrderId}
     </select>
     <select id="getOrderProductByShopOrderId" resultType="com.caimei.modules.order.entity.OrderProductVo">
         SELECT cop.orderProductID                                                 AS orderProductId,
@@ -1287,8 +1298,8 @@
                p.productCategory                                                  as productCategory,
                p.splitCode
         FROM cm_order_product cop
-        LEFT JOIN product p ON cop.productID = p.productID
-        left join cm_order co on co.orderID = cop.orderID
+                 LEFT JOIN product p ON cop.productID = p.productID
+                 left join cm_order co on co.orderID = cop.orderID
         WHERE cop.shopOrderID = #{shopOrderId}
           AND IF(co.userBeans = 0, 1 = 1, cop.shopid != 998)
         ORDER BY cop.discountPrice DESC
@@ -1326,105 +1337,137 @@
           AND orderID = #{orderId}
     </select>
     <select id="getSplitAccountList" resultType="com.caimei.modules.order.entity.SplitAccountPo">
-        SELECT
-            id,
-            orderId,
-            productId,
-            orderProductId,
-            shopId,
-            type,
-            subUserNo,
-            SUM(splitAccount) AS splitAccount,
-            mbOrderId,
-            orderRequestNo,
-            payStatus,
-            productType
+        SELECT id,
+               orderId,
+               productId,
+               orderProductId,
+               shopId,
+               type,
+               subUserNo,
+               SUM(splitAccount) AS splitAccount,
+               mbOrderId,
+               orderRequestNo,
+               payStatus,
+               productType
         FROM cm_split_account
-        WHERE type = 4 AND payStatus = 1 AND splitAccount > 0
+        WHERE type = 4
+          AND payStatus = 1
+          AND splitAccount > 0
           AND mbOrderId = #{mbOrderId}
         GROUP BY shopId
     </select>
     <select id="getPaidShopAmount" resultType="java.lang.Double">
         SELECT SUM(payAmount)
         FROM cm_pay_shop_record
-        WHERE STATUS = 1 AND delFlag = 0 AND shopOrderID = #{shopOrderId}
+        WHERE STATUS = 1
+          AND delFlag = 0
+          AND shopOrderID = #{shopOrderId}
     </select>
     <select id="findOnlinePay" resultType="java.lang.Integer">
-        SELECT COUNT(*) FROM
-        cm_receipt_order_relation cror
-        LEFT JOIN cm_discern_receipt cdr ON cdr.id = receiptID
-        LEFT JOIN cm_order co ON cror.orderId = co.orderId
-        WHERE cdr.payWay=1
+        SELECT COUNT(*)
+        FROM cm_receipt_order_relation cror
+                 LEFT JOIN cm_discern_receipt cdr ON cdr.id = receiptID
+                 LEFT JOIN cm_order co ON cror.orderId = co.orderId
+        WHERE cdr.payWay = 1
           AND co.orderType != 2
-          AND cror.orderID=#{orderID}
+          AND cror.orderID = #{orderID}
     </select>
     <select id="findSplitCode" resultType="java.lang.String">
-        select splitCode from cm_shop_order where shopOrderID = #{shopOrderId}
+        select splitCode
+        from cm_shop_order
+        where shopOrderID = #{shopOrderId}
     </select>
     <select id="findPayAmount" resultType="java.lang.Double">
-        SELECT SUM(splitAccount) FROM cm_split_account csa
-        LEFT JOIN cm_receipt_order_relation cror ON csa.shopOrderId=cror.shopOrderId
+        SELECT SUM(splitAccount)
+        FROM cm_split_account csa
+                 LEFT JOIN cm_receipt_order_relation cror ON csa.shopOrderId = cror.shopOrderId
         WHERE csa.shopOrderId = #{shopOrderId}
-          AND csa.type=5
+          AND csa.type = 5
           AND csa.settleStatus = 0
           AND csa.productType = 3
-          AND cror.splitStatus =1
-          AND cror.delflag=0
+          AND cror.splitStatus = 1
+          AND cror.delflag = 0
     </select>
     <select id="findShouldPayShopAmount" resultType="java.lang.Double">
-        select shouldPayShopAmount from cm_shop_order where shopOrderID = #{shopOrderId}
+        select shouldPayShopAmount
+        from cm_shop_order
+        where shopOrderID = #{shopOrderId}
     </select>
     <select id="findSettleSum" resultType="java.lang.Double">
-        SELECT IFNULL(SUM(settleAmount),0) FROM cm_settle_record
+        SELECT IFNULL(SUM(settleAmount), 0)
+        FROM cm_settle_record
         WHERE settleType = 1
           AND shopOrderId = 24665
     </select>
     <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
-        select distinct
-        csr.settleAmount,csr.shopOrderId,csr.settleTime from cm_settle_record csr
-        left join cm_shop_order cso on csr.shopOrderId = cso.shopOrderID
-        where cso.orderID=#{orderID}
-        and settleType = 2
+        select distinct csr.settleAmount,
+                        csr.shopOrderId,
+                        csr.settleTime,
+                        csr.settleType
+        from cm_settle_record csr
+                 left join cm_shop_order cso on csr.shopOrderId = cso.shopOrderID
+        where cso.orderID = #{orderID}
     </select>
     <select id="findSettleAmount" resultType="java.lang.Double">
-        SELECT ifnull(SUM(settleAmount),0)
+        SELECT ifnull(SUM(settleAmount), 0)
         FROM cm_settle_record csr
-        LEFT JOIN cm_shop_order cso ON csr.shopOrderId = cso.shopOrderId
-        WHERE settleType=1
-          AND cso.orderId=#{orderID}
+                 LEFT JOIN cm_shop_order cso ON csr.shopOrderId = cso.shopOrderId
+        WHERE settleType = 1
+          AND cso.orderId = #{orderID}
     </select>
     <select id="findShopOrderSize" resultType="java.lang.Integer">
-        SELECT COUNT(*) FROM cm_shop_order WHERE orderId=#{orderID}
-                                             AND shopId!=998
+        SELECT COUNT(*)
+        FROM cm_shop_order
+        WHERE orderId = #{orderID}
+          AND shopId != 998
+    </select>
+    <select id="findSplitCount" resultType="java.lang.Integer">
+        SELECT COUNT(*)
+        FROM cm_split_account
+        WHERE orderid = #{orderID}
+    </select>
+    <select id="getSplitRecord" resultType="com.caimei.modules.order.entity.SplitAccountPo">
+        select orderId, shopOrderId, splitTime, productType, splitAccount
+        from cm_split_account
+        where orderId = #{orderId}
+    </select>
+    <select id="getSplitTime" resultType="java.lang.Integer">
+        SELECT COUNT(*) FROM cm_split_account WHERE shopOrderId=#{shopOrderId}
+        AND DATE_ADD(splitTime,INTERVAL 1 DAY) <![CDATA[  <  ]]> now()
     </select>
     <insert id="insertSplitAccount">
         INSERT INTO cm_split_account (orderId, productId, orderProductId, shopId, couponRecordId, vipRecordId,
                                       authVipRecordId, type, subUserNo, splitAccount,
-                                      mbOrderId, orderRequestNo, payStatus, productType, shopOrderId ,splitTime)
+                                      mbOrderId, orderRequestNo, payStatus, productType, shopOrderId, splitTime)
         VALUES (#{orderId}, #{productId}, #{orderProductId}, #{shopId}, #{couponRecordId}, #{vipRecordId},
                 #{authVipRecordId}, #{type}, #{subUserNo}, #{splitAccount},
-                #{mbOrderId}, #{orderRequestNo}, #{payStatus}, #{productType},#{shopOrderId}, NOW());
+                #{mbOrderId}, #{orderRequestNo}, #{payStatus}, #{productType}, #{shopOrderId}, NOW());
     </insert>
     <insert id="insertPayShop" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
         INSERT INTO cm_pay_shop (shopID, name, bankAccountName, bankAccount, bankName, type, totalAmount, balancePayFee,
-                                 transferPayFee, payType, wipePayment, wipeRemarks, wipeRemarkImages, wipeTime, applicant,
+                                 transferPayFee, payType, wipePayment, wipeRemarks, wipeRemarkImages, wipeTime,
+                                 applicant,
                                  applyTime, reviewer, reviewTime, payTime, status, reason, delFlag)
-        VALUES (#{shopId}, #{name}, #{bankAccountName}, #{bankAccount}, #{bankName}, #{type}, #{totalAmount}, #{balancePayFee},
-                #{transferPayFee}, #{payType}, #{wipePayment}, #{wipeRemarks}, #{wipeRemarkImages}, #{wipeTime}, #{applicant},
+        VALUES (#{shopId}, #{name}, #{bankAccountName}, #{bankAccount}, #{bankName}, #{type}, #{totalAmount},
+                #{balancePayFee},
+                #{transferPayFee}, #{payType}, #{wipePayment}, #{wipeRemarks}, #{wipeRemarkImages}, #{wipeTime},
+                #{applicant},
                 #{applyTime}, #{reviewer}, #{reviewTime}, #{payTime}, #{status}, #{reason}, #{delFlag})
     </insert>
-    <insert id="insertPayShopRecord" keyColumn="id" keyProperty="id"  useGeneratedKeys="true">
-        INSERT INTO cm_pay_shop_record (shopID, shopOrderID, shopOrderNo, payAmount, wipePayment, payType, payTime, payShopID, status, delFlag)
-        VALUES (#{shopId}, #{shopOrderId}, #{shopOrderNo}, #{payAmount}, #{wipePayment}, #{payType}, #{payTime}, #{payShopId}, #{status}, #{delFlag})
+    <insert id="insertPayShopRecord" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO cm_pay_shop_record (shopID, shopOrderID, shopOrderNo, payAmount, wipePayment, payType, payTime,
+                                        payShopID, status, delFlag)
+        VALUES (#{shopId}, #{shopOrderId}, #{shopOrderNo}, #{payAmount}, #{wipePayment}, #{payType}, #{payTime},
+                #{payShopId}, #{status}, #{delFlag})
     </insert>
     <insert id="insertSettleRecord">
         INSERT INTO cm_settle_record(settleamount, settletype, shoporderid, splitcode, settletime)
-        VALUES (#{settleAmount},#{settleType},#{shopOrderId},#{splitCode},now())
+        VALUES (#{settleAmount}, #{settleType}, #{shopOrderId}, #{splitCode}, now())
     </insert>
 
     <update id="updateBrokerage">
-        UPDATE cm_shop_order SET
-            brokerage = #{brokerage}
+        UPDATE cm_shop_order
+        SET brokerage = #{brokerage}
         WHERE shopOrderID = #{shopOrderID}
     </update>
 

+ 106 - 53
src/main/webapp/WEB-INF/views/modules/bulkpurchase/settlementRecord.jsp

@@ -51,21 +51,33 @@
             line-height: 30px;
             padding-left: 8px;
         }
-        .zeroCost .message{
-            display:none;
-            position:absolute;
-            background:#FFF;
-            white-space:nowrap;
-            border:1px solid black;
+
+        .zeroCost .message {
+            display: none;
+            position: absolute;
+            background: #FFF;
+            white-space: nowrap;
+            border: 1px solid black;
 
         }
-        .zeroCost:hover .message{
+
+        .zeroCost:hover .message {
             display: inline-block;
             color: black;
             padding: 5px;
             margin-left: 10px;
         }
-        .weishaIcon {background:darkorange;color:white;margin:0 0px;padding:0 3px;font-style:normal;font-size: 12px; display:inline-block;border-radius:2px}
+
+        .weishaIcon {
+            background: darkorange;
+            color: white;
+            margin: 0 0px;
+            padding: 0 3px;
+            font-style: normal;
+            font-size: 12px;
+            display: inline-block;
+            border-radius: 2px
+        }
     </style>
     <script type="text/javascript">
         $(document).ready(function () {
@@ -109,7 +121,12 @@
     <c:if test="${from eq '3'}">
         <li><a href="${ctx}/shopOrder/checkPaymentOrder">订单财务信息</a></li>
     </c:if>
-    <li class="active"><a href="#">收退款记录</a></li>
+    <c:if test="${pageType==1}">
+        <li class="active"><a href="#">结算记录</a></li>
+    </c:if>
+    <c:if test="${pageType==2}">
+        <li class="active"><a href="#">分账记录</a></li>
+    </c:if>
 </ul>
 <br/>
 <table id="orderTable" class="table table-striped table-bordered table-condensed">
@@ -183,7 +200,8 @@
             </c:if>
 
             <c:if test="${order.zeroCostFlag eq 1}">
-                <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg" style="width: 15px;margin-bottom: 4px"></span>
+                <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg"
+                                                                   style="width: 15px;margin-bottom: 4px"></span>
                     <div class="message">
                         <span>商品成本为0,直接置为已付款,无需付款供应商</span>
                     </div>
@@ -191,35 +209,36 @@
             </c:if>
         </td>
         <c:if test="${order.onlinePayFlag == 0}">
+            <td>
+                结算状态:
+                <c:if test="${order.settleStatus == 1}">
+                    <font color="red">待结算</font>
+                </c:if>
+                <c:if test="${order.settleStatus == 2}">
+                    <font color="#ff8c00">部分结算</font>
+                </c:if>
+                <c:if test="${order.settleStatus == 3}">
+                    <font color="green">已结算</font>
+                </c:if>
+            </td>
+        </c:if>
         <td>
-            结算状态:
-            <c:if test="${order.settleStatus == 1}">
-                <font color="red">待结算</font>
+            <%--            退款(退货)状态:${fns:getDictLabel(order.refundType,'refundType' ,'' )}--%>
+            <c:if test="${order.refundType == 1}">
+                <font color="red">待发货</font>
             </c:if>
-            <c:if test="${order.settleStatus == 2}">
-                <font color="#ff8c00">部分结算</font>
+            <c:if test="${order.refundType == 2}">
+                <font color="#ff8c00">部分发货</font>
             </c:if>
-            <c:if test="${order.settleStatus == 3}">
-                <font color="green">已结算</font>
+            <c:if test="${order.refundType == 3}">
+                <font color="green">已发货</font>
             </c:if>
         </td>
-        </c:if>
-        <td>
-<%--            退款(退货)状态:${fns:getDictLabel(order.refundType,'refundType' ,'' )}--%>
-    <c:if test="${order.refundType == 1}">
-        <font color="red">待发货</font>
-    </c:if>
-    <c:if test="${order.refundType == 2}">
-        <font color="#ff8c00">部分发货</font>
-    </c:if>
-    <c:if test="${order.refundType == 3}">
-        <font color="green">已发货</font>
-    </c:if>
-        </td>
     </tr>
     <tr>
         <td>
-            机构:${order.bpOrderUserinfo.name}<c:if test="${order.organizeID == 3}"></c:if>
+            机构:${order.bpOrderUserinfo.name}
+            <c:if test="${order.organizeID == 3}"></c:if>
         </td>
         <td>
             收货人:${order.bpOrderUserinfo.shouHuoRen}
@@ -236,19 +255,23 @@
             订单金额:¥${order.payTotalFee}
             <c:if test="${not empty order.couponOrderRecord}">
                 <c:if test="${order.couponOrderRecord.couponType eq 0}">
-                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(活动券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font
+                            color="red">(活动券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
                 </c:if>
                 <c:if test="${order.couponOrderRecord.couponType eq 1}">
-                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(品类券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font
+                            color="red">(品类券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
                 </c:if>
                 <c:if test="${order.couponOrderRecord.couponType eq 2}">
                     <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(用户专享券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
                 </c:if>
                 <c:if test="${order.couponOrderRecord.couponType eq 3}">
-                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(店铺券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font
+                            color="red">(店铺券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
                 </c:if>
                 <c:if test="${order.couponOrderRecord.couponType eq 4}">
-                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font color="red">(新用户券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
+                    <a href="${ctx}/coupon/cmCouponClub/couponDetails?userId=${order.userID}"><font
+                            color="red">(新用户券抵扣¥${order.couponOrderRecord.couponAmount},满${order.couponOrderRecord.touchPrice}减${order.couponOrderRecord.couponAmount})</font></a>
                 </c:if>
             </c:if>
             <c:if test="${not empty order.heheCouponRecord}">
@@ -295,27 +318,57 @@
         </td>
     </tr>
 </table>
-<c:if test="${not empty settleRecord}">
-    <div class="record-title">佣金结算记录:</div>
-    <table id="refundTable" class="table table-striped table-bordered table-condensed">
-        <tr>
-            <th class="table-order">序号</th>
-            <th class="table-id">子订单ID</th>
-            <th class="table-cell3">结算时间</th>
-            <th class="table-cell4">结算金额</th>
-        </tr>
-        <c:forEach items="${settleRecord}" var="settle" varStatus="s">
+<c:if test="${pageType==1}">
+    <c:if test="${not empty settleRecord}">
+        <div class="record-title">结算记录:</div>
+        <table id="refundTable" class="table table-striped table-bordered table-condensed">
             <tr>
-                <td>${s.index + 1}</td>
-                <td>${settle.shopOrderId}</td>
-                <td><fmt:formatDate value="${settle.settleTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
-                <td><fmt:formatNumber value="${settle.settleAmount}" type="currency"/></td>
+                <th class="table-order">序号</th>
+                <th class="table-id">子订单ID</th>
+                <th class="table-cell3">结算时间</th>
+                <th class="table-cell4">供应商结算金额</th>
+                <th class="table-cell4">佣金结算金额</th>
             </tr>
-        </c:forEach>
-    </table>
+            <c:forEach items="${settleRecord}" var="settle" varStatus="s">
+                <tr>
+                    <td>${s.index + 1}</td>
+                    <td>${settle.shopOrderId}</td>
+                    <td><fmt:formatDate value="${settle.settleTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+                    <td><fmt:formatNumber value="${settle.settleType ==1?settle.settleAmount:0}" type="currency"/></td>
+                    <td><fmt:formatNumber value="${settle.settleType ==2?settle.settleAmount:0}" type="currency"/></td>
+                </tr>
+            </c:forEach>
+        </table>
+    </c:if>
+    <c:if test="${empty settleRecord}">
+        <div class="record-title">结算记录: 无</div>
+    </c:if>
 </c:if>
-<c:if test="${empty settleRecord}">
-    <div class="record-title">佣金结算记录: 无</div>
+<c:if test="${pageType==2}">
+    <c:if test="${not empty splitRecord}">
+        <div class="record-title">分账记录:</div>
+        <table id="refundTable" class="table table-striped table-bordered table-condensed">
+            <tr>
+                <th class="table-order">序号</th>
+                <th class="table-id">子订单ID</th>
+                <th class="table-cell3">分账时间</th>
+                <th class="table-cell4">供应商分账金额</th>
+                <th class="table-cell5">采美分账金额</th>
+            </tr>
+            <c:forEach items="${splitRecord}" var="split" varStatus="s">
+                <tr>
+                    <td>${s.index + 1}</td>
+                    <td>${split.shopOrderId}</td>
+                    <td><fmt:formatDate value="${split.splitTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+                    <td><fmt:formatNumber value="${split.productType ==1?split.splitAccount:0}" type="currency"/></td>
+                    <td><fmt:formatNumber value="${split.productType ==3?split.splitAccount:0}" type="currency"/></td>
+                </tr>
+            </c:forEach>
+        </table>
+    </c:if>
+    <c:if test="${empty splitRecord}">
+        <div class="record-title">分账记录: 无</div>
+    </c:if>
 </c:if>
 
 <script type="text/javascript" src="${ctxStatic}/modules/bulkpurchase/loadAddress.js"></script>

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

@@ -678,8 +678,11 @@
                 </c:forEach>
             </table>
             <div style="float:right">
+                <c:if test="${s.splitCount>0}">
+                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/toSettleRecord?orderID=${s.orderID}&pageType=2">分账记录</a>
+                </c:if>
                 <c:if test="${s.settleRecordNum>0}">
-                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toSettleRecord?orderID=${s.orderID}">佣金结算记录</a>
+                <a href="${ctx}/bulkpurchase/cmRefundsProduct/toSettleRecord?orderID=${s.orderID}&pageType=1">结算记录</a>
                 </c:if>
                 <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord?orderID=${s.orderID}&from=3">收付款记录</a>&nbsp;&nbsp;&nbsp;
                 <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID?orderID=${s.orderID}&from=3">用户退款/货记录</a>&nbsp;&nbsp;&nbsp;

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

@@ -379,7 +379,7 @@
                                 已付款
                             </c:if>
                             <c:if test="${s.paying ne '1' && s.payStatus ne '3' }">
-                                <input type="checkbox" ${s.status eq 7 || (s.onlineFlag>0 && s.splitCode ne 'E1807059160') ?'disabled':''}
+                                <input type="checkbox" ${s.status eq 7 ?'disabled':''}
                                        data-shoporderid="${s.shopOrderID}" data-shopid="${s.shopID}" data-isPayShopOtherFee="${s.payShopOtherFee}"/>
                             </c:if>
                         </c:if>

+ 22 - 5
src/main/webapp/WEB-INF/views/modules/order/cmSettlementList.jsp

@@ -344,7 +344,7 @@
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
                     <th style="width:20px;">
-                        <input type="checkbox" class="checkShop" data-shoporderid="${s.shopOrderID}" data-shopid="${s.shopID}" data-isPayShopOtherFee="${s.payShopOtherFee}" onclick="changeCheck()"/>
+                        <input type="checkbox" class="checkShop" data-shoporderid="${s.shopOrderID}" data-shopid="${s.shopID}" data-isPayShopOtherFee="${s.payShopOtherFee}" onclick="changeCheck(this)"/>
                     </th>
                     <th>子订单编号(ID)</th>
                     <th colspan="3">订单编号(ID)</th>
@@ -623,11 +623,12 @@
 <div class="pagination">${page}</div>
 
 <script>
-    function changeCheck(){
+    function changeCheck(el){
         var checked = $('input[type=checkbox]:checked');
-        if (checked.length >= 1) {
+        if (checked.length > 1) {
             // $(".checkShop").attr('disabled','true');
             alertx("请最多选择一个子订单进行结算");
+            $(el).prop('checked',false);
             return false;
         }
     }
@@ -819,10 +820,11 @@
         });
 
         $('#apply').on('click', function () {
+            var shopOrderId='';
             var checked = $('.pay-wrapper input[type=checkbox]:checked'), params = '?';
             for (var i = 0; i < checked.length; i++) {
-                var shoporderId = $(checked[i]).attr('data-shoporderid');
-                params += ('&shopOrderIDs=' + shoporderId);
+                shopOrderId = $(checked[i]).attr('data-shoporderid');
+                params += ('&shopOrderIDs=' + shopOrderId);
             }
             if (checked.length < 1 || params == '?') {
                 alertx('请至少选择一个订单');
@@ -832,6 +834,21 @@
                 alertx('每次只能选择一个子订单进行结算申请');
                 return false;
             }
+            var flag=0;
+            debugger;
+            $.ajax({
+                url: "${ctx}/order/cmPayShop/settleTime",
+                data: {"shopOrderId":shopOrderId},
+                type: "POST",
+                async: false,
+                success: function(data){
+                    flag=data.flag;
+                }
+            });
+            if(flag===1){
+                alertx('该子订单暂未到结算时间,请于T+1后的工作日再申请结算(T指子订单分账时间)');
+                return false;
+            }
             window.location.href = '${ctx}/order/cmPayShop/settleEdit' + params;
         });
 

+ 57 - 36
src/main/webapp/WEB-INF/views/modules/order/cmSplitAccountList.jsp

@@ -305,16 +305,20 @@
     <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
     <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
     <div class="pay-status">
-        <span style="color: red">点击右侧分账按钮,可将以下展示的所有子订单金额进行分账,将佣金分账给采美。 </span>
-        <input id="btnSubmit" class="btn btn-primary" type="submit" onclick="return confirmx('确定将展示的子订单全部分账吗?', '${ctx}/splitAccount/split')" value="手动分账"/>
+        <span style="color: red">每次选择一个子订单申请分账,系统将佣金分账给采美,付供应商的金额依然还在合利宝账户,需要再进行手动结算。 </span>
+<%--        <input id="btnSubmit" class="btn btn-primary" type="submit" onclick="return confirmx('确定将展示的子订单全部分账吗?', '${ctx}/splitAccount/split')" value="手动分账"/>--%>
     </div>
 </form:form>
 <sys:message content="${message}"/>
 <div class="pay-wrapper">
+    <button id="apply" class="t-btn" style="color:white;background-color:#2F6FAB">申请分账</button>
     <c:forEach items="${page.list}" var="s" varStatus="sIndex">
         <div class="pay-list-item">
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
+                    <th style="width:20px;" rowspan="6">
+                        <input type="checkbox" class="checkShop" data-shoporderid="${s.shopOrderID}" data-shopid="${s.shopID}" onclick="changeCheck(this)"/>
+                    </th>
                     <th>子订单编号(ID)</th>
                     <th colspan="3">订单编号(ID)</th>
                     <th colspan="2">订单金额</th>
@@ -504,25 +508,25 @@
                     </tr>
                 </c:forEach>
             </table>
-            <div class="pay-more-func">
-                <c:if test="${s.paying ne '1' and s.payStatus eq '1' and !s.modifyPayable}">
-                    <shiro:hasPermission name="order:cmPayShop:modifyPay">
-                        <a href="${ctx}/shopOrder/toChangePayShopAmount?shopOrderID=${s.shopOrderID}">修改成本</a>
-                    </shiro:hasPermission>
-                </c:if>
-                <c:if test="${(s.modifyPayable and s.paying ne '1') || s.payStatus eq '2'}">
-                    <a href="${ctx}/order/cmPayShop/differencePriceForm?shopOrderId=${s.shopOrderID}">供应商差价</a>
-                </c:if>
-                <c:if test="${s.paying ne '1' and s.payStatus eq '2'}">
-                    <c:if test="${!s.modifyPayable || s.receiptStatus eq '3'}">
-                        <shiro:hasPermission name="order:cmPayShop:modifyPay">
-                            <a href="${ctx}/shopOrder/toApplyPayWipe?shopOrderID=${s.shopOrderID}">付款抹平</a>
-                        </shiro:hasPermission>
-                    </c:if>
-                </c:if>
-                <a href="${ctx}/shopOrder/payShopRemark?shopOrderId=${s.shopOrderID}">应付备注</a>
-                <a href="${ctx}/shopOrder/payedAndRefundRecordList?shopOrderID=${s.shopOrderID}&operatingMode=${operatingMode}">退/付款记录</a>
-            </div>
+<%--            <div class="pay-more-func">--%>
+<%--                <c:if test="${s.paying ne '1' and s.payStatus eq '1' and !s.modifyPayable}">--%>
+<%--                    <shiro:hasPermission name="order:cmPayShop:modifyPay">--%>
+<%--                        <a href="${ctx}/shopOrder/toChangePayShopAmount?shopOrderID=${s.shopOrderID}">修改成本</a>--%>
+<%--                    </shiro:hasPermission>--%>
+<%--                </c:if>--%>
+<%--                <c:if test="${(s.modifyPayable and s.paying ne '1') || s.payStatus eq '2'}">--%>
+<%--                    <a href="${ctx}/order/cmPayShop/differencePriceForm?shopOrderId=${s.shopOrderID}">供应商差价</a>--%>
+<%--                </c:if>--%>
+<%--                <c:if test="${s.paying ne '1' and s.payStatus eq '2'}">--%>
+<%--                    <c:if test="${!s.modifyPayable || s.receiptStatus eq '3'}">--%>
+<%--                        <shiro:hasPermission name="order:cmPayShop:modifyPay">--%>
+<%--                            <a href="${ctx}/shopOrder/toApplyPayWipe?shopOrderID=${s.shopOrderID}">付款抹平</a>--%>
+<%--                        </shiro:hasPermission>--%>
+<%--                    </c:if>--%>
+<%--                </c:if>--%>
+<%--                <a href="${ctx}/shopOrder/payShopRemark?shopOrderId=${s.shopOrderID}">应付备注</a>--%>
+<%--                <a href="${ctx}/shopOrder/payedAndRefundRecordList?shopOrderID=${s.shopOrderID}&operatingMode=${operatingMode}">退/付款记录</a>--%>
+<%--            </div>--%>
         </div>
     </c:forEach>
 </div>
@@ -610,6 +614,16 @@
     <p style="text-align: center;"><font color="#1e90ff">暂无待分账子订单……</font></p>
 </c:if>
 <script>
+    function changeCheck(el){
+        var checked = $('input[type=checkbox]:checked');
+        if (checked.length > 1) {
+            // $(".checkShop").attr('disabled','true');
+            alertx("请最多选择一个子订单进行分账");
+            $(el).prop('checked',false);
+            return false;
+        }
+    }
+
     (function () {
         var payTableEle = $('.pay-table'),
             payProductEle = $('.pay-product-item');
@@ -798,22 +812,29 @@
         });
 
         $('#apply').on('click', function () {
-            var checked = $('.pay-wrapper input[type=checkbox]:checked'), params = '?';
-            for (var i = 0; i < checked.length; i++) {
-                var shoporderId = $(checked[i]).attr('data-shoporderid');
-                params += ('&shopOrderIDs=' + shoporderId);
-                var receiptStatus = $(checked[i]).attr('data-receiptStatus');
-                var modifyPayable = $(checked[i]).attr('data-modifyPayable');
-                if (modifyPayable && "3" != receiptStatus) {
-                    alertx('存在母订单线上支付尚未完成的情况,子订单(' + shoporderId + ')不能申请付款');
-                    return false;
+            top.$.jBox.confirm('确定对该子订单申请分账吗?','系统提示',function(v,h,f){
+                if(v=="ok"){
+                    var checked = $('.pay-wrapper input[type=checkbox]:checked'), params = '?';
+                    for (var i = 0; i < checked.length; i++) {
+                        var shoporderId = $(checked[i]).attr('data-shoporderid');
+                        params += ('&shopOrderIDs=' + shoporderId);
+                        var receiptStatus = $(checked[i]).attr('data-receiptStatus');
+                        var modifyPayable = $(checked[i]).attr('data-modifyPayable');
+                        if (modifyPayable && "3" != receiptStatus) {
+                            alertx('存在母订单线上支付尚未完成的情况,子订单(' + shoporderId + ')不能申请付款');
+                            return false;
+                        }
+                    }
+                    if (checked.length < 1 || params == '?') {
+                        alertx('请至少选择一个订单');
+                        return false;
+                    }
+                    window.location.href = '${ctx}/order/cmPayShop/splitEdit' + params;
                 }
-            }
-            if (checked.length < 1 || params == '?') {
-                alertx('请至少选择一个订单');
-                return false;
-            }
-            window.location.href = '${ctx}/order/cmPayShop/applyEdit' + params;
+            });
+
+
+
         });
 
         //付第三方