zhijiezhao 3 년 전
부모
커밋
0d3a7d7fd7

+ 18 - 0
src/main/java/com/caimei/modules/order/service/CmRefundShopService.java

@@ -190,10 +190,19 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                 so.setDiscountTotalFee(newOrder.getDiscountFee());
                 //机构运费
                 so.setFreight(newOrder.getFreight());
+                if("0".equals(newOrder.getFreePostFlag())||"-1".equals(newOrder.getFreePostFlag())||"-2".equals(newOrder.getFreePostFlag())){
+                    so.setFreight(Double.valueOf(newOrder.getFreePostFlag()));
+                }
                 //机构运费是否已退
                 Integer returnedFreightNum = newOrderProductDao.countReturnedFreightProduct(so.getOrderID());
                 Boolean returnedFreightFlag = returnedFreightNum == null ? false : returnedFreightNum > 0 ? true : false;
                 so.setReturnedFreightFlag(returnedFreightFlag);
+                //所有子订单号
+                List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
+                so.setShopOrderNos(strings);
+                //主订单总佣金
+                Double income = newShopOrderDao.findIncome(so.getOrderID());
+                so.setIncome(income);
             }
             cmRefundShop.setRefundAmount(refundAmount);
             cmRefundShop.setShopOrders(payOrderList);
@@ -249,10 +258,19 @@ public class CmRefundShopService extends CrudService<CmRefundShopDao, CmRefundSh
                 so.setDiscountTotalFee(newOrder.getDiscountFee());
                 //机构运费
                 so.setFreight(newOrder.getFreight());
+                if("0".equals(newOrder.getFreePostFlag())||"-1".equals(newOrder.getFreePostFlag())||"-2".equals(newOrder.getFreePostFlag())){
+                    so.setFreight(Double.valueOf(newOrder.getFreePostFlag()));
+                }
                 //机构运费是否已退
                 Integer returnedFreightNum = newOrderProductDao.countReturnedFreightProduct(so.getOrderID());
                 Boolean returnedFreightFlag = returnedFreightNum == null ? false : returnedFreightNum > 0 ? true : false;
                 so.setReturnedFreightFlag(returnedFreightFlag);
+                //所有子订单号
+                List<String> strings = newShopOrderDao.findShopOrderNos(so.getOrderID());
+                so.setShopOrderNos(strings);
+                //主订单总佣金
+                Double income = newShopOrderDao.findIncome(so.getOrderID());
+                so.setIncome(income);
             }
             cmRefundShop.setShopOrders(payOrderList);
         }

+ 130 - 127
src/main/java/com/caimei/modules/order/web/CmRefundShopController.java

@@ -27,6 +27,7 @@ import java.util.Map;
 
 /**
  * 退款表--供应商退款给采美Controller
+ *
  * @author lwt
  * @version 2019-07-01
  */
