Browse Source

页面调整

zhijiezhao 1 year ago
parent
commit
6c72bed693

+ 9 - 7
src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java

@@ -77,17 +77,18 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
             logger.info("-----------------:::::" + bean.getId());
             String type = "";
             String no = "";
-            if ("1".equals(bean.getReceiptType()) || "3".equals(bean.getReceiptType()) || "5".equals(bean.getReceiptType())) {
+            if ("1".equals(bean.getReceiptType()) || "3".equals(bean.getReceiptType()) || "5".equals(bean.getReceiptType()) ||
+                    "10".equals(bean.getReceiptType()) || "11".equals(bean.getReceiptType())) {
                 List<Map<String, Object>> orderIDs = cmDiscernReceiptDao.getShopOrderIDStr(bean.getId());
                 boolean flag = false;
                 boolean mapFlag = false;
-                if (orderIDs == null || orderIDs.size()<=0) {
+                if (orderIDs == null || orderIDs.size() <= 0) {
                     flag = true;
                 }
-                for (Map<String, Object> m : orderIDs){
+                for (Map<String, Object> m : orderIDs) {
                     mapFlag = ObjectUtils.isEmpty(m);
                 }
-                if (!mapFlag && orderIDs != null && orderIDs.size()>0 && null == orderIDs.get(0).get("shopOrderId")) {
+                if (!mapFlag && orderIDs != null && orderIDs.size() > 0 && null == orderIDs.get(0).get("shopOrderId")) {
                     flag = true;
                 }
                 if (flag) {
@@ -116,10 +117,10 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
                         }
                         if ("".equals(no)) {
                             // no += "<a href='/a/order/detail?id=" + map.get("orderID") + "'>" + map.get("shopOrderNo") + "</a>";
-                            no += "<a href='/a/order/detail?id=" + map.get("orderID") + "&shopOrderID=" + map.get("shopOrderId") + "'>" + "子订单" + map.get("shopOrderNo") + "("+map.get("shopOrderId")+")" + "</a>";
+                            no += "<a href='/a/order/detail?id=" + map.get("orderID") + "&shopOrderID=" + map.get("shopOrderId") + "'>" + "子订单" + map.get("shopOrderNo") + "(" + map.get("shopOrderId") + ")" + "</a>";
                         } else {
                             // no += ("<br><a href='/a/order/detail?id=" + map.get("orderID") + "'>" + map.get("shopOrderNo")) + "</a>";
-                            no += ("<br><a href='/a/order/detail?id=" + map.get("orderID") + "&shopOrderID=" + map.get("shopOrderId") + "'>" + "子订单" + map.get("shopOrderNo") + "("+map.get("shopOrderId")+")") + "</a>";
+                            no += ("<br><a href='/a/order/detail?id=" + map.get("orderID") + "&shopOrderID=" + map.get("shopOrderId") + "'>" + "子订单" + map.get("shopOrderNo") + "(" + map.get("shopOrderId") + ")") + "</a>";
                         }
                     }
                 }
@@ -162,7 +163,7 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
         List<ReceiptOrderInfoVo> orderInfos = new ArrayList<>(); //一个收款可能会关联了一个或多个订单
         ReceiptOrderInfoVo receiptOrderInfoVo = null;
         double needAmount = 0d;
-        for(CmReceiptOrderRelation relation : relations) {
+        for (CmReceiptOrderRelation relation : relations) {
             if (null != relation.getShopOrderId()) {
                 receiptOrderInfoVo = cmDiscernReceiptDao.getOrderInfoByShopOrderID(relation.getShopOrderId().toString());
                 BigDecimal add = MathUtil.add(receiptOrderInfoVo.getReceiptAmount(), cmDiscernReceiptService.findShoOrderIDReceipt(relation.getShopOrderId()));
@@ -497,6 +498,7 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
         Double receiptAmount = cmDiscernReceiptDao.findOrderReceipt(orderID);
         return receiptAmount;
     }
+
     public Double findShoOrderIDReceipt(Integer shopOrderID) {
         Double receiptAmount = cmDiscernReceiptDao.findShoOrderIDReceipt(shopOrderID);
         return receiptAmount;

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

@@ -343,20 +343,18 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
                 }
             }
             List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
+            double lr = 0d;
+            double allBrokerage = 0d;
             for (NewOrderProduct p : orderProductList) {
+                allBrokerage += p.getNum() * p.getBrokerage();
+                lr += p.getNum() * p.getCmCostPrice();
                 Integer returnNum = newOrderProductDao.CountReturnedPurchaseProduct(so.getShopOrderID(), p.getOrderProductID());
                 returnNum = returnNum == null ? 0 : returnNum;
                 p.setReturnedNum(returnNum);
-                // 还原下单时商品成本
-                /*Double newCostPrice = 0d;
-                newCostPrice = p.getCostPrice();
-                p.setCostPrice(MathUtil.div(p.getCostPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100),100)).doubleValue());
-                p.setNewCostPrice(newCostPrice);*/
                 p.setOldDiscountPrice(p.getDiscountPrice());
-                /*if ("0".equals(p.getIncludedTax()) && null != p.getTaxRate() && p.getTaxRate() > 0d) {
-                    p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
-                }*/
             }
+            so.setBrokerage(allBrokerage);
+            so.setAllServeAmount(lr);
             if (so.getShopPostFee() == null) so.setShopPostFee(0D);
             if (so.getShopTaxFee() == null) so.setShopTaxFee(0D);
             if (so.getShopOtherFee() == null) so.setShopOtherFee(0D);

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

@@ -894,7 +894,8 @@
         bou.name AS buyer,
         s.name AS shopName,
         c.name AS clubName,
-        cdr.payWay AS payWay
+        cdr.payWay AS payWay,
+        (select sum((num+presentNum)*cmCostPrice) from cm_order_product where shopOrderId = a.shopOrderId) as allServeAmount
         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
@@ -1008,7 +1009,8 @@
         co.payTotalFee AS payTotalFee,
         co.promotionFullReduction,
         bou.name AS buyer,
-        s.name AS shopName
+        s.name AS shopName,
+        (select sum((num+presentNum)*cmCostPrice) from cm_order_product where shopOrderId = a.shopOrderId) as allServeAmount
         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

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

@@ -411,8 +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>子订单编号(ID)</th>
                     <th>下单时间</th>
                     <th>订单金额</th>
                     <th>订单状态</th>
@@ -423,6 +422,9 @@
                     <th>应付金额</th>
                     <th>已付金额</th>
                     <th>结算状态</th>
+                    <th>采美平台服务费</th>
+                    <th>采美自营订单利润</th>
+                    <th>采美总利润</th>
                     <th>应结金额</th>
                     <th>已结金额</th>
                     <th>退款状态</th>
@@ -432,8 +434,7 @@
                 </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.shopOrderNo}(${s.shopOrderID})</td>
                     <td>${s.orderTime}</td>
                     <td><fmt:formatNumber value="${s.totalAmount}" type="number" pattern="#,##0.00"/></td>
                     <td>
@@ -481,6 +482,36 @@
                         <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>${s.allServeAmount}</td>
+                    <td>
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                    </td>
+                    <td>
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                    </td>
                     <td>
                         <fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
                     </td>
@@ -502,6 +533,7 @@
                     <td><fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/></td>
                 </tr>
                 <tr class="t2">
+                    <th>母订单编号(ID)</th>
                     <th colspan="3">机构</th>
                     <th colspan="3">供应商</th>
                     <th colspan="2">商品费</th>
@@ -514,6 +546,7 @@
                     <th colspan="2">付第三方</th>
                 </tr>
                 <tr class="t2">
+                    <td>${s.orderNo}(${s.orderID})</td>
                     <td colspan="3">
                         <c:if test="${s.organizeID eq 1}"><span class="org-note">星范</span></c:if>
                             ${s.clubName}
@@ -568,7 +601,7 @@
 
                 </tr>
                 <tr>
-                    <th colspan="3">商品名</th>
+                    <th colspan="4">商品名</th>
                     <th>规格</th>
                     <th>数量<%--(赠品)--%></th>
                     <th>退货</th>
@@ -582,7 +615,7 @@
                 <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">
+                        <td style="width:300px;" class="p-name" colspan="4">
                             <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}

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

@@ -219,7 +219,7 @@
                         <td>供应商成本(单)</td>
                         <td>集团成本(单)</td>
                         <td>平台服务费</td>
-                        <td>机构税率</td>
+                        <td>供应商税率</td>
                         <td>供应商税费(单)</td>
                     </tr>
                     <c:forEach items="${newShopOrder.newOrderProducts}" var="product" varStatus="index">

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

@@ -325,78 +325,67 @@
             <%--涛姐遍历下面这个table--%>
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
-                    <th>订单编号(ID)</th>
-                    <th colspan="3">客户</th>
-                    <th colspan="2">下单时间</th>
-                    <th>订单金额</th>
-                    <th colspan="3">所有子订单</th>
-                    <th>订单总佣金</th>
-                    <th>机构运费</th>
-                    <th>收款状态</th>
+                    <th>子订单编号(ID)</th>
+                    <th colspan="3">下单时间</th>
+                    <th colspan="2">子订单金额</th>
+                    <th colspan="4">采美平台服务费</th>
+                    <th>采美自营订单利润</th>
+                    <th>采美总利润</th>
+                    <th colspan="2">收款状态</th>
                     <th colspan="3">收款金额</th>
-                    <th>促销满减</th>
-                    <th>优惠券</th>
+                    <th colspan="2">经理折扣</th>
+                    <th colspan="2">优惠券</th>
                 <tr/>
                 <tr>
-                    <td> ${s.orderNo}(${s.orderID})</td>
-                    <td colspan="3"> ${s.buyer}</td>
-                    <td colspan="2"> ${s.orderTime}</td>
-                    <td>${s.payTotalFee}</td>
-                    <td colspan="3">
-                        <c:forEach items="${s.shopOrderNos}" var="cs">
-                            ${cs}<br/>
-                        </c:forEach>
-                    </td>
-                    <td>
-                        <c:if test="${empty s.brokerage}">0.00</c:if>
-                        <c:if test="${not empty s.brokerage}">${s.brokerage}</c:if>
-                         <%--   ${s.income}
-                        <c:if test="${not empty s.rebateFee}">
-                            <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>
-                        </c:if>--%>
-                    </td>
-                    <td>
-                        <label class="clubFreight" style="display: none">
-                            <c:choose>
-                                <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
-                                    <fmt:formatNumber value="${s.freight}"/>
-                                </c:when>
-                                <c:otherwise>
-                                    <fmt:formatNumber value="0"/>
-                                </c:otherwise>
-                            </c:choose>
-                        </label>
-                        <c:if test="${s.freight == 0}">
-                            包邮
+                    <td>${s.shopOrderNo}(${s.shopOrderID})</td>
+                    <td colspan="3"> ${s.orderTime}</td>
+                    <td colspan="2">${s.totalAmount}</td>
+                    <td colspan="4">${s.allServeAmount}</td>
+                    <c:if test="${empty s.brokerage}">
+                    <td class="payCm-t"></td>
+                    </c:if>
+                    <c:if test="${not empty s.brokerage}">
+                    <td class="">
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
                         </c:if>
-                        <c:if test="${s.freight == -1}">
-                            到付
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
                         </c:if>
-                        <c:if test="${s.freight == -2}">
-                            仪器到付-产品包邮
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
                         </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.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+                    </td>
+                    </c:if>
+                    <td>
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+                                              pattern="#,##0.00"/>
                         </c:if>
-                        <c:if test="${s.userBeans gt 0}">
-                            (采美豆抵用${s.userBeans})
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
                         </c:if>
                     </td>
-                    <td>
-                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&shopOrderID=${s.shopOrderID}&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 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">
-                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&shopOrderID=${s.shopOrderID}&from=1"
-                           style="text-decoration: underline">${s.receiptTotalFee}</a>
+                            ${s.receiptAmount}
+                        <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
                     </td>
-                    <td>
-                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
-                        <%--<label class="discountFee" style="display: none">
+                    <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}"/>
@@ -426,33 +415,58 @@
                                 </span>
                             </c:if>
                         </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
+                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
                     </td>
-                    <td>${s.couponAmount} </td>
+                    <td class="couponAmount" colspan="2">${s.couponAmount} </td>
                     <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
                 <tr/>
                 <tr>
-                    <th>子订单编号(ID)</th>
-                    <th colspan="3"> 供应商</th>
-                    <th colspan="3">子订单佣金</th>
-                    <th colspan="3">商品费</th>
+                    <th>客户</th>
+                    <th colspan="6"> 供应商</th>
+                    <th colspan="5">商品费</th>
                     <th>应付税费</th>
+                    <th>机构运费</th>
                     <th>供应商运费</th>
                     <th>付款状态</th>
                     <th colspan="3">付供应商</th>
-                    <th>付第三方</th>
-                    <th>成本类型</th>
+                    <th colspan="2">付第三方</th>
                 </tr>
                 <tr>
-                    <td>${s.shopOrderNo}(${s.shopOrderID})</td>
-                    <td colspan="3">${s.shopName}</td>
-                    <td colspan="3" class="payCm-t">子订单佣金</td>
-                    <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
+                    <td> ${s.buyer}</td>
+                    <td colspan="6">${s.shopName}</td>
+                        <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
+                    <td colspan="5" class="product-fee">${s.shopProductAmount}</td>
                     <td class="taxes">
                         <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
                     </td>
-
+                    <td>
+                        <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.shopPostFlag == 2}">
+                            到付
+                        </c:if>
+                        <c:if test="${s.shopPostFlag == -2}">
+                            仪器到付-产品包邮
+                        </c:if>
+                        <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>
 
