From f8ac14dfe690ce43e8f2c76d07487bc9794cbcc9 Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Mon, 18 Jan 2021 23:51:09 +0800
Subject: [PATCH] mdoify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html    |   55 +++++++++++++++++++++++----
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html |   15 +++++++
 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 |    8 ++--
 4 files changed, 76 insertions(+), 16 deletions(-)

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..15d24ec 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);
@@ -1204,7 +1204,7 @@
         moneyCardUseFlow.setBalance(cardUser.getGiftMoney()+cardUser.getRealMoney());
         moneyCardUseFlowDao.insert(moneyCardUseFlow);
 
-
+        changeOrderStatu(order);
         // 添加员工业绩
         achieveNewService.addAchaeveByOrder(order);
         return order;
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 5d05893..66b5414 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
@@ -161,11 +161,14 @@
 <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");
+
 	//<![CDATA[
 	var vue = new Vue({
 		el: '#app',
 		data : {
 			cardInfo : "",
+			loginUser : "",
 			rechargeMoney : "",
 			payMethods: [{
 				value: '现金支付',
@@ -208,6 +211,7 @@
 			let _this = this;
 			this.cardInfo = /*[[${obj}]]*/
 
+			this.cardInfo.vipId = vipId;
 			//获取用户列表
 			AjaxProxy.requst({
 				app: _this,
@@ -216,10 +220,37 @@
 					_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;
@@ -231,28 +262,25 @@
 							return false;
 						}
 						flow.amount = item.money;
-						if (item.type == '储值卡'){
-							flow.isGift = item.isGift;
-							flow.cardId = item.id;
-						}
 						total += item.money;
-						flows.push(flow)
+						flows.push(flow);
 					})
-					if (total > _this.order.arrears) {
-						this.$message.warning("输入付款总金额大于应还金额");
+					if (total == _this.rechargeMoney) {
+						this.$message.warning("付款金额应等于充值金额");
 						return false;
 					}
-					_this.order.flows = flows;
+					_this.cardInfo.flows = flows;
 				} else {
 					this.$message.warning("请选择支付方式");
 					return false;
 				}
 
+				_this.cardInfo.bjMoney = _this.rechargeMoney;
 				let url = basePath + "/admin/moneyCardUse/cz";
 
 				AjaxProxy.requst({
 					app: _this,
-					data: _this.order,
+					data: _this.cardInfo,
 					url: url,
 					callback: function (data) {
 						if (_this.printPaper) {
@@ -339,6 +367,15 @@
 			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);
+			},
 		}
 	});
 	//]]>
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 70960a4..195139c 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";

--
Gitblit v1.9.1