@@ -34,141 +35,143 @@ import java.util.Map;
 @RequestMapping(value = "${adminPath}/order/cmRefundShop")
 public class CmRefundShopController extends BaseController {
 
-	@Autowired
-	private CmRefundShopService cmRefundShopService;
+    @Autowired
+    private CmRefundShopService cmRefundShopService;
 
-	@Autowired
-	private CmUserOrganizeService cmUserOrganizeService;
+    @Autowired
+    private CmUserOrganizeService cmUserOrganizeService;
 
-	@ModelAttribute
-	public CmRefundShop get(@RequestParam(required=false) String id) {
-		CmRefundShop entity = null;
-		if (StringUtils.isNotBlank(id)){
-			entity = cmRefundShopService.get(id);
-		}
-		if (entity == null){
-			entity = new CmRefundShop();
-		}
-		return entity;
-	}
+    @ModelAttribute
+    public CmRefundShop get(@RequestParam(required = false) String id) {
+        CmRefundShop entity = null;
+        if (StringUtils.isNotBlank(id)) {
+            entity = cmRefundShopService.get(id);
+        }
+        if (entity == null) {
+            entity = new CmRefundShop();
+        }
+        return entity;
+    }
 
-	@RequiresPermissions("order:cmRefundShop:view")
-	@RequestMapping(value = {"list", ""})
-	public String list(CmRefundShop cmRefundShop, HttpServletRequest request, HttpServletResponse response, Model model) {
-		if (null != cmRefundShop.getStartTime() && !"".equals(cmRefundShop.getStartTime()) && !cmRefundShop.getStartTime().endsWith("00:00:00")) {
-			model.addAttribute("startTime", cmRefundShop.getStartTime());
-			cmRefundShop.setStartTime(cmRefundShop.getStartTime().trim() + " 00:00:00");
-		}
-		if (null != cmRefundShop.getEndTime() && !"".equals(cmRefundShop.getEndTime()) && !cmRefundShop.getEndTime().endsWith("23:59:59")) {
-			model.addAttribute("endTime", cmRefundShop.getEndTime());
-			cmRefundShop.setEndTime(cmRefundShop.getEndTime().trim() + " 23:59:59");
-		}
-		Page<CmRefundShop> page = cmRefundShopService.findPage(new Page<CmRefundShop>(request, response), cmRefundShop);
-		//获取组织列表
-		List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
-		model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
-		model.addAttribute("page", page);
-		return "modules/order/cmRefundShopList";
-	}
+    @RequiresPermissions("order:cmRefundShop:view")
+    @RequestMapping(value = {"list", ""})
+    public String list(CmRefundShop cmRefundShop, HttpServletRequest request, HttpServletResponse response, Model model) {
+        if (null != cmRefundShop.getStartTime() && !"".equals(cmRefundShop.getStartTime()) && !cmRefundShop.getStartTime().endsWith("00:00:00")) {
+            model.addAttribute("startTime", cmRefundShop.getStartTime());
+            cmRefundShop.setStartTime(cmRefundShop.getStartTime().trim() + " 00:00:00");
+        }
+        if (null != cmRefundShop.getEndTime() && !"".equals(cmRefundShop.getEndTime()) && !cmRefundShop.getEndTime().endsWith("23:59:59")) {
+            model.addAttribute("endTime", cmRefundShop.getEndTime());
+            cmRefundShop.setEndTime(cmRefundShop.getEndTime().trim() + " 23:59:59");
+        }
+        Page<CmRefundShop> page = cmRefundShopService.findPage(new Page<CmRefundShop>(request, response), cmRefundShop);
+        //获取组织列表
+        List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findOrganize();
+        model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
+        model.addAttribute("page", page);
+        return "modules/order/cmRefundShopList";
+    }
 
-	@RequestMapping(value = "export")
-	public void exports(CmRefundShop cmRefundShop, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
-		if (null != cmRefundShop.getStartTime() && !"".equals(cmRefundShop.getStartTime()) && !cmRefundShop.getStartTime().endsWith("00:00:00")) {
-			cmRefundShop.setStartTime(cmRefundShop.getStartTime().trim() + " 00:00:00");
-		}
-		if (null != cmRefundShop.getEndTime() && !"".equals(cmRefundShop.getEndTime()) && !cmRefundShop.getEndTime().endsWith("23:59:59")) {
-			cmRefundShop.setEndTime(cmRefundShop.getEndTime().trim() + " 23:59:59");
-		}
-		//获取订单数据
-		String fileName = "退款记录列表.xls";
-		String template = Global.getConfig("export.template");
-		String templateFileName = template + "/refundShopList.xls";
-		try {
-			Map data = new HashMap<String, Object>();
-			List<CmRefundShop> list = cmRefundShopService.exports(new Page<CmRefundShop>(request, response), cmRefundShop);
-			data.put("list", list);
-			new ExcelUtil().createExcel(templateFileName, data, fileName, response);
-		} catch (Exception e) {
-			addMessage(redirectAttributes, "退款记录列表导出失败!" + e.getMessage());
-			logger.info(e.getMessage());
-			e.printStackTrace();
-		}
-	}
+    @RequestMapping(value = "export")
+    public void exports(CmRefundShop cmRefundShop, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
+        if (null != cmRefundShop.getStartTime() && !"".equals(cmRefundShop.getStartTime()) && !cmRefundShop.getStartTime().endsWith("00:00:00")) {
+            cmRefundShop.setStartTime(cmRefundShop.getStartTime().trim() + " 00:00:00");
+        }
+        if (null != cmRefundShop.getEndTime() && !"".equals(cmRefundShop.getEndTime()) && !cmRefundShop.getEndTime().endsWith("23:59:59")) {
+            cmRefundShop.setEndTime(cmRefundShop.getEndTime().trim() + " 23:59:59");
+        }
+        //获取订单数据
+        String fileName = "退款记录列表.xls";
+        String template = Global.getConfig("export.template");
+        String templateFileName = template + "/refundShopList.xls";
+        try {
+            Map data = new HashMap<String, Object>();
+            List<CmRefundShop> list = cmRefundShopService.exports(new Page<CmRefundShop>(request, response), cmRefundShop);
+            data.put("list", list);
+            new ExcelUtil().createExcel(templateFileName, data, fileName, response);
+        } catch (Exception e) {
+            addMessage(redirectAttributes, "退款记录列表导出失败!" + e.getMessage());
+            logger.info(e.getMessage());
+            e.printStackTrace();
+        }
+    }
 
-	@RequiresPermissions("order:cmRefundShop:view")
-	@RequestMapping(value = "form")
-	public String form(CmRefundShop cmRefundShop, Model model) {
-		model.addAttribute("cmRefundShop", cmRefundShop);
-		return "modules/order/cmRefundShopForm";
-	}
+    @RequiresPermissions("order:cmRefundShop:view")
+    @RequestMapping(value = "form")
+    public String form(CmRefundShop cmRefundShop, Model model) {
+        model.addAttribute("cmRefundShop", cmRefundShop);
+        return "modules/order/cmRefundShopForm";
+    }
 
-	@RequiresPermissions("order:cmRefundShop:edit")
-	@RequestMapping(value = "save")
-	public String save(CmRefundShop cmRefundShop, Model model, RedirectAttributes redirectAttributes) {
-		if (!beanValidator(model, cmRefundShop)){
-			return form(cmRefundShop, model);
-		}
-		cmRefundShopService.save(cmRefundShop);
-		addMessage(redirectAttributes, "保存退款表--供应商退款给采美成功");
-		return "redirect:"+Global.getAdminPath()+"/order/cmRefundShop/?repage";
-	}
+    @RequiresPermissions("order:cmRefundShop:edit")
+    @RequestMapping(value = "save")
+    public String save(CmRefundShop cmRefundShop, Model model, RedirectAttributes redirectAttributes) {
+        if (!beanValidator(model, cmRefundShop)) {
+            return form(cmRefundShop, model);
+        }
+        cmRefundShopService.save(cmRefundShop);
+        addMessage(redirectAttributes, "保存退款表--供应商退款给采美成功");
+        return "redirect:" + Global.getAdminPath() + "/order/cmRefundShop/?repage";
+    }
 
-	@RequiresPermissions("order:cmRefundShop:delete")
-	@RequestMapping(value = "delete")
-	public String delete(CmRefundShop cmRefundShop, RedirectAttributes redirectAttributes) {
-		cmRefundShopService.delete(cmRefundShop);
-		addMessage(redirectAttributes, "删除退款表--供应商退款给采美成功");
-		return "redirect:"+Global.getAdminPath()+"/order/cmRefundShop/?repage";
-	}
+    @RequiresPermissions("order:cmRefundShop:delete")
+    @RequestMapping(value = "delete")
+    public String delete(CmRefundShop cmRefundShop, RedirectAttributes redirectAttributes) {
+        cmRefundShopService.delete(cmRefundShop);
+        addMessage(redirectAttributes, "删除退款表--供应商退款给采美成功");
+        return "redirect:" + Global.getAdminPath() + "/order/cmRefundShop/?repage";
+    }
 
-	@RequiresPermissions("order:cmRefundShop:edit")
-	@RequestMapping(value = "toRefund")
-	public String toRefund(CmRefundShop cmRefundShop, String[] shopOrderIDs, Model model, RedirectAttributes redirectAttributes) {
-		try {
-			cmRefundShopService.toRefund(cmRefundShop, shopOrderIDs);
-			model.addAttribute("cmRefundShop", cmRefundShop);
-		} catch (Exception e) {
-			logger.info(e.getMessage());
-			e.printStackTrace();
-		}
-		if (StringUtils.isEmpty(cmRefundShop.getId()))
-			return "modules/order/cmRefundShopForm";
-		else
-			return "modules/order/cmRefundShopDetail";
-	}
+    @RequiresPermissions("order:cmRefundShop:edit")
+    @RequestMapping(value = "toRefund")
+    public String toRefund(CmRefundShop cmRefundShop, String[] shopOrderIDs, Model model, RedirectAttributes redirectAttributes) {
+        try {
+            cmRefundShopService.toRefund(cmRefundShop, shopOrderIDs);
+            model.addAttribute("cmRefundShop", cmRefundShop);
+        } catch (Exception e) {
+            logger.info(e.getMessage());
+            e.printStackTrace();
+        }
+        if (StringUtils.isEmpty(cmRefundShop.getId())) {
+            return "modules/order/cmRefundShopForm";
+        } else {
+            return "modules/order/cmRefundShopDetail";
+        }
+    }
 
-	/**
-	 * 退款操作     shopOrderInfo  ==> value = 子订单ID_退款金额
-	 * @param cmRefundShop
-	 * @param refundInfo
-	 * @param model
-	 * @param redirectAttributes
-	 * @return
-	 */
-	@RequiresPermissions("order:cmRefundShop:edit")
-	@RequestMapping(value = "refund")
-	public String refund(CmRefundShop cmRefundShop, String[] refundInfo, Model model, RedirectAttributes redirectAttributes) {
-		try {
-			cmRefundShopService.refund(cmRefundShop, refundInfo);
-			model.addAttribute("cmRefundShop", cmRefundShop);
-		} catch (Exception e) {
-			logger.info(e.getMessage());
-			e.printStackTrace();
-		}
-		return "redirect:"+Global.getAdminPath()+"/order/cmRefundShop/?repage";
-	}
+    /**
+     * 退款操作     shopOrderInfo  ==> value = 子订单ID_退款金额
+     *
+     * @param cmRefundShop
+     * @param refundInfo
+     * @param model
+     * @param redirectAttributes
+     * @return
+     */
+    @RequiresPermissions("order:cmRefundShop:edit")
+    @RequestMapping(value = "refund")
+    public String refund(CmRefundShop cmRefundShop, String[] refundInfo, Model model, RedirectAttributes redirectAttributes) {
+        try {
+            cmRefundShopService.refund(cmRefundShop, refundInfo);
+            model.addAttribute("cmRefundShop", cmRefundShop);
+        } catch (Exception e) {
+            logger.info(e.getMessage());
+            e.printStackTrace();
+        }
+        return "redirect:" + Global.getAdminPath() + "/order/cmRefundShop/?repage";
+    }
 
-	/**
-	 * 撤销退款
-	 */
-	@RequiresPermissions("order:cmRefundShop:delete")
-	@RequestMapping(value = "revocation")
-	public String revocation(String id){
-		try {
-			cmRefundShopService.revocation(id);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return "redirect:"+Global.getAdminPath()+"/order/cmRefundShop/?repage";
-	}
+    /**
+     * 撤销退款
+     */
+    @RequiresPermissions("order:cmRefundShop:delete")
+    @RequestMapping(value = "revocation")
+    public String revocation(String id) {
+        try {
+            cmRefundShopService.revocation(id);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "redirect:" + Global.getAdminPath() + "/order/cmRefundShop/?repage";
+    }
 }

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

@@ -85,30 +85,83 @@
         <c:forEach items="${cmRefundShop.shopOrders}" var="s">
             <table class="table table-striped table-bordered table-condensed pay-table">
                 <tr>
-                    <th>子订单编号(ID)</th>
-                    <th colspan="3">订单编号(ID)</th>
-                    <th colspan="2">订单金额</th>
-                    <th colspan="3">下单时间</th>
+                    <th>订单编号(ID)</th>
+                    <th colspan="3">客户</th>
+                    <th colspan="2">下单时间</th>
+                    <th>订单金额</th>
+                    <th colspan="3">所有子订单</th>
+                    <th>订单总佣金</th>
+                    <th>机构运费</th>
                     <th>收款状态</th>
-                    <th>收款金额</th>
-                    <th colspan="3">经理折扣</th>
-                    <th>成本类型</th>
-                    <th>付第三方</th>
+                    <th colspan="3">收款金额</th>
+                    <th>经理折扣</th>
+                    <th>优惠券</th>
                 </tr>
                 <tr>
-                    <td><a href="${ctx}/order/detail?id=${s.orderID}">${s.shopOrderNo}(${s.shopOrderID})</a></td>
-                    <td colspan="3"><a href="${ctx}/order/detail?id=${s.orderID}">${s.orderNo}(${s.orderID})</a></td>
-                    <td colspan="2">${s.payTotalFee}</td>
-                    <td colspan="3">${s.orderTime}</td>
-                    <td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline">
-                        <c:if test="${s.receiptStatus == 1}"><font color="red">待收款</font></c:if>
-                        <c:if test="${s.receiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
-                        <c:if test="${s.receiptStatus == 3}"><font color="green">已收款</font></c:if></a></td>
-                    <td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline">${s.receiptTotalFee}</a></td>
+                    <td> ${s.orderNo}(${s.orderID})</td>
+                    <td colspan="3"> ${s.buyer}</td>
+                    <td colspan="2"> ${s.orderTime}</td>
+                    <td>${s.payTotalFee}</td>
+                    <td colspan="3">
+                        <c:forEach items="${s.shopOrderNos}" var="cs">
+                            ${cs}<br/>
+                        </c:forEach>
+                    </td>
+                    <td>${s.income}</td>
+                    <td>
+                        <label class="clubFreight"  style="display: none">
+                            <c:choose>
+                                <c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
+                                    <fmt:formatNumber value="${s.freight}"/>
+                                </c:when>
+                                <c:otherwise>
+                                    <fmt:formatNumber value="0"/>
+                                </c:otherwise>
+                            </c:choose>
+                        </label>
+                        <c:if test="${s.freight == 0}">
+                            包邮
+                        </c:if>
+                        <c:if test="${s.freight == -1}">
+                            到付
+                        </c:if>
+                        <c:if test="${s.freight == -2}">
+                            仪器到付-产品包邮
+                        </c:if>
+                        <c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
+                            <fmt:formatNumber value="${s.freight}" type="currency"/>
+                            <c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+                        </c:if>
+                        <c:if test="${s.userBeans gt 0}">
+                            (采美豆抵用${s.userBeans})
+                        </c:if>
+                    </td>
+                    <td>
+                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
+                           style="text-decoration: underline">
+                            <c:if test="${s.receiptStatus == 1}"><font color="red">待收款</font></c:if>
+                            <c:if test="${s.receiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
+                            <c:if test="${s.receiptStatus == 3}"><font color="green">已收款</font></c:if></a>
+                    </td>
                     <td colspan="3">
+                        <a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
+                           style="text-decoration: underline">${s.receiptTotalFee}</a>
+                    </td>
+                    <td>
+                        <label class="discountFee"  style="display: none">
+                            <c:choose>
+                                <c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
+                                    <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
+                                </c:when>
+                                <c:otherwise>
+                                    0
+                                </c:otherwise>
+                            </c:choose>
+                        </label>
                         <c:if test="${s.discountTotalFee gt 0}">
                             <c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
-                                <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}" type="currency"/>
+                                <fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"
+                                                  type="currency"/>
                             </c:if>
                             <c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
                                 ¥0.00
@@ -127,62 +180,61 @@
                         </c:if>
                         <c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
                     </td>
-                    <td><c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if><c:if test="${s.costType == '2'}">比例成本</c:if></td>
-                    <td class="third-party-fee">${s.shopOtherFee}</td>
-                </tr>
+                    <td>${s.couponAmount} </td>
+                <tr/>
                 <tr>
-                    <th>供应商</th>
-                    <th colspan="3">客户</th>
-                    <th>机构运费</th>
-                    <th>供应商运费</th>
+                    <th>子订单编号(ID)</th>
+                    <th colspan="3"> 供应商</th>
+                    <th colspan="3">子订单佣金</th>
                     <th colspan="3">商品费</th>
-                    <th colspan="2">付款状态</th>
-                    <th colspan="3">应付税费</th>
-                    <th colspan="2">付供应商</th>
+                    <th>应付税费</th>
+                    <th>供应商运费</th>
+                    <th>付款状态</th>
+                    <th colspan="3">付供应商</th>
+                    <th>付第三方</th>
+                    <th>成本类型</th>
                 </tr>
                 <tr>
-                    <td>${s.shopName}</td>
-                    <td colspan="3">
-                        <c:if test="${s.organizeID == 1}"><span class="org-note">星范</span></c:if>
-                            ${s.buyer}<c:if test="${s.organizeID == 3}"></c:if>
+                    <td>${s.shopOrderNo}(${s.shopOrderID})</td>
+                    <td colspan="3">${s.shopName}</td>
+                    <td colspan="3" class="payCm-t">子订单佣金</td>
+                    <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
+
+                    <td class="taxes">
+                        <fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
                     </td>
+
+                    <td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number"
+                                                          pattern="#,##0.00"/></td>
+
                     <td>
-                        <c:if test="${s.freight == 0}">
-                            包邮
-                        </c:if>
-                        <c:if test="${s.freight == -1}">
-                            到付
-                        </c:if>
-                        <c:if test="${s.freight == -2}">
-                            仪器到付-产品包邮
-                        </c:if>
-                        <c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
-                            <fmt:formatNumber value="${s.freight}" type="currency"/>
-                            <c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
-                        </c:if>
-                    </td>
-                    <td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number" pattern="#,##0.00"/></td>
-                    <td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-                    <td colspan="2"><c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font color="red">待付款</font></c:if>
+                        <c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font
+                                color="red">待付款</font></c:if>
                         <c:if test="${s.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
                         <c:if test="${s.payStatus == 3}"><font color="green">已付款</font></c:if>
                     </td>
-                    <td colspan="3" class="taxes"><fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/></td>
-                    <td colspan="2" class="supplier-fee">
+                    <td colspan="3" class="supplier-fee">
                         <div>应付:${s.shouldPayShopAmount}, 已付:<span class="payed">${s.payedShopAmount}</span>
                             <c:if test="${s.wipePayment > 0}"><font color="red">(付款抹平¥${s.wipePayment})</font></c:if>
                         </div>
                         <div>退款:${s.refundAmount}</div>
                     </td>
+                    <td class="third-party-fee">${s.shopOtherFee}</td>
+                    <td>
+                        <c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if>
+                        <c:if test="${s.costType == '2'}">比例成本</c:if>
+                    </td>
                 </tr>
                 <tr>
                     <th>商品名</th>
                     <th>规格</th>
                     <th>数量<%--(赠品)--%></th>
                     <th>退货</th>
-                    <th colspan="2">单价</th>
+                    <th colspan="3">单价</th>
                     <th colspan="3">机构税率 / 单税费 / 总税费</th>
-                    <th colspan="2">总价</th>
+                    <th>总价</th>
+                    <th>佣金(单)</th>
+                    <th>佣金(总)</th>
                     <th colspan="3">供应商税率 / 单税费 / 总税费</th>
                     <th>成本(单)</th>
                     <th>成本(总)</th>
@@ -201,7 +253,7 @@
                             <c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
                         </td>
                         <td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-                        <td colspan="2">${empty p.touchPrice?p.discountPrice:p.touchPrice }
+                        <td colspan="3">${empty p.touchPrice?p.discountPrice:p.touchPrice }
                             <c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
                                 <label style="color: red">
                                     (${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
@@ -218,7 +270,16 @@
                                 <fmt:formatNumber value="${empty p.totalAddedValueTax ?0.00:(p.addedValueTax * (p.num+p.presentNum-p.returnedNum))}" type="number" pattern="#,##0.00"/>
                             </c:otherwise>
                         </c:choose></td>
-                        <td colspan="2"><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
+                        <td><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
+
+                        <td><fmt:formatNumber
+                                value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax}"
+                                pattern="#,##0.00"/></td>
+
+                        <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 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>
@@ -355,7 +416,6 @@
         $('.tips-cancel-btn, #close-btn1').on('click',function() {
             $('.tips-popup').hide();
         });
-
         $('body').on('input propertychange','.refund',function() {
             var thisEle = $(this), wrapper = thisEle.parents(".supplier-fee"),
                 thisVal = thisEle.val(),
@@ -402,6 +462,7 @@
                 showTips('确认提示','确定操作已退付款?');
             }
         })
+
     })()
 </script>
 </html>