@@ -469,10 +483,10 @@
                                 应付:<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-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount-s.shopOtherFee},已补差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${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>
+                                <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},</span></div>
@@ -488,12 +502,7 @@
                                 class="red wipeText">¥0.00</em></span></label>
                     </td>
 
-                    <td class="third-party-fee">${s.shopOtherFee}</td>
-
-                    <td>
-                        <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">${s.shopOtherFee}</td>
                 </tr>
                 <tr>
                     <th>商品名</th>
@@ -502,11 +511,12 @@
                     <th>退货</th>
                     <th colspan="3">单价</th>
                     <th colspan="3">机构税率 / 单税费 / 总税费</th>
-                    <th>总价</th>
+                    <th colspan="2">总价</th>
                     <th>利润(单)</th>
                     <th>利润(总)</th>
+                    <th>平台服务费(单)</th>
                     <th colspan="3">供应商税率 / 单税费 / 总税费</th>
-                    <th>成本(单)</th>
+                    <th>成本(单 + 税)</th>
                     <th>成本(总)</th>
                 </tr>
                 <c:forEach items="${s.newOrderProducts}" var="p" varStatus="pIndex">
@@ -543,7 +553,7 @@
                                         type="number" pattern="#,##0.00"/>
                             </c:otherwise>
                         </c:choose></td>
-                        <td><fmt:formatNumber
+                        <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>
@@ -563,7 +573,7 @@
                                 0.00
                             </c:if>
                         </td>
-
+                        <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                         <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                         <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                         <td class="p-taxes-t"><c:choose>

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

@@ -297,10 +297,10 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <c:if test="${cmPayShop.redirectType == 2}" >
+    <c:if test="${cmPayShop.redirectType == 2}">
         <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
     </c:if>
-    <c:if test="${cmPayShop.redirectType != 2}" >
+    <c:if test="${cmPayShop.redirectType != 2}">
         <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
     </c:if>
     <li class="active"><a href="${ctx}/order/cmPayShop/applyDetail?id=${cmPayShop.id}">付款单详情</a></li>
@@ -335,83 +335,119 @@
     </div>
     <div class="payment-form-content">
         <%--涛姐遍历下面这个table--%>
