Browse Source

财务信息

huangzhiguo 1 year ago
parent
commit
3caf25242b
22 changed files with 696 additions and 438 deletions
  1. 3 1
      src/main/java/com/caimei/modules/order/dao/CmReceiptOrderRelationDao.java
  2. 12 0
      src/main/java/com/caimei/modules/order/dao/NewShopOrderDao.java
  3. 9 0
      src/main/java/com/caimei/modules/order/entity/NewOrder.java
  4. 45 0
      src/main/java/com/caimei/modules/order/entity/NewShopOrder.java
  5. 2 2
      src/main/java/com/caimei/modules/order/service/CmPayShopService.java
  6. 3 0
      src/main/java/com/caimei/modules/order/service/NewOrderService.java
  7. 59 33
      src/main/java/com/caimei/modules/order/service/NewShopOrderService.java
  8. 17 17
      src/main/java/com/caimei/modules/order/web/CmShopOrderController.java
  9. 10 1
      src/main/resources/mappings/modules/order/CmReceiptOrderRelationMapper.xml
  10. 6 0
      src/main/resources/mappings/modules/order/OrderMapper.xml
  11. 123 0
      src/main/resources/mappings/modules/order/ShopOrderMapper.xml
  12. 143 186
      src/main/webapp/WEB-INF/views/modules/order/checkPaymentOrder.jsp
  13. 1 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopCheck.jsp
  14. 1 0
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopDetail.jsp
  15. 2 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp
  16. 2 1
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp
  17. 1 0
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopList.jsp
  18. 49 27
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherPrintDetail.jsp
  19. 26 12
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherPrintDetails.jsp
  20. 6 4
      src/main/webapp/WEB-INF/views/modules/order/cmPayShopPrintDetail.jsp
  21. 12 5
      src/main/webapp/WEB-INF/views/modules/order/newOrderList.jsp
  22. 164 147
      src/main/webapp/WEB-INF/views/modules/order/refundRecord.jsp

+ 3 - 1
src/main/java/com/caimei/modules/order/dao/CmReceiptOrderRelationDao.java

@@ -30,7 +30,9 @@ public interface CmReceiptOrderRelationDao extends CrudDao<CmReceiptOrderRelatio
 
     List<Integer> toAudit(@Param("orderID")Integer orderID);
 
-    CmReceiptOrderRelation findOrderRelation(Integer orderID);
+    CmReceiptOrderRelation findOrderRelation(@Param("orderId") Integer orderId, @Param("shopOrderId") Integer shopOrderId);
+
+    Integer getDiscernPayWay(Integer orderID);
 
     Date findOnlinePayment(Integer orderID);
 

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

@@ -50,6 +50,18 @@ public interface NewShopOrderDao extends CrudDao<NewShopOrder> {
 
     List<NewShopOrder> payThirdParties(NewShopOrder shopOrder);
 
+    List<NewShopOrder> findShopOrderList(NewShopOrder shopOrder);
+
+    Double payAmountByShopOrderId(Integer shopOrderId);
+
+    Double settleAmountByShopOrderId(Integer shopOrderId);
+
+    Double payShopAmountShopOrderId(Integer shopOrderId);
+
+    Double returnedPurchaseFeeByShopOrderId(Integer shopOrderId);
+
+    Integer findSplitCount(Integer shopOrderId);
+
     void updatePayShopAmount(NewShopOrder shopOrder);
 
     List<NewShopOrder> findByShopOrderIDs(@Param("shopOrderIDs") List<String> shopOrderIDs);

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

@@ -25,6 +25,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer organizeStoreId;    // 组织门店id
     private Integer shopOrderID;        // varchar(100) comment '子订单ID',
     private String shopOrderIDs;        // varchar(100) comment '子订单ID',
+    private String shopOrderNoAndId;     // 子订单Id和子订单编号
     private String orderSubmitType;     // char(2) comment '订单提交类型',
     private String status;      // char(2) comment '订单状态'
     // v5.0.0新状态 '0待确认,11待收待发,12待收部发,13待收全发,21部收待发,22部收部发,23部收全发,31已收待发,32已收部发,33已收全发,4交易完成,5订单完成,6已关闭,7交易全退'
@@ -422,6 +423,14 @@ public class NewOrder extends DataEntity<NewOrder> {
         this.userID = userID;
     }
 
+    public String getShopOrderNoAndId() {
+        return shopOrderNoAndId;
+    }
+
+    public void setShopOrderNoAndId(String shopOrderNoAndId) {
+        this.shopOrderNoAndId = shopOrderNoAndId;
+    }
+
     public String getShopOrderIDs() {
         return shopOrderIDs;
     }

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

@@ -50,6 +50,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Double eachDiscount;        // 分摊优惠金额
     private Double receiptAmount;       // 已付金额
     private Double restAmount;      // 待付金额
+    private Double payShopAmount;   // 已付金额 -- 付供应商
     private Integer shopReceiptStatus;      // 子订单收款状态:1待收款,2部分收款,3已收款
     private String splitCode;   // 分账号
     private Double canRefundAmount;//   float comment '退款金额',
@@ -75,6 +76,9 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
 
 
 
+    private String rebateOrder;  //是不是返佣订单 是的1,  不是的0
+    private Integer splitCount; //分账记录数
+    private Integer settleRecordNum;   //佣金结算数量
     private Integer isColdChina;//    是否包含冷链费 0不包含 1包含
     private Integer freePostageTicketID;//  int(11) comment '使用的包邮券Id,为空表示未使用包邮券',
     private Double brokerage;//        decimal(11,2) comment '佣金',
@@ -107,6 +111,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Integer userBeans; //订单采美豆数量
     private Double svipShopReduction;   //超级会员优惠
     private Integer settleStatus;    //结算状态   1未结算2部分结算3已结算
+    private Double settleAmount;    // 结算金额
     private Integer payWay; //线上支付状态 1线上 2线下 3余额抵扣
     //-------------        虚拟字段   ----------------------------
     private Double income;       //主订单总佣金
@@ -284,6 +289,13 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
         this.settleStatus = settleStatus;
     }
 
+    public Double getSettleAmount() {
+        return settleAmount;
+    }
+
+    public void setSettleAmount(Double settleAmount) {
+        this.settleAmount = settleAmount;
+    }
 
     public Integer getPayWay() {
         return payWay;
@@ -340,6 +352,31 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     public void setPromotionFullReduction(Double promotionFullReduction) {
         this.promotionFullReduction = promotionFullReduction;
     }
+
+    public String getRebateOrder() {
+        return rebateOrder;
+    }
+
+    public void setRebateOrder(String rebateOrder) {
+        this.rebateOrder = rebateOrder;
+    }
+
+    public Integer getSplitCount() {
+        return splitCount;
+    }
+
+    public void setSplitCount(Integer splitCount) {
+        this.splitCount = splitCount;
+    }
+
+    public Integer getSettleRecordNum() {
+        return settleRecordNum;
+    }
+
+    public void setSettleRecordNum(Integer settleRecordNum) {
+        this.settleRecordNum = settleRecordNum;
+    }
+
     public Integer getIsColdChina() {
         return isColdChina;
     }
@@ -1415,6 +1452,14 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
         this.restAmount = restAmount;
     }
 
+    public Double getPayShopAmount() {
+        return payShopAmount;
+    }
+
+    public void setPayShopAmount(Double payShopAmount) {
+        this.payShopAmount = payShopAmount;
+    }
+
     public Integer getShopReceiptStatus() {
         return shopReceiptStatus;
     }

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

@@ -227,7 +227,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 }
                 // 子订单已收金额
                 Double receiptAmount = cmReceiptOrderRelationDao.findReceiptByShopOrderId(so.getShopOrderID().toString());
-                so.setReceiptAmount(MathUtil.add(so.getReceiptAmount(), receiptAmount).doubleValue());
+                so.setReceiptAmount(receiptAmount);
                 totalAmount -= so.getShopOtherFee();
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
                 /*
@@ -392,7 +392,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                 }
                 // 子订单已收金额
                 Double receiptAmount = cmReceiptOrderRelationDao.findReceiptByShopOrderId(so.getShopOrderID().toString());
-                so.setReceiptAmount(MathUtil.add(so.getReceiptAmount(), receiptAmount).doubleValue());
+                so.setReceiptAmount(receiptAmount);
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
                 /* 退货数量 */
                 Integer count = 0;

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

@@ -2396,6 +2396,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 order.setShopName(shopOrders.get(0).getShopName());
             }
             int count = 0;
+            String shopOrderNoAndId = "";
             for (NewShopOrder shopOrder : order.getNewShopOrders()) {
                 shopOrder.setOrderID(order.getOrderID());
                 shopOrder.setOrderNo(order.getOrderNo());
@@ -2412,6 +2413,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                 //通过子订单ID查询子订单信息
                 NewShopOrder newShopOrder = newShopOrderDao.get(String.valueOf(shopOrderID));
                 if (null != newShopOrder) {
+                    shopOrderNoAndId += newShopOrder.getShopOrderNo()+"("+newShopOrder.getShopOrderID()+")<br>";
                     shopOrder.setFee(newShopOrder.getFee());
                     shopOrder.setShouldPayProduct(newShopOrder.getShouldPayProduct());
                     List<NewOrderProduct> pList = newOrderProductDao.findListByShopOrderID(shopOrderID);
@@ -2426,6 +2428,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     shopOrder.setShouldPayProduct(0d);
                 }
             }