+ 118 - 55
src/main/webapp/WEB-INF/views/modules/order/cmRefundShopForm.jsp

@@ -90,30 +90,83 @@
 			<c:forEach items="${cmRefundShop.shopOrders}" var="s">
 				<table class="table table-striped table-bordered table-condensed pay-table">
 					<tr>
-						<th>子订单编号(ID)</th>
-						<th colspan="3">订单编号(ID)</th>
-						<th colspan="2">订单金额</th>
-						<th colspan="3">下单时间</th>
+						<th>订单编号(ID)</th>
+						<th colspan="3">客户</th>
+						<th colspan="2">下单时间</th>
+						<th>订单金额</th>
+						<th colspan="3">所有子订单</th>
+						<th>订单总佣金</th>
+						<th>机构运费</th>
 						<th>收款状态</th>
-						<th>收款金额</th>
-						<th colspan="3">经理折扣</th>
-						<th>成本类型</th>
-						<th>付第三方</th>
+						<th colspan="3">收款金额</th>
+						<th>经理折扣</th>
+						<th>优惠券</th>
 					</tr>
 					<tr>
-						<td><a href="${ctx}/order/detail?id=${s.orderID}">${s.shopOrderNo}(${s.shopOrderID})</a></td>
-						<td colspan="3"><a href="${ctx}/order/detail?id=${s.orderID}">${s.orderNo}(${s.orderID})</a></td>
-						<td colspan="2">${s.payTotalFee}</td>
-						<td colspan="3">${s.orderTime}</td>
-						<td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline">
-							<c:if test="${s.receiptStatus == 1}"><font color="red">待收款</font></c:if>
-							<c:if test="${s.receiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
-							<c:if test="${s.receiptStatus == 3}"><font color="green">已收款</font></c:if></a></td>
-						<td><a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1" style="text-decoration: underline">${s.receiptTotalFee}</a></td>
+						<td> ${s.orderNo}(${s.orderID})</td>
+						<td colspan="3"> ${s.buyer}</td>
+						<td colspan="2"> ${s.orderTime}</td>
+						<td>${s.payTotalFee}</td>
 						<td colspan="3">
