From 0a67d6a24417507a27e03d53da82bbd802257148 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Tue, 19 Jan 2021 02:20:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/api' into api

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html            |  565 +++++++++++++++++---------
 zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java           |   10 
 zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-sale-list.html     |   16 
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html                |    1 
 zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java                  |   15 
 zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml                          |   27 +
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form-bak.html        |  239 +++++++++++
 zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java                  |    6 
 zq-erp/src/main/java/com/matrix/system/hive/statistics/DailySaleVo.java                  |   10 
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html          |   17 
 zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java                       |    2 
 zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-sale-list.html |  157 +++++++
 zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java                   |    1 
 zq-erp/src/main/java/com/matrix/system/hive/pojo/CzXkVo.java                             |   14 
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java         |   13 
 zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml                     |   17 
 zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml                            |    2 
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html            |    7 
 zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java                     |   31 +
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html       |    7 
 zq-erp/src/main/java/com/matrix/system/hive/statistics/SysBusinessDataAction.java        |   28 +
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html         |   24 +
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html   |    2 
 23 files changed, 949 insertions(+), 262 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
index 5c5735f..dfd5149 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiCommonAction.java
@@ -47,6 +47,7 @@
  * @author wzy
  * @date 2020-12-21
  **/
+@CrossOrigin(origins = "*")
 @Api(value = "CommonAction", tags = "手机端公共请求类(含登陆)")
 @RestController
 @RequestMapping(value = "/api/common")
diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java
index 5a4b4fe..f3d4d1f 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiRankingAction.java
@@ -59,18 +59,15 @@
     @PostMapping(value = "/findShopAchieveRanking")
     public AjaxResult findShopAchieveRanking(@RequestBody RankingDto rankingDto) {
         AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("");
+        AchieveNew achieveNew = new AchieveNew();
+        QueryUtil.setQueryLimitCom(achieveNew);
+        achieveNew.setT1(rankingDto.getType());
+        achieveNew.setDatatime(new Date());
+
         if (RankingDto.SALE.equals(rankingDto.getDataType())) {
-            AchieveNew achieveNew = new AchieveNew();
-            QueryUtil.setQueryLimitCom(achieveNew);
-            achieveNew.setType(rankingDto.getType());
-            achieveNew.setDatatime(new Date());
-            List<RankingVo> list = achieveNewDao.selectShopConsumeAchieveRanking(achieveNew);
+            List<RankingVo> list = achieveNewDao.selectShopSaleAchieveRanking(achieveNew);
             ajaxResult.setRows(list);
         } else {
-            AchieveNew achieveNew = new AchieveNew();
-            QueryUtil.setQueryLimitCom(achieveNew);
-            achieveNew.setDatatime(new Date());
-            achieveNew.setT1(rankingDto.getType());
             List<RankingVo> rankingVos = achieveNewDao.selectShopConsumeAchieveRanking(achieveNew);
             ajaxResult.setRows(rankingVos);
         }
diff --git a/zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java b/zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java
index d392636..a6a05e7 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/vo/VipAchieveDataShowVo.java
@@ -21,10 +21,10 @@
     @ApiModelProperty(value = "现金业绩")
     private BigDecimal cashAmount;
 
-    @ApiModelProperty(value = "售卡业绩")
+    @ApiModelProperty(hidden = true)
     private BigDecimal cardAmount;
 
-    @ApiModelProperty(value = "产品业绩")
+    @ApiModelProperty(value = "订单提成")
     private BigDecimal goodsAmount;
 
     @ApiModelProperty(value = "划扣业绩")
@@ -36,7 +36,7 @@
     @ApiModelProperty(value = "赠送消耗")
     private BigDecimal freeConsume;
 
-    @ApiModelProperty(value = "提成")
+    @ApiModelProperty(value = "服务提成")
     private BigDecimal commission;
 
     @ApiModelProperty(value = "人头数")
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 75a6e73..6db943c 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
@@ -61,14 +61,12 @@
      * @author jyy
      */
     @RequestMapping(value = "/editFormCz")
-    public String editFormCz() {
-        SysVipInfo info =
-                (SysVipInfo) WebUtil.getSession().getAttribute(SystemConstance.CURRENT_CUSTOMER);
-        MoneyCardUse cardUseInfo = cardUseService.findByVipId(info.getId());
+    public String editFormCz(Long id) {
+        MoneyCardUse cardUseInfo = cardUseService.findByVipId(id);
 
         if (cardUseInfo == null) {
             cardUseInfo = new MoneyCardUse();
-            cardUseInfo.setVipId(info.getId());
+            cardUseInfo.setVipId(id);
             cardUseInfo.setCardName("储值卡");
             cardUseInfo.setIsVipCar(Dictionary.FLAG_YES_Y);
             cardUseInfo.setRealMoney(0D);
@@ -90,7 +88,7 @@
      */
     @RequestMapping(value = "/cz")
     public @ResponseBody
-    AjaxResult cz(CzXkVo czVo) {
+    AjaxResult cz(@RequestBody CzXkVo czVo) {
         SysOrder order=  orderService.updateAddCardMoney(czVo);
         AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "充值成功");
         result.putInMap("orderId",order.getId());
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
index 90d9a2e..46ee09f 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/AchieveNewDao.java
@@ -66,6 +66,8 @@
 
 	List<RankingVo> selectShopConsumeAchieveRanking(@Param("record") AchieveNew achieveNew);
 
+	List<RankingVo> selectShopSaleAchieveRanking(@Param("record") AchieveNew achieveNew);
+
 	List<RankingVo> selectBeauticianConsumeAchieveRanking(@Param("record") AchieveNew achieveNew);
 
 	List<AchieveNew> selectOrderItemAchieveByOrderId(Long orderId);
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/pojo/CzXkVo.java b/zq-erp/src/main/java/com/matrix/system/hive/pojo/CzXkVo.java
index b071654..66abb3a 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/pojo/CzXkVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/pojo/CzXkVo.java
@@ -1,6 +1,7 @@
 package com.matrix.system.hive.pojo;
 
 import com.matrix.system.hive.bean.AchieveNew;
+import com.matrix.system.hive.bean.SysOrderFlow;
 
 import java.util.List;
 
@@ -17,8 +18,17 @@
 	private Long staffId;
 	private Long vipId;
 	private List<AchieveNew> achaeveList;
-	
-	 
+
+	private List<SysOrderFlow> flows;
+
+	public List<SysOrderFlow> getFlows() {
+		return flows;
+	}
+
+	public void setFlows(List<SysOrderFlow> flows) {
+		this.flows = flows;
+	}
+
 	public Long getCardId() {
 		return cardId;
 	}
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 8bd6280..9cfcdec 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
@@ -1135,11 +1135,11 @@
     public SysOrder updateAddCardMoney(CzXkVo czVo) {
         SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY);
 
-        SysVipInfo vip = (SysVipInfo) WebUtil.getSession().getAttribute(SystemConstance.CURRENT_CUSTOMER);
-        czVo.setVipId(vip.getId());
+//        SysVipInfo vip = (SysVipInfo) WebUtil.getSession().getAttribute(SystemConstance.CURRENT_CUSTOMER);
+//        czVo.setVipId(vip.getId());
 
         //更新会员会员卡金额
-        MoneyCardUse cardUser = moneyCardUseDao.selectVipCard(vip.getId());
+        MoneyCardUse cardUser = moneyCardUseDao.selectVipCard(czVo.getVipId());
         cardUser.setRealMoney(MoneyUtil.add(cardUser.getRealMoney(), czVo.getBjmoney()));
         cardUser.setGiftMoney(MoneyUtil.add(cardUser.getGiftMoney(), czVo.getGiftMoney()));
         moneyCardUseDao.update(cardUser);
@@ -1170,6 +1170,7 @@
         order.setStaffId(user.getSuId());
         order.setIsCross(2 + "");
         order.setStatu(Dictionary.ORDER_STATU_YFK);
+        order.setCompanyId(user.getCompanyId());
         sysOrderDao.insert(order);
 
         SysOrderItem orderItem = new SysOrderItem();
@@ -1189,6 +1190,9 @@
         orderItem.setStatus(Dictionary.ORDER_STATU_YFK);
         orderItem.setAchaeveList(czVo.getAchaeveList());
         orderItemDao.insert(orderItem);
+        List<SysOrderItem> items = new ArrayList<>();
+        items.add(orderItem);
+        order.setItems(items);
 
 
         //设置卡项使用流水
@@ -1204,7 +1208,8 @@
         moneyCardUseFlow.setBalance(cardUser.getGiftMoney()+cardUser.getRealMoney());
         moneyCardUseFlowDao.insert(moneyCardUseFlow);
 
-
+        order.setFlows(czVo.getFlows());
+        changeOrderStatu(order);
         // 添加员工业绩
         achieveNewService.addAchaeveByOrder(order);
         return order;
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/DailySaleVo.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/DailySaleVo.java
index 743bd33..dabb87f 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/DailySaleVo.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/DailySaleVo.java
@@ -18,6 +18,8 @@
 
     private String shopName;
 
+    private BigDecimal shouldPay;
+
     private BigDecimal totalPay;
 
     private BigDecimal cashPay;
@@ -100,6 +102,14 @@
 
     private Long shopId;
 
+    public BigDecimal getShouldPay() {
+        return shouldPay;
+    }
+
+    public void setShouldPay(BigDecimal shouldPay) {
+        this.shouldPay = shouldPay;
+    }
+
     public BigDecimal getWechat() {
         return wechat;
     }
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/statistics/SysBusinessDataAction.java b/zq-erp/src/main/java/com/matrix/system/hive/statistics/SysBusinessDataAction.java
index 0b2fa69..14b05f9 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/statistics/SysBusinessDataAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/statistics/SysBusinessDataAction.java
@@ -60,22 +60,46 @@
     @RequestMapping(value = "/findDailySaleData")
     @ResponseBody
     public AjaxResult findDailySaleData(DailySaleVo dailySaleVo, PaginationVO pageVo) {
-
+        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
         Calendar calendar = Calendar.getInstance();
+        int total = 999;
+
+        Date endDate = new Date();
+        if (dailySaleVo.getEndTime() != null) {
+            if (!dailySaleVo.getEndTime().after(new Date())) {
+                calendar.setTime(dailySaleVo.getEndTime());
+                endDate = DateUtil.nextNDate(dailySaleVo.getEndTime(), 1);
+            }
+        }
+
+        calendar.add(Calendar.DATE, 1);
         calendar.add(Calendar.DATE, -pageVo.getOffset());
         String endTime = DateUtil.dateToString(calendar.getTime(), DateUtil.DATE_FORMAT_DD);
         calendar.add(Calendar.DATE, -pageVo.getLimit());
         String startTime = DateUtil.dateToString(calendar.getTime(), DateUtil.DATE_FORMAT_DD);
+
+        if (dailySaleVo.getBeginTime() != null) {
+            Date startDate = DateUtil.stringToDate(startTime, DateUtil.DATE_FORMAT_DD);
+            if(dailySaleVo.getBeginTime().after(startDate)) {
+                startTime = DateUtil.dateFormatStr(dailySaleVo.getBeginTime(), DateUtil.DATE_FORMAT_DD);
+            }
+            long sub = DateUtil.getTimeSpan(dailySaleVo.getBeginTime(), endDate, null);
+            Long l = sub / (1000 * 3600 * 24);
+            total = l.intValue();
+        }
         List<Date> xAxis = StatisticsTimeUtil.getTimeSpace(startTime, endTime, "日");
         List<StatisticsTimeDaoParam> timeSpaceParam = StatisticsTimeUtil.buidParam(xAxis);
         List<StatisticsTimeDaoParam> statisticsTimeDaoParams = timeSpaceParam.subList(0, timeSpaceParam.size() - 2);
 
+        if (dailySaleVo.getShopId() == null) {
+            dailySaleVo.setShopId(user.getShopId());
+        }
         List<DailySaleVo> dailySaleVos = sysBusinessDataDao.selectDailySaleData(statisticsTimeDaoParams, dailySaleVo.getShopId());
         List<DailySaleVo> result = new ArrayList<>();
         for (int i = dailySaleVos.size() - 1; i >= 0; i--) {
             result.add(dailySaleVos.get(i));
         }
-        return AjaxResult.buildSuccessInstance(result);
+        return AjaxResult.buildSuccessInstance(result, total);
     }
 
 }
\ No newline at end of file
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
index 1aeb371..88aab2e 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java
@@ -9,9 +9,7 @@
 import com.matrix.system.common.dao.BusParameterSettingsDao;
 import com.matrix.system.constance.Dictionary;
 import com.matrix.system.hive.bean.*;
-import com.matrix.system.hive.dao.SysOrderDao;
-import com.matrix.system.hive.dao.SysOrderItemDao;
-import com.matrix.system.hive.dao.SysVipInfoDao;
+import com.matrix.system.hive.dao.*;
 import com.matrix.system.hive.service.CodeService;
 import com.matrix.system.hive.service.ShoppingGoodsService;
 import com.matrix.system.hive.service.SysOrderService;
@@ -24,6 +22,7 @@
 import com.rabbitmq.client.DeliverCallback;
 import com.rabbitmq.client.Delivery;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
@@ -34,6 +33,7 @@
 /**
  * 微商城订单同步到erp系统
  */
+@Component
 public class OrderTask implements DeliverCallback {
 
 
@@ -73,6 +73,12 @@
     @Autowired
     BusParameterSettingsDao parameterSettingsDao;
 
+    @Autowired
+    private SysOrderFlowDao sysOrderFlowDao;
+
+    @Autowired
+    private ShoppingGoodsDao shoppingGoodsDao;
+
     @Transactional(rollbackFor = Exception.class)
     public void createOrder(ShopOrder orderDto) {
 
@@ -86,7 +92,7 @@
         }
 
         //获取订单归属门店
-        order.setCompanyId(bizUser.getCompanyId());
+        order.setCompanyId(vipInfo.getCompanyId());
         order.setShopId(Long.parseLong(orderDto.getStoreId()+""));
         //同步的订单订单编号保持一致
         order.setOrderNo(orderDto.getOrderNo());
@@ -100,6 +106,7 @@
         order.setCashPay(orderDto.getOrderMoney().doubleValue());
         order.setTotal(orderDto.getOrderMoney().doubleValue());
         order.setZkTotal(orderDto.getOrderMoney().doubleValue());
+        order.setPayTime(new Date());
         order.setArrears(0);
         int i = sysOrderDao.insert(order);
         // 创建订单明细,并计算总价与折扣总价
@@ -188,13 +195,21 @@
         orderService.setShopSelCount(sourceOrder);
 
         SysOrderFlow flow = new SysOrderFlow();
+        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);
+
         flow.setAmount(orderDto.getOrderMoney());
         flow.setPayMethod("微信");
 
-        List<SysOrderFlow> flows = new ArrayList<>();
-        flows.add(flow);
-        sourceOrder.setFlows(flows);
-        orderService.updateAfterMoney(sourceOrder);
+        flow.setShopId(sourceOrder.getShopId());
+        flow.setCompanyId(sourceOrder.getCompanyId());
+        sysOrderFlowDao.insert(flow);
 
     }
 
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
index d6f90e1..48bb959 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/AchieveNewDao.xml
@@ -964,7 +964,7 @@
 		select
 			b.shop_short_name name,
 			b.SHOP_IMAG photo,
-			sum(IFNULL(a.free_consume,0) + IFNULL(a.consume,0) + IFNULL(a.his_consume,0)) amount
+			sum(IFNULL(a.free_consume,0) + IFNULL(a.his_consume,0)) amount
 		from achieve_new a
 		left join sys_shop_info b on a.shop_id=b.ID
 		<where>
@@ -1060,4 +1060,29 @@
 		group by b.su_id
 		order by amount desc, b.su_id
 	</select>
+
+	<select id="selectShopSaleAchieveRanking" resultType="com.matrix.system.app.vo.RankingVo">
+		select
+			b.shop_short_name name,
+			b.SHOP_IMAG photo,
+			sum(IFNULL(a.consume,0) + IFNULL(a.card_cash,0)) amount
+		from achieve_new a
+		left join sys_shop_info b on a.shop_id=b.ID
+		<where>
+			<if test="record.companyId != null">
+				and a.company_id=#{record.companyId}
+			</if>
+			<if test='record.t1 == "1" and record.datatime != null'>
+				and date_format(datatime, '%Y-%m-%d') = date_format(#{record.datatime}, '%Y-%m-%d')
+			</if>
+			<if test='record.t1 == "2" and record.datatime != null'>
+				and date_format(datatime, '%Y-%m') = date_format(#{record.datatime}, '%Y-%m')
+			</if>
+			<if test='record.t1 == "3" and record.datatime != null'>
+				and date_format(datatime, '%Y') = date_format(#{record.datatime}, '%Y')
+			</if>
+		</where>
+		group by a.shop_id
+		order by amount desc, a.shop_id
+	</select>
 </mapper>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
index 3be128f..a857e67 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysBusinessDataDao.xml
@@ -804,11 +804,18 @@
         <foreach collection="list" index="index" item="item"   separator="union all"  >
             select
             #{item.beginTime} dataTime,
+            (select shop_short_name from sys_shop_info where id=#{shopId}) shopName,
+            (select sum(total) shouldPay from sys_order
+                where STATU in ('已付款', '欠款') and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
+                <if test="shopId != null">
+                    and shop_id=#{shopId}
+                </if>
+                ) shouldPay,
             (select IFNULL(sum(amount),0) from sys_order_flow
-            where <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]> and pay_method!='欠款'
-            <if test="shopId != null">
-                and shop_id=#{shopId}
-            </if>
+                where <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]> and pay_method!='欠款'
+                <if test="shopId != null">
+                    and shop_id=#{shopId}
+                </if>
             )totalPay,
             (select IFNULL(sum(amount),0) from sys_order_flow
             where pay_method not in ('储值卡', '欠款') and flow_type != '退款' and <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime}]]>
@@ -932,7 +939,7 @@
         from sys_order_flow
         where <![CDATA[ create_time > #{item.beginTime} and create_time < #{item.endTime} ]]>
         <if test="shopId != null">
-            and a.shop_id=#{shopId}
+            and shop_id=#{shopId}
         </if>
         group by paymethod
     </sql>
diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
index 6cc5489..16ea29d 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/hive/TjVipSumDao.xml
@@ -232,7 +232,7 @@
 		<foreach collection="list" index="index" item="item"   separator="union all"  >
 			select
 				#{item.beginTime} time,
-				(select ifnull(sum(card_cash),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) orderAmount,
+				(select ifnull(sum(ifnull(card_cash,0) + ifnull(consume,0)),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) orderAmount,
 				(select ifnull(sum(case t3 when '现金业绩' then card_cash else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cashAmount,
 				(select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardAmount,
 				(select ifnull(sum(case t3 when '划扣业绩' then consume else 0 end),0) from achieve_new a where a.beault_id=#{userId} and <![CDATA[datatime > #{item.beginTime} and datatime < #{item.endTime} ]]>) cardUseAmount,
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-sale-list.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-sale-list.html
new file mode 100644
index 0000000..8acd0ec
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/statistics/daily-sale-list.html
@@ -0,0 +1,157 @@
+
+<!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>
+ 
+</head>
+<body class="gray-bg">
+	 
+
+	<div class="ibox-content">
+		<!-- 搜索框部分start -->
+		<form class="form-inline" id="serchform">
+			<div class="form-group mr-20">
+				<label>日期范围</label>
+				<input name="beginTime" type="text" class="form-control datetimepicker" id="beginTime">-
+				<input name="endTime"  type="text" class="form-control datetimepicker" id="endTime">
+			</div>
+
+			<div class="form-group mr-20">
+				<label>门店</label>
+				<select class="form-control autoFull" data-filed="shopName" name="shopId" id="shopId"
+						th:data-url="@{/admin/shopInfo/findShops}">
+					<option value=''>--请选择部所属门店--</option>
+				</select>
+			</div>
+
+			<div class="row mb-10">
+				<div class="col-sm-8">
+					<button  onclick="myGrid.serchData()" type="button" class="btn btn-info btn-sm"><i class="fa fa-search" ></i> 搜索</button>
+					<button  type="reset"   class="btn btn-default btn-sm"><i class="fa fa-refresh " ></i> 重置</button>
+<!--					<button  matrix:btn="ygyjbb-exportExcel"  onclick="exportExcel()" type="button" class="btn btn-default btn-sm"><i class="fa fa-download" ></i> 导出</button>-->
+				</div>
+			</div>
+		</form>
+
+
+		<table id="mgrid">
+			<thead>
+				<tr>
+					<th data-formatter="MGrid.indexfn" data-align="center"
+						data-width="30px">序号</th>
+					<th data-field="dataTime">日期</th>
+					<th data-field="shopName">门店名称</th>
+					<th data-field="shouldPay" data-formatter="shouldPayFormat">应收金额</th>
+					<th data-field="totalPay">实收金额</th>
+					<th data-field="shouldPay" data-formatter="zkAmountFormat">折扣金额</th>
+					<th data-field="perCustomCnt">客单数</th>
+					<th data-field="customGoodsCnt">客品数</th>
+					<th data-field="cost">成本</th>
+					<th data-field="grossProfit">毛利</th>
+					<th data-field="grossProfitRate">毛利率</th>
+					<th data-field="wechat">微信</th>
+					<th data-field="alipay">支付宝</th>
+					<th data-field="cash">现金</th>
+					<th data-field="bankCard">银行卡</th>
+					<th data-field="tuan">团购</th>
+					<th data-field="cardBj">本金收款</th>
+					<th data-field="cardFree">赠金收款</th>
+					<th data-field="arrears">欠款</th>
+				</tr>
+			</thead>
+		</table>
+	</div>
+
+	<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
+	<script type="text/javascript" th:src="@{/js/function/public.js}"></script>
+	<script type="text/javascript">
+		var myGrid;
+		var initParam = {
+				format : "yyyy-mm-dd", //默认显示年与日,如果想显示十分秒:"yyyy-mm-dd hh:ii:ss"
+				minView: "month", 	//"month",只显示年月日的选择,不会再跳转去选择时分秒;如果想要选择时分秒的:"hour"
+			}
+		 MTools.ininDatetimepicker(initParam);
+		//限制结束时间不小于开始时间
+		 MTools.limitStartEndTime({});
+
+		$(function() {
+			MTools.autoFullSelect();
+			$(".select2").select2();
+			myGrid = MGrid.initGrid({
+				url : basePath+"/admin/sysBusinessData/findDailySaleData",
+				showExport : true,
+				showFooter : false,
+				height:'auto',
+				width:'auto',
+				exportDataType : "basic", //basic', 'all', 'selected'.
+				exportTypes : [ 'excel', 'xlsx' ], //导出类型
+				exportOptions : {
+					ignoreColumn : [ 0 ],
+					fileName : "客户消费统计" + MTools.getTime(), //文件名称设置
+					worksheetName : 'Sheet1', //表格工作区名称  
+					tableName : '客户消费统计',
+					excelstyles : [ 'background-color', 'color', 'font-size',
+							'font-weight' ],
+				}
+			});
+
+			$('[data-toggle="tooltip"]').tooltip()
+
+		});
+
+		function shouldPayFormat(value, row, index) {
+			return row.shouldPay + row.refund;
+		}
+
+		function zkAmountFormat(value, row, index) {
+			return row.shouldPay + row.refund - row.totalPay;
+		}
+
+		function footCountTitle(data) {
+			return "<b>合计</b>";
+		};
+		function countColumn(data) {
+			if (data) {
+				var resultsumQuantity = parseFloat(data).toFixed(2);//保留有效数字
+				return resultsumQuantity;
+			} else {
+				return "-";
+			}
+		};
+
+		function buildVipNameJump(value, row, index) {
+			return '<a  onClick="vipDetail(\'' + row.t9 +'\')"   class="text-primary " >'+value+'</a>';
+		}
+
+		function vipDetail(value) {
+			layer.full(layer.open({
+				type : 2,
+				title : "订单详情",
+				maxmin : true,
+				area : MUI.SIZE_M,
+				content : [basePath+'/admin/redirect/hive/beautySalon/vip?vipPhone=' + value ]
+			}));
+		}
+
+		function exportExcel(){
+
+			var param=MForm.toUrlParam("#serchform");
+
+			window.location.href=basePath+"/admin/achieve/exportDailyInfoNew?"+param;
+		}
+		
+	</script>
+</body>
+</html>
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 42a34a0..b39313f 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
@@ -303,6 +303,13 @@
 							}
 						} else {
 							Vue.set(item,'isActive',true);
+							var hasAmount = 0;
+							for(var i = 0; i < payMoneys.length; i++) {
+								hasAmount += parseFloat(payMoneys[i].money);
+							}
+							if (_this.order.arrears - hasAmount > 0) {
+								Vue.set(item, 'money', _this.order.arrears - hasAmount);
+							}
 							_this.payMoneys.push(item);
 						}
 					});
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form-bak.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form-bak.html
new file mode 100644
index 0000000..5c0925d
--- /dev/null
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form-bak.html
@@ -0,0 +1,239 @@
+<!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="ibox-content">
+
+		<form th:if="${obj ne null }" class="form-horizontal" id="dataform"
+			onsubmit="javascripr:return false;">
+			<input autocomplete="off"   type="hidden" name="cardId" th:value="${obj.id }">
+			<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" th:value="${obj.realMoney}"
+						readonly="readonly">
+					<div class="Validform_checktip"></div>
+				</div>
+				<label class="col-sm-2 control-label">充值时间</label>
+				<div class="col-sm-4">
+
+					<input autocomplete="off"   name="dateTime" type="text" datatype="*"
+						   class="form-control  datetimepicker" nullmsg="充值时间不能为空"
+						   style="display: inline;"
+						   th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}">
+					<div class="Validform_checktip"></div>
+				</div>
+
+
+			</div>
+			<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="bjmoney" value="0"
+						   onchange="changePayMoney('p0',this)"
+						   datatype="*" nullmsg="充值金额不能为空">
+					<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" value="0" dataType="n1-8"
+						name="giftMoney" />
+					<div class="Validform_checktip"></div>
+				</div>
+			</div>
+			<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" value="0" dataType="n1-8"
+						   name="jf" />
+					<div class="Validform_checktip"></div>
+				</div>
+
+				<label class="col-sm-2 control-label">下单顾问</label>
+				<div class="col-sm-4">
+					<select class="autoFull select2 " style="width: 100%"
+						th:data-url="@{/admin/getShopStaffByRoleName?roleName=健康顾问}"
+						data-value="suId" data-filed="suName"
+						th:data-def="${session.userInfo.suId }" name="staffId">
+					</select>
+				</div>
+
+			</div>
+			<div class="row ">
+				<div class="col-sm-10 pd-20 col-sm-offset-1">
+					<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">
+								<tr id="p0">
+									<td>1</td>
+									<td>会籍卡充值</td>
+									<td>0</td>
+									<td>
+										<table class="table   table-condensed   ">
+											<tr>
+												<td><select class="autoFull select2 input-sm" style="width: 80px;"
+													th:data-url="@{/admin/getShopStaffByRoleName?roleName=美疗师}"
+													data-value="suId" data-filed="suName"
+													th:data-def="${session.userInfo.suId }"
+													name="achaeveList[0].beaultId">
+												</select></td>
+												<td><input autocomplete="off"   type="text" class="form-control input-sm" value="0"
+													style="width: 80px" name="achaeveList[0].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"
+										onclick="addBeaute('p0','0')">添加</a></td>
+								</tr>
+							</tbody>
+						</table>
+					</div>
+				</div>
+			</div>
+
+
+			<div class="form-group ">
+				<div class="col-sm-12 text-center">
+					<a href="javascript:;" onclick="myForm.submit()"
+						class="btn btn-success radius">保存</a> &nbsp;&nbsp;&nbsp;&nbsp;
+					<button onclick="MTools.closeForm()" class="btn btn-danger radius"
+						type="button">取消</button>
+				</div>
+			</div>
+		</form>
+	</c:if>
+		<div th:if="${obj eq null }" class="text-center text-info">
+			<h2>该会员没有可用的会员卡!</h2>
+		</div>
+
+</div>
+<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script><script type="text/javascript">
+	$('.select2 ').select2();
+	MTools.autoFullSelect();
+	MTools.ininDatetimepicker({});
+	var myForm = MForm.initForm({
+		invokeUrl : basePath+"/admin/moneyCardUse/cz",
+		isAutoClose : false,
+		beforeSubmit : function() {
+
+			//校验业绩
+			var ifAchieveOk = true;
+			var achieveSum = 0;
+			$("#tbody2").children("tr").each(
+					function() {
+						var tr = $(this);
+						var pay = parseFloat(tr.find("td").eq(2).html());
+
+						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(isNaN(achieveSum)){
+				layer.msg("业绩金额格式错误", {
+					icon : 2
+				})
+				return false;
+			}
+			if (!ifAchieveOk) {
+				layer.msg("业绩金额不能大于支付金额", {
+					icon : 2
+				})
+				return false;
+			}
+
+		},
+		afterSubmit : function(loj) {
+
+			layer.open({
+				type: 2,
+				title: "打印订单",
+				area: ['250px', '550px'],
+				maxmin: true,
+				content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + loj.getResult().mapInfo.orderId],
+				cancel: function (index, layer) {
+					if (parent.app) {
+						parent.app.vipInfoFn();
+					} else {
+						parent.selectByKey();
+					}
+					MTools.closeForm();
+				}
+			});
+
+		},
+	});
+
+
+
+	//添加一个美疗师
+	function addBeaute(trId, itemIndex) {
+		if (!itemIndex) {
+			itemIndex = 0;
+		}
+		var id = MTools.randomStr();
+		console.log(1);
+		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="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"  value="0" style="width: 80px"  name="achaeveList['+achieveIndex+'].t1" '
+			+'name="items['+achieveIndex+'].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());
+	};
+</script>
+</body>
+</html>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
index 5c0925d..76320e7 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html
@@ -10,230 +10,385 @@
 <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>
+	<style>
+		.paymethod ul {
+			padding: 0;
+			margin: 0;
+			height: 50px;
+		}
+		.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;
+		}
+
+		.el-dialog__body {
+			padding-top: 10px !important;
+		}
+	</style>
 </head>
-<div class="ibox-content">
+<div class="panel-body" id="app">
+	<el-dialog title="充值" :visible.sync="dialogSettleVisible" :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false">
+		<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;">
+				<el-input v-model="rechargeMoney" placeholder="0.1元起充"></el-input>
+			</el-col>
+		</el-row>
 
-		<form th:if="${obj ne null }" class="form-horizontal" id="dataform"
-			onsubmit="javascripr:return false;">
-			<input autocomplete="off"   type="hidden" name="cardId" th:value="${obj.id }">
-			<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" th:value="${obj.realMoney}"
-						readonly="readonly">
-					<div class="Validform_checktip"></div>
-				</div>
-				<label class="col-sm-2 control-label">充值时间</label>
-				<div class="col-sm-4">
+		<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">
+							<li :class="{active : item.isActive}" @click="payMethodSelect(item, index)"><div style=" height:30px; line-height: 30px; display: flex; align-items: center"><img style="width: 25px; height: 25px; align-items: center;" :src="item.img"><span style="margin-left: 5px;">{{item.value}}</span></div></li>
+                        </span>
+					</ul>
+				</el-row>
+			</el-col>
+		</el-row>
 
-					<input autocomplete="off"   name="dateTime" type="text" datatype="*"
-						   class="form-control  datetimepicker" nullmsg="充值时间不能为空"
-						   style="display: inline;"
-						   th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd')}">
-					<div class="Validform_checktip"></div>
-				</div>
+		<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="item.money"></el-input></el-col>
+				</el-row>
+			</el-col>
+		</el-row>
 
+		<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="16">
+				<el-table class="mt-20"
+						  :border="true"
+						  :data="achieveList"
+						  style="width: 100%">
+					<el-table-column
+							type="index"
+							width="50">
+					</el-table-column>
+					<el-table-column
+							label="业绩" width="100">
+						<template slot-scope="scope">
+							<el-input v-model="scope.row.achieveMoney"></el-input>
+						</template>
+					</el-table-column>
+					<el-table-column
+							label="提成">
+						<template slot-scope="scope">
+							<el-input v-model="scope.row.commission"></el-input>
+						</template>
+					</el-table-column>
+					<el-table-column
+							label="员工" width="130">
+						<template slot-scope="scope">
+							<el-select v-model="scope.row.saleId" placeholder="请选择员工">
+								<el-option
+										v-for="item in userList"
+										:key="item.suId"
+										:label="item.suName"
+										:value="item.suId">
+								</el-option>
+							</el-select>
+						</template>
+					</el-table-column>
+					<el-table-column
+							width="150"
+							label="操作">
+						<template slot-scope="scope">
+							<el-button type="primary" v-if="scope.row.isShare"
+									   size="mini"
+									   @click="delAchieve(scope.$index, scope.row)">删除
+							</el-button>
+							<el-tooltip content="分享业绩" placement="top">
+								<el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
+										   size="mini" type="primary"></el-button>
+							</el-tooltip>
+						</template>
+					</el-table-column>
+				</el-table>
+			</el-col>
+		</el-row>
 
-			</div>
-			<div class="form-group">
+		<el-row style="text-align: center; margin: 20px 0 10px 0">
+			<el-checkbox v-model="printPaper">打印小票</el-checkbox>
+		</el-row>
 
-				<label class="col-sm-2 control-label">充值金额</label>
-				<div class="col-sm-4">
-					<input autocomplete="off"   type="text" class="form-control" name="bjmoney" value="0"
-						   onchange="changePayMoney('p0',this)"
-						   datatype="*" nullmsg="充值金额不能为空">
-					<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" value="0" dataType="n1-8"
-						name="giftMoney" />
-					<div class="Validform_checktip"></div>
-				</div>
-			</div>
-			<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" value="0" dataType="n1-8"
-						   name="jf" />
-					<div class="Validform_checktip"></div>
-				</div>
-
-				<label class="col-sm-2 control-label">下单顾问</label>
-				<div class="col-sm-4">
-					<select class="autoFull select2 " style="width: 100%"
-						th:data-url="@{/admin/getShopStaffByRoleName?roleName=健康顾问}"
-						data-value="suId" data-filed="suName"
-						th:data-def="${session.userInfo.suId }" name="staffId">
-					</select>
-				</div>
-
-			</div>
-			<div class="row ">
-				<div class="col-sm-10 pd-20 col-sm-offset-1">
-					<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">
-								<tr id="p0">
-									<td>1</td>
-									<td>会籍卡充值</td>
-									<td>0</td>
-									<td>
-										<table class="table   table-condensed   ">
-											<tr>
-												<td><select class="autoFull select2 input-sm" style="width: 80px;"
-													th:data-url="@{/admin/getShopStaffByRoleName?roleName=美疗师}"
-													data-value="suId" data-filed="suName"
-													th:data-def="${session.userInfo.suId }"
-													name="achaeveList[0].beaultId">
-												</select></td>
-												<td><input autocomplete="off"   type="text" class="form-control input-sm" value="0"
-													style="width: 80px" name="achaeveList[0].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"
-										onclick="addBeaute('p0','0')">添加</a></td>
-								</tr>
-							</tbody>
-						</table>
-					</div>
-				</div>
-			</div>
-
-
-			<div class="form-group ">
-				<div class="col-sm-12 text-center">
-					<a href="javascript:;" onclick="myForm.submit()"
-						class="btn btn-success radius">保存</a> &nbsp;&nbsp;&nbsp;&nbsp;
-					<button onclick="MTools.closeForm()" class="btn btn-danger radius"
-						type="button">取消</button>
-				</div>
-			</div>
-		</form>
-	</c:if>
-		<div th:if="${obj eq null }" class="text-center text-info">
-			<h2>该会员没有可用的会员卡!</h2>
-		</div>
-
+		<el-row style="text-align: center; margin: 10px 0 0 0">
+			<el-button type="primary" @click="submitRecharge">确认收款</el-button>
+			<el-button type="danger" @click="cancelSubmit">取消</el-button>
+		</el-row>
+	</el-dialog>
 </div>
-<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script><script type="text/javascript">
-	$('.select2 ').select2();
-	MTools.autoFullSelect();
-	MTools.ininDatetimepicker({});
-	var myForm = MForm.initForm({
-		invokeUrl : basePath+"/admin/moneyCardUse/cz",
-		isAutoClose : false,
-		beforeSubmit : function() {
+<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">
+	var vipId = $.query.get("vipId");
 
-			//校验业绩
-			var ifAchieveOk = true;
-			var achieveSum = 0;
-			$("#tbody2").children("tr").each(
-					function() {
-						var tr = $(this);
-						var pay = parseFloat(tr.find("td").eq(2).html());
-
-						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(isNaN(achieveSum)){
-				layer.msg("业绩金额格式错误", {
-					icon : 2
-				})
-				return false;
-			}
-			if (!ifAchieveOk) {
-				layer.msg("业绩金额不能大于支付金额", {
-					icon : 2
-				})
-				return false;
-			}
-
+	//<![CDATA[
+	var vue = new Vue({
+		el: '#app',
+		data : {
+			cardInfo : "",
+			loginUser : "",
+			rechargeMoney : "",
+			payMethods: [{
+				value: '现金支付',
+				img: '/images/pay/cash.png',
+				isActive: false,
+				type: '现金支付'
+			}, {
+				value: '微信',
+				img: '/images/pay/wechat.png',
+				isActive: false,
+				type: '微信'
+			}, {
+				value: '支付宝',
+				img: '/images/pay/zhifubao.png',
+				isActive: false,
+				type: '支付宝'
+			}, {
+				value: '银行卡',
+				img: '/images/pay/yinlian.png',
+				isActive: false,
+				type: '银行卡'
+			}, {
+				value: '团购',
+				img: '/images/pay/tuan.png',
+				isActive: false,
+				type: '团购'
+			}, ],
+			dialogSettleVisible : true,
+			defaultProps: {
+				children: 'children',
+				label: 'showLable'
+			},
+			achieveList : [],
+			userList: [],
+			treeSelect : [],
+			payMoneys : [],
+			printPaper : false,
 		},
-		afterSubmit : function(loj) {
+		created : function() {
+			let _this = this;
+			this.cardInfo = /*[[${obj}]]*/
 
-			layer.open({
-				type: 2,
-				title: "打印订单",
-				area: ['250px', '550px'],
-				maxmin: true,
-				content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + loj.getResult().mapInfo.orderId],
-				cancel: function (index, layer) {
-					if (parent.app) {
-						parent.app.vipInfoFn();
-					} else {
-						parent.selectByKey();
-					}
-					MTools.closeForm();
+			//获取用户列表
+			AjaxProxy.requst({
+				app: _this,
+				url: basePath + '/admin/shopAll',
+				callback: function (data) {
+					_this.userList = data.rows;
 				}
 			});
 
+			//获取登录用户信息
+			AjaxProxy.requst({
+				app: _this,
+				url: basePath + '/admin/getLoginUser',
+				callback: function (data) {
+					_this.loginUser = data.mapInfo.user;
+
+					_this.achieveList.push({
+						saleId: _this.loginUser.suId,
+						achieveMoney: 0,
+						commission : 0,
+						isShare: false,
+					});
+				}
+			});
 		},
-	});
+		methods : {
+			submitRecharge() {
+				let _this = this;
+
+				if (!_this.rechargeMoney) {
+					this.$message.warning("请输入充值金额");
+					return;
+				}
+
+				if (_this.rechargeMoney < 0.1) {
+					this.$message.warning("0.1元起充");
+					return;
+				}
+
+				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;
+						total += item.money;
+						flows.push(flow);
+					})
+					if (total != _this.rechargeMoney) {
+						this.$message.warning("付款金额应等于充值金额");
+						return false;
+					}
+					_this.cardInfo.flows = flows;
+				} else {
+					this.$message.warning("请选择支付方式");
+					return false;
+				}
+
+				let achaeveList = [];
+				_this.achieveList.forEach(achieve => {
+					let achieveNew = {
+						beaultId: achieve.saleId,
+						t1: achieve.achieveMoney,
+						t3: '现金业绩',
+						projPercentage: achieve.commission,
+					};
+					achaeveList.push(achieveNew);
+				})
+				_this.cardInfo.bjmoney = _this.rechargeMoney;
+				_this.cardInfo.achaeveList = achaeveList;
+				let url = basePath + "/admin/moneyCardUse/cz";
+
+				console.log(_this.cardInfo);
+				AjaxProxy.requst({
+					app: _this,
+					data: _this.cardInfo,
+					url: url,
+					callback: function (data) {
+						if (_this.printPaper) {
+							_this.print();
+						}
+
+						if(parent.myGrid) {
+							parent.myGrid.serchData();
+						}
+
+						if (parent.app) {
+							parent.app.vipInfoFn();
+						}
+
+						_this.closeFrame();
+					}
+				});
+			},
+			cancelSubmit() {
+				this.closeFrame();
+			},
+			print() {
+				let _this = this;
+				if (_this.order.id) {
+					layer.open({
+						type: 2,
+						title: "打印订单",
+						area: ['250px', '550px'],
+						maxmin: true,
+						content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + this.order.id],
+						cancel: function (index, layero) {
+							_this.closeFram();
+						}
+					});
+				} else {
+					this.$message.warning("请先挂单在打印");
+				}
 
 
+			},
+			payMethodSelect(item, index) {
+				let _this = this;
+				let payMoneys = _this.payMoneys;
+				let rechargeMoney = _this.rechargeMoney;
+				if (!rechargeMoney) {
+					this.$message.warning("请输入充值金额");
+					return;
+				}
 
-	//添加一个美疗师
-	function addBeaute(trId, itemIndex) {
-		if (!itemIndex) {
-			itemIndex = 0;
+				if (rechargeMoney < 0.1) {
+					this.$message.warning("0.1元起充");
+					return;
+				}
+				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);
+							var hasAmount = 0;
+							for(var i = 0; i < payMoneys.length; i++) {
+								hasAmount += parseFloat(payMoneys[i].money);
+							}
+							if (_this.rechargeMoney - hasAmount > 0) {
+								Vue.set(item, 'money', _this.rechargeMoney - hasAmount);
+							}
+							_this.payMoneys.push(item);
+						}
+					});
+				}
+			},
+			closeFrame() {
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			},
+			shareAchieve(index, row) {
+				row2 = JSON.parse(JSON.stringify(row));
+				row2.isShare = true;
+				this.achieveList.push(row2);
+			},
+			//删除业绩
+			delAchieve(index, row) {
+				this.achieveList.splice(index, 1);
+			},
 		}
-		var id = MTools.randomStr();
-		console.log(1);
-		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="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"  value="0" style="width: 80px"  name="achaeveList['+achieveIndex+'].t1" '
-			+'name="items['+achieveIndex+'].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());
-	};
+	});
+	//]]>
 </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 b4928db..55bf9b2 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
@@ -951,17 +951,30 @@
                             }
                             if (item.uuid == achieve.orderItem.uuid) {
                                 let achieveNew = {
+                                    uuid:item.uuid,
                                     beaultId: achieve.saleId,
                                     t1: achieve.achieveMoney,
                                     t3: achieve.t3,
                                     projPercentage: achieve.commission,
                                 };
-                                item.achaeveList.push(achieveNew);
+
+                                var flag = true;
+                                for(var j = 0; j < item.achaeveList.length; j++) {
+                                    if(item.achaeveList[j].uuid == achieveNew.uuid && item.achaeveList[j].beaultId == achieveNew.beaultId) {
+                                        flag = false;
+                                        break;
+                                    }
+                                }
+
+                                if (flag) {
+                                    item.achaeveList.push(achieveNew);
+                                }
                                 break;
                             }
                         }
                     })
 
+                    console.log(_this.order);
                     //校验业绩金额
                     if (_this.checkAchieve()) {
                         let url = basePath + "/admin/order/payOrder";
@@ -982,7 +995,7 @@
                                     if (_this.printPaper) {
                                         _this.print();
                                     }
-                                    _this.closeFram();
+                                    // _this.closeFram();
                                     // _this.$confirm('结算成功,是否立刻打印小票?', '提示', {
                                     //     confirmButtonText: '打印',
                                     //     cancelButtonText: '取消',
@@ -1222,6 +1235,13 @@
                             }
                         } else {
                             Vue.set(item,'isActive',true);
+                            var hasAmount = 0;
+                            for(var i = 0; i < payMoneys.length; i++) {
+                                hasAmount += parseFloat(payMoneys[i].money);
+                            }
+                            if (_this.order.payMoney - hasAmount > 0) {
+                                Vue.set(item, 'money', _this.order.payMoney - hasAmount);
+                            }
                             _this.payMoneys.push(item);
                         }
                     });
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
index 1c01d27..5453505 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -771,6 +771,13 @@
                             }
                         } else {
                             Vue.set(item,'isActive',true);
+                            var hasAmount = 0;
+                            for(var i = 0; i < payMoneys.length; i++) {
+                                hasAmount += parseFloat(payMoneys[i].money);
+                            }
+                            if (_this.refundMoney - hasAmount > 0) {
+                                Vue.set(item, 'money', _this.refundMoney - hasAmount);
+                            }
                             _this.payMoneys.push(item);
                         }
                     });
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html
index d7a795e..2a9aa0e 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/pbxq-form.html
@@ -48,7 +48,7 @@
             </el-row>
             <el-row class="order-info" type="flex" justify="space-around"  style="height: 150px; padding: 30px 30px;">
                 <el-col :span="5">