-            <c:forEach items="${cmPayShop.shopOrders}" var="s">
-                <table class="table table-striped table-bordered table-condensed pay-table">
-                    <tr>
-                        <th>子订单编号(ID)</th>
-                            <%--                        <th colspan="3">客户</th>--%>
-                        <th colspan="3">下单时间</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="2">优惠券</th>
-                    <tr/>
-                    <tr>
-                            <%--                        <td> ${s.orderNo}(${s.orderID})</td>--%>
-                        <td>${s.shopOrderNo}(${s.shopOrderID})</td>
-                            <%--                        <td colspan="3"> ${s.buyer}</td>--%>
-                        <td colspan="3"> ${s.orderTime}</td>
-                        <td colspan="2">${s.totalAmount}</td>
-                            <%--                        <td colspan="3">--%>
-                            <%--                        <c:forEach items="${s.shopOrderNos}" var="cs">--%>
-                            <%--                            ${cs}<br/>--%>
-                            <%--                        </c:forEach>--%>
-                            <%--                        </td>--%>
-                            <%--                        <td>--%>
-                            <%--                                ${s.income}--%>
-                            <%--                            <c:if test="${not empty s.rebateFee}">--%>
-                            <%--                                    <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>--%>
-                            <%--                            </c:if>--%>
-                            <%--                        </td>--%>
-                        <td colspan="4">${s.allServeAmount}</td>
-                            <%--<td>
-                                <label class="clubFreight"  style="display: none">
-                                    <c:choose>
-                                        <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
-                                            <fmt:formatNumber value="${s.freight}"/>
-                                        </c:when>
-                                        <c:otherwise>
-                                            <fmt:formatNumber value="0"/>
-                                        </c:otherwise>
-                                    </c:choose>
-                                </label>
-                                <c:if test="${s.freight == 0}">
-                                    包邮
-                                </c:if>
-                                <c:if test="${s.freight == -1}">
-                                    到付
-                                </c:if>
-                                <c:if test="${s.freight == -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.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
-                                </c:if>
-                                <c:if test="${s.userBeans gt 0}">
-                                    (采美豆抵用${s.userBeans})
-                                </c:if>
-                            </td>--%>
-                        <td colspan="2">
+        <c:forEach items="${cmPayShop.shopOrders}" var="s">
+            <table class="table table-striped table-bordered table-condensed pay-table">
+                <tr>
+                    <th>子订单编号(ID)</th>
+                        <%--                        <th colspan="3">客户</th>--%>
+                    <th colspan="3">下单时间</th>
+                    <th colspan="2">子订单金额</th>
+                        <%--                        <th colspan="3">所有子订单</th>--%>
+                        <%--                        <th>订单总佣金</th>--%>
+                    <th colspan="4">采美平台服务费</th>
+                    <th>采美自营订单利润</th>
+                    <th>采美总利润</th>
+                        <%--                        <th>机构运费</th>--%>
+                    <th colspan="2">收款状态</th>
+                    <th colspan="3">收款金额</th>
+                    <th colspan="2">促销满减</th>
+                    <th colspan="2">优惠券</th>
+                <tr/>
+                <tr>
+                        <%--                        <td> ${s.orderNo}(${s.orderID})</td>--%>
+                    <td>${s.shopOrderNo}(${s.shopOrderID})</td>
+                        <%--                        <td colspan="3"> ${s.buyer}</td>--%>
+                    <td colspan="3"> ${s.orderTime}</td>
+                    <td colspan="2">${s.totalAmount}</td>
+                        <%--                        <td colspan="3">--%>
+                        <%--                        <c:forEach items="${s.shopOrderNos}" var="cs">--%>
+                        <%--                            ${cs}<br/>--%>
+                        <%--                        </c:forEach>--%>
+                        <%--                        </td>--%>
+                        <%--                        <td>--%>
+                        <%--                                ${s.income}--%>
+                        <%--                            <c:if test="${not empty s.rebateFee}">--%>
+                        <%--                                    <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>--%>
+                        <%--                            </c:if>--%>
+                        <%--                        </td>--%>
+                    <td colspan="4">${s.allServeAmount}</td>
+                    <c:if test="${empty s.brokerage}">
+                    <td class="payCm-t"></td>
+                    </c:if>
+                    <c:if test="${not empty s.brokerage}">
+                    <td class="">
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                    </td>
+                    </c:if>
+                    <td>
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                    </td>
+                        <%--<td>
+                            <label class="clubFreight"  style="display: none">
+                                <c:choose>
+                                    <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
+                                        <fmt:formatNumber value="${s.freight}"/>
+                                    </c:when>
+                                    <c:otherwise>
+                                        <fmt:formatNumber value="0"/>
+                                    </c:otherwise>
+                                </c:choose>
+                            </label>
+                            <c:if test="${s.freight == 0}">
+                                包邮
+                            </c:if>
+                            <c:if test="${s.freight == -1}">
+                                到付
+                            </c:if>
+                            <c:if test="${s.freight == -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.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+                            </c:if>
+                            <c:if test="${s.userBeans gt 0}">
+                                (采美豆抵用${s.userBeans})
+                            </c:if>
+                        </td>--%>
+                    <td colspan="2">
                             <%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
                                style="text-decoration: underline">
                                 </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 colspan="3">
+                        <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">
                             <%--<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">
-                            <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                            ${s.receiptAmount}
+                        <c:if test="${s.accountAmount>0}">(余额抵扣 ¥${s.accountAmount})</c:if>
+                    </td>
+                    <td colspan="2">
+                        <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
                             <%--<label class="discountFee">
                                 <c:choose>
                                     <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
@@ -443,206 +479,198 @@
                                 </c:if>
                             </c:if>
                             <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
-                        </td>
-                        <td class="couponAmount" colspan="2">${s.couponAmount} </td>
-                        <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
-                    <tr/>
-                    <tr>
-                        <th>客户</th>
-                        <th colspan="3"> 供应商</th>
-                        <th colspan="3">子订单利润</th>
-                        <th colspan="3">商品费</th>
-                        <th>应付税费</th>
-                        <th>机构运费</th>
-                        <th>供应商运费</th>
-                        <th>付款状态</th>
-                        <th colspan="3">付供应商</th>
-                        <th colspan="2">付第三方</th>
+                    </td>
+                    <td class="couponAmount" colspan="2">${s.couponAmount} </td>
+                    <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
+                <tr/>
+                <tr>
+                    <th>客户</th>
+                    <th colspan="6"> 供应商</th>
+                    <th colspan="5">商品费</th>
+                    <th>应付税费</th>
+                    <th>机构运费</th>
+                    <th>供应商运费</th>
+                    <th>付款状态</th>
+                    <th colspan="3">付供应商</th>
+                    <th colspan="2">付第三方</th>
                         <%--<th>成本类型</th>--%>
-                    </tr>
-                    <tr>
-                        <td> ${s.buyer}</td>
-                        <td colspan="3">${s.shopName}</td>
-                        <c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-                        <c:if test="${not empty s.brokerage}">
-                            <td colspan="3" class="">
-                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
-                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                            </td>
+                </tr>
+                <tr>
+                    <td> ${s.buyer}</td>
+                    <td colspan="6">${s.shopName}</td>
+                        <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
+                    <td colspan="5" class="product-fee">${s.shopProductAmount}</td>
+                    <td class="taxes">
+                        <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
+                    </td>
+                    <td>
+                        <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>
-                            <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
-                        <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
-                        <td class="taxes">
-                            <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
-                        </td>
-                        <td>
-                            <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.shopPostFlag == 2}">
-                                到付
-                            </c:if>
-                            <c:if test="${s.shopPostFlag == -2}">
-                                仪器到付-产品包邮
-                            </c:if>
-                            <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>
-
-                        <td>
-                            <c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font
-                                    color="red">待付款</font></c:if>
-                            <c:if test="${s.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
-                            <c:if test="${s.payStatus == 3}"><font color="green">已付款</font></c:if>
-                        </td>
-
-                        <td colspan="3" class="supplier-fee">
-                            <div><span class="nowrap">
+                        <c:if test="${s.shopPostFlag == 2}">
+                            到付
+                        </c:if>
+                        <c:if test="${s.shopPostFlag == -2}">
+                            仪器到付-产品包邮
+                        </c:if>
+                        <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>
+
+                    <td>
+                        <c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font
+                                color="red">待付款</font></c:if>
+                        <c:if test="${s.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
+                        <c:if test="${s.payStatus == 3}"><font color="green">已付款</font></c:if>
+                    </td>
+
+                    <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-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
+                                应付:<fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number"
+                                                     pattern="#,##0.00"/>
                             </c:if>
 							<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber
+                                        value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${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}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
                             </c:if>
 							,</span>
-                                <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}"
-                                                                data-difference="${s.differencePrice}"
-                                                                data-pay="${s.shouldPayShopAmount}"
-                                                                data-payed="${s.payedShopAmount}"></span></div>
-                            <input type="hidden" name="payInfo" class="payInfo" data-shoporderid="${s.shopOrderID}"
-                                   value="${s.shopOrderID}_${s.waitPayShop}_0">
-                            <label class="wipeBtn"><input class="wipeFee" type="checkbox" value="0"><span>付款抹平:<em
-                                    class="red wipeText">¥0.00</em></span></label>
-                        </td>
-
-                        <td colspan="2" class="third-party-fee">${s.shopOtherFee}</td>
+                            <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}"
+                                                            data-difference="${s.differencePrice}"
+                                                            data-pay="${s.shouldPayShopAmount}"
+                                                            data-payed="${s.payedShopAmount}"></span></div>
+                        <input type="hidden" name="payInfo" class="payInfo" data-shoporderid="${s.shopOrderID}"
+                               value="${s.shopOrderID}_${s.waitPayShop}_0">
+                        <label class="wipeBtn"><input class="wipeFee" type="checkbox" value="0"><span>付款抹平:<em
+                                class="red wipeText">¥0.00</em></span></label>
+                    </td>
+
+                    <td colspan="2" class="third-party-fee">${s.shopOtherFee}</td>
 
                         <%--<td>
                             <c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if>
                             <c:if test="${s.costType == '2'}">比例成本</c:if>
                         </td>--%>
-                    </tr>
-                    <tr>
-                        <th>商品名</th>
-                        <th>规格</th>
-                        <th>数量<%--(赠品)--%></th>
-                        <th>退货</th>
-                        <th colspan="2">单价</th>
-                        <th colspan="3">机构税率 / 单税费 / 总税费</th>
-                        <th colspan="2">总价</th>
-                        <th>利润(单)</th>
-                        <th>利润(总)</th>
-                        <th>平台服务费(单)</th>
-                        <th colspan="3">供应商税率 / 单税费 / 总税费</th>
-                        <th>成本(单 + 税)</th>
-                        <th>成本(总)</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">
-                                <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>
-                                <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"/>
-                                </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>
-                                <c:if test="${p.productType == 0}">
-                                    <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${p.productType != 0}">
-                                    0.00
-                                </c:if>
-                            </td>
+                </tr>
+                <tr>
+                    <th>商品名</th>
+                    <th>规格</th>
+                    <th>数量<%--(赠品)--%></th>
+                    <th>退货</th>
+                    <th colspan="3">单价</th>
+                    <th colspan="3">机构税率 / 单税费 / 总税费</th>
+                    <th colspan="2">总价</th>
+                    <th>利润(单)</th>
+                    <th>利润(总)</th>
+                    <th>平台服务费(单)</th>
+                    <th colspan="3">供应商税率 / 单税费 / 总税费</th>
+                    <th>成本(单 + 税)</th>
+                    <th>成本(总)</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">
+                            <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="3"><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"/>
+                            </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>
+                            <c:if test="${p.productType == 0}">
+                                <fmt:formatNumber
+                                        value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}"
+                                        pattern="#,##0.00"/>
+                            </c:if>
+                            <c:if test="${p.productType != 0}">
+                                0.00
+                            </c:if>
+                        </td>
 
-                            <td class="payCm">
-                                <c:if test="${p.productType == 0}">
-                                    <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${p.productType != 0}">
-                                    0.00
-                                </c:if>
-                            </td>
-                            <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
-                            <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
-                            <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
-                            <td class="p-taxes-t"><c:choose>
-                                <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"/>
-                                </c:otherwise>
-                            </c:choose></td>
-                            <td class="p-costprice"><fmt:formatNumber value="${p.costPrice}" type="number"
-                                                                      pattern="#,##0.00"/></td>
-                            <td><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}"
-                                                  type="number" pattern="#,##0.00"/></td>
-                        </tr>
-                    </c:forEach>
-                </table>
-            </c:forEach>
+                        <td class="payCm">
+                            <c:if test="${p.productType == 0}">
+                                <fmt:formatNumber
+                                        value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}"
+                                        pattern="#,##0.00"/>
+                            </c:if>
+                            <c:if test="${p.productType != 0}">
+                                0.00
+                            </c:if>
+                        </td>
+                        <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number"
+                                              pattern="#,##0.00"/></td>
+                        <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
+                        <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
+                        <td class="p-taxes-t"><c:choose>
+                            <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"/>
+                            </c:otherwise>
+                        </c:choose></td>
+                        <td class="p-costprice"><fmt:formatNumber value="${p.costPrice}" type="number"
+                                                                  pattern="#,##0.00"/></td>
+                        <td><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}"
+                                              type="number" pattern="#,##0.00"/></td>
+                    </tr>
+                </c:forEach>
+            </table>
+        </c:forEach>
     </div>
     <div class="payment-form-bottom">
         <div>
@@ -687,7 +715,7 @@
                         <label>付款银行:</label>
                         <span id="payType">${cmPayShop.bankNameType}
 
-						</span>
+                        </span>
                     </c:if>
                     <c:if test="${cmPayShop.status != '0'}">
                         <label>付款时间:</label>

+ 44 - 24
src/main/webapp/WEB-INF/views/modules/order/cmPayShopEdit.jsp

@@ -94,7 +94,9 @@
                         <th colspan="2">子订单金额</th>
                             <%--                        <th colspan="3">所有子订单</th>--%>
                             <%--                        <th>订单总佣金</th>--%>
-                        <th colspan="4">总平台服务费</th>
+                        <th colspan="4">采美平台服务费</th>
+                        <th>采美自营订单利润</th>
+                        <th>采美总利润</th>
                             <%--                        <th>机构运费</th>--%>
                         <th colspan="2">收款状态</th>
                         <th colspan="3">收款金额</th>
@@ -118,7 +120,41 @@
                             <%--                                    <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>--%>
                             <%--                            </c:if>--%>
                             <%--                        </td>--%>
-                        <td colspan="4">${s.allServeAmount}</td>
+                                <td colspan="4">${s.allServeAmount}</td>
+                                <c:if test="${empty s.brokerage}">
+                                <td class="payCm-t"></td>
+                                </c:if>
+                                <c:if test="${not empty s.brokerage}">
+                                <td class="">
+                                    <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                        <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                                    </c:if>
+                                    <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                        <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+                                                          pattern="#,##0.00"/>
+                                    </c:if>
+                                    <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                        <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+                                                          pattern="#,##0.00"/>
+                                    </c:if>
+                                </td>
+                                </c:if>
+                                <td>
+                                    <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                        <fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+                                                          pattern="#,##0.00"/>
+                                    </c:if>
+                                    <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                        <fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+                                                          type="number"
+                                                          pattern="#,##0.00"/>
+                                    </c:if>
+                                    <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                        <fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+                                                          type="number"
+                                                          pattern="#,##0.00"/>
+                                    </c:if>
+                                </td>
                             <%--<td>
                                 <label class="clubFreight"  style="display: none">
                                     <c:choose>
@@ -199,9 +235,8 @@
                     <tr/>
                     <tr>
                         <th>客户</th>
-                        <th colspan="3"> 供应商</th>
-                        <th colspan="3">子订单利润</th>
-                        <th colspan="3">商品费</th>
+                        <th colspan="6"> 供应商</th>
+                        <th colspan="5">商品费</th>
                         <th>应付税费</th>
                         <th>机构运费</th>
                         <th>供应商运费</th>
@@ -212,24 +247,9 @@
                     </tr>
                     <tr>
                         <td> ${s.buyer}</td>
-                        <td colspan="3">${s.shopName}</td>
-                        <c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-                        <c:if test="${not empty s.brokerage}">
-                            <td colspan="3" class="">
-                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
-                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>>
-                                </c:if>
-                            </td>
-                        </c:if>
+                        <td colspan="6">${s.shopName}</td>
                             <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