+							<c:forEach items="${s.shopOrderNos}" var="cs">
+								${cs}<br/>
+							</c:forEach>
+						</td>
+						<td>${s.income}</td>
+						<td>
+							<label class="clubFreight"  style="display: none">
+								<c:choose>
+									<c:when test="${s.freight != -1 && s.freight != 0 && s.freight != -2 && s.returnedFreightFlag ne true}">
+										<fmt:formatNumber value="${s.freight}"/>
+									</c:when>
+									<c:otherwise>
+										<fmt:formatNumber value="0"/>
+									</c:otherwise>
+								</c:choose>
+							</label>
+							<c:if test="${s.freight == 0}">
+								包邮
+							</c:if>
+							<c:if test="${s.freight == -1}">
+								到付
+							</c:if>
+							<c:if test="${s.freight == -2}">
+								仪器到付-产品包邮
+							</c:if>
+							<c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
+								<fmt:formatNumber value="${s.freight}" type="currency"/>
+								<c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
+							</c:if>
+							<c:if test="${s.userBeans gt 0}">
+								(采美豆抵用${s.userBeans})
+							</c:if>
+						</td>
+						<td>
+							<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
+							   style="text-decoration: underline">
+								<c:if test="${s.receiptStatus == 1}"><font color="red">待收款</font></c:if>
+								<c:if test="${s.receiptStatus == 2}"><font color="#ff8c00">部分收款</font></c:if>
+								<c:if test="${s.receiptStatus == 3}"><font color="green">已收款</font></c:if></a>
+						</td>
+						<td colspan="3">
+							<a href="${ctx}/bulkpurchase/cmRefundsProduct/toRefundRecord.rpc?orderID=${s.orderID}&from=1"
+							   style="text-decoration: underline">${s.receiptTotalFee}</a>
+						</td>
+						<td>
+							<label class="discountFee"  style="display: none">
+								<c:choose>
+									<c:when test="${s.discountTotalFee gt 0 && s.discountTotalFee gt s.returnedPurchaseTotalFee}">
+										<fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"/>
+									</c:when>
+									<c:otherwise>
+										0
+									</c:otherwise>
+								</c:choose>
+							</label>
 							<c:if test="${s.discountTotalFee gt 0}">
 								<c:if test="${s.discountTotalFee gt s.returnedPurchaseTotalFee}">