+            order.setShopOrderNoAndId(shopOrderNoAndId);
             //一个子订单只有一个商品时,不可拆分
             if (order.getProductCount() == null) {
                 order.setProductCount(1);

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

@@ -313,7 +313,36 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             so.setReceiptTotalFee(receiptTotalFee);
             // 子订单已收金额
             Double receiptAmount = cmReceiptOrderRelationDao.findReceiptByShopOrderId(so.getShopOrderID().toString());
-            so.setReceiptAmount(MathUtil.add(so.getReceiptAmount(), receiptAmount).doubleValue());
+            so.setReceiptAmount(receiptAmount);
+            // 子订单已付金额
+            Double shopAmountShopOrderId = newShopOrderDao.payShopAmountShopOrderId(so.getShopOrderID());
+            so.setPayShopAmount(shopAmountShopOrderId);
+            // 已结金额
+            Double settleAmountByShopOrderId = newShopOrderDao.settleAmountByShopOrderId(so.getShopOrderID());
+            so.setSettleAmount(settleAmountByShopOrderId);
+            // 退款金额
+            Double returnedPurchaseFeeByShopOrderId = newShopOrderDao.returnedPurchaseFeeByShopOrderId(so.getShopOrderID());
+            so.setCanRefundAmount(returnedPurchaseFeeByShopOrderId);
+            //结算记录
+            List<SettleRecord> settleRecord = newShopOrderDao.findSettleRecord(so.getShopOrderID().toString());
+            Integer num = null == settleRecord ? 0 : settleRecord.size();
+            so.setSettleRecordNum(num);
+            //分账记录数
+            Integer splitCount = newShopOrderDao.findSplitCount(so.getShopOrderID());
+            so.setSplitCount(splitCount);
+            // 订单收款路径 线上、 线下
+            Integer discernPayWay = cmReceiptOrderRelationDao.getDiscernPayWay(so.getOrderID());
+            if (null != discernPayWay && 1 != discernPayWay) {
+                // 线下收款,结算金额设置为已付金额
+                so.setSettleAmount(shopAmountShopOrderId);
+                if ( so.getSettleAmount() > 0 && (MathUtil.sub(so.getShouldPayShopAmount(), so.getShopOtherFee()).doubleValue()) == so.getSettleAmount()) {
+                    so.setSettleStatus(3);
+                } else if(so.getSettleAmount() > 0 &&  (MathUtil.sub(so.getShouldPayShopAmount(), so.getShopOtherFee()).doubleValue()) > so.getSettleAmount()) {
+                    so.setSettleStatus(2);
+                } else {
+                    so.setSettleStatus(1);
+                }
+            }
             //第一次收款收款时间
             Date receiptDate = cmReceiptOrderRelationDao.findOnlinePayment(so.getOrderID());
             if (receiptDate != null) {
@@ -459,16 +488,17 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
         }
     }
 
-    public Page<NewOrder> findPaymentOrderList(Page<NewOrder> page, NewOrder newOrder) {
-        newOrder.setPage(page);
-        if (newOrder.getPayStatus() != null && newOrder.getPayStatus() != "") {
-            String[] split = newOrder.getPayStatus().split(",");
-            newOrder.setPs(split);
+    public Page<NewShopOrder> findPaymentOrderList(Page<NewShopOrder> page, NewShopOrder shopOrder) {
+        shopOrder.setPage(page);
+        if (StringUtils.isNotBlank(shopOrder.getPayStatus())) {
+            String[] split = shopOrder.getPayStatus().split(",");
+            shopOrder.setPs(split);
         }
-        List<NewOrder> orderList = newOrderDao.findOrderList(newOrder);
-        page.setList(orderList);
-
-        List<Integer> oId = orderList.stream().map(NewOrder::getOrderID).collect(Collectors.toList());
+        // List<NewOrder> orderList = newOrderDao.findOrderList(newOrder);
+        List<NewShopOrder> payOrderList = newShopOrderDao.findShopOrderList(shopOrder);
+        page.setList(payOrderList);
+        setValue(payOrderList);
+        /*List<Integer> oId = orderList.stream().map(NewOrder::getOrderID).collect(Collectors.toList());
         //看看这些订单有哪些是返佣订单 返回他们的orderID
         List<Integer> orderIds = null;
         if (CollectionUtils.isNotEmpty(oId)) {
@@ -534,7 +564,7 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
                 if (newShopOrder.getShopID() != 998) {
                     //统计子订单下的商品信息
                     List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(newShopOrder.getShopOrderID());
-                    /* 退货数量 */
+                     // 退货数量
                     for (NewOrderProduct p : orderProductList) {
                         Integer count = newOrderProductDao.CountReturnedPurchaseProduct(newShopOrder.getShopOrderID(), p.getOrderProductID());
                         p.setReturnedNum(count == null ? 0 : count);
@@ -568,31 +598,27 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
                 String name = heHeNewOrderDao.findHeUser(order.getUserID());
                 order.setClubName(name);
             }
-        }
+        }*/
         return page;
     }
 