-                        <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
+                        <td colspan="5" class="product-fee">${s.shopProductAmount}</td>
                         <td class="taxes">
                             <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
                         </td>
@@ -308,7 +328,7 @@
                         <th>规格</th>
                         <th>数量<%--(赠品)--%></th>
                         <th>退货</th>
-                        <th colspan="2">单价</th>
+                        <th colspan="3">单价</th>
                         <th colspan="3">机构税率 / 单税费 / 总税费</th>
                         <th colspan="2">总价</th>
                         <th>利润(单)</th>
@@ -332,7 +352,7 @@
                                 <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}"
+                            <td colspan="3"><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">

+ 162 - 132
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -379,10 +379,10 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <c:if test="${cmPayShop.redirectType == 2}" >
+    <c:if test="${cmPayShop.redirectType == 2}">
         <li><a href="${ctx}/order/cmPayShop/payList">付款管理</a></li>
     </c:if>
-    <c:if test="${cmPayShop.redirectType != 2}" >
+    <c:if test="${cmPayShop.redirectType != 2}">
         <li><a href="${ctx}/order/cmPayShop/">付款管理</a></li>
     </c:if>
     <li class="active"><a>提交付款单</a></li>
@@ -421,152 +421,173 @@
                 <table class="table table-striped table-bordered table-condensed pay-table">
                     <tr>
                         <th>子订单编号(ID)</th>
-<%--                        <th colspan="3">客户</th>--%>
+                            <%--                        <th colspan="3">客户</th>--%>
                         <th colspan="3">下单时间</th>
                         <th colspan="2">子订单金额</th>
-<%--                        <th colspan="3">所有子订单</th>--%>
-<%--                        <th>订单总佣金</th>--%>
+                            <%--                        <th colspan="3">所有子订单</th>--%>
+                            <%--                        <th>订单总佣金</th>--%>
                         <th colspan="4">采美平台服务费</th>
-<%--                        <th>机构运费</th>--%>
+                        <th>采美自营订单利润</th>
+                        <th>采美总利润</th>
+                            <%--                        <th>机构运费</th>--%>
                         <th colspan="2">收款状态</th>
                         <th colspan="3">收款金额</th>
                         <th colspan="2">促销满减</th>
                         <th colspan="2">优惠券</th>
                     <tr/>
                     <tr>
-<%--                        <td> ${s.orderNo}(${s.orderID})</td>--%>
+                            <%--                        <td> ${s.orderNo}(${s.orderID})</td>--%>
                         <td>${s.shopOrderNo}(${s.shopOrderID})</td>
-<%--                        <td colspan="3"> ${s.buyer}</td>--%>
+                            <%--                        <td colspan="3"> ${s.buyer}</td>--%>
                         <td colspan="3"> ${s.orderTime}</td>
                         <td colspan="2">${s.totalAmount}</td>
-<%--                        <td colspan="3">--%>
-<%--                        <c:forEach items="${s.shopOrderNos}" var="cs">--%>
-<%--                            ${cs}<br/>--%>
-<%--                        </c:forEach>--%>
-<%--                        </td>--%>
-<%--                        <td>--%>
-<%--                                ${s.income}--%>
-<%--                            <c:if test="${not empty s.rebateFee}">--%>
-<%--                                    <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>--%>
-<%--                            </c:if>--%>
-<%--                        </td>--%>
+                            <%--                        <td colspan="3">--%>
+                            <%--                        <c:forEach items="${s.shopOrderNos}" var="cs">--%>
+                            <%--                            ${cs}<br/>--%>
+                            <%--                        </c:forEach>--%>
+                            <%--                        </td>--%>
+                            <%--                        <td>--%>
+                            <%--                                ${s.income}--%>
+                            <%--                            <c:if test="${not empty s.rebateFee}">--%>
+                            <%--                                    <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>--%>
+                            <%--                            </c:if>--%>
+                            <%--                        </td>--%>
                         <td colspan="4">${s.allServeAmount}</td>
-                        <%--<td>
-                            <label class="clubFreight"  style="display: none">
-                                <c:choose>
-                                    <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
-                                        <fmt:formatNumber value="${s.freight}"/>
-                                    </c:when>
-                                    <c:otherwise>
-                                        <fmt:formatNumber value="0"/>
-                                    </c:otherwise>
-                                </c:choose>
-                            </label>
-                            <c:if test="${s.freight == 0}">
-                                包邮
-                            </c:if>
-                            <c:if test="${s.freight == -1}">
-                                到付
-                            </c:if>
-                            <c:if test="${s.freight == -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.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
-                            </c:if>
-                            <c:if test="${s.userBeans gt 0}">
-                                (采美豆抵用${s.userBeans})
+                        <c:if test="${empty s.brokerage}">
+                        <td class="payCm-t"></td>
                             </c:if>
-                        </td>--%>
-                        <td colspan="2">
-                            <%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-                               style="text-decoration: underline">
-                                </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 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">
-                            <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
-                            <%--<label class="discountFee">
-                                <c:choose>
-                                    <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
-                                        <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
-                                    </c:when>
-                                    <c:otherwise>
-                                        0
-                                    </c:otherwise>
-                                </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}"
-                                                      type="currency"/>
+                            <c:if test="${not empty s.brokerage}">
+                            <td class="">
+                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
                                 </c:if>
-                                <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
-                                    ¥0.00
+                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+                                                      pattern="#,##0.00"/>
                                 </c:if>
-                                <c:if test="${s.returnedPurchaseTotalFee gt 0}">
-                                <span style="color: red">
-                                    (原<fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>,因退货折扣取消
-                                    <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
-                                        <fmt:formatNumber value="${s.returnedPurchaseTotalFee}" type="currency"/>
-                                    </c:if>
-                                    <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
-                                        <fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>
-                                    </c:if>)
-                                </span>
+                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+                                                      pattern="#,##0.00"/>
                                 </c:if>
+                            </td>
                             </c:if>
-                            <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
-                        </td>
-                        <td class="couponAmount" colspan="2">${s.couponAmount} </td>
-                        <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
+                            <td>
+                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                                    <fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+                                                      pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+                                                      type="number"
+                                                      pattern="#,##0.00"/>
+                                </c:if>
+                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                                    <fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+                                                      type="number"
+                                                      pattern="#,##0.00"/>
+                                </c:if>
+                            </td>
+                                <%--<td>
+                                    <label class="clubFreight"  style="display: none">
+                                        <c:choose>
+                                            <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
+                                                <fmt:formatNumber value="${s.freight}"/>
+                                            </c:when>
+                                            <c:otherwise>
+                                                <fmt:formatNumber value="0"/>
+                                            </c:otherwise>
+                                        </c:choose>
+                                    </label>
+                                    <c:if test="${s.freight == 0}">
+                                        包邮
+                                    </c:if>
+                                    <c:if test="${s.freight == -1}">
+                                        到付
+                                    </c:if>
+                                    <c:if test="${s.freight == -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.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+                                    </c:if>
+                                    <c:if test="${s.userBeans gt 0}">
+                                        (采美豆抵用${s.userBeans})
+                                    </c:if>
+                                </td>--%>
+                            <td colspan="2">
+                                    <%--<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
+                                       style="text-decoration: underline">
+                                        </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 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">
+                                <fmt:formatNumber value="${s.promotionFullReduction}" type="number" pattern="#,##0.00"/>
+                                    <%--<label class="discountFee">
+                                        <c:choose>
+                                            <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
+                                                <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
+                                            </c:when>
+                                            <c:otherwise>
+                                                0
+                                            </c:otherwise>
+                                        </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}"
+                                                              type="currency"/>
+                                        </c:if>
+                                        <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
+                                            ¥0.00
+                                        </c:if>
+                                        <c:if test="${s.returnedPurchaseTotalFee gt 0}">
+                                        <span style="color: red">
+                                            (原<fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>,因退货折扣取消
+                                            <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
+                                                <fmt:formatNumber value="${s.returnedPurchaseTotalFee}" type="currency"/>
+                                            </c:if>
+                                            <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
+                                                <fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>
+                                            </c:if>)
+                                        </span>
+                                        </c:if>
+                                    </c:if>
+                                    <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>--%>
+                            </td>
+                            <td class="couponAmount" colspan="2">${s.couponAmount} </td>
+                            <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
                     <tr/>
                     <tr>
                         <th>客户</th>