-									<fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}" type="currency"/>
+									<fmt:formatNumber value="${s.discountTotalFee - s.returnedPurchaseTotalFee}"
+													  type="currency"/>
 								</c:if>
 								<c:if test="${s.discountTotalFee le s.returnedPurchaseTotalFee}">
 									¥0.00
@@ -132,45 +185,40 @@
 							</c:if>
 							<c:if test="${s.discountTotalFee le 0}">¥0.00</c:if>
 						</td>
-						<td><c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if><c:if test="${s.costType == '2'}">比例成本</c:if></td>
-						<td class="third-party-fee">${s.shopOtherFee}</td>
-					</tr>
+						<td>${s.couponAmount} </td>
+					<tr/>
 					<tr>
-						<th>供应商</th>
-						<th colspan="3">客户</th>
-						<th>机构运费</th>
-						<th>供应商运费</th>
+						<th>子订单编号(ID)</th>
+						<th colspan="3"> 供应商</th>
+						<th colspan="3">子订单佣金</th>
 						<th colspan="3">商品费</th>
-						<th colspan="2">付款状态</th>
-						<th colspan="3">应付税费</th>
-						<th colspan="2">付供应商</th>
+						<th>应付税费</th>
+						<th>供应商运费</th>
+						<th>付款状态</th>
+						<th colspan="3">付供应商</th>
+						<th>付第三方</th>
+						<th>成本类型</th>
 					</tr>
 					<tr>