-                    <p>会员姓名:{{serviceOrderInfo.vipInfo.staffName}}</p>
+                    <p>会员姓名:{{serviceOrderInfo.vipInfo.vipName}}</p>
                     <p>会员电话:{{serviceOrderInfo.vipInfo.phone}}</p>
                 </el-col>
                 <el-col :span="5">
@@ -81,7 +81,6 @@
                                 width="200">
                         </el-table-column>
                         <el-table-column
-                                prop="address"
                                 label="服务时间" :formatter="serviceTime">
                         </el-table-column>
                         <el-table-column
@@ -173,12 +172,14 @@
                 MTools.closeForm();
             },
             serviceTime(row, column) {
-                if (!column.bedState) {
-                    return "-";
-                }
-                var startTime = moment(column.bedState.startTime).format("YYYY-MM-DD HH:mm");
-                var endTime = moment(column.bedState.endTime).format("YYYY-MM-DD HH:mm");
-                return startTime + "-" + endTime;
+                console.log(column);
+                console.log(row);
+                // if (!column.bedState) {
+                //     return "-";
+                // }
+                var startTime = this.dateFormat(row.beginTime);
+                var endTime = this.dateFormat(row.endTime);
+                return startTime + " - " + endTime;
             }
         },
     });
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html
index 32a2969..785ca3a 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/service_all_list.html
@@ -76,7 +76,7 @@
             <div class="form-group mr-20">
                 <button type="button" class="btn btn-my btn-sm" id="btn4" value="">全部</button>
                 <button type="button" class="btn btn-my btn-sm active" id="btn1" value="待预约">待预约</button>