-                        <th colspan="3"> 供应商</th>
-                        <th colspan="3">采美自营订单利润</th>
-                        <th colspan="3">商品费</th>
+                        <th colspan="6"> 供应商</th>
+                        <th colspan="5">商品费</th>
                         <th>应付税费</th>
                         <th>机构运费</th>
                         <th>供应商运费</th>
                         <th>付款状态</th>
                         <th colspan="3">付供应商</th>
                         <th colspan="2">付第三方</th>
-                        <%--<th>成本类型</th>--%>
+                            <%--<th>成本类型</th>--%>
                     </tr>
                     <tr>
                         <td> ${s.buyer}</td>
-                        <td colspan="3">${s.shopName}</td>
-                        <c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-                        <c:if test="${not empty s.brokerage}">
-                            <td colspan="3" class="">
-                                <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
-                                    <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                    <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                                <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                                    <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>
-                                </c:if>
-                            </td>
-                        </c:if>
-                         <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
-                        <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
+                        <td colspan="6">${s.shopName}</td>
+                            <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
+                        <td colspan="5" class="product-fee">${s.shopProductAmount}</td>
 
                         <td class="taxes">
                             <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
                         </td>
                         <td>
-                            <label class="clubFreight"  style="display: none">
+                            <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}"/>
@@ -606,13 +627,16 @@
                         <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-s.shopOtherFee}" type="number" pattern="#,##0.00"/>
+                                应付:<fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number"
+                                                     pattern="#,##0.00"/>
                             </c:if>
 							<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                                <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
+                                <font color="black"><fmt:formatNumber
+                                        value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${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}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
                             </c:if>
 							,</span>
                                 <span class="nowrap">已付:${s.payedShopAmount},</span></div>
@@ -630,17 +654,17 @@
 
                         <td colspan="2" class="third-party-fee">${s.shopOtherFee}</td>
 
-                        <%--<td>
-                            <c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if>
-                            <c:if test="${s.costType == '2'}">比例成本</c:if>
-                        </td>--%>
+                            <%--<td>
+                                <c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if>
+                                <c:if test="${s.costType == '2'}">比例成本</c:if>
+                            </td>--%>
                     </tr>
                     <tr>
                         <th>商品名</th>
                         <th>规格</th>
                         <th>数量<%--(赠品)--%></th>
                         <th>退货</th>
-                        <th colspan="2">单价</th>
+                        <th colspan="3">单价</th>
                         <th colspan="3">机构税率 / 单税费 / 总税费</th>
                         <th colspan="2">总价</th>
                         <th>利润(单)</th>
@@ -664,8 +688,9 @@
                                 <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
                             </td>
                             <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-                            <td colspan="2">
-                                <fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}" type="number" pattern="#,##0.00"/>
+                            <td colspan="3">
+                                <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)?'不含税-能开票':'不含税-不能开票'})
@@ -689,7 +714,9 @@
                                     type="number" pattern="#,##0.00"/></td>
                             <td>
                                 <c:if test="${p.productType == 0}">
-                                    <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                                    <fmt:formatNumber
+                                            value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}"
+                                            pattern="#,##0.00"/>
                                 </c:if>
                                 <c:if test="${p.productType != 0}">
                                     0.00
@@ -698,13 +725,16 @@
 
                             <td class="payCm">
                                 <c:if test="${p.productType == 0}">
-                                    <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                                    <fmt:formatNumber
+                                            value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}"
+                                            pattern="#,##0.00"/>
                                 </c:if>
                                 <c:if test="${p.productType != 0}">
                                     0.00
                                 </c:if>
                             </td>
-                            <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
+                            <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number"
+                                                  pattern="#,##0.00"/></td>
                             <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                             <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                             <td class="p-taxes-t"><c:choose>
@@ -1010,12 +1040,12 @@
                 totalComissionVal = 0,
                 resVal = '';
             totalComissionEle = thisEle.find('.payCm'),//单个商品总佣金
-            comissionEle = thisEle.find('.payCm-t'),//子订单佣金
-            thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),//付第三方
-            freightVal = thisEle.find('.freight').text().replace(',', ''),//供应商运费
-            clubFreight = Number(thisEle.find('.clubFreight').text().replace(',', '')),//机构运费
-            discountFee = Number(thisEle.find('.discountFee').text().replace(',', '')),//经理折扣
-            eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',',''));//分摊优惠
+                comissionEle = thisEle.find('.payCm-t'),//子订单佣金
+                thirdPartyVal = thisEle.find('.third-party-fee').text().replace(',', ''),//付第三方
+                freightVal = thisEle.find('.freight').text().replace(',', ''),//供应商运费
+                clubFreight = Number(thisEle.find('.clubFreight').text().replace(',', '')),//机构运费
+                discountFee = Number(thisEle.find('.discountFee').text().replace(',', '')),//经理折扣
+                eachDiscount = Number(thisEle.find('.eachDiscount').text().replace(',', ''));//分摊优惠
             totalComissionEle.each(function () {
                 totalComissionVal += Number($(this).text().replace(',', ''));
             })

+ 44 - 30
src/main/webapp/WEB-INF/views/modules/order/cmPayShopPrintDetail.jsp

@@ -102,7 +102,9 @@
 							<th colspan="2">子订单金额</th>
 								<%--                        <th colspan="3">所有子订单</th>--%>
 								<%--                        <th>订单总佣金</th>--%>
-							<th colspan="4">总平台服务费</th>
+							<th colspan="4">采美平台服务费</th>
+							<th>采美自营订单利润</th>
+							<th>采美总利润</th>
 								<%--                        <th>机构运费</th>--%>
 							<th colspan="2">收款状态</th>
 							<th colspan="3">收款金额</th>
@@ -126,7 +128,41 @@
 								<%--                                    <span style="color: red">(含返佣服务费¥${s.rebateFee})</span>--%>
 								<%--                            </c:if>--%>
 								<%--                        </td>--%>
-							<td colspan="4">${s.allServeAmount}</td>
+									<td colspan="4">${s.allServeAmount}</td>
+									<c:if test="${empty s.brokerage}">
+									<td class="payCm-t"></td>
+									</c:if>
+									<c:if test="${not empty s.brokerage}">
+									<td class="">
+										<c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+											<fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+										</c:if>
+										<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+											<fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+															  pattern="#,##0.00"/>
+										</c:if>
+										<c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+											<fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+															  pattern="#,##0.00"/>
+										</c:if>
+									</td>
+									</c:if>
+									<td>
+										<c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+											<fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+															  pattern="#,##0.00"/>
+										</c:if>
+										<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+											<fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+															  type="number"
+															  pattern="#,##0.00"/>
+										</c:if>
+										<c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+											<fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+															  type="number"
+															  pattern="#,##0.00"/>
+										</c:if>
+									</td>
 								<%--<td>
                                     <label class="clubFreight"  style="display: none">
                                         <c:choose>
@@ -207,37 +243,20 @@
 						<tr/>
 						<tr>
 							<th>客户</th>
-							<th colspan="3"> 供应商</th>
-							<th colspan="3">子订单利润</th>
-							<th colspan="3">商品费</th>
+							<th colspan="6"> 供应商</th>
+							<th colspan="5">商品费</th>
 							<th>应付税费</th>
 							<th>机构运费</th>
 							<th>供应商运费</th>
 							<th>付款状态</th>
 							<th colspan="3">付供应商</th>
 							<th colspan="2">付第三方</th>
-							<%--<th>成本类型</th>--%>
 						</tr>
 						<tr>
 							<td> ${s.buyer}</td>