-						<td>${s.shopName}</td>
-						<td colspan="3">${s.buyer}<c:if test="${s.organizeID == 3}"></c:if></td>
-						<td>
-							<c:if test="${s.freight == 0}">
-								包邮
-							</c:if>
-							<c:if test="${s.freight == -1}">
-								到付
-							</c:if>
-							<c:if test="${s.freight == -2}">
-								仪器到付-产品包邮
-							</c:if>
-							<c:if test="${s.freight != -1 && s.freight != 0 && s.freight != -2}">
-								<fmt:formatNumber value="${s.freight}" type="currency"/>
-								<c:if test="${s.returnedFreightFlag eq true}"><font color="red">(已退)</font></c:if>
-							</c:if>
-						</td>
-						<td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number" pattern="#,##0.00"/></td>
+						<td>${s.shopOrderNo}(${s.shopOrderID})</td>
+						<td colspan="3">${s.shopName}</td>
+						<td colspan="3" class="payCm-t">子订单佣金</td>
 						<td colspan="3" class="product-fee">${s.shopProductAmount}</td>
-						<td colspan="2"><c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font color="red">待付款</font></c:if>
+
+						<td class="taxes">
+							<fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/>
+						</td>
+
+						<td class="freight"><fmt:formatNumber value="${s.shopPostFee}" type="number"
+															  pattern="#,##0.00"/></td>
+
+						<td>
+							<c:if test="${s.payStatus == 1 || empty s.payStatus || s.payStatus == 0}"><font
+									color="red">待付款</font></c:if>
 							<c:if test="${s.payStatus == 2}"><font color="#ff8c00">部分付款</font></c:if>
 							<c:if test="${s.payStatus == 3}"><font color="green">已付款</font></c:if>
 						</td>