-    public NewOrder findRefundRecord(Integer orderID) {
-        NewOrder order = newOrderDao.get(orderID.toString());
-        CmReceiptOrderRelation receiptOrderRelations = cmReceiptOrderRelationDao.findOrderRelation(orderID);
+    public NewShopOrder findRefundRecord(Integer shopOrderId) {
+        // NewOrder order = newOrderDao.get(orderID.toString());
+        NewShopOrder shopOrder = newShopOrderDao.get(shopOrderId.toString());
+        CmReceiptOrderRelation receiptOrderRelations = cmReceiptOrderRelationDao.findOrderRelation(shopOrder.getOrderID(), shopOrderId);
         if (receiptOrderRelations != null && receiptOrderRelations.getRelationType().equals("1")) {
-            order.setRebateOrder("1");
-            order.setReceiptStatus("4");
-            order.setAlreadyReceipt("----");
-            order.setPayStatus("4");
-            order.setPaid("----");
+            shopOrder.setRebateOrder("1");
+            shopOrder.setReceiptStatus("4");
+            shopOrder.setAlreadyReceipt("----");
+            shopOrder.setPayStatus("4");
+            shopOrder.setPaid("----");
         } else {
-            order.setRebateOrder("0");
-            //统计该主订单的收款金额
-            Double receiptTotalFee = cmReceiptOrderRelationDao.findPayFeeByOrderID(orderID.toString());
-            if (receiptTotalFee == null) receiptTotalFee = 0d;
-            order.setAlreadyReceipt(String.valueOf(receiptTotalFee));
-            //统计该主订单的付款金额
-            Double paid = newOrderDao.findPaidOrderID(order.getOrderID());
-            if (paid == null) paid = 0d;
-            order.setPaid(String.valueOf(paid));
+            shopOrder.setRebateOrder("0");
         }
-        if (order.getTotalDiscount() == null) order.setTotalDiscount(0d);
+        ArrayList<NewShopOrder> newShopOrders = new ArrayList<>();
+        newShopOrders.add(shopOrder);
+        setValue(newShopOrders);
+        /*if (order.getTotalDiscount() == null) order.setTotalDiscount(0d);
         List<NewShopOrder> shopOrders = newShopOrderDao.findListByOrderID(orderID);
         List<NewShopOrder> list = new ArrayList();
         //统计所有子订单付供应商金额之和
@@ -611,7 +637,7 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             if (newShopOrder.getShopID() != 998) {
                 //统计子订单下的商品信息
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(newShopOrder.getShopOrderID());
-                /* 退货数量 */
+                // 退货数量
                 for (NewOrderProduct p : orderProductList) {
                     Integer count = newOrderProductDao.CountReturnedPurchaseProduct(newShopOrder.getShopOrderID(), p.getOrderProductID());
                     p.setReturnedNum(count == null ? 0 : count);
@@ -637,8 +663,8 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
         returnedFreightFlag = returnedFreightNum == null ? false : returnedFreightNum > 0 ? true : false;
         order.setReturnedFreightFlag(returnedFreightFlag);
         order.setShouldPayShopAmount(shouldPayShopAmount);
-        order.setNewShopOrders(list);
-        return order;
+        order.setNewShopOrders(list);*/
+        return newShopOrders.get(0);
     }
 
     @Transactional(readOnly = false)

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

@@ -253,16 +253,16 @@ public class CmShopOrderController extends BaseController {
 
     @RequiresPermissions("order:cmPayShop:view")
     @RequestMapping("checkPaymentOrder")
-    public String checkPaymentOrder(NewOrder newOrder, HttpServletRequest request, HttpServletResponse response, Model model) {
-        if (null != newOrder.getStartTime() && !"".equals(newOrder.getStartTime()) && !newOrder.getStartTime().endsWith("00:00:00")) {
-            model.addAttribute("startTime", newOrder.getStartTime());
-            newOrder.setStartTime(newOrder.getStartTime().trim() + " 00:00:00");
+    public String checkPaymentOrder(NewShopOrder newShopOrder, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (null != newShopOrder.getStartTime() && !"".equals(newShopOrder.getStartTime()) && !newShopOrder.getStartTime().endsWith("00:00:00")) {
+            model.addAttribute("startTime", newShopOrder.getStartTime());
+            newShopOrder.setStartTime(newShopOrder.getStartTime().trim() + " 00:00:00");
         }
-        if (null != newOrder.getEndTime() && !"".equals(newOrder.getEndTime()) && !newOrder.getEndTime().endsWith("23:59:59")) {
-            model.addAttribute("endTime", newOrder.getEndTime());
-            newOrder.setEndTime(newOrder.getEndTime().trim() + " 23:59:59");
+        if (null != newShopOrder.getEndTime() && !"".equals(newShopOrder.getEndTime()) && !newShopOrder.getEndTime().endsWith("23:59:59")) {
+            model.addAttribute("endTime", newShopOrder.getEndTime());
+            newShopOrder.setEndTime(newShopOrder.getEndTime().trim() + " 23:59:59");
         }
-        Page<NewOrder> page = newShopOrderService.findPaymentOrderList(new Page<NewOrder>(request, response), newOrder);
+        Page<NewShopOrder> page = newShopOrderService.findPaymentOrderList(new Page<NewShopOrder>(request, response), newShopOrder);
         List<CmUserOrganize> organizeList = cmUserOrganizeService.findOrganize();
         model.addAttribute("page", page);
         model.addAttribute("organizeList", organizeList);
@@ -275,23 +275,23 @@ public class CmShopOrderController extends BaseController {
      */
     @RequiresPermissions("order:cmPayShop:view")
     @RequestMapping("refundRecord")
-    public String refundRecord(Integer orderID, Model model) {
-        NewOrder order = newShopOrderService.findRefundRecord(orderID);
-        List<Integer> shopOrderIDs = newShopOrderService.findIDsByOrderID(orderID);
+    public String refundRecord(Integer shopOrderId, Model model) {
+        NewShopOrder shopOrder = newShopOrderService.findRefundRecord(shopOrderId);
+        // List<Integer> shopOrderIDs = newShopOrderService.findIDsByOrderID(orderID);
         List<CmPayShopRecord> pr = new ArrayList<>();
         List<CmRefundShopRecord> rr = new ArrayList<>();
         List<CmDiscernReceipt> receipts = new ArrayList<>();
-        for (Integer shopOrderID : shopOrderIDs) {
-            List<CmPayShopRecord> payShopRecordList = newShopOrderService.getPayedRecords(shopOrderID.toString());
+        // for (Integer shopOrderID : shopOrderIDs) {
+            List<CmPayShopRecord> payShopRecordList = newShopOrderService.getPayedRecords(shopOrderId.toString());
             pr.addAll(payShopRecordList);
-            List<CmRefundShopRecord> refundShopRecordList = newShopOrderService.getRefundedRecords(shopOrderID.toString());
+            List<CmRefundShopRecord> refundShopRecordList = newShopOrderService.getRefundedRecords(shopOrderId.toString());
             rr.addAll(refundShopRecordList);
-            List<CmDiscernReceipt> receiptList = newShopOrderService.getDiscernReceipts(shopOrderID);
+            List<CmDiscernReceipt> receiptList = newShopOrderService.getDiscernReceipts(shopOrderId);
             receipts.addAll(receiptList);
-        }
+        // }
         model.addAttribute("pr", pr);
         model.addAttribute("rr", rr);
-        model.addAttribute("order", order);
+        model.addAttribute("shopOrder", shopOrder);
         model.addAttribute("receipts", receipts);
         return "modules/order/refundRecord";
     }

+ 10 - 1
src/main/resources/mappings/modules/order/CmReceiptOrderRelationMapper.xml

@@ -180,11 +180,20 @@
     <select id="findOrderRelation" resultType="CmReceiptOrderRelation">
         SELECT *
         FROM cm_receipt_order_relation
-        WHERE orderID = #{orderID}
+        WHERE (orderID = #{orderId} or shopOrderId = #{shopOrderId})
           AND delFlag = '0'
         GROUP BY orderID
     </select>
 
+    <select id="getDiscernPayWay" resultType="java.lang.Integer">
+        SELECT cdr.payWay
+        FROM cm_receipt_order_relation cror
+                 LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
+        WHERE cror.orderID = #{orderID} and cror.delFlag = 0
+        ORDER BY cdr.payWay
+        LIMIT 1
+    </select>
+
     <select id="findOnlinePayment" resultType="date">
         SELECT cdr.receiptDate
         FROM cm_receipt_order_relation cror

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

@@ -173,6 +173,12 @@
             <if test="orderNo != null and orderNo != ''">
                 AND co.orderNo = #{orderNo}
             </if>
+            <if test="shopOrderID != null and shopOrderID != ''">
+                AND cso.shopOrderID = #{shopOrderID}
+            </if>
+            <if test="shopOrderNo != null and shopOrderNo != ''">
+                AND cso.shopOrderNo = #{shopOrderNo}
+            </if>
             <if test="organizeID != null">
                 AND co.organizeID = #{organizeID}
             </if>

+ 123 - 0
src/main/resources/mappings/modules/order/ShopOrderMapper.xml

@@ -865,6 +865,129 @@
         ORDER BY a.shopOrderID DESC
     </select>
 
+    <select id="findShopOrderList" resultType="newShopOrder">
+        select<include refid="shopOrderColumns"/>,
+        co.payTotalFee AS payTotalFee,
+        bou.name AS buyer,
+        s.name AS shopName,
+        c.name AS clubName,
+        cdr.payWay AS payWay
+        from cm_shop_order a
+        left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
+        left join bp_order_userinfo bou on bou.orderId = a.orderID
+        left join cm_order co on co.orderID = a.orderID
+        LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
+        LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
+        left join shop s on s.shopID = a.shopID
+        LEFT JOIN club c ON c.userID = a.userID
+        <where>
+            (s.shopId = 1161 OR s.AccountOwnership = 0 OR a.splitCode = 'E1807059160' or a.ordertype = 2)
+            and a.shopStatus not in (4, 5)
+            <if test="startTime != null and startTime != ''">
+                AND (a.orderTime &gt; #{startTime} OR a.orderTime = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (a.orderTime &lt; #{endTime} OR a.orderTime = #{endTime})
+            </if>
+            <if test="orderID != null and orderID != ''">
+                AND a.orderID = #{orderID}
+            </if>
+            <if test="organizeID != null and organizeID != 9999">
+                AND co.organizeID = #{organizeID}
+            </if>
+            <if test="organizeID == 9999 ">
+                AND co.orderType = 2
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                AND a.orderNo like concat('%', #{orderNo} ,'%')
+            </if>
+            <if test="ps != null and ps.length>0 ">
+                AND a.payStatus in
+                <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="receiptStatus != null and receiptStatus!= ''">
+                AND a.receiptStatus = #{receiptStatus}
+            </if>
+            <if test="refundStatus !=null and refundStatus != ''">
+                AND a.refundStatus = #{refundStatus}
+            </if>
+            <if test="settleStatus != null and settleStatus!= ''">
+                AND a.settleStatus = #{settleStatus}
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name like concat('%', #{shopName} ,'%')
+            </if>
+            <if test="buyer != null and buyer != ''">
+                AND bou.name like concat('%', #{buyer} ,'%')
+            </if>
+            <if test="clubName != null and clubName != ''">
+                AND c.name like concat('%', #{clubName} ,'%')
+            </if>
+            <if test="shopOrderID != null and shopOrderID != ''">
+                AND a.shopOrderID = #{shopOrderID}
+            </if>
+            <if test="shopOrderNo != null and shopOrderNo != ''">
+                AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
+            </if>
+            <if test="operatingMode != null and operatingMode == '1'.toString()">
+                and a.payStatus != 3 and co.status NOT IN (6,7)
+            </if>
+            <if test="operatingMode != null and operatingMode == '2'.toString()">
+                and a.payStatus != 1 and co.status != 6
+            </if>
+            <if test="operatingMode != null and operatingMode == '3'.toString()">
+                and a.payStatus = 3 and co.status NOT IN (6,7)
+            </if>
+            and co.delFlag = 0
+            --              and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
+            and a.delFlag = 0
+            and (a.organizeID!=4 or a.organizeID is null)
+            and a.shopID != 998
+            and co.orderID not in (
+            SELECT orderID FROM cm_order_product WHERE productID IN
+            (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
+            )
+        </where>
+        group by a.shopOrderID
+        ORDER BY a.shopOrderID DESC
+    </select>
+
+    <select id="payAmountByShopOrderId" resultType="java.lang.Double">
+        SELECT IFNULL(SUM(cpsr.payAmount), 0)
+        FROM cm_pay_shop cps
+                 LEFT JOIN cm_pay_shop_record cpsr ON cps.id = cpsr.payShopID
+        WHERE cps.delFlag = 0 AND cpsr.delFlag = 0
+          AND cpsr.shopOrderID = #{shopOrderId}
+    </select>
+
+    <select id="settleAmountByShopOrderId" resultType="java.lang.Double">
+        SELECT IFNULL(SUM(settleAmount), 0)
+        FROM cm_settle_record
+        WHERE shopOrderId = #{shopOrderId}
+    </select>
+
+    <select id="payShopAmountShopOrderId" resultType="java.lang.Double">
+        SELECT IFNULL(SUM(cpsr.payCmAmount), 0)
+        FROM cm_pay_shop cps
+                 LEFT JOIN cm_pay_shop_record cpsr ON cps.id = cpsr.payShopID
+        WHERE cpsr.delFlag = 0 AND cpsr.shopOrderID = 29478
+    </select>
+
+    <select id="returnedPurchaseFeeByShopOrderId" resultType="java.lang.Double">
+        SELECT
+            IFNULL(SUM(crp.returnedPurchaseFee), 0)
+        FROM cm_returned_purchase crp
+                 LEFT JOIN cm_returned_purchase_product crpp ON crp.id = crpp.returnedID
+        WHERE crp.delFlag = 0 AND crp.status = 2
+          AND crp.shopOrderId = #{shopOrderId}
+    </select>
+    <select id="findSplitCount" resultType="java.lang.Integer">
+        SELECT COUNT(*)
+        FROM cm_split_account
+        WHERE shopOrderId = #{shopOrderId}
+    </select>
     <select id="findPayOrderListByIDs" resultType="newShopOrder">
         select distinct<include refid="shopOrderColumns"/>,
         co.payTotalFee AS payTotalFee,

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

@@ -331,13 +331,13 @@
     <li class="active tab-li"><a href="${ctx}/shopOrder/checkPaymentOrder">订单财务信息</a></li>
 </ul>
 
-<form:form id="searchForm" onsubmit="submitFunc()" modelAttribute="newOrder"
+<form:form id="searchForm" onsubmit="submitFunc()" modelAttribute="newShopOrder"
            action="${ctx}/shopOrder/checkPaymentOrder" method="post" class="breadcrumb form-search">
     <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
     <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
     <div class="ul-form">
         <label>子订单ID:</label>
-        <form:input path="shopOrderIDs" htmlEscape="false" onkeyup="onlynum(this)" maxlength="8" class="input-medium"/>
+        <form:input path="shopOrderID" htmlEscape="false" onkeyup="onlynum(this)" maxlength="8" class="input-medium"/>
         <label>子订单编号:</label>
         <form:input path="shopOrderNo" htmlEscape="false" maxlength="20" class="input-medium"/>
         <label>订单ID:</label>
@@ -368,18 +368,17 @@
                               htmlEscape="false"/>
             </form:select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <label>退款状态:</label>
-            <form:select path="refundType" class="select-ele input-medium required">
+            <form:select path="refundStatus" class="select-ele input-medium required">
                 <form:option value="" label="所有"/>
-                <form:option value="0" label="无退款"/>
-                <form:option value="1" label="部分退款"/>
-                <form:option value="2" label="已退款"/>
+                <form:option value="1" label="无退款"/>
+                <form:option value="3" label="有退款"/>
             </form:select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-            <label>返佣订单:</label>
+            <%--<label>返佣订单:</label>
             <form:select path="rebateOrder" class="select-ele input-medium required">
                 <form:option value="" label="请选择"/>
                 <form:option value="1" label="是"/>
                 <form:option value="0" label="否"/>
-            </form:select>
+            </form:select>--%>
         </div>
         <div class="pay-status">
             <label>组织:</label>
@@ -412,6 +411,7 @@
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr class="t1">
                     <th class="item0">序号</th>
+                    <th colspan="2">子订单编号(ID)</th>
                     <th colspan="2">母订单编号(ID)</th>
                     <th>下单时间</th>
                     <th>订单金额</th>
@@ -427,56 +427,34 @@
                     <th>已结金额</th>
                     <th>退款状态</th>
                     <th>退款金额</th>
-                    <th>机构</th>
                     <th>优惠券</th>
                     <th>经理折扣</th>
-                    <th>机构运费</th>
-                    <th>是否返佣</th>
                 </tr>
                 <tr>
                     <td rowspan="0" class="item0">${(page.pageNo-1)*page.pageSize+sIndex.index+1}</td>
+                    <td colspan="2">${s.shopOrderNo}(${s.shopOrderID})</td>
                     <td colspan="2">${s.orderNo}(${s.orderID})</td>
                     <td>${s.orderTime}</td>
-                    <td><fmt:formatNumber value="${s.payTotalFee}" type="number" pattern="#,##0.00"/></td>
+                    <td><fmt:formatNumber value="${s.totalAmount}" type="number" pattern="#,##0.00"/></td>
                     <td>
-                        <c:if test="${s.status eq 11 || s.status eq 12 || s.status eq 13 ||s.status eq 21 ||s.status eq 22 ||
-				        s.status eq 23 || s.status eq 31 ||s.status eq 32 ||s.status eq 33}">交易中<br>(${fns:getDictLabel(s.status,"order_detail_status","" )})</c:if>
-                        <c:if test="${s.status eq 0 || s.status eq 4 || s.status eq 5 || s.status eq 6 || s.status eq 7}">${fns:getDictLabel(s.status,"order_detail_status","" )}</c:if>
-                        <c:if test="${s.status eq 6}">
-                            <br>${s.closeTime ne null?s.closeTime:''}
-                        </c:if>
+                        <c:if test="${s.status == 0}"><font color="red">待确认</font></c:if>
+                        <c:if test="${s.status == 1}"><font color="#ff8c00">已确认</font></c:if>
+                        <c:if test="${s.status == 2}"><font color="#ff8c00">交易完成</font></c:if>
+                        <c:if test="${s.status == 3}"><font color="green">订单完成</font></c:if>
+                        <c:if test="${s.status == 4}"><font color="green">已关闭</font></c:if>
+                        <c:if test="${s.status == 5}"><font color="green">交易全退</font></c:if>
                     </td>
                     <td>
-                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-                           style="text-decoration: underline">
-                            <c:if test="${s.receiptStatus == 1}">
-                                <font color="red">待收款</font>
-                            </c:if>
-                            <c:if test="${s.receiptStatus == 2}">
-                                <font color="#ff8c00">部分收款</font>
-                            </c:if>
-                            <c:if test="${s.receiptStatus == 3}">
-                                <font color="green">已收款</font>
-                            </c:if>
-                            <c:if test="${s.receiptStatus == 4}">
-                                ----
-                            </c:if>
-                        </a>
+                        <c:if test="${s.shopReceiptStatus == 1}"><font color="red">待收款</font></c:if>
+                        <c:if test="${s.shopReceiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
+                        <c:if test="${s.shopReceiptStatus == 3}"><font color="green">已收款</font></c:if>
                     </td>
                     <td>
-                        <fmt:formatNumber value="${s.payableAmount}" type="number" pattern="#,##0.00"/>
-                        (余额抵扣:<fmt:formatNumber value="${s.balancePayFee}" type="number" pattern="#,##0.00"/>)
+                        <fmt:formatNumber value="${s.needPayAmount}" type="number" pattern="#,##0.00"/>
+                        (余额抵扣:<fmt:formatNumber value="${s.accountAmount}" type="number" pattern="#,##0.00"/>)
                     </td>
                     <td>
-                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-                           style="text-decoration: underline">
-                            <c:if test="${s.alreadyReceipt eq '----'}">
-                                ${s.alreadyReceipt}
-                            </c:if>
-                            <c:if test="${s.alreadyReceipt ne '----'}">
-                                <fmt:formatNumber value="${s.alreadyReceipt}" type="number" pattern="#,##0.00"/>
-                            </c:if>
-                        </a>
+                        ${s.receiptAmount}
                     </td>
                     <td>
                         <c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font
@@ -484,7 +462,7 @@
                         <c:if test="${s.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
                         <c:if test="${s.payStatus == 3}"><font color="green">已付款</font>
                             <c:if test="${s.zeroCostFlag eq 1}">
-                                <a href="javascript:;" class="zeroCost"><span><img src="/static/images/info.jpg"
+                                <a href="javascript: void(0);" class="zeroCost"><span><img src="/static/images/info.jpg"
                                                                                    style="width: 15px;margin-bottom: 4px"></span>
                                     <div class="message">
                                         <span>商品成本为0,直接置为已付款,无需付款供应商</span>
@@ -494,162 +472,139 @@
                         </c:if>
                         <c:if test="${s.payStatus == 4}">----</c:if>
                     </td>
-                    <td><fmt:formatNumber value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></td>
+                    <td><fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/></td>
                     <td>
-                        <c:if test="${s.paid eq '----'}">
-                            ${s.alreadyReceipt}
-                        </c:if>
-                        <c:if test="${s.paid ne '----'}">
-                            <fmt:formatNumber value="${s.paid}" type="number" pattern="#,##0.00"/>
-                        </c:if>
+                        <fmt:formatNumber value="${s.payShopAmount}" type="number" pattern="#,##0.00"/>
                     </td>
                     <td>
-                        <c:if test="${s.onlinePayFlag eq 0}">
-                            <c:if test="${s.settleAmount < s.shouldPayShopAmount && s.settleAmount > 0}"><font color="#ff8c00">部分结算</font></c:if>
-                            <c:if test="${s.settleAmount eq s.shouldPayShopAmount && s.settleAmount > 0}"><font color="green">已结算</font></c:if>
-                            <c:if test="${s.settleAmount eq 0}"><font color="red">未结算</font></c:if>
-                        </c:if>
-                        <c:if test="${s.onlinePayFlag eq 1}">---</c:if>
+                        <c:if test="${s.settleStatus == 1}"><font color="#ff8c00">未结算</font></c:if>
+                        <c:if test="${s.settleStatus  == 2}"><font color="green">部分结算</font></c:if>
+                        <c:if test="${s.settleStatus == 3}"><font color="red">已结算</font></c:if>
                     </td>
                     <td>
-                        <c:if test="${s.onlinePayFlag eq 0}"><fmt:formatNumber value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></c:if>
-                        <c:if test="${s.onlinePayFlag eq 1}">---</c:if>
+                        <fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
                     </td>
                     <td>
-                        <c:if test="${s.onlinePayFlag eq 0}"><fmt:formatNumber value="${s.settleAmount}" type="number" pattern="#,##0.00"/></c:if>
-                        <c:if test="${s.onlinePayFlag eq 1}">---</c:if>
+                        <fmt:formatNumber value="${s.settleAmount}" type="number" pattern="#,##0.00"/>
                     </td>
                     <td>
-                        <c:if test="${s.refundType == 1}">
-                            <font>部分退款</font>
-                        </c:if>
-                        <c:if test="${s.refundType == 2}">
-                            <font>已退款</font>
-                        </c:if>
-                        <c:if test="${s.refundType != 1 && s.refundType != 2}">
+                        <c:if test="${s.refundStatus == 1}">
                             <font>无退款</font>
                         </c:if>
-                    </td>
-                    <td><fmt:formatNumber value="${s.returnValue}" type="number" pattern="#,##0.00"/></td>
-                    <td>
-                        <c:if test="${s.organizeID == '1'}">
-                            <span class="org-note">星范</span>
-                        </c:if>
-                            ${s.clubName}
-                        <c:if test="${s.orderType eq 2}">
-                            <font color="red">(呵呵商城)</font>
-                        </c:if>
-                        <c:if test="${s.organizeID == 3}">
-
+                        <c:if test="${s.refundStatus == 3}">
+                            <font>有退款</font>
                         </c:if>
                     </td>
+                    <td><fmt:formatNumber value="${s.canRefundAmount}" type="number" pattern="#,##0.00"/></td>
                     <td>
-                            ${s.couponAmount}
+                        <fmt:formatNumber value="${s.couponAmount}" type="number" pattern="#,##0.00"/>
                     </td>
                     <td><fmt:formatNumber value="${s.discountFee}" type="number" pattern="#,##0.00"/></td>
+                </tr>
+                <tr class="t2">
+                    <th colspan="3">机构</th>
+                    <th colspan="3">供应商</th>
+                    <th colspan="2">商品费</th>
+                    <th colspan="2">已付供应商</th>
+                    <th>供应商退款</th>
+                    <th colspan="2">应付供应商</th>
+                    <th colspan="2">应付税费</th>
+                    <th colspan="2">机构运费</th>
+                    <th>供应商运费</th>
+                    <th colspan="2">付第三方</th>
+                </tr>
+                <tr class="t2">
+                    <td colspan="3">
+                        <c:if test="${s.organizeID eq 1}"><span class="org-note">星范</span></c:if>
+                            ${s.clubName}
+                        <c:if test="${s.orderType eq 2}"><font color="red">(呵呵商城)</font></c:if>
+                        <c:if test="${s.organizeID == 4}"><font color="red">(丽格集采联盟)</font></c:if>
+                    </td>
+                    <td colspan="3">${s.shopName}</td>
+                    <td colspan="2" class="product-fee"><fmt:formatNumber value="${s.shopProductAmount}"
+                                                                          type="number" pattern="#,##0.00"/></td>
+                    <td colspan="2"><fmt:formatNumber value="${s.payedShopAmount}" type="number"
+                                                      pattern="#,##0.00"/></td>
                     <td>
-                        <c:if test="${s.freight == 0}">
+                        <fmt:formatNumber value="${s.refundAmount}" type="number" pattern="#,##0.00"/>
+                    </td>
+                    <td colspan="2">
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2 }">
+                            <font color="#E15616"><fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number"
+                                                                    pattern="#,##0.00"/></font>
+                        </c:if>
+                              <%--1少付2多付--%>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已补差价:${s.differencePrice})</font>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已退差价:${s.differencePrice})</font>
+                        </c:if>
+
+                    </td>
+                    <td colspan="2"><fmt:formatNumber value="${s.shopTaxFee}" type="number"
+                                                      pattern="#,##0.00"/></td>
+                    <td colspan="2">
+                        <c:if test="${s.shopPostFlag == 0}">
                             包邮
                         </c:if>
-                        <c:if test="${s.freight == -1}">
+                        <c:if test="${s.shopPostFlag == 2}">
                             到付
                         </c:if>
-                        <c:if test="${s.freight == -2}">
+                        <c:if test="${s.shopPostFlag == -2}">
                             仪器到付-产品包邮
                         </c:if>
-                        <c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
-                            <fmt:formatNumber value="${s.freight}" type="currency"/>
+                        <c:if test="${s.shopPostFlag != 2 && s.shopPostFlag != 0 && s.shopPostFlag != -2}">
+                            <fmt:formatNumber value="${s.shopPostFee}" type="number" pattern="#,##0.00"/>
                             <c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
                         </c:if>
+                        <c:if test="${s.userBeans > 0}">
+                            <br><font color="red">(采美豆抵用:${s.userBeans})</font>
+                        </c:if>
                     </td>
-                    <td>
-                        <c:if test="${s.rebateOrder == '1'}">是</c:if>
-                        <c:if test="${s.rebateOrder == '0'}">否</c:if>
-                    </td>
+                    <td class="product-freight"><fmt:formatNumber value="${s.shopPostFee}" type="number"
+                                                                  pattern="#,##0.00"/></td>
+                    <td colspan="2"><fmt:formatNumber value="${s.shopOtherFee}" type="number" pattern="#,##0.00"/></td>
+
                 </tr>
-                <c:forEach items="${s.newShopOrders}" var="so" varStatus="soIndex">
-                    <tr class="t2">
-                        <th colspan="3">子订单编号(ID)</th>
-                        <th colspan="3">供应商</th>
-                        <th colspan="2">商品费</th>
-                        <th colspan="2">已付供应商</th>
-                        <th>供应商退款</th>
-                        <th colspan="2">应付供应商</th>
-                        <th colspan="3">应付税费</th>
-                        <th>供应商运费</th>
-                        <th colspan="2">付第三方</th>
-                        <th colspan="2">成本类型</th>
-                    </tr>
-                    <tr class="t2">
-                        <td colspan="3">${so.shopOrderNo}(${so.shopOrderID})</td>
-                        <td colspan="3">${so.shopName}</td>
-                        <td colspan="2" class="product-fee"><fmt:formatNumber value="${so.shopProductAmount}"
-                                                                              type="number" pattern="#,##0.00"/></td>
-                        <td colspan="2"><fmt:formatNumber value="${so.payedShopAmount}" type="number"
-                                                          pattern="#,##0.00"/></td>
-                        <td>
-                            <c:if test="${so.refundAmount > 0}">
-                                <fmt:formatNumber value="${so.refundAmount}" type="number" pattern="#,##0.00"/>
-                            </c:if>
+                <tr>
+                    <th colspan="3">商品名</th>
+                    <th>规格</th>
+                    <th>数量<%--(赠品)--%></th>
+                    <th>退货</th>
+                    <th colspan="2">单价</th>
+                    <th colspan="3">机构税率 / 单税费 / 总税费</th>
+                    <th colspan="2">总价</th>
+                    <th colspan="3">供应商税率 / 单税费 / 总税费</th>
+                    <th colspan="2">成本(单 + 税)</th>
+                    <th colspan="2">成本(总)</th>
+                </tr>
+                <c:forEach items="${s.newOrderProducts}" var="p" varStatus="pIndex">
+                    <tr class="pay-product-item">
+                        <input type="hidden" class="p-copId" value="${p.orderProductID}">
+                        <td style="width:300px;" class="p-name" colspan="3">
+                            <c:if test="${p.productType eq 1}"><font color="red">协商赠品:</font></c:if>
+                            <c:if test="${p.productType eq 2}"><font color="red">促销赠品:</font></c:if>
+                                ${p.name}
                         </td>
-                        <td colspan="2">
-                            <c:if test="${so.differenceType ne 1 && so.differenceType ne 2 }">
-                                <font color="#E15616"><fmt:formatNumber value="${so.shouldPayShopAmount}" type="number"
-                                                                        pattern="#,##0.00"/></font>
-                            </c:if>
-                                  <%--1少付2多付--%>
-                            <c:if test="${so.differenceType eq 1 && so.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${so.shouldPayShopAmount+so.differencePrice}"/></font><font color="red">(原应付:${so.shouldPayShopAmount},已补差价:${so.differencePrice})</font>
-                            </c:if>
-                            <c:if test="${so.differenceType eq 2 && so.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${so.shouldPayShopAmount-so.differencePrice}"/></font><font color="red">(原应付:${so.shouldPayShopAmount},已退差价:${so.differencePrice})</font>
+                        <td style="width:80px;">${p.unit}</td>
+                        <td class="p-num" data-num="${p.num + p.presentNum}">
+                                ${p.num}
+                            <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
+                        </td>
+                        <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
+                        <td colspan="2"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}"
+                                                          type="number" pattern="#,##0.00"/>
+                            <c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
+                                <label style="color: red">
+                                    (${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
+                                </label>
                             </c:if>
-
                         </td>
-                        <td colspan="3"><fmt:formatNumber value="${so.shopTaxFee}" type="number"
-                                                          pattern="#,##0.00"/></td>
-                        <td class="product-freight"><fmt:formatNumber value="${so.shopPostFee}" type="number"
-                                                                      pattern="#,##0.00"/></td>
-                        <td colspan="2"><fmt:formatNumber value="${so.shopOtherFee}" type="number" pattern="#,##0.00"/></td>
-                        <td colspan="2"><c:if test="${empty so.costType || so.costType == '1'}">固定成本</c:if><c:if
-                                test="${so.costType == '2'}">比例成本</c:if></td>
-                    </tr>
-                    <tr>
-                        <th colspan="3">商品名</th>
-                        <th>规格</th>
-                        <th>数量<%--(赠品)--%></th>
-                        <th>退货</th>
-                        <th colspan="2">单价</th>
-                        <th colspan="3">机构税率 / 单税费 / 总税费</th>
-                        <th colspan="2">总价</th>
-                        <th colspan="3">供应商税率 / 单税费 / 总税费</th>
-                        <th>成本(单)</th>
-                        <th colspan="4">成本(总)</th>
-                    </tr>
-                    <c:forEach items="${so.newOrderProducts}" var="p" varStatus="pIndex">
-                        <tr class="pay-product-item">
-                            <td colspan="3" class="product-name">
-                                <c:if test="${p.productType eq 1}"><font color="red">协商赠品:</font></c:if>
-                                <c:if test="${p.productType eq 2}"><font color="red">促销赠品:</font></c:if>
-                                    ${p.name}
-                            </td>
-                            <td style="width:80px;">${p.unit}</td>
-                            <td class="p-num" data-num="${p.num + p.presentNum}">
-                                    ${p.num}
-                                <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
-                            </td>
-                            <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-                            <td colspan="2"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}"
-                                                              type="number" pattern="#,##0.00"/>
-                                <c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
-                                    <label style="color: red">
-                                        (${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
-                                    </label>
-                                </c:if>
-                            </td>
-                            <td>${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.taxRate?0.0:p.taxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
-                            <td>${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.addedValueTax ?0.00:p.addedValueTax}</td>
-                            <td><c:choose>
+                        <td>${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.taxRate?0.0:p.taxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
+                        <td>${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.addedValueTax ?0.00:p.addedValueTax}</td>
+                        <td>
+                            <c:choose>
                                 <c:when test="${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))}">
                                     ---
                                 </c:when>
@@ -658,13 +613,15 @@
                                             value="${empty p.totalAddedValueTax ?0.00:(p.addedValueTax * (p.num+p.presentNum-p.returnedNum))}"
                                             type="number" pattern="#,##0.00"/>
                                 </c:otherwise>
-                            </c:choose></td>
-                            <td colspan="2"><fmt:formatNumber
-                                    value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
-                                    type="number" pattern="#,##0.00"/></td>
-                            <td>${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
-                            <td>${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
-                            <td><c:choose>
+                            </c:choose>
+                        </td>
+                        <td colspan="2"><fmt:formatNumber
+                                value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
+                                type="number" pattern="#,##0.00"/></td>
+                        <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
+                        <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
+                        <td class="p-taxes-t">
+                            <c:choose>
                                 <c:when test="${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))}">
                                     ---
                                 </c:when>
@@ -673,13 +630,13 @@
                                             value="${empty p.shouldPayTotalTax ?0.00:(p.singleShouldPayTotalTax * (p.num+p.presentNum-p.returnedNum))}"
                                             type="number" pattern="#,##0.00"/>
                                 </c:otherwise>
-                            </c:choose></td>
-                            <td><fmt:formatNumber value="${p.costPrice}" type="number" pattern="#,##0.00"/></td>
-                            <td colspan="4"><fmt:formatNumber
-                                    value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}" type="number"
-                                    pattern="#,##0.00"/></td>
-                        </tr>
-                    </c:forEach>
+                            </c:choose>
+                        </td>
+                        <td class="p-costprice" colspan="2"><fmt:formatNumber value="${p.costPrice}" type="number"
+                                                                  pattern="#,##0.00"/></td>
+                        <td colspan="2"><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}"
+                                              type="number" pattern="#,##0.00"/></td>
+                    </tr>
                 </c:forEach>
             </table>
             <div style="float:right">
@@ -691,7 +648,7 @@
                 </c:if>
                 <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord?orderID=${s.orderID}&shopOrderID=${s.shopOrderID}&from=3">收付款记录</a>&nbsp;&nbsp;&nbsp;
                 <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRecturnRecordByOrderID?orderID=${s.orderID}&from=3">用户退款/货记录</a>&nbsp;&nbsp;&nbsp;
-                <a href="${ctx}/shopOrder/refundRecord?orderID=${s.orderID}">供应商退/付款记录</a>
+                <a href="${ctx}/shopOrder/refundRecord?shopOrderId=${s.shopOrderID}">供应商退/付款记录</a>
             </div>
         </div>
     </c:forEach>

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

@@ -467,7 +467,7 @@
                                 <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
                             </c:if>
 							,</span>
-                            <span class="nowrap">已付:${s.payedShopAmount-s.shopOtherFee},</span></div>
+                            <span class="nowrap">已付:${s.payedShopAmount},</span></div>
                         <div><span class="nowrap">待付:<input type="number"
                                                             value="<fmt:formatNumber value="${s.waitPayShop-s.shopOtherFee}" pattern="0.00"/>"
                                                             class="need-to-pay" data-type="${s.differenceType}"

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

@@ -403,6 +403,7 @@
                         <td colspan="3">
                             <%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline"></a>--%>
                                 ${s.receiptAmount}
+                                <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                         </td>
                         <td colspan="2">
                             <label class="discountFee">

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

@@ -152,7 +152,8 @@
                         </td>
                         <td colspan="3">
                             <%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline"></a>--%>
-                                ${s.receiptAmount}
+                            ${s.receiptAmount}
+                            <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                         </td>
                         <td colspan="2">
                             <label class="discountFee">

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

@@ -485,6 +485,7 @@
                         <td colspan="3">
                             <%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline"></a>--%>
                                 ${s.receiptAmount}
+                                <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                         </td>
                         <td colspan="2">
                             <label class="discountFee">
@@ -596,7 +597,7 @@
                                 <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
                             </c:if>
 							,</span>
-                                <span class="nowrap">已付:${s.payedShopAmount-s.shopOtherFee},</span></div>
+                                <span class="nowrap">已付:${s.payedShopAmount},</span></div>
                             <div><span class="nowrap">待付:<input type="number"
                                                                 value="<fmt:formatNumber value="${s.waitPayShop-s.shopOtherFee}" pattern="0.00"/>"
                                                                 class="need-to-pay" data-type="${s.differenceType}"

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

@@ -426,6 +426,7 @@
                     </td>
                     <td><%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline"></a></td>--%>
                         ${s.receiptAmount}
+                        <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                     <td colspan="3">
                         <c:if test="${s.discountTotalFee gt 0}">
                             <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">

+ 49 - 27
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherPrintDetail.jsp

@@ -489,29 +489,40 @@
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
                     <th>子订单编号(ID)</th>
-                    <th colspan="3">订单编号(ID)</th>
-                    <th colspan="2">订单金额</th>
+                        <%--                        <th colspan="3">客户</th>--%>
                     <th colspan="3">下单时间</th>
-                    <th>收款状态</th>
-                    <th>收款金额</th>
+                    <th colspan="2">子订单金额</th>
+                        <%--                        <th colspan="3">所有子订单</th>--%>
+                        <%--                        <th>订单总佣金</th>--%>
+                    <th colspan="4">总平台服务费</th>
+                        <%--                        <th>机构运费</th>--%>
+                    <th colspan="2">收款状态</th>
+                    <th colspan="3">收款金额</th>
                     <th colspan="2">经理折扣</th>
-                    <th colspan="3">成本类型</th>
                     <th colspan="2">付第三方</th>
                 </tr>
                 <tr>
                     <td>${s.shopOrderNo}(${s.shopOrderID})</td>
-                    <td colspan="3">${s.orderNo}(${s.orderID})</td>
-                    <td colspan="2">${s.payTotalFee}</td>
-                    <td colspan="3">${s.orderTime}</td>
-                        <%--此处对应订单列表收款状态--%>
-                    <td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-                           style="text-decoration: underline">
-                        <c:if test="${s.receiptStatus == 1}"><font color="red">待收款</font></c:if>
-                        <c:if test="${s.receiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
-                        <c:if test="${s.receiptStatus == 3}"><font color="green">已收款</font></c:if></a></td>
-                    <td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-                           style="text-decoration: underline">${s.receiptTotalFee}</a></td>
+                    <td colspan="3"> ${s.orderTime}</td>
+                    <td colspan="2">${s.totalAmount}</td>
+                    <td colspan="4">${s.allServeAmount}</td>
                     <td colspan="2">
+                        <c:if test="${s.shopReceiptStatus == 1}"><font color="red">待收款</font></c:if>
+                        <c:if test="${s.shopReceiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
+                        <c:if test="${s.shopReceiptStatus == 3}"><font color="green">已收款</font></c:if>
+                    </td>
+                    <td colspan="3">
+                            ${s.receiptAmount}
+                        <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
+                    </td>
+                    <td colspan="2">
+                        <label class="discountFee">
+                            <c:choose>
+                                <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
+                                    <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
+                                </c:when>
+                            </c:choose>
+                        </label>
                         <c:if test="${s.discountTotalFee gt 0}">
                             <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
                                 <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"
@@ -534,8 +545,6 @@
                         </c:if>
                         <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
                     </td>
-                    <td colspan="3"><c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if><c:if
-                            test="${s.costType == '2'}">比例成本</c:if></td>
                     <td colspan="2" class="third-party-fee"><fmt:formatNumber value="${s.shopOtherFee}" type="number"
                                                                               pattern="#,##0.00"/></td>
                 </tr>
@@ -558,19 +567,32 @@
                         <c:if test="${s.organizeID == 3}"></c:if>
                     </td>
                     <td>
-                        <c:if test="${s.freight == 0}">
+                        <label class="clubFreight"  style="display: none">
+                            <c:choose>
+                                <c:when test="${s.shopPostFlag != 2 && s.shopPostFlag != 0 && s.shopPostFlag != -2 && s.returnedFreightFlag ne true}">
+                                    <fmt:formatNumber value="${s.shopPostFee}"/>
+                                </c:when>
+                                <c:otherwise>
+                                    <fmt:formatNumber value="0"/>
+                                </c:otherwise>
+                            </c:choose>
+                        </label>
+                        <c:if test="${s.shopPostFlag == 0}">
                             包邮
                         </c:if>
-                        <c:if test="${s.freight == -1}">
+                        <c:if test="${s.shopPostFlag == 2}">
                             到付
                         </c:if>
-                        <c:if test="${s.freight == -2}">
+                        <c:if test="${s.shopPostFlag == -2}">
                             仪器到付-产品包邮
                         </c:if>
-                        <c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
-                            <fmt:formatNumber value="${s.freight}" type="currency"/>
+                        <c:if test="${s.shopPostFlag != 2 && s.shopPostFlag != 0 && s.shopPostFlag != -2}">
+                            <fmt:formatNumber value="${s.shopPostFee}" type="number" pattern="#,##0.00"/>
                             <c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
                         </c:if>
+                        <c:if test="${s.userBeans gt 0}">
+                            (采美豆抵用${s.userBeans})
+                        </c:if>
                     </td>
                     <td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number"
                                                           pattern="#,##0.00"/></td>
@@ -587,13 +609,13 @@
                     <td colspan="2" class="supplier-fee">
                         <div>
                             <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">应付:<fmt:formatNumber
-                                    value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/>
+                                    value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
                             </c:if>
                             <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已补差价:${s.differencePrice})</font>
                             </c:if>
                             <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已退差价:${s.differencePrice})</font>
                             </c:if>,
                             已付:<fmt:formatNumber value="${s.payedShopAmount}" type="number" pattern="#,##0.00"/>
                         </div>
@@ -603,7 +625,7 @@
                                                                              pattern="#,##0.00"/></span>,
                             </c:if>
                             待付: <fmt:formatNumber
-                                value="${s.wipePayment > 0 ? 0 : (s.differenceType eq 1 ? (s.differencePrice + s.waitPayShop):(s.waitPayShop - s.differencePrice))}"
+                                value="${s.wipePayment > 0 ? 0 : (s.differenceType eq 1 ? (s.differencePrice + s.waitPayShop-s.shopOtherFee):(s.waitPayShop - s.differencePrice-s.shopOtherFee))}"
                                 type="number" pattern="#,##0.00"/>
                         </div>
                         <c:if test="${s.wipePayment > 0}">

+ 26 - 12
src/main/webapp/WEB-INF/views/modules/order/cmPayShopOtherPrintDetails.jsp

@@ -386,19 +386,32 @@
                     <td>${s.shopName}</td>
                     <td colspan="3">${s.buyer}<c:if test="${s.organizeID == 3}"></c:if></td>
                     <td>
-                        <c:if test="${s.freight == 0}">
+                        <label class="clubFreight"  style="display: none">
+                            <c:choose>
+                                <c:when test="${s.shopPostFlag != 2 && s.shopPostFlag != 0 && s.shopPostFlag != -2 && s.returnedFreightFlag ne true}">
+                                    <fmt:formatNumber value="${s.shopPostFee}"/>
+                                </c:when>
+                                <c:otherwise>
+                                    <fmt:formatNumber value="0"/>
+                                </c:otherwise>
+                            </c:choose>
+                        </label>
+                        <c:if test="${s.shopPostFlag == 0}">
                             包邮
                         </c:if>
-                        <c:if test="${s.freight == -1}">
+                        <c:if test="${s.shopPostFlag == 2}">
                             到付
                         </c:if>
-                        <c:if test="${s.freight == -2}">
+                        <c:if test="${s.shopPostFlag == -2}">
                             仪器到付-产品包邮
                         </c:if>
-                        <c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
-                            <fmt:formatNumber value="${s.freight}" type="currency"/>
+                        <c:if test="${s.shopPostFlag != 2 && s.shopPostFlag != 0 && s.shopPostFlag != -2}">
+                            <fmt:formatNumber value="${s.shopPostFee}" type="number" pattern="#,##0.00"/>
                             <c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
                         </c:if>
+                        <c:if test="${s.userBeans gt 0}">
+                            (采美豆抵用${s.userBeans})
+                        </c:if>
                     </td>
                     <td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number"
                                                           pattern="#,##0.00"/></td>
@@ -411,23 +424,24 @@
                     <td class="supplier-fee">
                         <div>
                             <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">应付:<fmt:formatNumber
-                                    value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/>
+                                    value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
                             </c:if>
                             <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已补差价:${s.differencePrice})</font>
                             </c:if>
                             <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
-                            </c:if>
-                            已付:<fmt:formatNumber value="${s.payedShopAmount}" type="number" pattern="#,##0.00"/>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已退差价:${s.differencePrice})</font>
+                            </c:if>
+                            已付:<fmt:formatNumber value="${s.payedShopAmount}" type="number" pattern="#,##0.00"/>
                         </div>
                         <div>
                             <c:if test="${s.refundAmount > 0}">
                                 <span style="color:red">退款:<fmt:formatNumber value="${s.refundAmount}" type="number"
                                                                              pattern="#,##0.00"/></span>,
                             </c:if>
-                            待付:<fmt:formatNumber value="${s.wipePayment>0 ? 0 : s.waitPayShop}" type="number"
-                                                 pattern="#,##0.00"/>
+                            待付: <fmt:formatNumber
+                                value="${s.wipePayment > 0 ? 0 : (s.differenceType eq 1 ? (s.differencePrice + s.waitPayShop-s.shopOtherFee):(s.waitPayShop - s.differencePrice-s.shopOtherFee))}"
+                                type="number" pattern="#,##0.00"/>
                         </div>
                         <c:if test="${s.wipePayment > 0}">
                             <div>

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

@@ -164,8 +164,10 @@
 								<c:if test="${s.shopReceiptStatus == 3}"><font color="green">已收款</font></c:if>
 							</td>
 							<td colspan="3">
-								<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-								   style="text-decoration: underline">${s.receiptAmount}</a>
+								<%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
+								   style="text-decoration: underline"></a>--%>
+									${s.receiptAmount}
+									<c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
 							</td>
 							<td colspan="2">
 								<label class="discountFee">
@@ -268,7 +270,7 @@
 							<td colspan="3" class="supplier-fee">
 								<div><span class="nowrap">
                             <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
-								应付:<fmt:formatNumber value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/>
+								应付:<fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
 							</c:if>
 							<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
 								<font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
@@ -279,7 +281,7 @@
 							,</span>
 									<span class="nowrap">已付:${s.payedShopAmount},</span></div>
 								<div><span class="nowrap">待付:<input type="number"
-																	value="<fmt:formatNumber value="${s.waitPayShop}" pattern="0.00"/>"
+																	value="<fmt:formatNumber value="${s.waitPayShop-s.shopOtherFee}" pattern="0.00"/>"
 																	class="need-to-pay" data-type="${s.differenceType}"
 																	data-difference="${s.differencePrice}"
 																	data-pay="${s.shouldPayShopAmount}"

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

@@ -80,6 +80,14 @@
                 <label>订单号:</label>
                 <form:input path="orderNo" htmlEscape="false" maxlength="30" class="input-medium"/>
             </div>
+            <div class="item">
+                <label>子订单ID:</label>
+                <form:input path="shopOrderID" id="shipOrderID" htmlEscape="false" maxlength="30" class="input-medium"/>
+            </div>
+            <div class="item">
+                <label>子订单号:</label>
+                <form:input path="shopOrderNo" htmlEscape="false" maxlength="30" class="input-medium"/>
+            </div>
             <div class="item">
                 <label>机构:</label>
                 <form:input path="buyer" maxlength="20" class="input-medium"/>
@@ -221,8 +229,8 @@
 <fmt:formatDate value="<%=new Date()%>" var="monthFirst" pattern="yyyy-MM-01"/>
 <div class="data-title">
     <ul>
-        <li>订单ID</li>
-        <li>订单编号</li>
+        <li style="width: 190px; ">订单编号(订单ID)</li>
+        <li style="width: 195px; ">订单编号(子订单ID)</li>
         <li>订单类型</li>
         <li>返佣订单</li>
 <%--        <li>二手订单</li>--%>
@@ -244,9 +252,8 @@
     <c:forEach items="${page.list}" var="order">
         <%--颜色区分分期不分期订单以及终止订单--%>
         <ul class="spileOrder" data-id="${order.orderNo}">
-            <li>${order.orderID}</li>
-            <li style="position: relative">${order.orderNo}
-            </li>
+            <li>${order.orderNo}(${order.orderID})</li>
+            <li style="position: relative">${order.shopOrderNoAndId}</li>
             <li>
                 <c:if test="${order.orderType == 1}">
                     自主订单

+ 164 - 147
src/main/webapp/WEB-INF/views/modules/order/refundRecord.jsp

@@ -88,13 +88,14 @@
 <body>
 <ul class="nav nav-tabs">
     <li><a href="${ctx}/shopOrder/checkPaymentOrder">订单财务信息</a></li>
-    <li class="active tab-li"><a href="${ctx}/shopOrder/refundRecord?orderID=${order.orderID}">供应商退/付款记录</a></li>
+    <li class="active tab-li"><a href="${ctx}/shopOrder/refundRecord?shopOrderId=${shopOrder.shopOrderID}">供应商退/付款记录</a></li>
 </ul>
 <sys:message content="${message}"/>
 <div class="pay-wrapper">
     <div class="pay-list-item">
         <table class="table table-striped table-bordered table-condensed pay-table">
             <tr class="t1">
+                <th colspan="2">子订单编号(ID)</th>
                 <th colspan="2">母订单编号(ID)</th>
                 <th>下单时间</th>
                 <th>订单金额</th>
@@ -105,208 +106,224 @@
                 <th>付款状态</th>
                 <th>应付金额</th>
                 <th>已付金额</th>
+                <th>结算状态</th>
+                <th>应结金额</th>
+                <th>已结金额</th>
                 <th>退款状态</th>
                 <th>退款金额</th>
-                <th colspan="2">机构</th>
                 <th>优惠券</th>
                 <th>经理折扣</th>
-                <th>机构运费</th>
-                <th>是否返佣</th>
             </tr>
             <tr>
-                <td colspan="2">${order.orderNo}(${order.orderID})</td>
-                <td>${order.orderTime}</td>
-                <td><fmt:formatNumber value="${order.payTotalFee}" type="number" pattern="#,##0.00"/></td>
+                <td colspan="2">${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</td>
+                <td colspan="2">${shopOrder.orderNo}(${shopOrder.orderID})</td>
+                <td>${shopOrder.orderTime}</td>
+                <td><fmt:formatNumber value="${shopOrder.totalAmount}" type="number" pattern="#,##0.00"/></td>
                 <td>
-                    <c:if test="${order.status eq 11 || order.status eq 12 || order.status eq 13 ||order.status eq 21 ||order.status eq 22 ||
-                    order.status eq 23 || order.status eq 31 ||order.status eq 32 ||order.status eq 33}">交易中<br>(${fns:getDictLabel(order.status,"order_detail_status","" )})</c:if>
-                    <c:if test="${order.status eq 0 || order.status eq 4 || order.status eq 5 || order.status eq 6 || order.status eq 7}">${fns:getDictLabel(order.status,"order_detail_status","" )}</c:if>
+                    <c:if test="${shopOrder.status == 0}"><font color="red">待确认</font></c:if>
+                    <c:if test="${shopOrder.status == 1}"><font color="#ff8c00">已确认</font></c:if>
+                    <c:if test="${shopOrder.status == 2}"><font color="#ff8c00">交易完成</font></c:if>
+                    <c:if test="${shopOrder.status == 3}"><font color="green">订单完成</font></c:if>
+                    <c:if test="${shopOrder.status == 4}"><font color="green">已关闭</font></c:if>
+                    <c:if test="${shopOrder.status == 5}"><font color="green">交易全退</font></c:if>
                 </td>
                 <td>
-                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=1"  style="text-decoration: underline">
-                        <c:if test="${order.receiptStatus == 1}">
-                            <font color="red">待收款</font>
-                        </c:if>
-                        <c:if test="${order.receiptStatus == 2}">
-                            <font color="#ff8c00">部分收款</font>
-                        </c:if>
-                        <c:if test="${order.receiptStatus == 3}">
-                            <font color="green">已收款</font>
-                        </c:if>
-                        <c:if test="${order.receiptStatus == 4}">
-                            ----
-                        </c:if>
-                    </a>
+                    <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>
                 </td>
                 <td>
-                    <fmt:formatNumber value="${order.payableAmount}" type="number" pattern="#,##0.00"/>
-                    (余额抵扣:<fmt:formatNumber value="${order.balancePayFee}" type="number" pattern="#,##0.00"/>)
+                    <fmt:formatNumber value="${shopOrder.needPayAmount}" type="number" pattern="#,##0.00"/>
+                    (余额抵扣:<fmt:formatNumber value="${shopOrder.accountAmount}" type="number" pattern="#,##0.00"/>)
                 </td>
                 <td>
-                    <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${order.orderID}&from=1"  style="text-decoration: underline">
-                        <c:if test="${order.alreadyReceipt eq '----'}">
-                            ${order.alreadyReceipt}
-                        </c:if>
-                        <c:if test="${order.alreadyReceipt ne '----'}">
-                            <fmt:formatNumber value="${order.alreadyReceipt}" type="number" pattern="#,##0.00"/>
-                        </c:if>
-                    </a>
+                    ${shopOrder.receiptAmount}
                 </td>
                 <td>
-                    <c:if test="${order.payStatus == 1 || empty order.payStatus || order.payStatus == 0}"><font
+                    <c:if test="${shopOrder.payStatus == 1 || empty shopOrder.payStatus || shopOrder.payStatus == 0}"><font
                             color="red">待付款</font></c:if>
-                    <c:if test="${order.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
-                    <c:if test="${order.payStatus == 3}"><font color="green">已付款</font>
-                        <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>
+                    <c:if test="${shopOrder.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
+                    <c:if test="${shopOrder.payStatus == 3}"><font color="green">已付款</font>
+                        <c:if test="${shopOrder.zeroCostFlag eq 1}">
+                            <a href="javascript: void(0);" class="zeroCost"><span><img src="/static/images/info.jpg"
+                                                                                       style="width: 15px;margin-bottom: 4px"></span>
                                 <div class="message">
                                     <span>商品成本为0,直接置为已付款,无需付款供应商</span>
                                 </div>
                             </a>
                         </c:if>
                     </c:if>
-                    <c:if test="${order.payStatus == 4}">----</c:if>
+                    <c:if test="${shopOrder.payStatus == 4}">----</c:if>
                 </td>
-                <td><fmt:formatNumber value="${order.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></td>
+                <td><fmt:formatNumber value="${shopOrder.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></td>
                 <td>
-                    <c:if test="${order.paid eq '----'}">
-                        ${order.alreadyReceipt}
-                    </c:if>
-                    <c:if test="${order.paid ne '----'}">
-                        <fmt:formatNumber value="${order.paid}" type="number" pattern="#,##0.00"/>
-                    </c:if>
+                    <fmt:formatNumber value="${shopOrder.payShopAmount}" type="number" pattern="#,##0.00"/>
                 </td>
                 <td>
-                    <c:if test="${order.refundType == 1}">
-                          <font color="#ff8c00">部分退款</font>
-                    </c:if>
-                    <c:if test="${order.refundType == 2}">
-                         <font color="green">已退款</font>
+                    <c:if test="${shopOrder.settleStatus == 1}"><font color="#ff8c00">未结算</font></c:if>
+                    <c:if test="${shopOrder.settleStatus  == 2}"><font color="green">部分结算</font></c:if>
+                    <c:if test="${shopOrder.settleStatus == 3}"><font color="red">已结算</font></c:if>
+                </td>
+                <td>
+                    <fmt:formatNumber value="${shopOrder.shouldPayShopAmount}" type="number" pattern="#,##0.00"/>
+                </td>
+                <td>
+                    <fmt:formatNumber value="${shopOrder.settleAmount}" type="number" pattern="#,##0.00"/>
+                </td>
+                <td>
+                    <c:if test="${shopOrder.refundStatus == 1}">
+                        <font>无退款</font>
                     </c:if>
-                    <c:if test="${order.refundType != 1 && order.refundType != 2}">
-                         <font color="red">无退款</font>
+                    <c:if test="${shopOrder.refundStatus == 3}">
+                        <font>有退款</font>
                     </c:if>
                 </td>
-                <td><fmt:formatNumber value="${order.returnValue}" type="number" pattern="#,##0.00"/></td>
-                <td colspan="2">
-                    <c:if test="${order.organizeID == '1'}">
-                        <span class="org-note">星范</span>
-                    </c:if>
-                        ${order.buyer}<c:if test="${order.organizeID == 3}"></c:if>
+                <td><fmt:formatNumber value="${shopOrder.canRefundAmount}" type="number" pattern="#,##0.00"/></td>
+                <td>
+                    <fmt:formatNumber value="${shopOrder.couponAmount}" type="number" pattern="#,##0.00"/>
                 </td>
+                <td><fmt:formatNumber value="${shopOrder.discountFee}" type="number" pattern="#,##0.00"/></td>
+            </tr>
+            <tr class="t2">
+                <th colspan="3">机构</th>
+                <th colspan="3">供应商</th>
+                <th colspan="2">商品费</th>
+                <th colspan="2">已付供应商</th>
+                <th>供应商退款</th>
+                <th colspan="2">应付供应商</th>
+                <th colspan="2">应付税费</th>
+                <th>机构运费</th>
+                <th>供应商运费</th>
+                <th colspan="2">付第三方</th>
+                <th colspan="2">成本类型</th>
+            </tr>
+            <tr class="t2">
+                <td colspan="3">
+                    <c:if test="${shopOrder.organizeID eq 1}"><span class="org-note">星范</span></c:if>
+                    ${shopOrder.clubName}
+                    <c:if test="${shopOrder.orderType eq 2}"><font color="red">(呵呵商城)</font></c:if>
+                    <c:if test="${shopOrder.organizeID == 4}"><font color="red">(丽格集采联盟)</font></c:if>
+                </td>
+                <td colspan="3">${shopOrder.shopName}</td>
+                <td colspan="2" class="product-fee"><fmt:formatNumber value="${shopOrder.shopProductAmount}"
+                                                                      type="number" pattern="#,##0.00"/></td>
+                <td colspan="2"><fmt:formatNumber value="${shopOrder.payedShopAmount}" type="number"
+                                                  pattern="#,##0.00"/></td>
                 <td>
-                    ${order.couponAmount}
+                    <fmt:formatNumber value="${shopOrder.refundAmount}" type="number" pattern="#,##0.00"/>
                 </td>
-                <td><fmt:formatNumber value="${order.discountFee}" type="number" pattern="#,##0.00"/></td>
+                <td colspan="2">
+                    <c:if test="${shopOrder.differenceType ne 1 && shopOrder.differenceType ne 2 }">
+                        <font color="#E15616"><fmt:formatNumber value="${shopOrder.shouldPayShopAmount}" type="number"
+                                                                pattern="#,##0.00"/></font>
+                    </c:if>
+                    <%--1少付2多付--%>
+                    <c:if test="${shopOrder.differenceType eq 1 && shopOrder.differencePrice > 0}">
+                        <font color="black"><fmt:formatNumber value="${shopOrder.shouldPayShopAmount+shopOrder.differencePrice}"/></font><font color="red">(原应付:${shopOrder.shouldPayShopAmount},已补差价:${shopOrder.differencePrice})</font>
+                    </c:if>
+                    <c:if test="${shopOrder.differenceType eq 2 && shopOrder.differencePrice > 0}">
+                        <font color="black"><fmt:formatNumber value="${shopOrder.shouldPayShopAmount-shopOrder.differencePrice}"/></font><font color="red">(原应付:${shopOrder.shouldPayShopAmount},已退差价:${shopOrder.differencePrice})</font>
+                    </c:if>
+
+                </td>
+                <td colspan="2"><fmt:formatNumber value="${shopOrder.shopTaxFee}" type="number"
+                                                  pattern="#,##0.00"/></td>
                 <td>
-                    <c:if test="${order.freight == 0}">
+                    <c:if test="${shopOrder.shopPostFlag == 0}">
                         包邮
                     </c:if>
-                    <c:if test="${order.freight == -1}">
+                    <c:if test="${shopOrder.shopPostFlag == 2}">
                         到付
                     </c:if>
-                    <c:if test="${order.freight == -2}">
+                    <c:if test="${shopOrder.shopPostFlag == -2}">
                         仪器到付-产品包邮
                     </c:if>
-                    <c:if test="${order.freight != -1 && order.freight != 0 && order.freight != -2}">
-                        <fmt:formatNumber value="${order.freight}" type="currency"/>
-                        <c:if test="${order.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+                    <c:if test="${shopOrder.shopPostFlag != 2 && shopOrder.shopPostFlag != 0 && shopOrder.shopPostFlag != -2}">
+                        <fmt:formatNumber value="${shopOrder.shopPostFee}" type="number" pattern="#,##0.00"/>
+                        <c:if test="${shopOrder.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+                    </c:if>
+                    <c:if test="${shopOrder.userBeans > 0}">
+                        <br><font color="red">(采美豆抵用:${shopOrder.userBeans})</font>
                     </c:if>
                 </td>
-                <td>
-                    <c:if test="${order.rebateOrder == '1'}">是</c:if>
-                    <c:if test="${order.rebateOrder == '0'}">否</c:if>
-                </td>
+                <td class="product-freight"><fmt:formatNumber value="${shopOrder.shopPostFee}" type="number"
+                                                              pattern="#,##0.00"/></td>
+                <td colspan="2"><fmt:formatNumber value="${shopOrder.shopOtherFee}" type="number" pattern="#,##0.00"/></td>
+                <td colspan="2"><c:if test="${empty shopOrder.costType || shopOrder.costType == '1'}">固定成本</c:if><c:if
+                        test="${shopOrdercostType == '2'}">比例成本</c:if></td>
             </tr>
-            <c:forEach items="${order.newShopOrders}" var="so" varStatus="soIndex">
-                <tr class="t2">
-                    <th colspan="3">子订单编号(ID)</th>
-                    <th colspan="3">供应商</th>
-                    <th colspan="2">商品费</th>
-                    <th colspan="2">已付供应商</th>
-                    <th>供应商退款</th>
-                    <th colspan="2">应付供应商</th>
-                    <th colspan="3">应付税费</th>
-                    <th>供应商运费</th>
-                    <th>付第三方</th>
-                    <th>成本类型</th>
-                </tr>
-                <tr class="t2">
-                    <td colspan="3">${so.shopOrderNo}(${so.shopOrderID})</td>
-                    <td colspan="3">${so.shopName}</td>
-                    <td colspan="2" class="product-fee"><fmt:formatNumber value="${so.shopProductAmount}" type="number" pattern="#,##0.00"/></td>
-                    <td colspan="2"><fmt:formatNumber value="${so.payedShopAmount}" type="number" pattern="#,##0.00"/></td>
-                    <td>
-                        <c:if test="${so.refundAmount > 0}">
-                            <fmt:formatNumber value="${so.refundAmount}" type="number" pattern="#,##0.00"/>
-                        </c:if>
-                    </td>
-                    <td colspan="2"><fmt:formatNumber value="${so.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></td>
-                    <td colspan="3"><fmt:formatNumber value="${so.shopTaxFee}" type="number" pattern="#,##0.00"/></td>
-                    <td class="product-freight"><fmt:formatNumber value="${so.shopPostFee}" type="number" pattern="#,##0.00"/></td>
-                    <td><fmt:formatNumber value="${so.shopOtherFee}" type="number" pattern="#,##0.00"/></td>
-                    <td><c:if test="${empty so.costType || so.costType == '1'}">固定成本</c:if><c:if test="${so.costType == '2'}">比例成本</c:if></td>
-                </tr>
-                <tr>
-                    <th colspan="3">商品名</th>
-                    <th>规格</th>
-                    <th>数量<%--(赠品)--%></th>
-                    <th>退货</th>
-                    <th colspan="2">单价</th>
-                    <th colspan="3">机构税率 / 单税费 / 总税费</th>
-                    <th colspan="2">总价</th>
-                    <th colspan="3">供应商税率 / 单税费 / 总税费</th>
-                    <th>成本(单)</th>
-                    <th colspan="2">成本(总)</th>
-                </tr>
-                <c:forEach items="${so.newOrderProducts}" var="p" varStatus="pIndex">
-                    <tr class="pay-product-item">
-                        <td colspan="3" class="product-name">
-                            <c:if test="${p.productType eq 1}"><font color="red">协商赠品:</font></c:if>
-                            <c:if test="${p.productType eq 2}"><font color="red">促销赠品:</font></c:if>
+            <tr>
+                <th colspan="3">商品名</th>
+                <th>规格</th>
+                <th>数量<%--(赠品)--%></th>
+                <th>退货</th>
+                <th colspan="2">单价</th>
+                <th colspan="3">机构税率 / 单税费 / 总税费</th>
+                <th colspan="2">总价</th>
+                <th colspan="3">供应商税率 / 单税费 / 总税费</th>
+                <th colspan="2">成本(单)</th>
+                <th colspan="2">成本(总)</th>
+            </tr>
+            <c:forEach items="${shopOrder.newOrderProducts}" var="p" varStatus="pIndex">
+                <tr class="pay-product-item">
+                    <input type="hidden" class="p-copId" value="${p.orderProductID}">
+                    <td style="width:300px;" class="p-name" colspan="3">
+                        <c:if test="${p.productType eq 1}"><font color="red">协商赠品:</font></c:if>
+                        <c:if test="${p.productType eq 2}"><font color="red">促销赠品:</font></c:if>
                             ${p.name}
-                        </td>
-                        <td style="width:80px;">${p.unit}</td>
-                        <td class="p-num" data-num="${p.num + p.presentNum}">
+                    </td>
+                    <td style="width:80px;">${p.unit}</td>
+                    <td class="p-num" data-num="${p.num + p.presentNum}">
                             ${p.num}
-                            <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
-                        </td>
-                        <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-                        <td colspan="2"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}" type="number" pattern="#,##0.00"/>
-                            <c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
-                                <label style="color: red">
-                                    (${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
-                                </label>
-                            </c:if>
-                        </td>
-                        <td>${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.taxRate?0.0:p.taxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
-                        <td>${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.addedValueTax ?0.00:p.addedValueTax}</td>
-                        <td><c:choose>
+                        <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
+                    </td>
+                    <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
+                    <td colspan="2"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}"
+                                                      type="number" pattern="#,##0.00"/>
+                        <c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
+                            <label style="color: red">
+                                (${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
+                            </label>
+                        </c:if>
+                    </td>
+                    <td>${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.taxRate?0.0:p.taxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
+                    <td>${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.addedValueTax ?0.00:p.addedValueTax}</td>
+                    <td>
+                        <c:choose>
                             <c:when test="${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))}">
                                 ---
                             </c:when>
                             <c:otherwise>
-                                <fmt:formatNumber value="${empty p.totalAddedValueTax ?0.00:(p.addedValueTax * (p.num+p.presentNum-p.returnedNum))}" type="number" pattern="#,##0.00"/>
+                                <fmt:formatNumber
+                                        value="${empty p.totalAddedValueTax ?0.00:(p.addedValueTax * (p.num+p.presentNum-p.returnedNum))}"
+                                        type="number" pattern="#,##0.00"/>
                             </c:otherwise>
-                        </c:choose></td>
-                        <td colspan="2"><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
-                        <td>${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
-                        <td>${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
-                        <td><c:choose>
+                        </c:choose>
+                    </td>
+                    <td colspan="2"><fmt:formatNumber
+                            value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}"
+                            type="number" pattern="#,##0.00"/></td>
+                    <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
+                    <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
+                    <td class="p-taxes-t">
+                        <c:choose>
                             <c:when test="${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))}">
                                 ---
                             </c:when>
                             <c:otherwise>
-                                <fmt:formatNumber value="${empty p.shouldPayTotalTax ?0.00:(p.singleShouldPayTotalTax * (p.num+p.presentNum-p.returnedNum))}" type="number" pattern="#,##0.00"/>
+                                <fmt:formatNumber
+                                        value="${empty p.shouldPayTotalTax ?0.00:(p.singleShouldPayTotalTax * (p.num+p.presentNum-p.returnedNum))}"
+                                        type="number" pattern="#,##0.00"/>
                             </c:otherwise>
-                        </c:choose></td>
-                        <td><fmt:formatNumber value="${p.costPrice}" type="number" pattern="#,##0.00"/></td>
-                        <td colspan="2"><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
-                    </tr>
-                </c:forEach>
+                        </c:choose>
+                    </td>
+                    <td class="p-costprice" colspan="2"><fmt:formatNumber value="${p.costPrice}" type="number"
+                                                                          pattern="#,##0.00"/></td>
+                    <td colspan="2"><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}"
+                                                      type="number" pattern="#,##0.00"/></td>
+                </tr>
             </c:forEach>
         </table>
-
     </div>
     <span style="font-weight:bold">付款记录</span>
     <table id="contentTable" class="payment" width="70%" border="1">