zhijiezhao 1 year ago
parent
commit
ff947a4627

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

@@ -249,7 +249,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                     }
                     // 付采美总金额
-                    allServeAmount =MathUtil.add(allServeAmount , MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
+                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
                 }
                 so.setAllServeAmount(allServeAmount);
                 so.setNewOrderProducts(orderProductList);
@@ -400,7 +400,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
                         p.setDiscountPrice(MathUtil.div(p.getDiscountPrice(), MathUtil.div(MathUtil.add(p.getTaxRate(), 100), 100)).doubleValue());
                     }
                     // 付采美总金额
-                    allServeAmount =MathUtil.add(allServeAmount , MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
+                    allServeAmount = MathUtil.add(allServeAmount, MathUtil.mul(p.getNum(), p.getCmCostPrice())).doubleValue();
                 }
                 so.setAllServeAmount(allServeAmount);
                 if (so.getShopPostFee() == null) so.setShopPostFee(0D);
@@ -993,15 +993,17 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         CmPayShop payShop = new CmPayShop();
         payShop.setShopID(shopOrder.getShopID().toString());
         payShop.setName(payShopOther.getName());
-        if (2 != payShopOther.getPayType()) {
+        String status = "0";
+        if (null != payShopOther.getPayType() && 2 == payShopOther.getPayType()) {
+            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
+            payShop.setApplyTime(format);
+            payShop.setReviewTime(format);
+            status = "1";
+        } else {
             payShop.setBankAccountName(payShopOther.getBankAccountName());
             payShop.setBankAccount(payShopOther.getBankAccount());
             payShop.setBankName(payShopOther.getBankName());
             payShop.setType(payShopOther.getType().toString());
-        } else {
-            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
-            payShop.setApplyTime(format);
-            payShop.setReviewTime(format);
         }
         payShop.setTotalAmount(payShopOther.getShopOtherFee().doubleValue());
         payShop.setBalancePayFee(0d);
@@ -1009,7 +1011,6 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
         payShop.setWipePayment(0d);
         payShop.setApplicant(currentUser.getId());
         payShop.setApplyTime(time);
-        String status = 2 == payShopOther.getPayType() ? "1" : "0";
         payShop.setStatus(status);
         payShop.setDelFlag("0");
         if (payShopOther.getPayShopId() == null) {
@@ -1393,10 +1394,10 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
 //                        //成本>结算金额,部分结算
 //                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 2);
 //                    } else {
-                        //成本=结算金额 全部结算
-                        newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
+                    //成本=结算金额 全部结算
+                    newOrderDao.updateShopOrderSettleStatus(shopOrderId, 3);
 //                    }
-                } else  {
+                } else {
                     //佣金结算
                     settleRecord.setSettleType(settleFlag);
                     settleRecord.setSettleAmount(settleAmount);

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

@@ -224,14 +224,16 @@
                         <tr class="orderProducts">
                             <td hidden><input id="num" name="newOrderProducts[${index.index}].num"
                                               value="${product.num - product.returnedNum}"></td>
-<%--                            <td hidden><input id="taxRate" name="newOrderProducts[${index.index}].taxRate" value="${product.taxRate}"></td>--%>
+                                <%--                            <td hidden><input id="taxRate" name="newOrderProducts[${index.index}].taxRate" value="${product.taxRate}"></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}" name="newOrderProducts[${index.index}].includedTax" value="${product.includedTax}"></td>
+                            <td hidden><input id="includedTax${index.index}"
+                                              name="newOrderProducts[${index.index}].includedTax"
+                                              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"
@@ -244,7 +246,9 @@
                                     </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="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>
@@ -300,8 +304,9 @@
                 <tr>
                     <td style="padding-top: 10px;">
                         <b>付供应商:</b><font color="red"><span
-                            id="div-supplier-fee">${newShopOrder.shouldPayShopAmount}</span></font>
+                            id="div-supplier-fee">${newShopOrder.shouldPayShopAmount-newShopOrder.shopOtherFee}</span></font>
                     </td>
+                    <input style="display: none" id="hidePayShop" value="${newShopOrder.shouldPayShopAmount}">
                         <%--<td style="padding-top: 10px;">
                             <b>已付供应商:</b><font color="red"><span id="div-payedShopAmount">${newShopOrder.payedShopAmount}</span></font>
                         </td>--%>
@@ -465,6 +470,17 @@
         if (obj.value == null || obj.value == "") {
             obj.value = 0;
         }
+        var of = $("#shopOtherFee").val();
+        console.log(of);
+        if (of > 0) {
+            // // 使用getElementById获取span元素
+            // var spanElement = document.getElementById("div-supplier-fee");
+            // var text = spanElement.innerText;
+            var text = $("#hidePayShop").val();
+            console.log("text----------" + text);
+            var pay = text - of;
+            $("#div-supplier-fee").text(pay);
+        }
     }
 
     // 修改成本价
@@ -536,7 +552,7 @@
             //计算应付供应商
             totalAmount += ((Number(productNum) * Number(costPrice)) + (Number(productNum) * Number(singleShouldPayTotalTax))); /* + (Number(productNum) * Number(singleShouldPayTotalTax))*/
         });
-        totalAmount += Number(shopPostFee);
+        totalAmount -= Number(shopPostFee);
         // 四舍五入
         var s = totalAmount.toFixed(2);
         $("#div-supplier-fee").text(s);

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

@@ -504,13 +504,13 @@
                                                                     pattern="#,##0.00"/></td>
                     <td class="supplier-fee">
                         <c:if test="${s.differenceType ne 1 && s.differenceType ne 2 }">
-                            <font color="#E15616"><fmt:formatNumber value="${s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></font>
+                            <font color="#E15616"><fmt:formatNumber value="${s.shouldPayShopAmount-s.shopOtherFee}" type="number" pattern="#,##0.00"/></font>
                         </c:if>
                         <c:if test="${s.differenceType eq 1 && s.differencePrice > 0}">
-                            <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
+                            <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount+s.differencePrice-s.shopOtherFee}"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已补差价:${s.differencePrice})</font>
                         </c:if>
                         <c:if test="${s.differenceType eq 2 && s.differencePrice > 0}">
-                            <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice}" type="number" pattern="#,##0.00"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
+                            <font color="black"><fmt:formatNumber value="${s.shouldPayShopAmount-s.differencePrice-s.shopOtherFee}" type="number" pattern="#,##0.00"/></font><font color="red">(原应付:${s.shouldPayShopAmount},已退差价:${s.differencePrice})</font>
                         </c:if>
                     </td>
                     <input type="hidden" class="payedShopAmount" value="${s.payedShopAmount}">