-						<td colspan="3" class="taxes"><fmt:formatNumber value="${s.shopTaxFee}" type="number" pattern="#,##0.00"/></td>
-						<td colspan="2" class="supplier-fee">
+						<td colspan="3" class="supplier-fee">
 							<div>应付:${s.shouldPayShopAmount}, 已付:${s.payedShopAmount}
 								<c:if test="${s.wipePayment > 0}"><font color="red">(付款抹平¥${s.wipePayment})</font></c:if>
 							</div>
@@ -179,15 +227,22 @@
 							<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>
+						<td class="third-party-fee">${s.shopOtherFee}</td>
+						<td>
+							<c:if test="${empty s.costType || s.costType == '1'}">固定成本</c:if>
+							<c:if test="${s.costType == '2'}">比例成本</c:if>
+						</td>
 					</tr>
 					<tr>
 						<th>商品名</th>
 						<th>规格</th>
 						<th>数量<%--(赠品)--%></th>
 						<th>退货</th>
-						<th colspan="2">单价</th>
+						<th colspan="3">单价</th>
 						<th colspan="3">机构税率 / 单税费 / 总税费</th>
-						<th colspan="2">总价</th>
+						<th>总价</th>
+						<th>佣金(单)</th>
+						<th>佣金(总)</th>
 						<th colspan="3">供应商税率 / 单税费 / 总税费</th>
 						<th>成本(单)</th>
 						<th>成本(总)</th>