-							<td colspan="3">${s.shopName}</td>
-							<c:if test="${empty s.brokerage}"><td colspan="3" class="payCm-t"></td></c:if>
-							<c:if test="${not empty s.brokerage}">
-								<td colspan="3" class="">
-									<c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
-										<fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
-									</c:if>
-									<c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-										<fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number" pattern="#,##0.00"/>
-									</c:if>
-									<c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-										<fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number" pattern="#,##0.00"/>
-									</c:if>
-								</td>
-							</c:if>
+							<td colspan="6">${s.shopName}</td>
 								<%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
-							<td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-
+							<td colspan="5" class="product-fee">${s.shopProductAmount}</td>
 							<td class="taxes">
 								<fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
 							</td>
@@ -305,18 +324,13 @@
 							</td>
 
 							<td colspan="2" class="third-party-fee">${s.shopOtherFee}</td>
-
-							<%--<td>
-								<c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if>
-								<c:if test="${s.costType == '2'}">比例成本</c:if>
-							</td>--%>
 						</tr>
 						<tr>
 							<th>商品名</th>
 							<th>规格</th>
 							<th>数量<%--(赠品)--%></th>
 							<th>退货</th>
-							<th colspan="2">单价</th>
+							<th colspan="3">单价</th>
 							<th colspan="3">机构税率 / 单税费 / 总税费</th>
 							<th colspan="2">总价</th>
 							<th>利润(单)</th>
@@ -340,7 +354,7 @@
 									<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}"
+								<td colspan="3"><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">

+ 138 - 114
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopDetail.jsp

@@ -85,132 +85,151 @@
         <c:forEach items="${cmRefundShop.shopOrders}" var="s">
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
-                    <th>订单编号(ID)</th>
-                    <th colspan="3">客户</th>
-                    <th colspan="2">下单时间</th>
-                    <th>订单金额</th>
-                    <th colspan="3">所有子订单</th>
-                    <th>订单总佣金</th>
-                    <th>机构运费</th>
-                    <th>收款状态</th>
+                    <th>子订单编号(ID)</th>
+                    <th colspan="3">下单时间</th>
+                    <th colspan="2">子订单金额</th>
+                    <th colspan="4">采美平台服务费</th>
+                    <th>采美自营订单利润</th>
+                    <th>采美总利润</th>
+                    <th colspan="2">收款状态</th>
                     <th colspan="3">收款金额</th>
-                    <th>经理折扣</th>
-                    <th>优惠券</th>
+                    <th colspan="2">经理折扣</th>
+                    <th colspan="2">优惠券</th>
                 </tr>
                 <tr>
-                    <td> ${s.orderNo}(${s.orderID})</td>
-                    <td colspan="3"> ${s.buyer}</td>
-                    <td colspan="2"> ${s.orderTime}</td>
-                    <td>${s.payTotalFee}</td>
-                    <td colspan="3">
-                        <c:forEach items="${s.shopOrderNos}" var="cs">
-                            ${cs}<br/>
-                        </c:forEach>
+                    <td>${s.shopOrderNo}(${s.shopOrderID})</td>
+                    <td colspan="3"> ${s.orderTime}</td>
+                    <td colspan="2">${s.totalAmount}</td>
+                    <td colspan="4">${s.allServeAmount}</td>
+                    <c:if test="${empty s.brokerage}">
+                    <td class="payCm-t"></td>
+                    </c:if>
+                    <c:if test="${not empty s.brokerage}">
+                    <td class="">
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage}" type="number" pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage-s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage+s.differencePrice}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
                     </td>
+                    </c:if>
                     <td>
-                        <c:if test="${empty s.brokerage}">0.00</c:if>
-                        <c:if test="${not empty s.brokerage}">${s.brokerage}</c:if>
+                        <c:if test="${s.differenceType ne 1 && s.differenceType ne 2}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount}" type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount - s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                        <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
+                            <fmt:formatNumber value="${s.brokerage + s.allServeAmount + s.differencePrice}"
+                                              type="number"
+                                              pattern="#,##0.00"/>
+                        </c:if>
+                    </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" >
+                        0
+<%--                        <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:otherwise>--%>
+<%--                                    0--%>
+<%--                                </c:otherwise>--%>
+<%--                            </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}"--%>
+<%--                                                  type="currency"/>--%>
+<%--                            </c:if>--%>
+<%--                            <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">--%>
+<%--                                ¥0.00--%>
+<%--                            </c:if>--%>
+<%--                            <c:if test="${s.returnedPurchaseTotalFee gt 0}">--%>
+<%--                                <span style="color: red">--%>
+<%--                                    (原<fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>,因退货折扣取消--%>
+<%--                                    <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">--%>
+<%--                                        <fmt:formatNumber value="${s.returnedPurchaseTotalFee}" type="currency"/>--%>
+<%--                                    </c:if>--%>
+<%--                                    <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">--%>
+<%--                                        <fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>--%>
+<%--                                    </c:if>)--%>
+<%--                                </span>--%>
+<%--                            </c:if>--%>
+<%--                        </c:if>--%>
+<%--                        <c:if test="${s.discountTotalFee lt 0}">¥0.00</c:if>--%>
+                    </td>
+                    <td class="couponAmount" colspan="2">${s.couponAmount} </td>
+                    <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
+                <tr/>
+                <tr>
+                    <th>客户</th>
+                    <th colspan="6"> 供应商</th>
+                    <th colspan="5">商品费</th>
+                    <th>应付税费</th>
+                    <th>机构运费</th>
+                    <th>供应商运费</th>
+                    <th>付款状态</th>
+                    <th colspan="3">付供应商</th>
+                    <th colspan="2">付第三方</th>
+                </tr>
+                <tr>
+                    <td> ${s.buyer}</td>
+                    <td colspan="6">${s.shopName}</td>
+                        <%-- 子订单佣金=商品总佣金+机构运费-付第三方-供应商运费-分摊优惠--%>
+                    <td colspan="5" class="product-fee">${s.shopProductAmount}</td>
+                    <td class="taxes">
+                        <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
                     </td>
                     <td>
                         <label class="clubFreight"  style="display: none">
                             <c:choose>
-                                <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
-                                    <fmt:formatNumber value="${s.freight}"/>
+                                <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.freight == 0}">
+                        <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>
-                        <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 colspan="3">
-                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
-                           style="text-decoration: underline">${s.receiptTotalFee}</a>
-                    </td>
-                    <td>
-                        <label class="discountFee"  style="display: none">
-                            <c:choose>
-                                <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
-                                    <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
-                                </c:when>
-                                <c:otherwise>
-                                    0
-                                </c:otherwise>
-                            </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}"
-                                                  type="currency"/>
-                            </c:if>
-                            <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
-                                ¥0.00
-                            </c:if>
-                            <c:if test="${s.returnedPurchaseTotalFee gt 0}">
-                                <span style="color: red">
-                                    (原<fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>,因退货折扣取消
-                                    <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
-                                        <fmt:formatNumber value="${s.returnedPurchaseTotalFee}" type="currency"/>
-                                    </c:if>
-                                    <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
-                                        <fmt:formatNumber value="${s.discountTotalFee}" type="currency"/>
-                                    </c:if>)
-                                </span>
-                            </c:if>
-                        </c:if>
-                        <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
-                    </td>
-                    <td>${s.couponAmount} </td>
-                    <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
-                <tr/>
-                <tr>
-                    <th>子订单编号(ID)</th>
-                    <th colspan="3"> 供应商</th>
-                    <th colspan="3">子订单佣金</th>
-                    <th colspan="3">商品费</th>
-                    <th>应付税费</th>
-                    <th>供应商运费</th>
-                    <th>付款状态</th>
-                    <th colspan="3">付供应商</th>
-                    <th>付第三方</th>
-                    <th>成本类型</th>
-                </tr>
-                <tr>
-                    <td>${s.shopOrderNo}(${s.shopOrderID})</td>
-                    <td colspan="3">${s.shopName}</td>
-                    <c:if test="${empty s.brokerage}"><td colspan="3" class="">0.00</td></c:if>
-                    <c:if test="${not empty s.brokerage}"><td colspan="3" class="">${s.brokerage}</td></c:if>
-                    <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-                    <td class="taxes">
-                        <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
-                    </td>
-
                     <td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number"
                                                           pattern="#,##0.00"/></td>
-
                     <td>
                         <c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font
                                 color="red">待付款</font></c:if>
