Selaa lähdekoodia

供应商退款相关

plf 3 vuotta sitten
vanhempi
commit
bc8af979c8

+ 3 - 0
src/main/java/com/caimei/modules/order/dao/CmPayShopDao.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.order.dao;
 
+import com.caimei.modules.order.entity.CmDiscernReceipt;
 import com.caimei.modules.order.entity.CmPayShop;
 import com.caimei.modules.order.entity.NewShopOrder;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
@@ -27,4 +28,6 @@ public interface CmPayShopDao extends CrudDao<CmPayShop> {
     CmPayShop getPayShopByShopOrderId(@Param("shopOrderID") String shopOrderID);
 
     List<Integer> getShopOrderIdsList(@Param("payShopID") String payShopID);
+
+    List<CmDiscernReceipt> getDiscernReceipts(Integer shopOrderId);
 }

+ 12 - 2
src/main/java/com/caimei/modules/order/dao/CmRefundShopRecordDao.java

@@ -1,15 +1,17 @@
 package com.caimei.modules.order.dao;
 
 import com.caimei.modules.order.entity.CmPayShopRecord;
+import com.caimei.modules.order.entity.CmRefundShopRecord;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import com.caimei.modules.order.entity.CmRefundShopRecord;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
  * 退款记录表DAO接口
+ *
  * @author lwt
  * @version 2019-07-01
  */
