From cc74efb36fd1f1de56b3acb2ba59d4b416eaed4f Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Tue, 19 Jan 2021 00:23:21 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html    |   20 +++++++++++++++-----
 zq-erp/src/main/java/com/matrix/system/hive/action/MoneyCardUseController.java   |   10 ++++------
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java |    4 ++++
 3 files changed, 23 insertions(+), 11 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 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/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java
index 15d24ec..667251d 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
@@ -1189,6 +1189,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,6 +1207,7 @@
         moneyCardUseFlow.setBalance(cardUser.getGiftMoney()+cardUser.getRealMoney());
         moneyCardUseFlowDao.insert(moneyCardUseFlow);
 
+        order.setFlows(czVo.getFlows());
         changeOrderStatu(order);
         // 添加员工业绩
         achieveNewService.addAchaeveByOrder(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 66b5414..fde34e1 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
@@ -85,7 +85,6 @@
 				<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-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>
@@ -211,7 +210,6 @@
 			let _this = this;
 			this.cardInfo = /*[[${obj}]]*/
 
-			this.cardInfo.vipId = vipId;
 			//获取用户列表
 			AjaxProxy.requst({
 				app: _this,
@@ -265,7 +263,7 @@
 						total += item.money;
 						flows.push(flow);
 					})
-					if (total == _this.rechargeMoney) {
+					if (total != _this.rechargeMoney) {
 						this.$message.warning("付款金额应等于充值金额");
 						return false;
 					}
@@ -275,9 +273,21 @@
 					return false;
 				}
 
-				_this.cardInfo.bjMoney = _this.rechargeMoney;
+				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,
@@ -356,7 +366,7 @@
 							for(var i = 0; i < payMoneys.length; i++) {
 								hasAmount += parseFloat(payMoneys[i].money);
 							}
-							if (_this.order.arrears - hasAmount > 0) {
+							if (_this.rechargeMoney - hasAmount > 0) {
 								Vue.set(item, 'money', _this.rechargeMoney - hasAmount);
 							}
 							_this.payMoneys.push(item);

--
Gitblit v1.9.1