@@ -223,11 +242,7 @@
                         </div>
                         <div>退款:${s.refundAmount}</div>
                     </td>
-                    <td class="third-party-fee">${s.shopOtherFee}</td>
-                    <td>
-                        <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">${s.shopOtherFee}</td>
                 </tr>
                 <tr>
                     <th>商品名</th>
@@ -236,11 +251,12 @@
                     <th>退货</th>
                     <th colspan="3">单价</th>
                     <th colspan="3">机构税率 / 单税费 / 总税费</th>
-                    <th>总价</th>
+                    <th colspan="2">总价</th>
                     <th>利润(单)</th>
                     <th>利润(总)</th>
+                    <th>平台服务费(单)</th>
                     <th colspan="3">供应商税率 / 单税费 / 总税费</th>
-                    <th>成本(单)</th>
+                    <th>成本(单 + 税)</th>
                     <th>成本(总)</th>
                 </tr>
                 <c:forEach items="${s.newOrderProducts}" var="p" varStatus="pIndex">
@@ -257,7 +273,8 @@
                             <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
                         </td>
                         <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-                        <td colspan="3">${empty p.touchPrice?p.discountPrice:p.touchPrice }
+                        <td colspan="3"><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)?'不含税-能开票':'不含税-不能开票'})
@@ -271,14 +288,17 @@
                                 ---
                             </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><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 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>
                             <c:if test="${p.productType == 0}">
-                                <fmt:formatNumber value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
+                                <fmt:formatNumber value="${p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)}" pattern="#,##0.00"/>
                             </c:if>
                             <c:if test="${p.productType != 0}">
                                 0.00
@@ -287,13 +307,13 @@
 
                         <td class="payCm">
                             <c:if test="${p.productType == 0}">
-                                <fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
+                                <fmt:formatNumber value="${(p.oldDiscountPrice - (p.costPrice + p.cmCostPrice + p.organizeCostPrice)) * (p.num + p.presentNum - p.returnedNum)}" pattern="#,##0.00"/>
                             </c:if>
                             <c:if test="${p.productType != 0}">
                                 0.00
                             </c:if>
                         </td>
-
+                        <td><fmt:formatNumber value="${p.returnedNum == p.num ? 0.00 : p.cmCostPrice}" type="number" pattern="#,##0.00"/></td>
                         <td class="p-taxes">${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'---':empty p.supplierTaxRate?0.0:p.supplierTaxRate}${(p.includedTax ne '' and p.includedTax eq 0 and p.invoiceType eq 3)?'':'%'}</td>
                         <td class="p-taxes">${(p.includedTax ne '' and (p.includedTax eq 1 or (p.includedTax eq 0 and p.invoiceType eq 3)))?'---': empty p.singleShouldPayTotalTax ?0.00:p.singleShouldPayTotalTax}</td>
                         <td class="p-taxes-t"><c:choose>
@@ -301,11 +321,15 @@
                                 ---
                             </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 class="p-costprice"><fmt:formatNumber value="${p.costPrice}" type="number" pattern="#,##0.00"/></td>
-                        <td><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
+                        <td class="p-costprice"><fmt:formatNumber value="${p.costPrice}" type="number"
+                                                                  pattern="#,##0.00"/></td>
+                        <td><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}"
+                                              type="number" pattern="#,##0.00"/></td>
                     </tr>
                 </c:forEach>
             </table>

+ 41 - 8
src/main/webapp/WEB-INF/views/modules/order/refundRecord.jsp

@@ -95,8 +95,7 @@
     <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>子订单编号(ID)</th>
                 <th>下单时间</th>
                 <th>订单金额</th>
                 <th>订单状态</th>
@@ -107,16 +106,18 @@
                 <th>应付金额</th>
                 <th>已付金额</th>
                 <th>结算状态</th>
+                <th>采美平台服务费</th>
+                <th>采美自营订单利润</th>
+                <th>采美总利润</th>
                 <th>应结金额</th>
                 <th>已结金额</th>
                 <th>退款状态</th>
                 <th>退款金额</th>
                 <th>优惠券</th>
-                <th>经理折扣</th>
+                <th colspan="2">经理折扣</th>
             </tr>
             <tr>
-                <td colspan="2">${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</td>
-                <td colspan="2">${shopOrder.orderNo}(${shopOrder.orderID})</td>
+                <td>${shopOrder.shopOrderNo}(${shopOrder.shopOrderID})</td>
                 <td>${shopOrder.orderTime}</td>
                 <td><fmt:formatNumber value="${shopOrder.totalAmount}" type="number" pattern="#,##0.00"/></td>
                 <td>
@@ -164,6 +165,36 @@
                     <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>${shopOrder.allServeAmount}</td>
+                <td>
+                    <c:if test="${shopOrder.differenceType ne 1 && shopOrder.differenceType ne 2}">
+                        <fmt:formatNumber value="${shopOrder.brokerage}" type="number" pattern="#,##0.00"/>
+                    </c:if>
+                    <c:if test="${shopOrder.differenceType eq 1 && shopOrder.differencePrice > 0}">
+                        <fmt:formatNumber value="${shopOrder.brokerage-shopOrder.differencePrice}" type="number"
+                                          pattern="#,##0.00"/>
+                    </c:if>
+                    <c:if test="${shopOrder.differenceType eq 2 && shopOrder.differencePrice > 0}">
+                        <fmt:formatNumber value="${shopOrder.brokerage+shopOrder.differencePrice}" type="number"
+                                          pattern="#,##0.00"/>
+                    </c:if>
+                </td>
+                <td>
+                    <c:if test="${shopOrder.differenceType ne 1 && shopOrder.differenceType ne 2}">
+                        <fmt:formatNumber value="${shopOrder.brokerage + shopOrder.allServeAmount}" type="number"
+                                          pattern="#,##0.00"/>
+                    </c:if>
+                    <c:if test="${shopOrder.differenceType eq 1 && shopOrder.differencePrice > 0}">
+                        <fmt:formatNumber value="${shopOrder.brokerage + shopOrder.allServeAmount - shopOrder.differencePrice}"
+                                          type="number"
+                                          pattern="#,##0.00"/>
+                    </c:if>
+                    <c:if test="${shopOrder.differenceType eq 2 && shopOrder.differencePrice > 0}">
+                        <fmt:formatNumber value="${shopOrder.brokerage + shopOrder.allServeAmount + shopOrder.differencePrice}"
+                                          type="number"
+                                          pattern="#,##0.00"/>
+                    </c:if>
+                </td>
                 <td>
                     <fmt:formatNumber value="${shopOrder.shouldPayShopAmount}" type="number" pattern="#,##0.00"/>
                 </td>
@@ -182,9 +213,10 @@
                 <td>
                     <fmt:formatNumber value="${shopOrder.couponAmount}" type="number" pattern="#,##0.00"/>
                 </td>
-                <td><fmt:formatNumber value="${shopOrder.discountFee}" type="number" pattern="#,##0.00"/></td>
+                <td colspan="2"><fmt:formatNumber value="${shopOrder.discountFee}" type="number" pattern="#,##0.00"/></td>
             </tr>
             <tr class="t2">
+                <th>母订单编号(ID)</th>
                 <th colspan="3">机构</th>
                 <th colspan="3">供应商</th>
                 <th colspan="2">商品费</th>
@@ -198,6 +230,7 @@
                 <th colspan="2">成本类型</th>
             </tr>
             <tr class="t2">
+                <td>${shopOrder.orderNo}(${shopOrder.orderID})</td>
                 <td colspan="3">
                     <c:if test="${shopOrder.organizeID eq 1}"><span class="org-note">星范</span></c:if>
                     ${shopOrder.clubName}
@@ -253,7 +286,7 @@
                         test="${shopOrdercostType == '2'}">比例成本</c:if></td>
             </tr>
             <tr>
-                <th colspan="3">商品名</th>
+                <th colspan="4">商品名</th>
                 <th>规格</th>
                 <th>数量<%--(赠品)--%></th>
                 <th>退货</th>
@@ -267,7 +300,7 @@
             <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">
+                    <td style="width:300px;" class="p-name" colspan="4">
                         <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}