@@ -206,7 +261,7 @@
 								<c:if test="${p.presentNum > 0}">(赠:${p.presentNum})</c:if>
 							</td>
 							<td><font color="${p.returnedNum>0?'red':''}">${p.returnedNum}</font></td>
-							<td colspan="2"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}" type="number" pattern="#,##0.00"/>
+							<td colspan="3"><fmt:formatNumber value="${empty p.touchPrice?p.discountPrice:p.touchPrice}" type="number" pattern="#,##0.00"/>
 								<c:if test="${p.includedTax != null and p.includedTax != '' and p.includedTax ne 2}">
 									<font color="red">
 										(${p.includedTax eq 1?'含税':(p.invoiceType eq 1 or p.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
@@ -223,7 +278,16 @@
 									<fmt:formatNumber value="${empty p.totalAddedValueTax ?0.00:(p.addedValueTax * (p.num+p.presentNum-p.returnedNum))}" type="number" pattern="#,##0.00"/>
 								</c:otherwise>
 							</c:choose></td>
-							<td colspan="2"><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
+							<td><fmt:formatNumber value="${((empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax)*(p.num+p.presentNum-p.returnedNum)}" type="number" pattern="#,##0.00"/></td>
+
+							<td><fmt:formatNumber
+									value="${(empty p.touchPrice?p.discountPrice:p.touchPrice) + p.addedValueTax - p.costPrice - p.singleShouldPayTotalTax}"
+									pattern="#,##0.00"/></td>
+
+							<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 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>
@@ -321,8 +385,7 @@
 		payTableEle.each(function (i,l) {
 			var leftLength = $(this).find('tr').length,
 					productLength = $(this).find('.pay-product-item').length;
-			// 商品列表合并单元格
-			/*$(this).find('.mergeRows').attr('rowspan',productLength);*/
+			$(this).find('.mergeRows').attr('rowspan',productLength);
 		});
 
 		$('.tips-cancel-btn, #close-btn1').on('click',function() {