-                <button type="button" class="btn btn-my btn-sm" id="btn2" value="预约成功待处理">待派单</button>
+<!--                <button type="button" class="btn btn-my btn-sm" id="btn2" value="预约成功待处理">待派单</button>-->
                 <button type="button" class="btn btn-my btn-sm" id="btn3" value="需配料">待配料</button>
                 <button type="button" class="btn btn-my btn-sm" id="btn3" value="配料完成">待服务</button>
                 <button type="button" class="btn btn-my btn-sm" id="btn6" value="服务中">服务中</button>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
index 94115eb..ab0f2fc 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip.html
@@ -127,7 +127,6 @@
                 <el-button type="primary" plain @click="recharge">充值</el-button>
                 <el-button type="warning" plain @click="addOrder">开单</el-button>
                 <el-button type="success" plain @click="addServiceOrder">开服务单</el-button>
-                <el-button type="danger" plain @click="returnMoney">退款</el-button>
             </el-col>
         </el-header>
         <el-container>
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-sale-list.html b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-sale-list.html
index 4d459b9..9d71abc 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-sale-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/statistics/daily-sale-list.html
@@ -53,9 +53,9 @@
 						data-width="30px">序号</th>
 					<th data-field="dataTime">日期</th>
 					<th data-field="shopName">门店名称</th>
