Browse Source

分帐/付款

zhijiezhao 1 year ago
parent
commit
ff31927635

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

@@ -268,4 +268,6 @@ public interface NewOrderDao extends CrudDao<NewOrder> {
     List<SplitAccountPo> getSplitRecord(Integer orderID);
 
     Integer getSplitTime(Integer shopOrderId);
+
+    Double getPaidOrganizePrice(Integer orderProductId);
 }

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

@@ -52,7 +52,15 @@ public class OrderProductVo implements Serializable {
      */
     private Integer costCheckFlag;
     /**
-     * 成本价
+     * 集团/组织固定成本
+     */
+    private Double organizeCostPrice;
+    /**
+     * 平台服务费,采美固定成本
+     */
+    private Double cmCostPrice;
+    /**
+     * 供应商成本价,商品成本
      */
     private Double costPrice;
     /**

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

@@ -71,7 +71,7 @@ public class SplitAccountPo implements Serializable {
      */
     private Integer payStatus;
     /**
-     * 商品类型:1商品成本,2供应商运费,3佣金,4二手发布
+     * 商品类型:1商品成本,2供应商运费,3佣金,4二手发布,5组织佣金
      */
     private Integer productType;
     /**

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

@@ -10,7 +10,6 @@ import com.caimei.redis.RedisService;
 import com.caimei.utils.MathUtil;
 import com.thinkgem.jeesite.common.service.BaseService;
 import okhttp3.*;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -319,8 +318,12 @@ public class SplitAccountService extends BaseService {
         List<OrderProductVo> orderProductList = newOrderDao.getOrderProductByShopOrderId(shopOrder.getShopOrderId());
 
         for (OrderProductVo orderProduct : orderProductList) {
-            // 价格 * 数量 * 供应商成本比例/100
-            double costPrice = MathUtil.mul(orderProduct.getTotalAmount(), orderProduct.getShopPercent() / 100, 2).doubleValue();
+            /**   价格 * 数量
+             *    前版本为全比例成本,当前版本重新加回固定成本,新增字段cmCostPrice(平台服务费,分帐分采美),organizeCostPrice(组织/集团成本。分帐分组织)
+             *    在此规则下,分帐方式取cop固定成本值。因存在成本修改,不能取cm_sku实时更新成本!
+             */
+            double costPrice = MathUtil.mul(orderProduct.getCostPrice(), orderProduct.getNum(), 2).doubleValue();
+            double organizePrice = MathUtil.mul(orderProduct.getOrganizeCostPrice(), orderProduct.getNum(), 2).doubleValue();
             if (2 == supportFlag) {
                 //供应商自己承担手续费
                 costPrice = MathUtil.sub(costPrice, procedureFee).doubleValue();
@@ -363,8 +366,46 @@ public class SplitAccountService extends BaseService {
             if (MathUtil.compare(splitAmount, 0) == 0) {
                 break;
             }
+            // 判断是否支付过组织佣金
+            Double organizePaid = newOrderDao.getPaidOrganizePrice(orderProduct.getOrderProductId());
+            // 支付过金额大于0
+            if (null != organizePaid && MathUtil.compare(organizePaid, 0) > 0) {
+                //已付>0,组织佣金 - 已付
+                organizePrice = MathUtil.sub(organizePrice, paidAmount).doubleValue();
+            }
+            // 待分账金额>组织佣金
+            if (MathUtil.compare(splitAmount, organizePrice) > 0) {
+                // 待分账金额-组织佣金
+                splitAmount = MathUtil.sub(splitAmount, organizePrice).doubleValue();
+            } else {
+                organizePrice = splitAmount;
+                splitAmount = 0.00;
+            }
+            /** 成本分完,金额未尽,有组织佣金的情况,优先组织佣金
+             *  当前版本,采美供应商上架丽格商城,会存在三成本均>0的情况
+             *  若无组织佣金,所有剩余金额归于采美佣金
+             */
+            if (organizePrice > 0) {
+                SplitAccountPo splitAccount = new SplitAccountPo();
+                splitAccount.setShopOrderId(shopOrder.getShopOrderId());
+                splitAccount.setOrderId(shopOrder.getOrderId());
+                splitAccount.setOrderProductId(orderProduct.getOrderProductId());
+                splitAccount.setShopId(orderProduct.getShopId());
+                splitAccount.setSplitAccount(organizePrice);
+                splitAccount.setProductType(5);
+                // 该商品设置了商户号
+                splitAccount.setType(4);
+                splitAccount.setSubUserNo(shopOrder.getSplitCode());
+                logger.info("组织佣金分账参数------------->" + splitAccount.toString());
+                list.add(splitAccount);
+            }
+            if (MathUtil.compare(splitAmount, 0) == 0) {
+                break;
+            }
         }
-        // 如果还有钱则为佣金,分到网络
+        /**  当前版本还要考虑分组织/集团佣金
+         *   如果还有钱则为佣金,分到网络
+         */
         if (MathUtil.compare(splitAmount, 0) > 0) {
             // 此处不考虑手续费,外部计算总额
             SplitAccountPo splitAccount = new SplitAccountPo();

+ 17 - 10
src/main/resources/mappings/modules/order/OrderMapper.xml

@@ -1265,7 +1265,6 @@
                cop.productImage                                                   AS image,
                cop.price,
                cop.shopName,
-               IF(cop.shopid = 998 AND co.freight > 0, co.freight, cop.costPrice) AS costPrice,
                cop.normalPrice,
                cop.ladderPriceFlag,
                cop.discountPrice,
@@ -1296,17 +1295,18 @@
                cop.notOutStore,
                cop.isActProduct                                                   AS actProduct,
                cop.productType,
-               p.productCategory                                                  as productCategory,
-               p.splitCode,
-               cs.shopPercent,
-               cs.cmPercent,
-               cs.organizePercent
+               p.productCategory                                                  AS productCategory,
+#                当前版本采美豆抵运费未实装,且运费子订单已取消,运费金额并入子订单,取值不做操作
+#                IF(cop.shopid = 998 AND co.freight > 0, co.freight, cop.costPrice) AS costPrice,
+               IFNULL(cop.costPrice,0)                                            AS costPrice,
+               IFNULL(cop.organizeCostPrice,0)                                    AS organizeCostPrice,
+               IFNULL(cop.cmCostPrice,0)                                          AS cmCostPrice,
+               p.splitCode
         FROM cm_order_product cop
-                 LEFT JOIN product p ON cop.productID = p.productID
-                 left join cm_order co on co.orderID = cop.orderID
-                 left join cm_sku cs on cop.skuId = cs.skuId and cop.organizeID=cs.organizeID
+        LEFT JOIN product p ON cop.productID = p.productID
+        left join cm_order co on co.orderID = cop.orderID
         WHERE cop.shopOrderID = #{shopOrderId}
-          AND IF(co.userBeans = 0, 1 = 1, cop.shopid != 998)
+#           AND IF(co.userBeans = 0, 1 = 1, cop.shopid != 998)
         group by p.productID
         ORDER BY cop.discountPrice DESC
     </select>
@@ -1455,6 +1455,13 @@
         from cm_voucher_image
         where voucherId = #{id}
     </select>
+    <select id="getPaidOrganizePrice" resultType="java.lang.Double">
+        SELECT SUM(splitAccount)
+        FROM cm_split_account
+        WHERE orderProductId = #{orderProductId}
+          AND payStatus = 1
+          AND productType = 5
+    </select>
     <insert id="insertSplitAccount">
         INSERT INTO cm_split_account (orderId, productId, orderProductId, shopId, couponRecordId, vipRecordId,
                                       authVipRecordId, type, subUserNo, splitAccount,

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

@@ -1,32 +1,43 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>付款修改</title>
-	<meta name="decorator" content="default"/>
-	<style type="text/css">
-			.table th {text-align: center}
-		.table td {text-align: center}
-		#searchForm {
-			white-space: nowrap;
-		}
-		.pay-wrapper {
-			padding: 0 10px;
-		}
-		.pay-list-item {
-			margin-bottom: 30px;
-		}
-		.pay-table th {
-			background: #f9f9f9;
-		}
-		.pay-table tr:first-child th {
-			background: #eee !important;
-		}
-		.pay-table td {
-			background: #fff !important;
-		}
-
-       .form-horizontal .controls {
+    <title>付款修改</title>
+    <meta name="decorator" content="default"/>
+    <style type="text/css">
+        .table th {
+            text-align: center
+        }
+
+        .table td {
+            text-align: center
+        }
+
+        #searchForm {
+            white-space: nowrap;
+        }
+
+        .pay-wrapper {
+            padding: 0 10px;
+        }
+
+        .pay-list-item {
+            margin-bottom: 30px;
+        }
+
+        .pay-table th {
+            background: #f9f9f9;
+        }
+
+        .pay-table tr:first-child th {
+            background: #eee !important;
+        }
+
+        .pay-table td {
+            background: #fff !important;
+        }
+
+        .form-horizontal .controls {
             margin-left: 0;
         }
 
@@ -47,23 +58,29 @@
             text-align: center;
             white-space: nowrap;
         }
-        .controls{
+
+        .controls {
             font-size: 0;
         }
-        .controls .conList{
+
+        .controls .conList {
             display: inline-block;
             margin-right: 15px;
         }
-        .conList .btn:nth-of-type(1){
+
+        .conList .btn:nth-of-type(1) {
             margin-left: 25px;
         }
-        .select2-choice{
+
+        .select2-choice {
             width: 100px;
         }
+
         .upload-content {
             margin-top: -70px;
             display: inline-block;
         }
+
         .upload-content .conList .btn:nth-of-type(1) {
             width: 90px;
             height: 100px;
@@ -71,19 +88,23 @@
             background: #fff;
             position: relative;
         }
-        .upload-content .conList .btn:nth-of-type(1)>div {
+
+        .upload-content .conList .btn:nth-of-type(1) > div {
             position: absolute;
             top: 50%;
             left: 50%;
             transform: translate(-50%, -50%);
             color: #666;
         }
+
         .upload-content .conList .btn:nth-of-type(1) span {
             font-size: 35px;
         }
+
         .upload-content .conList .btn:nth-of-type(1) h5 {
             color: #666;
         }
+
         .cancel-upload {
             background: transparent;
             border: none;
@@ -94,7 +115,8 @@
             cursor: pointer;
             z-index: 100;
         }
-         .upload-content .conList ol li {
+
+        .upload-content .conList ol li {
             width: 114px;
             min-height: 80px;
             text-align: center;
@@ -103,46 +125,47 @@
             top: 120px;
             margin-left: 2px;
         }
+
         .hide-pic {
             display: none !important;
         }
-	</style>
-	<script type="text/javascript">
-        $(document).ready(function() {
-				$("#inputForm").validate({
-                ignore:"",
-                submitHandler: function(form){
-					var modifyShouldPayNote = $("#modifyShouldPayNote").val();//备注
-					if(null == modifyShouldPayNote || ""  == modifyShouldPayNote){
-						alertx("请填写备注内容");
-						return false;
-					}
-					var confirmProductNames = $("#confirmProductNames").val();//修改了成本的含税商品商品名
-					if (confirmProductNames != "") {
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            $("#inputForm").validate({
+                ignore: "",
+                submitHandler: function (form) {
+                    var modifyShouldPayNote = $("#modifyShouldPayNote").val();//备注
+                    if (null == modifyShouldPayNote || "" == modifyShouldPayNote) {
+                        alertx("请填写备注内容");
+                        return false;
+                    }
+                    var confirmProductNames = $("#confirmProductNames").val();//修改了成本的含税商品商品名
+                    if (confirmProductNames != "") {
                         var products = confirmProductNames.substring(0, confirmProductNames.length - 1);
-						var msg = "["+products+"]为含税商品,\n" +
-								"\n" +
-								"您已修改了成本,请确认是否需要修改税率。\n" +
-								"\n" +
-								"若需要修改税率,请点击继续修改按钮后进行修改;\n" +
-								"\n" +
-								"若不需要修改税率,请点击直接确定按钮完成修改";
-						top.$.jBox.confirm(msg, '提示', function (v, h, f) {
-							if (v == true) {
-								loading('正在提交,请稍等...');
-								form.submit();
-							}
-							return;
-						}, {buttons: {'继续修改': false, '直接确定': true}});
-					}else {
+                        var msg = "[" + products + "]为含税商品,\n" +
+                            "\n" +
+                            "您已修改了成本,请确认是否需要修改税率。\n" +
+                            "\n" +
+                            "若需要修改税率,请点击继续修改按钮后进行修改;\n" +
+                            "\n" +
+                            "若不需要修改税率,请点击直接确定按钮完成修改";
+                        top.$.jBox.confirm(msg, '提示', function (v, h, f) {
+                            if (v == true) {
+                                loading('正在提交,请稍等...');
+                                form.submit();
+                            }
+                            return;
+                        }, {buttons: {'继续修改': false, '直接确定': true}});
+                    } else {
                         loading('正在提交,请稍等...');
                         form.submit();
                     }
                 },
                 errorContainer: "#messageBox",
-                errorPlacement: function(error, element) {
+                errorPlacement: function (error, element) {
                     $("#messageBox").text("输入有误,请先更正。");
-                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                         error.appendTo(element.parent().parent());
                     } else {
                         error.insertAfter(element);
@@ -150,7 +173,8 @@
                 }
             });
         });
-        function page(n,s){
+
+        function page(n, s) {
             $("#pageNo").val(n);
             $("#pageSize").val(s);
             $("#searchForm").submit();
@@ -159,314 +183,363 @@
 
         //初始化默认清除本地本地Item数据
 
-	</script>
+    </script>
 </head>
 <body>
 <ul class="nav nav-tabs">
-<%--		<li><a href="${ctx}/order/cmPayShop">付款列表</a></li>--%>
-		<li><a href="${ctx}/shopOrder/payOrderList?operatingMode=1">申请付款</a></li>
-		<li class="active"><a href="${ctx}/shopOrder/toChangePayShopAmount?costType=1&shopOrderID=${shopOrderId}">修改成本</a></li>
+    <%--		<li><a href="${ctx}/order/cmPayShop">付款列表</a></li>--%>
+    <li><a href="${ctx}/shopOrder/payOrderList?operatingMode=1">申请付款</a></li>
+    <li class="active"><a href="${ctx}/shopOrder/toChangePayShopAmount?costType=1&shopOrderID=${shopOrderId}">修改成本</a>
+    </li>
 </ul>
 <input type="hidden" id="confirmProductNames">
-<form:form id="inputForm" modelAttribute="newShopOrder" action="${ctx}/order/cmPayShop/saveChangePayShopAmount?id=${shopOrderId}&costType=1" method="post"
+<form:form id="inputForm" modelAttribute="newShopOrder"
+           action="${ctx}/order/cmPayShop/saveChangePayShopAmount?id=${shopOrderId}&costType=1" method="post"
            class="form-horizontal">
-		<ul class="nav nav-tabs" id="myTab">
-		<c:if test="${dbCostType eq 1 || empty dbCostType}">
-			<li class="active" id="li-fixed-cost"><a href="${ctx}/shopOrder/toChangePayShopAmount?costType=1&shopOrderID=${shopOrderId}">固定成本修改</a></li>
-		</c:if>
-		<c:if test="${dbCostType eq 2 || empty dbCostType}">
-				<li id="li-proportional-cost"><a href="${ctx}/shopOrder/toChangePayShopAmount?costType=2&shopOrderID=${shopOrderId}">销售比例成本修改</a></li>
-		</c:if>
-		</ul>
-		<c:forEach items="${page.list}" var="newShopOrder">
-		<div class="tab-content">
-			<div class="tab-pane active revise-content" id="fixed-cost">
-			<input id="shopOrderID" type="hidden"  name="shopOrderID" value="${newShopOrder.shopOrderID}">
-			<input id="orderID" type="hidden"  name="orderID" value="${newShopOrder.orderID}">
-			<input id="productAmount" type="hidden"  name="productAmount" value="${newShopOrder.productAmount}">
-				<label style="color:red">注意:计算成本时请注意,含税商品的成本包括税费,无需另外计算税费</label>
-				<table class="table table-striped table-bordered table-condensed"  style="width: 70%">
-					<tr>
-						<td>商品名</td>
-						<td>供应商成本(单)</td>
-						<td>集团成本(单)</td>
-						<td>采美成本(单)</td>
-						<td>供应商税率</td>
-						<td>供应商税费(单)</td>
-					</tr>
-							<c:forEach items="${newShopOrder.newOrderProducts}" var="product" varStatus="index">
-									<tr class="orderProducts">
-										<td hidden><input id="num" name="newOrderProducts[${index.index}].num" value="${product.num - product.returnedNum}"></td>
-										<td hidden><input id="presentNum" name="newOrderProducts[${index.index}].presentNum" value="${product.presentNum}"></td>
-										<td hidden><input id="name" name="newOrderProducts[${index.index}].name" value="${product.name}"></td>
-										<td hidden><input id="orderProductID" name="newOrderProducts[${index.index}].orderProductID" value="${product.orderProductID}"></td>
-										<td hidden><input id="includedTax${index.index}" value="${product.includedTax}"></td>
-										<td hidden><input id="productID${index.index}" value="${product.productID}"></td>
-										<td width="40%" id="productName${index.index}">${product.name}</td>
-										<td width="30%"><input id="costPrice"  style="width: 80px;float: left" name="newOrderProducts[${index.index}].costPrice" value="${product.costPrice}" onchange="changeShouldPay(this,${index.index})" />
-											<c:if test="${product.includedTax != null and product.includedTax != '' and product.includedTax ne 2}">
-												<label style="color: red">
-													(${product.includedTax eq 1?'含税':(product.invoiceType eq 1 or product.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
-												</label>
-											</c:if>
-										</td>
-										<td><input id="organizeCostPrice"  style="width: 80px;float: left" name="newOrderProducts[${index.index}].organizeCostPrice" value="${product.organizeCostPrice}"/></td>
-										<td><input id="cmCostPrice"  style="width: 80px;float: left" name="newOrderProducts[${index.index}].cmCostPrice" value="${product.cmCostPrice}"/></td>
-										<td width="20%">
-											<c:choose>
-												<c:when test="${product.includedTax ne '' and product.includedTax eq 0 and product.invoiceType ne 1 and product.invoiceType ne 2}">
-													<label style="text-align: center">-----</label>
-												</c:when>
-												<c:otherwise>
-													<input style="width: 120px;float: left" maxlength="5" id="supplierTaxRate" name="newOrderProducts[${index.index}].supplierTaxRate" value="${empty product.supplierTaxRate?0.0:product.supplierTaxRate}" onchange="changeShouldPay(this)" />%
-												</c:otherwise>
-											</c:choose>
-										</td>
-										<td width="10%">
-											<c:choose>
-												<c:when test="${product.includedTax ne '' and ((product.includedTax eq 0 and product.invoiceType ne 1 and product.invoiceType ne 2) or product.includedTax eq 1 )}">
-													<label id="singleShouldPayTotalTaxLabel" name="newOrderProducts[${index.index}].singleShouldPayTotalTaxLabel" style="text-align: center">-----</label>
-													<input type="hidden" id="singleShouldPayTotalTax" name="newOrderProducts[${index.index}].singleShouldPayTotalTax" value="${empty product.singleShouldPayTotalTax?0.0:product.singleShouldPayTotalTax}">
-												</c:when>
-												<c:otherwise>
-													<label id="singleShouldPayTotalTaxLabel" style="text-align: center" name="newOrderProducts[${index.index}].singleShouldPayTotalTaxLabel">${empty product.singleShouldPayTotalTax?0.0:product.singleShouldPayTotalTax}</label>
-													<input type="hidden" id="singleShouldPayTotalTax" name="newOrderProducts[${index.index}].singleShouldPayTotalTax" value="${empty product.singleShouldPayTotalTax?0.0:product.singleShouldPayTotalTax}">
-												</c:otherwise>
-											</c:choose>
-										</td>
-									</tr>
-							</c:forEach>
-				</table>
-			</div>
-			<table>
-				<tr>
-					<td>
-						<b>供应商运费:</b><input type="number" id="shopPostFee" name="shopPostFee"  onchange="changeShouldPay(this)"  value="${newShopOrder.shopPostFee}" style="margin-left: 20px"/>
-					</td>
-					<td>
-						<b>付第三方:</b><input type="number" id="shopOtherFee" name="shopOtherFee"  onchange="inputnum(this)"  value="${newShopOrder.shopOtherFee}" style="margin-left: 5px;" ${(!newShopOrder.payShopOtherFee || payShopOtherFee > 0) ? 'readonly="true"':""}/>
-					</td>
-				</tr>
-				<tr>
-					<td style="padding-top: 10px;">
-						<b>付供应商:</b><font color="red"><span id="div-supplier-fee">${newShopOrder.shouldPayShopAmount}</span></font>
-					</td>
-					<%--<td style="padding-top: 10px;">
-						<b>已付供应商:</b><font color="red"><span id="div-payedShopAmount">${newShopOrder.payedShopAmount}</span></font>
-					</td>--%>
-				</tr>
-			</table>
-			<div style="margin-top: 10px">
-				<div class="remark-title"><font color="red">*</font>备注内容:</div>
-				<textarea name="modifyShouldPayNote" id="modifyShouldPayNote" class="remark-textarea" maxlength="500" placeholder="建议填写修改原因和修改前后的金额对比,不超过500字" style="width: 600px;height: 150px;margin-left: 70px;margin-top: -20px"></textarea>
-			</div>
-		</div>
-
-		</c:forEach>
-
-		<div >
-			<div class="controls upload-content" style="margin: -91px 0px 0px 16px;" id="remarkImageBox">
-			        <label>图片:</label>
-                    <div class="conList">
-                        <form:hidden id="remarkImage1" path="remarkImage1" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage1" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage2" path="remarkImage2" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage2" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage3" path="remarkImage3" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage3" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage4" path="remarkImage4" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage4" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage5" path="remarkImage5" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage5" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage6" path="remarkImage6" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage6" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage7" path="remarkImage7" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage7" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList hide-pic">
-                        <form:hidden id="remarkImage8" path="remarkImage8" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage8" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList  hide-pic">
-                        <form:hidden id="remarkImage9" path="remarkImage9" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage9" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                    <div class="conList  hide-pic">
-                        <form:hidden id="remarkImage10" path="remarkImage10" htmlEscape="false" maxlength="255" class="input-xlarge"/>
-                        <sys:ckfinder input="remarkImage10" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-                    </div>
-                </div>
-		</div>
-		<div class="form-actions">
-                <input id="btnSubmit" class="btn btn-primary" type="submit" value="确认"/>
-                <input id="btnCancel" class="btn" type="button" value="返回" onclick="history.go(-1)"/>
+    <%--		<ul class="nav nav-tabs" id="myTab">--%>
+    <%--		<c:if test="${dbCostType eq 1 || empty dbCostType}">--%>
+    <%--			<li class="active" id="li-fixed-cost"><a href="${ctx}/shopOrder/toChangePayShopAmount?costType=1&shopOrderID=${shopOrderId}">固定成本修改</a></li>--%>
+    <%--		</c:if>--%>
+    <%--		<c:if test="${dbCostType eq 2 || empty dbCostType}">--%>
+    <%--				<li id="li-proportional-cost"><a href="${ctx}/shopOrder/toChangePayShopAmount?costType=2&shopOrderID=${shopOrderId}">销售比例成本修改</a></li>--%>
+    <%--		</c:if>--%>
+    <%--		</ul>--%>
+    <c:forEach items="${page.list}" var="newShopOrder">
+        <div class="tab-content">
+            <div class="tab-pane active revise-content" id="fixed-cost">
+                <input id="shopOrderID" type="hidden" name="shopOrderID" value="${newShopOrder.shopOrderID}">
+                <input id="orderID" type="hidden" name="orderID" value="${newShopOrder.orderID}">
+                <input id="productAmount" type="hidden" name="productAmount" value="${newShopOrder.productAmount}">
+                <label style="color:red">注意:计算成本时请注意,含税商品的成本包括税费,无需另外计算税费</label>
+                <table class="table table-striped table-bordered table-condensed" style="width: 70%">
+                    <tr>
+                        <td>商品名</td>
+                        <td>供应商成本(单)</td>
+                        <td>集团成本(单)</td>
+                        <td>采美成本(单)</td>
+                        <td>供应商税率</td>
+                        <td>供应商税费(单)</td>
+                    </tr>
+                    <c:forEach items="${newShopOrder.newOrderProducts}" var="product" varStatus="index">
+                        <tr class="orderProducts">
+                            <td hidden><input id="num" name="newOrderProducts[${index.index}].num"
+                                              value="${product.num - product.returnedNum}"></td>
+                            <td hidden><input id="presentNum" name="newOrderProducts[${index.index}].presentNum"
+                                              value="${product.presentNum}"></td>
+                            <td hidden><input id="name" name="newOrderProducts[${index.index}].name"
+                                              value="${product.name}"></td>
+                            <td hidden><input id="orderProductID" name="newOrderProducts[${index.index}].orderProductID"
+                                              value="${product.orderProductID}"></td>
+                            <td hidden><input id="includedTax${index.index}" value="${product.includedTax}"></td>
+                            <td hidden><input id="productID${index.index}" value="${product.productID}"></td>
+                            <td width="40%" id="productName${index.index}">${product.name}</td>
+                            <td width="30%"><input id="costPrice" style="width: 80px;float: left"
+                                                   name="newOrderProducts[${index.index}].costPrice"
+                                                   value="${product.costPrice}"
+                                                   onchange="changeShouldPay(this,${index.index})"/>
+                                <c:if test="${product.includedTax != null and product.includedTax != '' and product.includedTax ne 2}">
+                                    <label style="color: red">
+                                        (${product.includedTax eq 1?'含税':(product.invoiceType eq 1 or product.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
+                                    </label>
+                                </c:if>
+                            </td>
+                            <td><input id="organizeCostPrice"  style="width: 80px;float: left" name="newOrderProducts[${index.index}].organizeCostPrice" value="${product.organizeCostPrice}"/></td>
+                            <td><input id="cmCostPrice" style="width: 80px;float: left"
+                                       name="newOrderProducts[${index.index}].cmCostPrice"
+                                       value="${product.cmCostPrice}"/></td>
+                            <td width="20%">
+                                <c:choose>
+                                    <c:when test="${product.includedTax ne '' and product.includedTax eq 0 and product.invoiceType ne 1 and product.invoiceType ne 2}">
+                                        <label style="text-align: center">-----</label>
+                                    </c:when>
+                                    <c:otherwise>
+                                        <input style="width: 120px;float: left" maxlength="5" id="supplierTaxRate"
+                                               name="newOrderProducts[${index.index}].supplierTaxRate"
+                                               value="${empty product.supplierTaxRate?0.0:product.supplierTaxRate}"
+                                               onchange="changeShouldPay(this)"/>%
+                                    </c:otherwise>
+                                </c:choose>
+                            </td>
+                            <td width="10%">
+                                <c:choose>
+                                    <c:when test="${product.includedTax ne '' and ((product.includedTax eq 0 and product.invoiceType ne 1 and product.invoiceType ne 2) or product.includedTax eq 1 )}">
+                                        <label id="singleShouldPayTotalTaxLabel"
+                                               name="newOrderProducts[${index.index}].singleShouldPayTotalTaxLabel"
+                                               style="text-align: center">-----</label>
+                                        <input type="hidden" id="singleShouldPayTotalTax"
+                                               name="newOrderProducts[${index.index}].singleShouldPayTotalTax"
+                                               value="${empty product.singleShouldPayTotalTax?0.0:product.singleShouldPayTotalTax}">
+                                    </c:when>
+                                    <c:otherwise>
+                                        <label id="singleShouldPayTotalTaxLabel" style="text-align: center"
+                                               name="newOrderProducts[${index.index}].singleShouldPayTotalTaxLabel">${empty product.singleShouldPayTotalTax?0.0:product.singleShouldPayTotalTax}</label>
+                                        <input type="hidden" id="singleShouldPayTotalTax"
+                                               name="newOrderProducts[${index.index}].singleShouldPayTotalTax"
+                                               value="${empty product.singleShouldPayTotalTax?0.0:product.singleShouldPayTotalTax}">
+                                    </c:otherwise>
+                                </c:choose>
+                            </td>
+                        </tr>
+                    </c:forEach>
+                </table>
+            </div>
+            <table>
+                <tr>
+                    <td>
+                        <b>供应商运费:</b><input type="number" id="shopPostFee" name="shopPostFee"
+                                            onchange="changeShouldPay(this)" value="${newShopOrder.shopPostFee}"
+                                            style="margin-left: 20px"/>
+                    </td>
+                    <td>
+                        <b>付第三方:</b><input type="number" id="shopOtherFee" name="shopOtherFee" onchange="inputnum(this)"
+                                           value="${newShopOrder.shopOtherFee}"
+                                           style="margin-left: 5px;" ${(!newShopOrder.payShopOtherFee || payShopOtherFee > 0) ? 'readonly="true"':""}/>
+                    </td>
+                </tr>
+                <tr>
+                    <td style="padding-top: 10px;">
+                        <b>付供应商:</b><font color="red"><span
+                            id="div-supplier-fee">${newShopOrder.shouldPayShopAmount}</span></font>
+                    </td>
+                        <%--<td style="padding-top: 10px;">
+                            <b>已付供应商:</b><font color="red"><span id="div-payedShopAmount">${newShopOrder.payedShopAmount}</span></font>
+                        </td>--%>
+                </tr>
+            </table>
+            <div style="margin-top: 10px">
+                <div class="remark-title"><font color="red">*</font>备注内容:</div>
+                <textarea name="modifyShouldPayNote" id="modifyShouldPayNote" class="remark-textarea" maxlength="500"
+                          placeholder="建议填写修改原因和修改前后的金额对比,不超过500字"
+                          style="width: 600px;height: 150px;margin-left: 70px;margin-top: -20px"></textarea>
+            </div>
         </div>
+
+    </c:forEach>
+
+    <div>
+        <div class="controls upload-content" style="margin: -91px 0px 0px 16px;" id="remarkImageBox">
+            <label>图片:</label>
+            <div class="conList">
+                <form:hidden id="remarkImage1" path="remarkImage1" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage1" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage2" path="remarkImage2" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage2" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage3" path="remarkImage3" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage3" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage4" path="remarkImage4" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage4" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage5" path="remarkImage5" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage5" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage6" path="remarkImage6" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage6" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage7" path="remarkImage7" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage7" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList hide-pic">
+                <form:hidden id="remarkImage8" path="remarkImage8" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage8" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList  hide-pic">
+                <form:hidden id="remarkImage9" path="remarkImage9" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage9" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+            <div class="conList  hide-pic">
+                <form:hidden id="remarkImage10" path="remarkImage10" htmlEscape="false" maxlength="255"
+                             class="input-xlarge"/>
+                <sys:ckfinder input="remarkImage10" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+            </div>
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="确认"/>
+        <input id="btnCancel" class="btn" type="button" value="返回" onclick="history.go(-1)"/>
+    </div>
 </form:form>
 
 <script type="text/javascript">
 
-//图片初始化
-  $(function () {
+    //图片初始化
+    $(function () {
         $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
         $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
         $('.upload-content .conList').find('.cancel-upload').hide();
         var observeEle = document.getElementsByClassName('upload-content')[0];
         var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
-        var MutationObserverConfig={
+        var MutationObserverConfig = {
             childList: true,
             subtree: true,
             characterData: true
         };
-        var observer = new MutationObserver(function(mutations){
-            $.each(mutations, function(index,item) {
+        var observer = new MutationObserver(function (mutations) {
+            $.each(mutations, function (index, item) {
                 if (item.type === 'childList') {
                     // 在创建新的 element 时调用
                     var target = $(item.target),
                         thisWrapper = target.closest('.conList'),
                         nextEle = thisWrapper.next();
-                    thisWrapper.find('li').css('z-index',99);
+                    thisWrapper.find('li').css('z-index', 99);
                     thisWrapper.find('.cancel-upload').show();
-                    if(nextEle.hasClass('hide-pic')) {
+                    if (nextEle.hasClass('hide-pic')) {
                         nextEle.removeClass('hide-pic');
                     }
                 }
             })
         });
-        observer.observe(observeEle,MutationObserverConfig);
+        observer.observe(observeEle, MutationObserverConfig);
 
-        $('body').on('click','.upload-content li',function() {
+        $('body').on('click', '.upload-content li', function () {
             var index = $(this).closest('.conList').index() + 1,
-                str = 'remarkImage'+index+'FinderOpen';
-            eval(str+'()');
+                str = 'remarkImage' + index + 'FinderOpen';
+            eval(str + '()');
         });
-        $('body').on('click', '.cancel-upload',function() {
+        $('body').on('click', '.cancel-upload', function () {
             var wrapper = $(this).closest('.conList');
-            wrapper.find('li').css('z-index','-1');
+            wrapper.find('li').css('z-index', '-1');
             wrapper.find('input').val('');
             $(this).hide();
             if ($('.cancel-upload:visible').length < 9) {
                 wrapper.addClass("hide-pic");
-            }else{
+            } else {
                 wrapper.removeClass("hide-pic");
             }
             wrapper.parent().append(wrapper.clone());
             wrapper.remove();
-			$(".conList").each(function(i,ele){
-				if($(ele).find("input.input-xlarge").val()){
-					$(ele).next().removeClass("hide-pic")
-				}
-			})
+            $(".conList").each(function (i, ele) {
+                if ($(ele).find("input.input-xlarge").val()) {
+                    $(ele).next().removeClass("hide-pic")
+                }
+            })
+        });
+        $(window).on("load", function () {
+            setTimeout(function () {
+                $("#remarkImageBox").find("input.input-xlarge").each(function (i, ele) {
+                    if ($(ele).val()) {
+                        $(ele).next().find("li").css("z-index", "99");
+                        $(ele).parents(".conList").find(".cancel-upload").show();
+                        $(ele).parents(".conList").next().removeClass("hide-pic")
+                    }
+                })
+            }, 500);
         });
-		$(window).on("load", function(){
-			setTimeout(function(){
-				$("#remarkImageBox").find("input.input-xlarge").each(function(i,ele){
-					if($(ele).val()){
-						$(ele).next().find("li").css("z-index","99");
-						$(ele).parents(".conList").find(".cancel-upload").show();
-						$(ele).parents(".conList").next().removeClass("hide-pic")
-					}
-				})
-			},500);
-		});
     });
 
     // 输入框验证
-	function inputnum(obj){
-		obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
-		obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
-		obj.value = obj.value.replace(/\.{2,}/g,""); //只保留第一个, 清除多余的
-		obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
-		obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
-		if(obj.value == null || obj.value == "" ){
-			obj.value = 0;
-		}
-	}
-
-	// 修改成本价
-	var confirmProductNames = "";
-	var confirmProductIdArr = [];
-	function changeShouldPay(eleThis,index) {
-		var productName = $("#productName" + index).text();
-		var productId = $("#productID" + index).val();
-		var includedTax = $("#includedTax" + index).val();
-		var addFlag = true;
-		for (var i = 0 ;i<confirmProductIdArr.length;i++){
-			if (confirmProductIdArr[i] == productId) {
-				addFlag = false;
-			}
-		}
-		if (includedTax == '1' && addFlag) {
-			confirmProductIdArr.push(productId);
-			confirmProductNames += productName+",";
-			confirmProductNames.substring(0, confirmProductNames.length-1);
-			$("#confirmProductNames").val(confirmProductNames);
-		}
-		//修改不符合规则值
-		eleThis.value = eleThis.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
-		eleThis.value = eleThis.value.replace(/^\./g,""); //验证第一个字符是数字
-		eleThis.value = eleThis.value.replace(/\.{2,}/g,""); //只保留第一个, 清除多余的
-		eleThis.value = eleThis.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
-		eleThis.value = eleThis.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
-		if($(eleThis).val() == null || $(eleThis).val() == "" ){
-			$(eleThis).val(0);
-		}
-
-		var totalAmount = Number(0);
-		//获取供应商层信息
-		var shopPostFee = $("#shopPostFee").val();
-		var shopOtherFee = $("#shopOtherFee").val();
-		if(null == shopPostFee)shopPostFee = 0;
-		// if(null == shopOtherFee)shopOtherFee = 0;
-		/*var n = parseFloat(that.value);
-		that.value = n.toFixed(2)*/
-		// 计算所有商品的成本和税费
-		$(".orderProducts").each(function(i, ele){
-			// 商品层信息
-			var num = $(ele).find('input[id=num]').val();
-			var presentNum = $(ele).find('input[id=presentNum]').val();
-			var costPrice = $(ele).find('input[id=costPrice]').val();
-			var supplierTaxRate = $(ele).find('input[id=supplierTaxRate]').val();
-			var singleShouldPayTotalTax = $(ele).find('label[id=singleShouldPayTotalTaxLabel]').text();// 单个供应商是税费
-
-			console.log(num+" "+presentNum+" "+" "+costPrice+" "+supplierTaxRate+" "+singleShouldPayTotalTax)
-
-			// 校验参数
-			if(null == num)num = 0;
-			if(null == presentNum)presentNum = 0;
-			if(null == costPrice)costPrice = 0;
-			if(null == supplierTaxRate)supplierTaxRate = 0;
-			if(null == singleShouldPayTotalTax)singleShouldPayTotalTax = 0;
-			var productNum = Number(num) + Number(presentNum);
-
-			if (singleShouldPayTotalTax == '-----') {
-				singleShouldPayTotalTax = 0;
-				$(ele).find('input[id=singleShouldPayTotalTax]').val(0);
-			}else {
-				//计算供应商税费(单)
-				singleShouldPayTotalTax = (costPrice * supplierTaxRate * 0.01).toFixed(2);
-				$(ele).find('label[id=singleShouldPayTotalTaxLabel]').text(singleShouldPayTotalTax);
-				$(ele).find('input[id=singleShouldPayTotalTax]').val(singleShouldPayTotalTax);
-			}
-			//计算应付供应商
-			totalAmount += ((Number(productNum) * Number(costPrice)) + (Number(productNum) * Number(singleShouldPayTotalTax)));
-		});
-		totalAmount += Number(shopPostFee);
-		// 四舍五入
-		var s = totalAmount.toFixed(2);
-		$("#div-supplier-fee").text(s);
-	}
+    function inputnum(obj) {
+        obj.value = obj.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+        obj.value = obj.value.replace(/^\./g, ""); //验证第一个字符是数字
+        obj.value = obj.value.replace(/\.{2,}/g, ""); //只保留第一个, 清除多余的
+        obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        if (obj.value == null || obj.value == "") {
+            obj.value = 0;
+        }
+    }
+
+    // 修改成本价
+    var confirmProductNames = "";
+    var confirmProductIdArr = [];
+
+    function changeShouldPay(eleThis, index) {
+        var productName = $("#productName" + index).text();
+        var productId = $("#productID" + index).val();
+        var includedTax = $("#includedTax" + index).val();
+        var addFlag = true;
+        for (var i = 0; i < confirmProductIdArr.length; i++) {
+            if (confirmProductIdArr[i] == productId) {
+                addFlag = false;
+            }
+        }
+        if (includedTax == '1' && addFlag) {
+            confirmProductIdArr.push(productId);
+            confirmProductNames += productName + ",";
+            confirmProductNames.substring(0, confirmProductNames.length - 1);
+            $("#confirmProductNames").val(confirmProductNames);
+        }
+        //修改不符合规则值
+        eleThis.value = eleThis.value.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
+        eleThis.value = eleThis.value.replace(/^\./g, ""); //验证第一个字符是数字
+        eleThis.value = eleThis.value.replace(/\.{2,}/g, ""); //只保留第一个, 清除多余的
+        eleThis.value = eleThis.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+        eleThis.value = eleThis.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
+        if ($(eleThis).val() == null || $(eleThis).val() == "") {
+            $(eleThis).val(0);
+        }
+
+        var totalAmount = Number(0);
+        //获取供应商层信息
+        var shopPostFee = $("#shopPostFee").val();
+        var shopOtherFee = $("#shopOtherFee").val();
+        if (null == shopPostFee) shopPostFee = 0;
+        // if(null == shopOtherFee)shopOtherFee = 0;
+        /*var n = parseFloat(that.value);
+        that.value = n.toFixed(2)*/
+        // 计算所有商品的成本和税费
+        $(".orderProducts").each(function (i, ele) {
+            // 商品层信息
+            var num = $(ele).find('input[id=num]').val();
+            var presentNum = $(ele).find('input[id=presentNum]').val();
+            var costPrice = $(ele).find('input[id=costPrice]').val();
+            var supplierTaxRate = $(ele).find('input[id=supplierTaxRate]').val();
+            var singleShouldPayTotalTax = $(ele).find('label[id=singleShouldPayTotalTaxLabel]').text();// 单个供应商是税费
+
+            console.log(num + " " + presentNum + " " + " " + costPrice + " " + supplierTaxRate + " " + singleShouldPayTotalTax)
+
+            // 校验参数
+            if (null == num) num = 0;
+            if (null == presentNum) presentNum = 0;
+            if (null == costPrice) costPrice = 0;
+            if (null == supplierTaxRate) supplierTaxRate = 0;
+            if (null == singleShouldPayTotalTax) singleShouldPayTotalTax = 0;
+            var productNum = Number(num) + Number(presentNum);
+
+            if (singleShouldPayTotalTax == '-----') {
+                singleShouldPayTotalTax = 0;
+                $(ele).find('input[id=singleShouldPayTotalTax]').val(0);
+            } else {
+                //计算供应商税费(单)
+                singleShouldPayTotalTax = (costPrice * supplierTaxRate * 0.01).toFixed(2);
+                $(ele).find('label[id=singleShouldPayTotalTaxLabel]').text(singleShouldPayTotalTax);
+                $(ele).find('input[id=singleShouldPayTotalTax]').val(singleShouldPayTotalTax);
+            }
+            //计算应付供应商
+            totalAmount += ((Number(productNum) * Number(costPrice)) + (Number(productNum) * Number(singleShouldPayTotalTax)));
+        });
+        totalAmount += Number(shopPostFee);
+        // 四舍五入
+        var s = totalAmount.toFixed(2);
+        $("#div-supplier-fee").text(s);
+    }
 
 </script>
 </body>

+ 28 - 24
src/main/webapp/WEB-INF/views/modules/order/cmPayShopForm.jsp

@@ -415,12 +415,13 @@
             <c:forEach items="${cmPayShop.shopOrders}" var="s">
                 <table class="table table-striped table-bordered table-condensed pay-table">
                     <tr>
-                        <th>订单编号(ID)</th>
+                        <th>订单编号(ID)</th>
                         <th colspan="3">客户</th>
                         <th colspan="2">下单时间</th>
-                        <th>订单金额</th>
-                        <th colspan="3">所有子订单</th>
-                        <th>订单总佣金</th>
+                        <th>子订单金额</th>
+<%--                        <th colspan="3">所有子订单</th>--%>
+<%--                        <th>订单总佣金</th>--%>
+                        <th colspan="4">总平台服务费</th>
                         <th>机构运费</th>
                         <th>收款状态</th>
                         <th colspan="3">收款金额</th>
@@ -428,21 +429,23 @@
                         <th>优惠券</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="2"> ${s.orderTime}</td>
                         <td>${s.payTotalFee}</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"></td>
                         <td>
                             <label class="clubFreight"  style="display: none">
                                 <c:choose>
@@ -519,9 +522,9 @@
                         <td class="eachDiscount" style="display: none">${s.eachDiscount}</td>
                     <tr/>
                     <tr>
-                        <th>子订单编号(ID)</th>
+                        <th>客户</th>
                         <th colspan="3"> 供应商</th>
-                        <th colspan="3">子订单佣金</th>
+                        <th colspan="3">子订单利润</th>
                         <th colspan="3">商品费</th>
                         <th>应付税费</th>
                         <th>供应商运费</th>
@@ -531,7 +534,7 @@
                         <th>成本类型</th>
                     </tr>
                     <tr>
-                        <td>${s.shopOrderNo}(${s.shopOrderID})</td>
+                        <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="">${s.brokerage}</td></c:if>
@@ -589,11 +592,12 @@
                         <th>规格</th>
                         <th>数量<%--(赠品)--%></th>
                         <th>退货</th>
-                        <th colspan="3">单价</th>
+                        <th colspan="2">单价</th>
                         <th colspan="3">机构税率 / 单税费 / 总税费</th>
                         <th>总价</th>
-                        <th>佣金(单)</th>
-                        <th>佣金(总)</th>
+                        <th>利润(单)</th>
+                        <th>利润(总)</th>
+                        <th>平台服务费</th>
                         <th colspan="3">供应商税率 / 单税费 / 总税费</th>
                         <th>成本(单)</th>
                         <th>成本(总)</th>
@@ -612,7 +616,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="3"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}"
+                            <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">
@@ -642,7 +646,7 @@
                             <td class="payCm"><fmt:formatNumber
                                     value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax) * (p.num + p.presentNum - p.returnedNum)}"
                                     pattern="#,##0.00"/></td>
-
+                            <td>??</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>