From b6e7b81fd914cb08eb49d6cea916139e594020ac Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Fri, 08 Jan 2021 18:09:31 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java | 15 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html | 594 ++++++++++++-------------- zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java | 13 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form-bak.html | 348 +++++++++++++++ zq-erp/src/main/java/com/matrix/system/hive/service/CodeService.java | 2 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html | 138 +++-- zq-erp/src/main/java/com/matrix/system/hive/service/imp/CodeServiceImpl.java | 6 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 186 ++----- 8 files changed, 773 insertions(+), 529 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java index 2744c37..8f749b4 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java @@ -181,23 +181,10 @@ * @author jyy */ @RequestMapping(value = "/toBj") - public String toBj(Long id, HttpServletRequest request) { + public String toBj(Long id) { // 根据id查到对应的订单信息 SysOrder order = orderService.findById(id); WebUtil.getRequest().setAttribute("order", order); - - SysOrderItem item = new SysOrderItem(); - item.setOrderId(order.getId()); - item.setStatus(Dictionary.ORDER_STATU_QK); - order.setItems(orderItemService.findByModel(item)); - - - MoneyCardUse moneyCardUse = new MoneyCardUse(); - moneyCardUse.setVipId(order.getVipId()); - moneyCardUse.setStatus(Dictionary.MONEYCARD_STATUS_YX); - List<MoneyCardUse> cards = cardUseService.findByModel(moneyCardUse); - - WebUtil.getRequest().setAttribute("cards", cards); return "admin/hive/beautySalon/bj-form"; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java index 6292e8f..bf8cdae 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrderFlow.java @@ -11,7 +11,18 @@ public class SysOrderFlow implements Serializable { private static final long serialVersionUID = 7519131902836023680L; - public static final String PAY_METHOD_CARD = "会员卡"; + public static final String PAY_METHOD_CARD = "储值卡"; + + public static final String PAY_METHOD_ARREARS = "欠款"; + + public static final String FLOW_TYPE_BUY = "购买"; + + public static final String FLOW_TYPE_REPAY = "还款"; + + public static final String FLOW_TYPE_REFUND = "退款"; + + public static final String IS_GIFT_Y = "Y"; + public static final String IS_GIFT_N = "N"; private String createBy; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/CodeService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/CodeService.java index fefb430..896518f 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/CodeService.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/CodeService.java @@ -24,6 +24,8 @@ * @throws */ public String getOrderCode(); + + public String getFlowCode(); /** * 根据一定的规则返回一个随机编号。 diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/CodeServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/CodeServiceImpl.java index fa3cb22..8d7277f 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/CodeServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/CodeServiceImpl.java @@ -94,5 +94,9 @@ Date date=new Date(); return fmt.format(date); } - + + @Override + public String getFlowCode() { + return "F" + getNowTimeString(); + } } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java index 00031d1..e76196b 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java @@ -154,21 +154,10 @@ @Override public SysOrder checkAndSaveOrder(SysOrder sysOrder) { - // 收款改变订单状态 - /** - * 判断订单条目的一个付款情况 - */ - // 计算现金支付金额 - double xjMoney = 0.0; - // 计算卡支付总额 - double cardMoney = 0.0; + // 计算订单折扣金额,收款情况下 计算订单总额 double zkTotal = 0.0; - /** - * 记录本次消费的卡,防止扣除多次消费记录 - */ - ArrayList<Long> userCard = new ArrayList<Long>(); // 页面的pageOrder 参数只包含支付金额信息,不带有购买商品 for (SysOrderItem item : sysOrder.getItems()) { @@ -179,43 +168,14 @@ item.setIsFree(Dictionary.FLAG_YES); } - - // 如果支付方式是非现金则记录现金支付金额 - if (!item.getPayMethod().equals(PayMethodEnum.VIP_CARD.getCode())) { - xjMoney = MoneyUtil.add(xjMoney, item.getPayMoney()); -// item.setCashPay(item.getPayMoney()); - } else { - cardMoney = MoneyUtil.add(cardMoney, item.getPayMoney()); -// item.setCardPay(item.getPayMoney()); - - } - - // 订单欠款减去支付金额 设置实际欠款 Double itemZkTotal = MoneyUtil.mul(item.getZkPrice(), Double.valueOf(item.getCount())); zkTotal=MoneyUtil.add(zkTotal, itemZkTotal); -// item.setArrears(MoneyUtil.sub(itemZkTotal, item.getPayMoney())); - - - // 如果存在欠款,将条目状态设置为欠款 -// if (item.getArrears() > 0) { -// item.setStatus(Dictionary.ORDER_STATU_QK); -// } else if (item.getArrears() < 0) { -// item.setPayMoney(item.getZkPrice()); -// item.setStatus(Dictionary.ORDER_STATU_DFK); -// } else { -// item.setStatus(Dictionary.ORDER_STATU_DFK); -// } item.setStatus(Dictionary.ORDER_STATU_DFK); } - double arrears; + SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); - // 如果是收款,收款可以改变订单价格,所以需要求和出 订单折后价来计算本次欠款 - arrears = MoneyUtil.sub(zkTotal, MoneyUtil.add(cardMoney, xjMoney)); sysOrder.setZkTotal(zkTotal); -// sysOrder.setArrears(arrears); -// sysOrder.setCardPay(cardMoney); -// sysOrder.setCashPay(xjMoney); sysOrder.setStatu(Dictionary.ORDER_STATU_DFK); sysOrder.setStaffId(user.getSuId()); sysOrder.setCompanyId(user.getCompanyId()); @@ -502,47 +462,36 @@ * @author:姜友瑶 */ private void changeOrderStatu(SysOrder sourceOrder) { - + int i = 1; + String orderStatus = Dictionary.ORDER_STATU_YFK; for (SysOrderFlow flow : sourceOrder.getFlows()) { + flow.setFlowNo(codeService.getFlowCode() + "-" + i); + Long goodsId = sourceOrder.getItems().get(0).getGoodsId(); + ShoppingGoods goods = shoppingGoodsDao.selectById(goodsId); + flow.setFlowContent(goods.getName() + "等" + sourceOrder.getItems().size() + "件产品"); + + flow.setOrderId(sourceOrder.getId()); + flow.setVipId(sourceOrder.getVipId()); + flow.setFlowType(SysOrderFlow.FLOW_TYPE_BUY); // 若使用储值卡付款 if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { - + if (flow.getCardId() != null) { + MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(flow.getCardId()); + cardPaySk(moneyCardUse, sourceOrder, flow); + } } - } -// boolean haQk=false; -// -// for(SysOrderItem sysOrderItem:sourceOrder.getItems()){ -// -// if(!sysOrderItem.getStatus().equals(Dictionary.ORDER_STATU_QK)){ -// SysOrderItem updateItem=new SysOrderItem(); -// updateItem.setId(sysOrderItem.getId()); -// updateItem.setStatus(Dictionary.ORDER_STATU_YFK); -// -// if (sysOrderItem.getPayMethod().equals(Dictionary.PAY_TYPE_MOENY_CARD ) ) { -// -// if(sysOrderItem.getPayMethodDetail()!=null){ -// // 查询要支付的充值卡 -// MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(Long.parseLong(sysOrderItem.getPayMethodDetail())); -// // 扣除付款卡金额并添加流水 -// cardPaySk(moneyCardUse, sourceOrder, sysOrderItem); -// }else{ -// throw new GlobleException("请选择支付的会员卡"); -// } -// -// -// } -// orderItemDao.update(updateItem); -// }else { -// haQk=true; -// } -// } + if (SysOrderFlow.PAY_METHOD_ARREARS.equals(flow.getPayMethod())) { + orderStatus = Dictionary.ORDER_STATU_QK; + sourceOrder.setArrears(flow.getAmount().doubleValue()); + } + sysOrderFlowDao.insert(flow); + i++; + } // 更新收款状态 - sourceOrder.setStatu(Dictionary.ORDER_STATU_YFK); + sourceOrder.setStatu(orderStatus); sysOrderDao.update(sourceOrder); - - } @@ -581,59 +530,50 @@ * 使用充值卡付款操作 * * @param sourceOrder - * @param userCard - * @param orderItem - * @param temp 设置是否扣除使用次数 true 扣除 + * @param moneyCardUse + * @param flow */ - private void cardPaySk(MoneyCardUse moneyCardUse, SysOrder sourceOrder, - SysOrderItem orderItem) { + private void cardPaySk(MoneyCardUse moneyCardUse, SysOrder sourceOrder, SysOrderFlow flow) { // 判断商品是否在充值卡的限制购买,判断分类 - if (!isInBangding(moneyCardUse, orderItem.getGoodsId())) { - throw new GlobleException(shoppingGoodsDao.selectById(orderItem.getGoodsId()).getName() + "不在" - + moneyCardUse.getCardName() + "优惠中"); - } - SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); - Double balance = moneyCardUse.getRealMoney(); - if (moneyCardUse.getGiftMoney() != null) { - balance = MoneyUtil.add(balance, moneyCardUse.getGiftMoney()); - } - // 判断金额是否足够支付 - if (balance >= orderItem.getPayMoney()) { - - MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); - - // 余额充足先从本金中扣除 - if (moneyCardUse.getRealMoney() >= orderItem.getPayMoney()) { - double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), orderItem.getPayMoney()); - moneyCardUse.setRealMoney(surplus); - moneyCardUseFlow.setTotal(0-orderItem.getPayMoney()); - - } else { - // 本金不够 - double surplus = MoneyUtil.sub(orderItem.getPayMoney(), moneyCardUse.getRealMoney()); - moneyCardUseFlow.setTotal(0- moneyCardUse.getRealMoney()); - // 扣除所有本金 - moneyCardUse.setRealMoney(0D); - moneyCardUse.setGiftMoney(MoneyUtil.sub(moneyCardUse.getGiftMoney(), surplus)); - // 只要是用了赠送金额购买的就视为赠送套餐 18-12-01 jyy - orderItem.setIsFree(Dictionary.FLAG_YES); - moneyCardUseFlow.setGiftMoney(0-surplus); + sourceOrder.getItems().forEach(item -> { + if (!isInBangding(moneyCardUse, item.getGoodsId())) { + throw new GlobleException(shoppingGoodsDao.selectById(item.getGoodsId()).getName() + "不在" + moneyCardUse.getCardName() + "优惠中"); } + }); - //设置卡项使用流水 - moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); - moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); - moneyCardUseFlow.setVipId(sourceOrder.getVipId()); - moneyCardUseFlow.setTimes(-1); - moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); - moneyCardUseFlow.setCreateTime(new Date()); - moneyCardUseFlow.setOperationId(user.getSuId()); - moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney()+moneyCardUse.getRealMoney()); - moneyCardUseFlowDao.insert(moneyCardUseFlow); + SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); + MoneyCardUseFlow moneyCardUseFlow=new MoneyCardUseFlow(); + if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { + if(moneyCardUse.getGiftMoney() >= flow.getAmount().doubleValue()) { + double surplus = MoneyUtil.sub(moneyCardUse.getGiftMoney(), flow.getAmount().doubleValue()); + moneyCardUse.setGiftMoney(surplus); + + moneyCardUseFlow.setGiftMoney(0D - flow.getAmount().doubleValue()); + } else { + throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); + } } else { - throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); + if(moneyCardUse.getRealMoney() >= flow.getAmount().doubleValue()) { + double surplus = MoneyUtil.sub(moneyCardUse.getRealMoney(), flow.getAmount().doubleValue()); + moneyCardUse.setRealMoney(surplus); + + moneyCardUseFlow.setTotal(0 - flow.getAmount().doubleValue()); + } else { + throw new GlobleException(moneyCardUse.getCardName() + "余额不足"); + } } + + //设置卡项使用流水 + moneyCardUseFlow.setCarUseId(moneyCardUse.getId()); + moneyCardUseFlow.setOrderNo(sourceOrder.getOrderNo()); + moneyCardUseFlow.setVipId(sourceOrder.getVipId()); + moneyCardUseFlow.setTimes(-1); + moneyCardUseFlow.setType(MoneyCardUseFlow.USE_TYPE_CONSUMER); + moneyCardUseFlow.setCreateTime(new Date()); + moneyCardUseFlow.setOperationId(user.getSuId()); + moneyCardUseFlow.setBalance(moneyCardUse.getGiftMoney()+moneyCardUse.getRealMoney()); + moneyCardUseFlowDao.insert(moneyCardUseFlow); // 达到使用次数后自动清空余额 if (!moneyCardUse.getIsVipCar().equals(Dictionary.FLAG_YES_Y) @@ -810,8 +750,8 @@ if (!pageItem.getPayMethod().equals(Dictionary.PAY_TYPE_MOENY)) { // 查询要支付的充值卡 MoneyCardUse moneyCardUse = moneyCardUseDao.selectById(Long.parseLong(pageItem.getPayMethod())); - // 扣除付款卡金额并添加流水 - cardPaySk(moneyCardUse, sourceOrder, pageItem); + // 扣除付款卡金额并添加流水 TODO 补交卡支付 +// cardPaySk(moneyCardUse, sourceOrder, pageItem); sourceItem.setCardPay((sourceItem.getCardPay()==null?0:sourceItem.getCardPay())+pageItem.getPayMoney()); cardPayTotal+=pageItem.getPayMoney(); }else{ diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form-bak.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form-bak.html new file mode 100644 index 0000000..8e4fb55 --- /dev/null +++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form-bak.html @@ -0,0 +1,348 @@ + + + + +<!DOCTYPE HTML> +<html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> +<head> +<meta charset="utf-8"> +<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> +<meta name="renderer" content="webkit|ie-comp|ie-stand"> +<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> +<meta name="viewport" + content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> +<meta http-equiv="Cache-Control" content="no-siteapp" /> +<LINK rel="Bookmark" href="../images/favicon.ico"> +<!-- 本框架基本脚本和样式 --> +<script type="text/javascript" + th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> +<script type="text/javascript" + th:src="@{/js/systools/MBase.js}"></script> + +<title></title> + + +</head> + +<div class="panel-body"> + <div class="form-group"> + <label class="col-sm-2 control-label">订单号</label> + <div class="col-sm-4"> + <span class="form-control-static" th:text="${order.orderNo}"></span> + </div> + <label class="col-sm-2 control-label">订单总价</label> + <div class="col-sm-4"> + <span class="form-control-static" id="total" th:text="${order.total}"></span> + </div> + </div> + <br> + <div class="form-group"> + <label class="col-sm-2 control-label">客户编号</label> + <div class="col-sm-4"> + <span class="form-control-static" th:text="${order.vipNo}"></span> + </div> + <label class="col-sm-2 control-label">客户姓名</label> + <div class="col-sm-4"> + <span class="form-control-static" th:text="${order.vipName}"></span> + </div> + </div> + <br> + <div class="form-group"> + <label class="col-sm-2 control-label">折后价</label> + <div class="col-sm-4"> + <span class="form-control-static" id="zkTotal" th:text="${order.zkTotal}"></span> + </div> + <label class="col-sm-2 control-label">欠款</label> + <div class="col-sm-4"> + <span class="form-control-static" id="zkTotal" th:text="${order.arrears}"></span> + </div> + </div> + <br> + <div class="form-group"> + <label class="col-sm-2 control-label">卡付金额</label> + <div class="col-sm-4"> + <span class="form-control-static" id="zkTotal" th:text="${order.cardPay}"></span> + </div> + <label class="col-sm-2 control-label">现金付款</label> + <div class="col-sm-4"> + <span class="form-control-static" id="zkTotal" th:text="${order.cashPay}"></span> + </div> + </div> + <br> + <div class="form-group"> + <label class="col-sm-2 control-label">顾问姓名</label> + <div class="col-sm-4"> + <span class="form-control-static" th:text="${order.staffName}"></span> + </div> + </div> +</div> + + + + +<div class="row "> + <div class="col-sm-10 pd-20 col-sm-offset-1"> + <form class="form-horizontal" id="dataform" + onsubmit="javascripr:return false;"> + <div class="tabs-container "> + <ul class="nav nav-tabs"> + <li class="active"><a data-toggle="tab" href="#tab-1" + aria-expanded="true">收款</a></li> + <li class=""><a data-toggle="tab" href="#tab-2" + aria-expanded="false">业绩</a></li> + </ul> + <div class="tab-content"> + <div id="tab-1" class="tab-pane active"> + <div class="panel-body"> + <div class="col-sm-12 form-group"> + <!-- 改变折扣后的总价 --> + <input autocomplete="off" type="hidden" name="zkTotal" th:value="${order.zkTotal}" + id="zkTotalInput"> + <div class="panel-body"> + <table class="table table-striped table-condensed table-hover"> + <thead> + <tr> + <th>序号</th> + <th>商品名称</th> + <th>单价</th> + <th>购买数量</th> + <th>折扣单价</th> + <th>支付方式</th> + <th>支付金额</th> + </tr> + </thead> + <tbody id="tbody"> + <tr th:each="item,count:${order.items }"> + <td th:text="${count.index}+1"></td> + <td> + <span th:text=" ${item.shoppingGoods.name }"></span> + + <span th:if="${item.isFree eq '是' }" th:text="赠"></span> + </td> + <td th:text="${item.price }"></td> + <td th:text="${item.count}"></td> + <td th:text="${item.zkPrice}"></td> + + <td><input autocomplete="off" type="hidden" + th:name="'items['+${count.index}+'].id'" + th:value="${item.id }"> + + + <input autocomplete="off" type="hidden" th:name="'items['+${count.index}+'].goodsId'" + th:value="${item.goodsId }"> + <input autocomplete="off" type="hidden" th:name="'items['+${count.index}+'].count'" th:value="${item.count}"> + + <select class="form-control" + th:name="'items['+${count.index}+'].payMethod'"> + <option th:if="${item.type eq '充值卡'}" value="现金">现金</option> + <option value="现金">现金</option> + <th:block th:if="${item.type ne '充值卡'}"> + <th:block th:each="cardItem:${cards }" > + <option th:value="${cardItem.id }" th:text="${cardItem.cardName }+'-余:'+${cardItem.realMoney+cardItem.giftMoney}"></option> + </th:block> + </th:block> + + </select></td> + <td><input autocomplete="off" type="text" class="form-control" + th:onchange="'changePayMoney(\'p'+${item.id}+'\',this)'" + + onchange="reckonTotal()" dataType="price" nullmsg="请填写金额" + errormsg="金额可为两位小数的正数" th:value="${item.arrears}" + th:name="'items['+${count.index}+'].payMoney'" > + <div class="Validform_checktip"></div></td> + </tr> + </th> + </tbody> + </table> + </div> + </div> + + + + <div class="col-sm-12 form-group"> + <div class="form-group"> + <div class="form-group"> + <label class="col-sm-2 control-label">实收金额</label> + <div class="col-sm-4"> + <input autocomplete="off" type="text" class="form-control" name="actualPay" + id="money" readonly="readonly" th:value="${order.arrears}" + datatype="/^(([0-9]\d{0,9})|0)(\.\d{1,2})?$/" + ignore="ignore"> + <div class="Validform_checktip"></div> + </div> + + <label class="col-sm-2 control-label">备注</label> + <div class="col-sm-4"> + <input autocomplete="off" type="text" class="form-control" name="remark" + th:value="${order.remark}" datatype="*0-200" ignore="ignore"> + <div class="Validform_checktip"></div> + </div> + </div> + </div> + <input autocomplete="off" type="hidden" id="id" name="id" th:value="${order.id}" /> + </div> + </div> + </div> + <div id="tab-2" class="tab-pane"> + <div class="panel-body"> + <table class="table table-condensed "> + <thead> + <tr> + <th>序号</th> + <th>商品名称</th> + <th>分配金额</th> + <th>美疗师业绩</th> + <th>操作</th> + </tr> + </thead> + <tbody id="tbody2"> + <th:block th:each="item,count:${order.items }" > + <tr th:id="'p'+${item.id}"> + <td th:text="${count.index}+1"></td> + <td th:text="${item.shoppingGoods.name }"> + <span th:if="${item.isFree eq '是' }" th:text="赠"></span> + </td> + <td th:text="${item.arrears }"></td> + <td> + <table class="table table-condensed "> + <tr th:each="achaeve,count2:${item.achaeveList }"> + <td><select class="autoFull select2 input-sm" + + data-value="suId" + data-filed="suName" + th:data-def="${achaeve.staffId }" + th:name="'items['+${count.index}+'].achaeveList['+${count2.index}'].beaultId'" + th:data-url="@{/admin/getShopStaffByRoleName?roleName=美疗师}" + > + </select></td> + <td><input autocomplete="off" type="text" + class="form-control input-sm" style="width: 80px" + th:name="'items['+${count.index}+'].achaeveList['+${count2.index}'].t1"></td> + <td><button class="btn btn-danger btn-sm" + onclick="deleteBeaute(this)">删除</button></td> + </tr> + </table> + </td> + <td><a class="btn btn-default btn-sm" + th:onclick="'addBeaute(\'p'+${item.id}+'\','+${count.index}+')'">添加</a></td> + </tr> + + </tbody> + </table> + </div> + </div> + </div> + <div class="form-group mt-20 "> + <div class="col-sm-12 text-center"> + <a href="javascript:;" + onclick="myForm.submit()" class="btn btn-success radius">确认</a> + + <button onclick="MTools.closeForm()" + class="btn btn-danger radius" type="button">取消</button> + </div> + </div> + </div> + </form> + </div> +</div> + + +<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script><script type="text/javascript"> + var myForm = MForm.initForm({ + invokeUrl : basePath+"/admin/moneyCardUse/bj", + beforeSubmit : function() { + + //校验业绩 + var ifAchieveOk=true; + $("#tbody2").children("tr").each(function(){ + var tr=$(this); + var pay=parseFloat(tr.find("td").eq(2).html()); + var achieveSum=0; + tr.find("td").eq(3).find("table").find("tr").each(function(){ + var achieve= parseFloat($(this).find("td").eq(1).find("input").val()); + achieveSum+=achieve; + }); + if(achieveSum>pay){ + ifAchieveOk=false; + } + }); + if(!ifAchieveOk){ + layer.msg("业绩金额不能大于支付金额",{icon:2}) + return false; + } + + + var money = parseFloat($("#money").val()); + var total = parseFloat($("#zkTotal").html()); + }, + afterSubmit : function() { + if(parent.myGrid) { + parent.myGrid.serchData(); + } + + if (parent.app) { + parent.app.orderQuery(); + } + }, + }); + + //添加一个美疗师 + function addBeaute(trId,itemIndex){ + if(!itemIndex){ + itemIndex=0; + } + var id=MTools.randomStr(); + + var table=$("#"+trId).find("td").eq(3).find("table") + + var achieveIndex=$("#"+trId).find("td").eq(3).find("table").find("tr").length; + var html= '<tr> <td><select class="autoFull select2 input-sm" id="'+id+'" name="items['+itemIndex+'].achaeveList['+achieveIndex+'].beaultId" ' + +'data-url="'+basePath+'/admin/getShopStaffByRoleName?roleName=美疗师" data-value="suId" data-filed="suName" data-def=""' + +'name="beatuyId"> </select></td> <td><input autocomplete="off" type="text" class="form-control input-sm" style="width: 80px" name="items['+itemIndex+'].achaeveList['+achieveIndex+'].t1" ' + +'name="items['+itemIndex+'].zkPrice" ></td> <td><button class="btn btn-danger btn-sm" onclick="deleteBeaute(this)" >删除</button></td> </tr>'; + $("#"+trId).find("td").eq(3).find("table").append(html); + $('#'+id).select2({'width':'80px'}); + MTools.autoFullSelect({selecteder:'#'+id}); + }; + //删除一个美疗师 + function deleteBeaute(node){ + $(node).closest("tr").remove(); + } + + //修改收款金额 + function changePayMoney(trId,node){ + console.log(trId,node); + $("#"+trId).find("td").eq(2).html($(node).val()); + }; + + + //改变折扣单价 + function changeZkprice() { + var sum = 0; + $("#tbody").find("tr").each(function() { + var $tds = $(this).find("td"); + var count = $tds.eq(3).html(); + var zkprice = $tds.eq(4).find("input").eq(0).val(); + totalMoney = parseFloat(count) * parseFloat(zkprice); + $tds.eq(6).find("input").eq(0).val(totalMoney); + sum += totalMoney; + }); + $("#money").val(sum); + $("#zkTotal").html(sum); + $("#zkTotalInput").val(sum); + } + + //计算实收 + function reckonTotal() { + var sum = 0; + $("#tbody").find("tr").each(function() { + var $tds = $(this).find("td"); + var count = $tds.eq(6).find("input").eq(0).val(); + sum += parseFloat(count) + }); + $("#money").val(sum); + + } +</script> +</body> +</html> \ No newline at end of file diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html index 8e4fb55..07843ca 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html @@ -1,8 +1,4 @@ - - - - -<!DOCTYPE HTML> +<!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> @@ -13,336 +9,278 @@ content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <LINK rel="Bookmark" href="../images/favicon.ico"> -<!-- 本框架基本脚本和样式 --> -<script type="text/javascript" - th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> -<script type="text/javascript" - th:src="@{/js/systools/MBase.js}"></script> - + <!-- 本框架基本脚本和样式 --> + <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script> + <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}"> + <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/> <title></title> - - -</head> - -<div class="panel-body"> - <div class="form-group"> - <label class="col-sm-2 control-label">订单号</label> - <div class="col-sm-4"> - <span class="form-control-static" th:text="${order.orderNo}"></span> - </div> - <label class="col-sm-2 control-label">订单总价</label> - <div class="col-sm-4"> - <span class="form-control-static" id="total" th:text="${order.total}"></span> - </div> - </div> - <br> - <div class="form-group"> - <label class="col-sm-2 control-label">客户编号</label> - <div class="col-sm-4"> - <span class="form-control-static" th:text="${order.vipNo}"></span> - </div> - <label class="col-sm-2 control-label">客户姓名</label> - <div class="col-sm-4"> - <span class="form-control-static" th:text="${order.vipName}"></span> - </div> - </div> - <br> - <div class="form-group"> - <label class="col-sm-2 control-label">折后价</label> - <div class="col-sm-4"> - <span class="form-control-static" id="zkTotal" th:text="${order.zkTotal}"></span> - </div> - <label class="col-sm-2 control-label">欠款</label> - <div class="col-sm-4"> - <span class="form-control-static" id="zkTotal" th:text="${order.arrears}"></span> - </div> - </div> - <br> - <div class="form-group"> - <label class="col-sm-2 control-label">卡付金额</label> - <div class="col-sm-4"> - <span class="form-control-static" id="zkTotal" th:text="${order.cardPay}"></span> - </div> - <label class="col-sm-2 control-label">现金付款</label> - <div class="col-sm-4"> - <span class="form-control-static" id="zkTotal" th:text="${order.cashPay}"></span> - </div> - </div> - <br> - <div class="form-group"> - <label class="col-sm-2 control-label">顾问姓名</label> - <div class="col-sm-4"> - <span class="form-control-static" th:text="${order.staffName}"></span> - </div> - </div> -</div> - - - - -<div class="row "> - <div class="col-sm-10 pd-20 col-sm-offset-1"> - <form class="form-horizontal" id="dataform" - onsubmit="javascripr:return false;"> - <div class="tabs-container "> - <ul class="nav nav-tabs"> - <li class="active"><a data-toggle="tab" href="#tab-1" - aria-expanded="true">收款</a></li> - <li class=""><a data-toggle="tab" href="#tab-2" - aria-expanded="false">业绩</a></li> - </ul> - <div class="tab-content"> - <div id="tab-1" class="tab-pane active"> - <div class="panel-body"> - <div class="col-sm-12 form-group"> - <!-- 改变折扣后的总价 --> - <input autocomplete="off" type="hidden" name="zkTotal" th:value="${order.zkTotal}" - id="zkTotalInput"> - <div class="panel-body"> - <table class="table table-striped table-condensed table-hover"> - <thead> - <tr> - <th>序号</th> - <th>商品名称</th> - <th>单价</th> - <th>购买数量</th> - <th>折扣单价</th> - <th>支付方式</th> - <th>支付金额</th> - </tr> - </thead> - <tbody id="tbody"> - <tr th:each="item,count:${order.items }"> - <td th:text="${count.index}+1"></td> - <td> - <span th:text=" ${item.shoppingGoods.name }"></span> - - <span th:if="${item.isFree eq '是' }" th:text="赠"></span> - </td> - <td th:text="${item.price }"></td> - <td th:text="${item.count}"></td> - <td th:text="${item.zkPrice}"></td> - - <td><input autocomplete="off" type="hidden" - th:name="'items['+${count.index}+'].id'" - th:value="${item.id }"> - - - <input autocomplete="off" type="hidden" th:name="'items['+${count.index}+'].goodsId'" - th:value="${item.goodsId }"> - <input autocomplete="off" type="hidden" th:name="'items['+${count.index}+'].count'" th:value="${item.count}"> - - <select class="form-control" - th:name="'items['+${count.index}+'].payMethod'"> - <option th:if="${item.type eq '充值卡'}" value="现金">现金</option> - <option value="现金">现金</option> - <th:block th:if="${item.type ne '充值卡'}"> - <th:block th:each="cardItem:${cards }" > - <option th:value="${cardItem.id }" th:text="${cardItem.cardName }+'-余:'+${cardItem.realMoney+cardItem.giftMoney}"></option> - </th:block> - </th:block> - - </select></td> - <td><input autocomplete="off" type="text" class="form-control" - th:onchange="'changePayMoney(\'p'+${item.id}+'\',this)'" - - onchange="reckonTotal()" dataType="price" nullmsg="请填写金额" - errormsg="金额可为两位小数的正数" th:value="${item.arrears}" - th:name="'items['+${count.index}+'].payMoney'" > - <div class="Validform_checktip"></div></td> - </tr> - </th> - </tbody> - </table> - </div> - </div> - - - - <div class="col-sm-12 form-group"> - <div class="form-group"> - <div class="form-group"> - <label class="col-sm-2 control-label">实收金额</label> - <div class="col-sm-4"> - <input autocomplete="off" type="text" class="form-control" name="actualPay" - id="money" readonly="readonly" th:value="${order.arrears}" - datatype="/^(([0-9]\d{0,9})|0)(\.\d{1,2})?$/" - ignore="ignore"> - <div class="Validform_checktip"></div> - </div> - - <label class="col-sm-2 control-label">备注</label> - <div class="col-sm-4"> - <input autocomplete="off" type="text" class="form-control" name="remark" - th:value="${order.remark}" datatype="*0-200" ignore="ignore"> - <div class="Validform_checktip"></div> - </div> - </div> - </div> - <input autocomplete="off" type="hidden" id="id" name="id" th:value="${order.id}" /> - </div> - </div> - </div> - <div id="tab-2" class="tab-pane"> - <div class="panel-body"> - <table class="table table-condensed "> - <thead> - <tr> - <th>序号</th> - <th>商品名称</th> - <th>分配金额</th> - <th>美疗师业绩</th> - <th>操作</th> - </tr> - </thead> - <tbody id="tbody2"> - <th:block th:each="item,count:${order.items }" > - <tr th:id="'p'+${item.id}"> - <td th:text="${count.index}+1"></td> - <td th:text="${item.shoppingGoods.name }"> - <span th:if="${item.isFree eq '是' }" th:text="赠"></span> - </td> - <td th:text="${item.arrears }"></td> - <td> - <table class="table table-condensed "> - <tr th:each="achaeve,count2:${item.achaeveList }"> - <td><select class="autoFull select2 input-sm" - - data-value="suId" - data-filed="suName" - th:data-def="${achaeve.staffId }" - th:name="'items['+${count.index}+'].achaeveList['+${count2.index}'].beaultId'" - th:data-url="@{/admin/getShopStaffByRoleName?roleName=美疗师}" - > - </select></td> - <td><input autocomplete="off" type="text" - class="form-control input-sm" style="width: 80px" - th:name="'items['+${count.index}+'].achaeveList['+${count2.index}'].t1"></td> - <td><button class="btn btn-danger btn-sm" - onclick="deleteBeaute(this)">删除</button></td> - </tr> - </table> - </td> - <td><a class="btn btn-default btn-sm" - th:onclick="'addBeaute(\'p'+${item.id}+'\','+${count.index}+')'">添加</a></td> - </tr> - - </tbody> - </table> - </div> - </div> - </div> - <div class="form-group mt-20 "> - <div class="col-sm-12 text-center"> - <a href="javascript:;" - onclick="myForm.submit()" class="btn btn-success radius">确认</a> - - <button onclick="MTools.closeForm()" - class="btn btn-danger radius" type="button">取消</button> - </div> - </div> - </div> - </form> - </div> -</div> - - -<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script><script type="text/javascript"> - var myForm = MForm.initForm({ - invokeUrl : basePath+"/admin/moneyCardUse/bj", - beforeSubmit : function() { - - //校验业绩 - var ifAchieveOk=true; - $("#tbody2").children("tr").each(function(){ - var tr=$(this); - var pay=parseFloat(tr.find("td").eq(2).html()); - var achieveSum=0; - tr.find("td").eq(3).find("table").find("tr").each(function(){ - var achieve= parseFloat($(this).find("td").eq(1).find("input").val()); - achieveSum+=achieve; - }); - if(achieveSum>pay){ - ifAchieveOk=false; - } - }); - if(!ifAchieveOk){ - layer.msg("业绩金额不能大于支付金额",{icon:2}) - return false; - } - - - var money = parseFloat($("#money").val()); - var total = parseFloat($("#zkTotal").html()); - }, - afterSubmit : function() { - if(parent.myGrid) { - parent.myGrid.serchData(); - } - - if (parent.app) { - parent.app.orderQuery(); - } - }, - }); - - //添加一个美疗师 - function addBeaute(trId,itemIndex){ - if(!itemIndex){ - itemIndex=0; + <style> + .paymethod ul { + padding: 0; + margin: 0; + height: 50px; } - var id=MTools.randomStr(); + .paymethod ul li { + padding: 10px; + margin: 5px; + list-style:none; + float: left; + display: block; + cursor: pointer; + position: relative; + border: white 1px solid; + } + .paymethod ul li:hover { + border: #409EFF 1px solid; + } + .paymethod .active { + border: #409EFF 1px solid; + } + .paymethod .active::after { + content: ''; + display: block; + height: 0px; + width: 0px; + position: absolute; + bottom: 0; + right: 0; + color:#fff; + /**对号大小*/ + font-size: 10px; + line-height: 8px; + border: 3px solid; + border-color: transparent #4884ff #4884ff transparent; + } - var table=$("#"+trId).find("td").eq(3).find("table") + .el-dialog__body { + padding-top: 10px !important; + } + </style> +</head> +<div class="panel-body" id="app"> + <el-dialog title="还款" :visible.sync="dialogSettleVisible" show-close> + <el-row type="flex" align="middle" style="padding: 0 0 10px 0;"> + <el-col :span="5" style="text-align: center;">还款金额</el-col> + <el-col :span="10" style="text-align: center; line-height: 50px;"><span style="color: red; font-size: 20px;">¥ {{order.arrears}}</span></el-col> + </el-row> - var achieveIndex=$("#"+trId).find("td").eq(3).find("table").find("tr").length; - var html= '<tr> <td><select class="autoFull select2 input-sm" id="'+id+'" name="items['+itemIndex+'].achaeveList['+achieveIndex+'].beaultId" ' - +'data-url="'+basePath+'/admin/getShopStaffByRoleName?roleName=美疗师" data-value="suId" data-filed="suName" data-def=""' - +'name="beatuyId"> </select></td> <td><input autocomplete="off" type="text" class="form-control input-sm" style="width: 80px" name="items['+itemIndex+'].achaeveList['+achieveIndex+'].t1" ' - +'name="items['+itemIndex+'].zkPrice" ></td> <td><button class="btn btn-danger btn-sm" onclick="deleteBeaute(this)" >删除</button></td> </tr>'; - $("#"+trId).find("td").eq(3).find("table").append(html); - $('#'+id).select2({'width':'80px'}); - MTools.autoFullSelect({selecteder:'#'+id}); - }; - //删除一个美疗师 - function deleteBeaute(node){ - $(node).closest("tr").remove(); - } - - //修改收款金额 - function changePayMoney(trId,node){ - console.log(trId,node); - $("#"+trId).find("td").eq(2).html($(node).val()); - }; + <el-row type="flex" align="middle" style="padding: 10px 0;"> + <el-col :span="5" style="text-align: center;">收款方式</el-col> + <el-col class="paymethod" :span="15"> + <el-row> + <ul> + <span v-for="(item, index) in payMethods"> + <el-popover + :disabled="item.type != '储值卡'" + placement="bottom" + trigger="hover" + @hide="popoverHide(item)"> + <el-row style="text-align: center;"><span style="padding: 0 0 10px 0; display: block; font-size: 12px;">选择储值卡支付方式</span></el-row> + <el-tree :data="moneyCards" + show-checkbox + default-expand-all + node-key="id" + ref="tree" + check-strictly + highlight-current + @check="(click, checked,$item)=>{handleCheckChange(click, checked,$item)}" + :props="defaultProps"> + </el-tree> + <li :class="{active : item.isActive}" v-if="item.value != '欠款'" slot="reference" @click="payMethodSelect(item, index)">{{item.value}}</li> + </el-popover> + </span> + </ul> + </el-row> + </el-col> + </el-row> - - //改变折扣单价 - function changeZkprice() { - var sum = 0; - $("#tbody").find("tr").each(function() { - var $tds = $(this).find("td"); - var count = $tds.eq(3).html(); - var zkprice = $tds.eq(4).find("input").eq(0).val(); - totalMoney = parseFloat(count) * parseFloat(zkprice); - $tds.eq(6).find("input").eq(0).val(totalMoney); - sum += totalMoney; - }); - $("#money").val(sum); - $("#zkTotal").html(sum); - $("#zkTotalInput").val(sum); - } + <el-row type="flex" align="middle" style="padding: 10px 0 50px 0;"> + <el-col :span="5" style="text-align: center;">支付金额</el-col> + <el-col :span="15"> + <el-row style="line-height: 50px;" v-for="(item, index) in payMoneys"> + <el-col :span="6" style="text-align: right; padding-right: 10px; font-size: 12px;">{{item.value}}</el-col> + <el-col :span="8"><el-input v-model.number="item.money"></el-input></el-col> + <el-col :span="6" style="margin-left: 10px;" v-if="item.type == '储值卡'">{{item.isGift == 1 ? '赠送余额' : '余额' }}:<span class="arrears">¥ {{item.balance}}</span></el-col> + </el-row> + </el-col> + </el-row> - //计算实收 - function reckonTotal() { - var sum = 0; - $("#tbody").find("tr").each(function() { - var $tds = $(this).find("td"); - var count = $tds.eq(6).find("input").eq(0).val(); - sum += parseFloat(count) - }); - $("#money").val(sum); + <el-row style="text-align: center; margin: 20px 0 10px 0"> + <el-checkbox v-model="printPaper">打印小票</el-checkbox> + </el-row> - } + <el-row style="text-align: center; margin: 10px 0 0 0"> + <el-button type="primary" @click="">确认收款</el-button> + </el-row> + </el-dialog> +</div> + +<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> +<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script> +<script type="text/javascript" th:src="@{/plugin/layer/layer.js}"></script> +<script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script> +<script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script> +<script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script> +<script type="text/javascript" th:inline="javascript"> + //<![CDATA[ + var vue = new Vue({ + el: '#app', + data : { + order : "", + payMethods: [{ + value: '现金支付', + isActive: false, + type: '现金支付' + }, { + value: '微信', + isActive: false, + type: '微信' + }, { + value: '支付宝', + isActive: false, + type: '支付宝' + }, { + value: '银行卡', + isActive: false, + type: '银行卡' + }, { + value: '团购', + isActive: false, + type: '团购' + }, { + value: '储值卡', + isActive: false, + type: '储值卡' + }, { + value: '欠款', + isActive: false, + type: '欠款' + },], + moneyCards : [], + dialogSettleVisible : true, + defaultProps: { + children: 'children', + label: 'showLable' + }, + treeSelect : [], + payMoneys : [], + printPaper : true, + }, + created : function() { + this.order = /*[[${order}]]*/ + this.getVipMoneyCards(); + + console.log(this.order) + }, + methods : { + getVipMoneyCards() { + let _this = this; + if (_this.order.vipId) { + AjaxProxy.requst({ + app: _this, + data: {vipId: _this.order.vipId}, + contentType: 'application/x-www-form-urlencoded', + url: basePath + '/admin/moneyCardUse/getUseMoneyCard', + callback: function (data) { + if (data.rows.length > 0) { + data.rows.forEach(function (item, index, input) { + item.showLable = item.cardName + "-余额:" + (item.realMoney) + item.uuid = MTools.uuid(); + if (item.giftMoney != 0) { + var children = []; + var gift = {}; + gift.id = item.id; + gift.giftMoney = item.giftMoney; + gift.showLable = item.cardName + '-赠送金额' + item.giftMoney; + gift.cardName = item.cardName; + gift.isGift = 1; + gift.uuid = MTools.uuid(); + children.push(gift); + item.children = children; + } + }); + _this.moneyCards = data.rows; + } + + } + }); + } + }, + payMethodSelect(item, index) { + let _this = this; + let payMoneys = _this.payMoneys; + if (item.type != '储值卡') { + this.$nextTick(function () { + if (item.isActive) { + Vue.set(item,'isActive',false); + var index = -1; + for (var i = 0; i < payMoneys.length; i++) { + let payMoney = payMoneys[i]; + if (payMoney.value == item.value) { + index = i; + break; + } + } + + if (index > -1) { + _this.payMoneys.splice(index, 1) + } + } else { + Vue.set(item,'isActive',true); + _this.payMoneys.push(item); + } + }); + } + }, + popoverHide(item) { + if(this.treeSelect.length <= 0) { + Vue.set(item, 'isActive', false) + } else { + Vue.set(item, 'isActive', true) + } + }, + handleCheckChange(clickNode, checked) { + let _this = this; + + let nodes = checked.checkedNodes; + _this.treeSelect = nodes; + var index = -1; + // 判断点击节点是否在已展示支付方式中 + for(var i = 0; i < _this.payMoneys.length; i++) { + let node = _this.payMoneys[i]; + if (node.uuid === clickNode.uuid) { + index = i; + break; + } + } + + // 若点击节点在选中节点中,且已展示支付方式不存在,则添加 + if (nodes.indexOf(clickNode) > -1 && index === -1) { + var node = clickNode; + var item = {}; + if (node.isGift) { + item.value = node.cardName; + item.balance = node.giftMoney; + item.isGift = 'Y'; + } else { + item.value = node.cardName; + item.balance = node.realMoney; + item.isGift = 'N'; + } + item.type = '储值卡'; + item.id = node.id; + item.uuid = clickNode.uuid; + _this.payMoneys.push(item); + } + + // 若点击节点不存在选中节点中,且已展示支付方式中存在,则移除 + if (nodes.indexOf(clickNode) === -1 && index > -1) { + _this.payMoneys.splice(index, 1); + } + }, + } + }); + //]]> </script> </body> </html> \ No newline at end of file diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html index 48a3070..351359d 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html @@ -320,9 +320,9 @@ <!-- <el-table-column--> -<!-- label="会员卡">--> +<!-- label="储值卡">--> <!-- <template slot-scope="scope">--> -<!-- <el-select :disabled="scope.row.payMethod!='会员卡'" v-model="scope.row.payMethodDetail"--> +<!-- <el-select :disabled="scope.row.payMethod!='储值卡'" v-model="scope.row.payMethodDetail"--> <!-- placeholder="请选择支付卡">--> <!-- <el-option--> <!-- v-for="item in moneyCards"--> @@ -354,7 +354,7 @@ <li>订单总金额:{{order.total}}</li> - <li>整单折扣:<span class="arrears">{{order.total - order.zkTotal}}</span></li> + <li>整单折扣:<span class="arrears" v-if="order.zkTotal != null">{{order.total - order.zkTotal}}</span></li> <!-- <li v-if="order.arrears>0">订单欠款:<span class="arrears">{{order.arrears}}</span></li>--> <!-- <li v-if="order.arrears<0">找零:<span class="arrears">{{order.arrears}}</span></li>--> </ul> @@ -370,7 +370,7 @@ <el-button type="primary" @click="print()">打印</el-button> <el-button type="primary" @click="drawer = true">业绩设置</el-button> <!-- <el-button type="success" @click="confirmSubmit()" class="bigbtn"> 结算</el-button>--> - <el-button type="success" @click="dialogSettleVisible = true" class="bigbtn">收款</el-button> + <el-button type="success" @click="openPayMoney" class="bigbtn">收款 ¥{{order.payMoney}}</el-button> </el-col> </el-row> @@ -467,11 +467,11 @@ <ul> <span v-for="(item, index) in payMethods"> <el-popover - :disabled="item.type != '会员卡'" + :disabled="item.type != '储值卡'" placement="bottom" trigger="hover" @hide="popoverHide(item)"> - <el-row style="text-align: center;"><span style="padding: 0 0 10px 0; display: block; font-size: 12px;">选择会员卡支付方式</span></el-row> + <el-row style="text-align: center;"><span style="padding: 0 0 10px 0; display: block; font-size: 12px;">选择储值卡支付方式</span></el-row> <el-tree :data="moneyCards" show-checkbox default-expand-all @@ -496,17 +496,17 @@ <el-row style="line-height: 50px;" v-for="(item, index) in payMoneys"> <el-col :span="6" style="text-align: right; padding-right: 10px; font-size: 12px;">{{item.value}}</el-col> <el-col :span="8"><el-input v-model.number="item.money"></el-input></el-col> - <el-col :span="6" style="margin-left: 10px;" v-if="item.type == '会员卡'">{{item.isGift == 1 ? '赠送余额' : '余额' }}:<span class="arrears">¥ {{item.balance}}</span></el-col> + <el-col :span="6" style="margin-left: 10px;" v-if="item.type == '储值卡'">{{item.isGift == 1 ? '赠送余额' : '余额' }}:<span class="arrears">¥ {{item.balance}}</span></el-col> </el-row> </el-col> </el-row> <el-row style="text-align: center; margin: 20px 0 10px 0"> - <el-checkbox>打印小票</el-checkbox> + <el-checkbox v-model="printPaper">打印小票</el-checkbox> </el-row> <el-row style="text-align: center; margin: 10px 0 0 0"> - <el-button type="primary" @click="submitPay">确认收款</el-button> + <el-button type="primary" @click="confirmSubmit">确认收款</el-button> </el-row> </el-dialog> @@ -574,9 +574,9 @@ isActive: false, type: '团购' }, { - value: '会员卡', + value: '储值卡', isActive: false, - type: '会员卡' + type: '储值卡' }, { value: '欠款', isActive: false, @@ -602,13 +602,14 @@ loading: false, /******搜索表格数据END********/ - dialogSettleVisible : true, + dialogSettleVisible : false, defaultProps: { children: 'children', label: 'showLable' }, treeSelect : [], - payMoneys : [] + payMoneys : [], + printPaper : true, }, @@ -697,7 +698,7 @@ changePayMethod(item) { console.log("changePayMethod", item); - if (item.payMethod != '会员卡') { + if (item.payMethod != '储值卡') { item.payMethodDetail = ''; } }, @@ -868,39 +869,38 @@ */ submitOrder(submitType) { - - - if (this.checkSubmitOrder()) { let _this = this; - - //检查支付方式 - // let hasPayMethod=true; - // _this.order.items.forEach(item=>{ - // if(!item.payMethod){ - // hasPayMethod=false; - // return; - // } - // }); - // if(!hasPayMethod){ - // this.$message.warning("请选择支付方式"); - // return false; - // } - - let flows = [] - _this.payMoneys.forEach(item=>{ - let flow = {}; - flow.payMethod = item.type; - flow.amount = item.money; - if (item.type == 6) { - flow.isGift = item.isGift; - flow.cardId = item.id; + if(submitType == 1) { + if (_this.payMoneys.length > 0) { + let flows = [] + var total = 0; + _this.payMoneys.forEach(item => { + let flow = {}; + flow.payMethod = item.type; + if (!item.money) { + this.$message.warning("请输入" + item.type + "的付款金额"); + return false; + } + flow.amount = item.money; + if (item.type == '储值卡'){ + flow.isGift = item.isGift; + flow.cardId = item.id; + } + total += item.money; + flows.push(flow) + }) + if (total != _this.order.payMoney) { + this.$message.warning("输入付款总金额与应付金额不符"); + return false; + } + _this.order.flows = flows; + } else { + this.$message.warning("请选择支付方式"); + return false; } - flows.push(flow) - }) - _this.order.flows = flows; - + } //匹配业绩 _this.achieveList.forEach(achieve => { @@ -937,16 +937,20 @@ _this.order.orderNo = order.orderNo; //结算打印提示 if (submitType == 1) { - _this.$confirm('结算成功,是否立刻打印小票?', '提示', { - confirmButtonText: '打印', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { + if (_this.printPaper) { _this.print(); - - }).catch(() => { - _this.closeFram(); - }); + } + _this.closeFram(); + // _this.$confirm('结算成功,是否立刻打印小票?', '提示', { + // confirmButtonText: '打印', + // cancelButtonText: '取消', + // type: 'warning' + // }).then(() => { + // _this.print(); + // + // }).catch(() => { + // _this.closeFram(); + // }); } else { _this.$message.success(data.info); } @@ -969,7 +973,7 @@ */ checkAchieve() { /* - //TODO 前端展示不检测,因为考虑到会员卡支付问题 + //TODO 前端展示不检测,因为考虑到储值卡支付问题 let _this = this; for (let i = 0; i < _this.order.items.length; i++) { if (_this.achieveList.length > 0) { @@ -1008,10 +1012,10 @@ this.$message.warning("折扣单价填写不正确"); return false; } - if (!(MTools.isRealNum(item.payMoney) && item.payMoney >= 0)) { - this.$message.warning("实付金额填写不正确"); - return false; - } + // if (!(MTools.isRealNum(item.payMoney) && item.payMoney >= 0)) { + // this.$message.warning("实付金额填写不正确"); + // return false; + // } }) } else { this.$message.warning("请选择要购买的产品"); @@ -1051,6 +1055,9 @@ } }); this.achieveList = achieveListNew; + this.order.zkTotal = 0; + this.order.total = 0; + this.order.payMoney = 0; this.calculationTotal(); }, @@ -1155,7 +1162,7 @@ payMethodSelect(item, index) { let _this = this; let payMoneys = _this.payMoneys; - if (item.type != 6) { + if (item.type != '储值卡') { this.$nextTick(function () { if (item.isActive) { Vue.set(item,'isActive',false); @@ -1207,13 +1214,13 @@ if (node.isGift) { item.value = node.cardName; item.balance = node.giftMoney; - item.isGift = 1; + item.isGift = 'Y'; } else { item.value = node.cardName; item.balance = node.realMoney; - item.isGift = 0; + item.isGift = 'N'; } - item.type = '会员卡'; + item.type = '储值卡'; item.id = node.id; item.uuid = clickNode.uuid; _this.payMoneys.push(item); @@ -1224,7 +1231,14 @@ _this.payMoneys.splice(index, 1); } }, - submitPay() { + openPayMoney() { + let _this = this; + if (!_this.order.items.length > 0) { + this.$message.warning("请选择要购买的产品"); + return false; + } + + _this.dialogSettleVisible = true; } } -- Gitblit v1.9.1