-					<th data-field="totalPay">应收金额</th>
+					<th data-field="shouldPay" data-formatter="shouldPayFormat">应收金额</th>
 					<th data-field="totalPay">实收金额</th>
-					<th data-field="hisConsume">折扣金额</th>
+					<th data-field="shouldPay" data-formatter="zkAmountFormat">折扣金额</th>
 					<th data-field="perCustomCnt">客单数</th>
 					<th data-field="customGoodsCnt">客品数</th>
 					<th data-field="cost">成本</th>
@@ -79,8 +79,8 @@
 	<script type="text/javascript">
 		var myGrid;
 		var initParam = {
-				format : "yyyy-mm-dd hh:ii", //默认显示年与日,如果想显示十分秒:"yyyy-mm-dd hh:ii:ss"
-				minView: "hour", 	//"month",只显示年月日的选择,不会再跳转去选择时分秒;如果想要选择时分秒的:"hour"
+				format : "yyyy-mm-dd", //默认显示年与日,如果想显示十分秒:"yyyy-mm-dd hh:ii:ss"
+				minView: "month", 	//"month",只显示年月日的选择,不会再跳转去选择时分秒;如果想要选择时分秒的:"hour"
 			}
 		 MTools.ininDatetimepicker(initParam);
 		//限制结束时间不小于开始时间
@@ -111,6 +111,14 @@
 
 		});
 
+		function shouldPayFormat(value, row, index) {
+			return row.shouldPay + row.refund;
+		}
+
+		function zkAmountFormat(value, row, index) {
+			return row.shouldPay + row.refund - row.totalPay;
+		}
+
 		function footCountTitle(data) {
 			return "<b>合计</b>";
 		};

--
Gitblit v1.9.1