@@ -18,7 +20,7 @@ public interface CmRefundShopRecordDao extends CrudDao<CmRefundShopRecord> {
 
     List<String> findByRefundShopID(@Param("refundShopID") String refundShopID);
 
-    List<CmRefundShopRecord> getRefundedRecords(@Param("shopOrderID")  String shopOrderID);
+    List<CmRefundShopRecord> getRefundedRecords(@Param("shopOrderID") String shopOrderID);
 
     List<CmRefundShopRecord> getByRefundShopID(@Param("refundShopID") String id);
 
@@ -29,4 +31,12 @@ public interface CmRefundShopRecordDao extends CrudDao<CmRefundShopRecord> {
     void updateByDelFlag(Integer refundShopId);
 
     Integer findByPaymentType(Integer shopOrderID);
+
+    /**
+     * 查询收款供应商退款金额
+     *
+     * @param shopOrderId
+     * @return
+     */
+    BigDecimal findShopRefund(Integer shopOrderId);
 }

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

@@ -16,7 +16,7 @@ public class ReceiptOrderInfoVo {
     private String receiptStatus;//(收款买家)收款状态:1待收款、2部分收款、3已收款
     private String orderType;//订单类型 协销订单 0 普通订单 1
     private String orderTime;//下单时间
-    private String relationType;		// 关系类型:1返佣订单(返佣款)、2非返佣订单(订单款或者非订单款)
+    private String relationType;        // 关系类型:1返佣订单(返佣款)、2非返佣订单(订单款或者非订单款)
     private Integer userID;     //订单用户id
 
     //----------------返佣款项   是根据子订单再去关联的主订单
@@ -27,6 +27,9 @@ public class ReceiptOrderInfoVo {
     private List<ReceiptRecordVo> receiptRecordVo;
     private double payableAmount;
     private boolean receiptOrderFlag;// 判断订单中抹平的订单是否是和多个订单一起支付的,
+    private Double shouldPayShopAmount;     //应付金额
+    private Double payedShopAmount;     //已付供应商金额
+    private Double refundsAmount;       //已退款供应商金额
 
 
     public String getOrganizeID() {
@@ -172,4 +175,28 @@ public class ReceiptOrderInfoVo {
     public void setUserID(Integer userID) {
         this.userID = userID;
     }
+
+    public Double getShouldPayShopAmount() {
+        return shouldPayShopAmount;
+    }
+
+    public void setShouldPayShopAmount(Double shouldPayShopAmount) {
+        this.shouldPayShopAmount = shouldPayShopAmount;
+    }
+
+    public Double getPayedShopAmount() {
+        return payedShopAmount;
+    }
+
+    public void setPayedShopAmount(Double payedShopAmount) {
+        this.payedShopAmount = payedShopAmount;
+    }
+
+    public Double getRefundsAmount() {
+        return refundsAmount;
+    }
+
+    public void setRefundsAmount(Double refundsAmount) {
+        this.refundsAmount = refundsAmount;
+    }
 }

+ 20 - 5
src/main/java/com/caimei/modules/order/service/CmDiscernReceiptService.java

@@ -1,13 +1,11 @@
 package com.caimei.modules.order.service;
 
 import com.caimei.modules.hehe.dao.HeHeNewOrderDao;
-import com.caimei.modules.order.dao.CmDiscernReceiptDao;
-import com.caimei.modules.order.dao.CmRebateRecordDao;
-import com.caimei.modules.order.dao.NewOrderDao;
-import com.caimei.modules.order.dao.NewShopOrderDao;
+import com.caimei.modules.order.dao.*;
 import com.caimei.modules.order.entity.*;
 import com.caimei.modules.user.dao.NewCmShopDao;
 import com.caimei.modules.user.entity.NewCmShop;
+import com.caimei.utils.MathUtil;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.utils.DateUtils;
@@ -19,6 +17,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -48,6 +47,8 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
     private NewShopOrderDao newShopOrderDao;
     @Resource
     private HeHeNewOrderDao heHeNewOrderDao;
+    @Resource
+    private CmRefundShopRecordDao cmRefundShopRecordDao;
 
     public CmDiscernReceipt get(String id) {
         return super.get(id);
@@ -63,7 +64,7 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
             logger.info("-----------------:::::" + bean.getId());
             String type = "";
             String no = "";
-            if ("1".equals(bean.getReceiptType()) || "3".equals(bean.getReceiptType())) {
+            if ("1".equals(bean.getReceiptType()) || "3".equals(bean.getReceiptType()) || "5".equals(bean.getReceiptType())) {
                 List<Map<String, Object>> orderIDs = cmDiscernReceiptDao.getOrderIDStr(bean.getId());
                 for (Map<String, Object> map : orderIDs) {
                     if ("".equals(type)) {
@@ -121,6 +122,20 @@ public class CmDiscernReceiptService extends CrudService<CmDiscernReceiptDao, Cm
             if ("1".equals(relation.getRelationType())) { // relation.orderID 指的是子订单id
                 roi = cmDiscernReceiptDao.getOrderInfoByShopOrderID(relation.getOrderID());
                 roi.setRelationType("1");
+                if ("5".equals(vo.getReceiptType())) {
+                    //供应商退款,已退金额
+                    List<CmRefundShopRecord> records = cmRefundShopRecordDao.getRefundedRecords(roi.getShopOrderID());
+                    if (records != null && records.size() > 0) {
+                        Double collect = records.stream().mapToDouble(CmRefundShopRecord::getRefundAmount).sum();
+                        roi.setRefundsAmount(collect);
+                    } else {
+                        roi.setRefundsAmount(0d);
+                    }
+                    //查询收款供应商退款金额
+                    BigDecimal shopRefundAmount = cmRefundShopRecordDao.findShopRefund(Integer.valueOf(roi.getShopOrderID()));
+                    BigDecimal refundsAmount = MathUtil.add(roi.getRefundsAmount(), shopRefundAmount);
+                    roi.setRefundsAmount(refundsAmount.doubleValue());
+                }
             }
             if ("2".equals(relation.getRelationType())) { // relation.orderID 指的是主订单id
                 roi = cmDiscernReceiptDao.getOrderInfoByOrderID(relation.getOrderID());

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

@@ -131,7 +131,11 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                 } else {
                     so.setRefundsAmount(0d);
                 }
-                BigDecimal payAmount = MathUtil.sub(so.getPayedShopAmount(), MathUtil.add(so.getRefundsAmount(), so.getShouldPayShopAmount()));
+                //查询收款供应商退款金额
+                BigDecimal shopRefundAmount = cmRefundShopRecordDao.findShopRefund(so.getShopOrderID());
+                BigDecimal refundsAmount = MathUtil.add(so.getRefundsAmount(), shopRefundAmount);
+                so.setRefundsAmount(refundsAmount.doubleValue());
+                BigDecimal payAmount = MathUtil.sub(so.getPayedShopAmount(), refundsAmount);
                 refundAmount = MathUtil.add(refundAmount, payAmount).doubleValue();
                 List<NewOrderProduct> orderProductList = newOrderProductDao.findByShopOrderID(so.getShopOrderID());
                 /*
@@ -254,8 +258,11 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
             } else {
                 shopOrder.setRefundsAmount(0d);
             }
+            //查询收款供应商退款金额
+            BigDecimal shopRefundAmount = cmRefundShopRecordDao.findShopRefund(shopOrder.getShopOrderID());
+            BigDecimal refundsAmount = MathUtil.add(shopOrder.getRefundsAmount(), shopRefundAmount);
             // 已付 - (已退+本次退款)
-            BigDecimal tempFee = MathUtil.sub(shopOrder.getPayedShopAmount(), MathUtil.add(shopOrder.getRefundsAmount(), refundAmount));
+            BigDecimal tempFee = MathUtil.sub(shopOrder.getPayedShopAmount(), MathUtil.add(refundsAmount, refundAmount));
             // 已付 - 已退 >= 应付
             if (MathUtil.compare(tempFee, shopOrder.getShouldPayShopAmount()) >= 0) {
                 shopOrder.setPaying("0"); //退出付款进行状态

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

@@ -10,6 +10,7 @@ import com.caimei.modules.order.utils.ProductType;
 import com.caimei.modules.product.dao.CmPromotionDao;
 import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.utils.MathUtil;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
 import com.thinkgem.jeesite.common.utils.StringUtils;
@@ -332,6 +333,18 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
             if (id != null && id > 0) {
                 so.setPayShopOtherFee(false);
             }
+            //已退金额
+            List<CmRefundShopRecord> records = cmRefundShopRecordDao.getRefundedRecords(String.valueOf(so.getShopOrderID()));
+            if (records != null && records.size() > 0) {
+                Double collect = records.stream().mapToDouble(CmRefundShopRecord::getRefundAmount).sum();
+                so.setRefundsAmount(collect);
+            } else {
+                so.setRefundsAmount(0d);
+            }
+            //查询收款供应商退款金额
+            BigDecimal shopRefundAmount = cmRefundShopRecordDao.findShopRefund(so.getShopOrderID());
+            BigDecimal refundsAmount = MathUtil.add(so.getRefundsAmount(), shopRefundAmount);
+            so.setRefundsAmount(refundsAmount.doubleValue());
         }
         return page;
     }
@@ -628,4 +641,8 @@ public class NewShopOrderService extends CrudService<NewShopOrderDao, NewShopOrd
         }
         return differenceList;
     }
+
+    public List<CmDiscernReceipt> getDiscernReceipts(Integer shopOrderId) {
+        return cmPayShopDao.getDiscernReceipts(shopOrderId);
+    }
 }

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

@@ -203,15 +203,19 @@ public class CmShopOrderController extends BaseController {
         List<Integer> shopOrderIDs = newShopOrderService.findIDsByOrderID(orderID);
         List<CmPayShopRecord> pr = new ArrayList<>();
         List<CmRefundShopRecord> rr = new ArrayList<>();
+        List<CmDiscernReceipt> receipts = new ArrayList<>();
         for (Integer shopOrderID : shopOrderIDs) {
             List<CmPayShopRecord> payShopRecordList = newShopOrderService.getPayedRecords(shopOrderID.toString());
             pr.addAll(payShopRecordList);
             List<CmRefundShopRecord> refundShopRecordList = newShopOrderService.getRefundedRecords(shopOrderID.toString());
             rr.addAll(refundShopRecordList);
+            List<CmDiscernReceipt> receiptList = newShopOrderService.getDiscernReceipts(shopOrderID);
+            receipts.addAll(receiptList);
         }
         model.addAttribute("pr", pr);
         model.addAttribute("rr", rr);
         model.addAttribute("order", order);
+        model.addAttribute("receipts", receipts);
         return "modules/order/refundRecord";
     }
 

+ 2 - 0
src/main/resources/mappings/modules/order/CmDiscernReceiptMapper.xml

@@ -566,6 +566,8 @@
 			cso.shopOrderNo AS shopOrderNo,
 			cso.shopOrderID AS shopOrderID,
 			cso.needPayAmount AS shopOrderAmount,
+			cso.shouldPayShopAmount AS shouldPayShopAmount,
+			cso.payedShopAmount AS payedShopAmount,
 			s.name AS shopName
 		from cm_shop_order cso
 		left join cm_order co on cso.orderID = co.orderID

+ 20 - 0
src/main/resources/mappings/modules/order/CmPayShopMapper.xml

@@ -258,4 +258,24 @@
 		where id=1
 	</update>
 
+	<select id="getDiscernReceipts" resultType="com.caimei.modules.order.entity.CmDiscernReceipt">
+		SELECT
+		  cdr.id,
+		  cdr.payType,
+		  cdr.receiptType,
+		  cdr.receiptAmount,
+		  cdr.receiptDate
+		FROM
+		  cm_discern_receipt cdr
+		  LEFT JOIN cm_receipt_order_relation cror ON cdr.id = cror.receiptID
+		WHERE
+		  cror.relationType = 1
+		  AND cror.delFlag = 0
+		  AND cror.orderID = #{shopOrderId}
+		  AND cdr.receiptType = 5
+		  AND cdr.receiptStatus = 2
+		ORDER BY
+		  receiptDate DESC
+	</select>
+
 </mapper>

+ 15 - 0
src/main/resources/mappings/modules/order/CmRefundShopRecordMapper.xml

@@ -162,4 +162,19 @@
 		LIMIT
 		  1
 	</select>
+
+	<select id="findShopRefund" resultType="java.math.BigDecimal">
+        SELECT
+          SUM(cdr.receiptAmount)
+        FROM
+          cm_receipt_order_relation cror
+          LEFT JOIN cm_discern_receipt cdr ON cdr.id = cror.receiptID
+        WHERE
+          cror.relationType = 1
+          AND cror.delFlag = 0
+          AND cror.orderID = #{shopOrderId}
+          AND cdr.delFlag = 0
+          AND cdr.receiptType = 5
+          AND cdr.receiptStatus = 2
+    </select>
 </mapper>

+ 10 - 4
src/main/webapp/WEB-INF/views/modules/order/cmDiscernReceiptForm.jsp

@@ -162,6 +162,9 @@
                             <c:if test="${vo.payType != 10}">
                                 转账返佣
                             </c:if>
+                        </c:if>
+                        <c:if test="${vo.receiptType == 5}">
+                            供应商退款
                         </c:if>
 					</span>
             <span><label>收款类型:</label>${fns:getPayTypeStr(vo.payType)}</span>
@@ -211,14 +214,17 @@
     <div class="receipt-order-form">
         <c:forEach items="${vo.orderInfos}" var="orderInfo">
             <div class="receipt-order-form">
-                <c:if test="${vo.receiptType == 3}">
+                <c:if test="${vo.receiptType == 3 || vo.receiptType == 5}">
                     <div class="receipt-suborder-title">
                         <span class="font-blue"><label>子订单编号:</label><a
                                 href="${ctx}/order/detail?id=${orderInfo.orderID}">${orderInfo.shopOrderNo}(${orderInfo.shopOrderID})</a></span>
-                        <span><label>订单金额:</label>¥<fmt:formatNumber
-                                value="${orderInfo.shopOrderAmount}"
-                                pattern="#0.00"/></span>
+                        <span><label>订单金额:</label>¥<fmt:formatNumber value="${orderInfo.shopOrderAmount}" pattern="#0.00"/></span>
                         <span><label>供应商:</label>${orderInfo.shopName}</span>
+                        <c:if test="${vo.receiptType == 5}">
+                            <span><label>应付金额:</label>¥<fmt:formatNumber value="${orderInfo.shouldPayShopAmount}" pattern="#0.00"/></span>
+                            <span><label>已付金额:</label>¥<fmt:formatNumber value="${orderInfo.payedShopAmount}" pattern="#0.00"/></span>
+                            <span><label>已退金额:</label>¥<fmt:formatNumber value="${orderInfo.refundsAmount}" pattern="#0.00"/></span>
+                        </c:if>
                     </div>
                 </c:if>
                 <div class="receipt-order-row2">

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

@@ -11,7 +11,7 @@
 		.ul-form{white-space:nowrap;margin-left:-10px !important}
 		.ul-form label{width:90px;text-align:left;margin-top:15px}
 		.time-space-symbols{width:100px;display:inline-block;text-align:center}
-		#btnSubmit{width:128px;margin-left:443px}
+		#btnSubmit{width:128px;margin-left:80%}
 		.td-a{width:100%;float:left;display:block;text-align:center}
 		@media screen and (max-width:1300px){#searchForm{width:1460px !important}
 		.nav-tabs,#contentTable{width:1490px !important}
@@ -65,6 +65,8 @@
 							onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
 			</div>
 			<div>
+				<label>付款单名称:</label>
+				<form:input path="name" htmlEscape="false" maxlength="250" class="input-medium"/>
 				<label>付款审核状态:</label>
 				<form:select path="status" class="input-medium">
 					<form:option value="" label="所有"/>
@@ -86,9 +88,9 @@
 					<form:option value="2" label="供应商差价"/>
 					<form:option value="3" label="付第三方"/>
 				</form:select>
-				&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
-				<div class="clearfix"></div>
 			</div>
+			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
+			<div class="clearfix"></div>
 		</div>
 	</form:form>
 	<sys:message content="${message}"/>

+ 7 - 6
src/main/webapp/WEB-INF/views/modules/order/cmRefundRecordList.jsp

@@ -88,8 +88,7 @@
 		<li class="active tab-li"><a href="${ctx}/shopOrder/refundRecordList?operatingMode=2">记录退款</a></li>
 	</c:if>
 </ul>
-<form:form id="searchForm" onsubmit="submitFunc()" modelAttribute="newShopOrder" action="${ctx}/shopOrder/refundRecordList?operatingMode=${operatingMode
-}" method="post" class="breadcrumb form-search">
+<form:form id="searchForm" onsubmit="submitFunc()" modelAttribute="newShopOrder" action="${ctx}/shopOrder/refundRecordList?operatingMode=${operatingMode}" method="post" class="breadcrumb form-search">
 	<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 	<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
 	<div class="ul-form">
@@ -179,7 +178,7 @@
 					<th>收款状态</th>
 					<th>收款金额</th>
 					<th colspan="3">经理折扣</th>
-					<th colspan="2">成本类型</th>
+					<th colspan="3">成本类型</th>
 				</tr>
 				<tr>
 					<td><a href="${ctx}/order/detail?id=${s.orderID}">${s.shopOrderNo}(${s.shopOrderID})</a></td>
@@ -214,7 +213,7 @@
 						</c:if>
 						<c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
 					</td>
-					<td colspan="2"><c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if><c:if test="${s.costType == '2'}">比例成本</c:if></td>
+					<td colspan="3"><c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if><c:if test="${s.costType == '2'}">比例成本</c:if></td>
 				</tr>
 				<tr>
 					<th>供应商</th>
@@ -226,6 +225,7 @@
 					<th colspan="3">应付税费</th>
 					<th>付供应商</th>
 					<th>付第三方</th>
+					<th>退款金额</th>
 				</tr>
 				<tr>
 					<td>${s.shopName}</td>
@@ -269,6 +269,7 @@
 						<input type="hidden" class="proportional" value="${s.proportional}">
 						<input type="hidden" class="modifyShouldPayNote" value="${s.modifyShouldPayNote}">
 					<td class="third-party-fee"><fmt:formatNumber value="${s.shopOtherFee}" type="number" pattern="#,##0.00"/></td>
+					<td><fmt:formatNumber value="${s.refundsAmount}" type="number" pattern="#,##0.00"/></td>
 				</tr>
 				<tr>
 					<th>商品名</th>
@@ -280,7 +281,7 @@
 					<th colspan="2">总价</th>
                     <th colspan="3">供应商税率 / 单税费 / 总税费</th>
 					<th>成本(单)</th>
-					<th>成本(总)</th>
+					<th colspan="2">成本(总)</th>
 				</tr>
 				<c:forEach items="${s.newOrderProducts}" var="p" varStatus="pIndex">
 					<tr class="pay-product-item">
@@ -329,7 +330,7 @@
 							</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 colspan="2"><fmt:formatNumber value="${p.costPrice * (p.num + p.presentNum - p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
 					</tr>
 				</c:forEach>
 			</table>

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

@@ -272,7 +272,7 @@
 						</div>
 						<div class="refund-wrapper">
 							<c:if test="${cmRefundShop.refundWay == '2'||cmRefundShop.refundWay == '3'}">
-								余额账户:¥${cmRefundShop.refundBalanceAmount}
+								欠款账簿:¥${cmRefundShop.refundBalanceAmount}
 							</c:if>
 						</div>
 					</div>

+ 23 - 19
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopForm.jsp

@@ -174,9 +174,10 @@
 							<div>应付:${s.shouldPayShopAmount}, 已付:${s.payedShopAmount}
 								<c:if test="${s.wipePayment > 0}"><font color="red">(付款抹平¥${s.wipePayment})</font></c:if>
 							</div>
-							<div>已退:${s.refundsAmount}, 待退:<span class="need-refund"><fmt:formatNumber value="${s.payedShopAmount-s.refundsAmount-s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></span></div>
-							<div>退款:<input type="number" value="${s.payedShopAmount-s.refundsAmount-s.shouldPayShopAmount}" class="refund refundMoneyInput" ></div>
+							<div>已退:${s.refundsAmount}<%--, 待退:<span class="need-refund"><fmt:formatNumber value="${s.payedShopAmount-s.refundsAmount-s.shouldPayShopAmount}" type="number" pattern="#,##0.00"/></span>--%></div>
+							<div>退款:<input type="number" value="0" class="refund refundMoneyInput" ></div>
 							<input type="hidden" data-shoporderid="${s.shopOrderID}" name="refundInfo" class="refundInfo" value="${s.shopOrderID}_${s.payedShopAmount-s.refundsAmount-s.shouldPayShopAmount}">
+							<input type="hidden" class="need-refund" value="${s.payedShopAmount-s.refundsAmount}">
 						</td>
 					</tr>
 					<tr>
@@ -248,10 +249,10 @@
 				<div class="refund-methods">
 					<label>接收退款方式:</label>
 					<div>
-						<div class="refund-wrapper">
+						<%--<div class="refund-wrapper">
 							<input type="checkbox" class="refund-checkbox" name="refundWay" value="11" checked>线下转账&nbsp
 							<select name="refundType" id="">
-								<%--<option value="6">账户余额</option>--%>
+								&lt;%&ndash;<option value="6">账户余额</option>&ndash;%&gt;
 								<option value="1">建设银行7297</option>
 								<option value="2">中信银行0897</option>
 								<option value="3">中信银行7172</option>
@@ -260,10 +261,13 @@
 								<option value="6">虚拟银行0000</option>
 							</select>
 							<input type="number" name="refundAmount" class="refund-amount" value="0.00">
-						</div>
+						</div>--%>
 						<div class="refund-wrapper">
-							<input type="checkbox" class="refund-checkbox" name="refundWay" value="22">欠款账簿
-							<input type="number" name="refundBalanceAmount" class="refund-amount" value="0.00">
+							<%--<input type="checkbox" class="refund-checkbox" name="refundWay" value="22" checked>--%>
+								欠款账簿
+								<input type="hidden" name="refundBalanceAmount" class="refund-amount" value="0.00">
+								<input type="hidden" name="refundWay" value="22">
+								<span id="refundBalanceAmount">0.00</span>
 						</div>
 						<input type="hidden" name="shopID" value="${cmRefundShop.shopID}">
 					</div>
@@ -322,29 +326,31 @@
 				var thisEle = $(this), wrapper = thisEle.parents(".supplier-fee"),
 						thisVal = thisEle.val(),
 						totalAmount = 0,
-						alreadyPaid = Number(wrapper.find('.need-refund').text());
-						//alreadyPaid = Number(wrapper.find('.need-refund').text().replace('待退:',''));
+						alreadyPaid = Number(wrapper.find('.need-refund').val());
 				if(thisVal.length > 8){
 					wrapper.find('.refund').val(thisVal.slice(0,8));
 				}
 				if((thisVal > alreadyPaid) ) {
 					thisEle.val(alreadyPaid);
+					thisVal = alreadyPaid;
 				}
 				$('.refund').each(function (index, ele) {
 					totalAmount+= Number($(this).val());
 				});
 				$('#totalRefundAmount').text(totalAmount);
+				$('#refundBalanceAmount').text(totalAmount);
 				$('#totalRefundAmount-hidden').val(totalAmount);
+				$('.refund-amount').val(totalAmount);
 				var refundInfo = wrapper.find('.refundInfo');
 				refundInfo.val(refundInfo.attr('data-shoporderid') + '_' + thisVal);
 			});
 
-			$('.refund-amount').on('input',function() {
+			/*$('.refund-amount').on('input',function() {
 			    var thisVal = $(this).val();
 			    if(thisVal < 0) {
                     $(this).val(0);
 				}
-			})
+			})*/
 
 			function showTips(title,text) {
 				$('.tips-popup h4').text(title);
@@ -363,10 +369,9 @@
                 }
 			})
 			$('.refund-cfm-btn').on('click',function() {
-				var totalRefundAmount = $('#totalRefundAmount').text(),
+				/*var totalRefundAmount = $('#totalRefundAmount').text(),
 					refundCheckbox = $('.refund-checkbox:checked'),
-                    // totalRefundAmountInput = $('#refundMoneyInput').val(),//退款金额输入框
-					inputTotalAmount = 0;
+					inputTotalAmount = 0;*/
 				var isNullFlag = false;
                 $('.refund').each(function (index, ele) {
                     var _thisVal = $(this).val();
@@ -377,19 +382,19 @@
 					}
                 });
 
-                if(refundCheckbox.length < 1) {
+               /* if(refundCheckbox.length < 1) {
                     $('.tips-cfm-btn').addClass('tips-cfm-directly');
                     $('.tips-cancel-btn').hide();
                     showTips('信息提示','请勾选接收退款方式');
                     return false;
-                }
+                }*/
                 if(isNullFlag){
                     $('.tips-cfm-btn').addClass('tips-cfm-directly');
                     $('.tips-cancel-btn').hide();
                     showTips('信息提示','退款金额不能为空');
                     return false;
                 }
-                refundCheckbox.each(function(){
+                /*refundCheckbox.each(function(){
                     var wrapper = $(this).closest('.refund-wrapper'),
                         thisAmount = wrapper.find('.refund-amount');
                     inputTotalAmount += Number(thisAmount.val());
@@ -400,8 +405,7 @@
                     showTips('确认提示','各退款方式的金额之和不等于退款总金额,请重新计算后再提交申请。');
                     $('.tips-cancel-btn').hide();
                     return false;
-                }
-
+                }*/
                 $('.tips-cfm-btn').removeClass('tips-cfm-directly');
                 $('.tips-cancel-btn').show();
                 showTips('确认提示','确定操作已退付款?');

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

@@ -355,6 +355,36 @@
         </tr>
         </thead>
         <tbody>
+        <c:forEach items="${receipts}" var="r">
+            <tr>
+                <td>${r.id}</td>
+                <td><a href="${ctx}/order/cmDiscernReceipt/detail?id=${r.id}">${r.id}</a></td>
+                <td>${r.receiptDate}</td>
+                <td>
+                    <div class="text-left">
+                        线下转账:
+                        <c:if test="${r.payType == '1'}">
+                            建设银行7297
+                        </c:if>
+                        <c:if test="${r.payType == '2'}">
+                            中信银行0897
+                        </c:if>
+                        <c:if test="${r.payType == '3'}">
+                            中信银行7172
+                        </c:if>
+                        <c:if test="${r.payType == '4'}">
+                            广发银行0115
+                        </c:if>
+                        <c:if test="${r.payType == '5'}">
+                            广发银行5461
+                        </c:if>
+                        &nbsp&nbsp
+                        ¥${r.receiptAmount}<br>
+                    </div>
+                </td>
+                <td>${r.refundAmount}</td>
+            </tr>
+        </c:forEach>
         <c:forEach items="${rr}" var="r">
             <tr>
                 <td>${r.id}</td>
@@ -380,7 +410,7 @@
                         </c:if>
                         &nbsp&nbsp
                         ¥${r.cmRefundShop.refundAmount}<br>
-                        余额账户:&nbsp&nbsp¥${r.cmRefundShop.refundBalanceAmount}
+                        欠款账簿:&nbsp&nbsp¥${r.cmRefundShop.refundBalanceAmount}
                     </div>
                     <c:if test="${(r.cmRefundShop.refundAmount+r.cmRefundShop.refundBalanceAmount) != r.refundAmount}">
                         <span style="color: #9c0408">(本次退款涉及其他子订单,每种退款方式的金额为多个子订单的该方式退款总和)</span>