From a72aa4bb793ec765892406c842039a71b33215b1 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 11 Mar 2021 18:12:22 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/cz-form.html |   89 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 67 insertions(+), 22 deletions(-)

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..12f1b8c 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
@@ -62,7 +62,7 @@
 		<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-input type="number" v-model="rechargeMoney" @change="changeRechargeMoney"  placeholder="可充负数退款"></el-input>
 			</el-col>
 		</el-row>
 
@@ -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>
@@ -161,12 +160,15 @@
 <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 : "",
-			rechargeMoney : "",
+			loginUser : "",
+			rechargeMoney : 0,
 			payMethods: [{
 				value: '现金支付',
 				img: '/images/pay/cash.png',
@@ -216,10 +218,39 @@
 					_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 : {
+			//修改充值金额同步修改业绩
+			changeRechargeMoney(){
+				let aMoeny=(this.rechargeMoney/this.achieveList.length).toFixed(2);
+				this.achieveList.forEach(item=>{
+					item.achieveMoney=aMoeny;
+				});
+			},
 			submitRecharge() {
 				let _this = this;
+
+				if (!_this.rechargeMoney) {
+					this.$message.warning("请输入充值金额");
+					return;
+				}
+
 				if (_this.payMoneys.length > 0) {
 					let flows = []
 					var total = 0;
@@ -230,29 +261,39 @@
 							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)
+						flow.amount = parseFloat(item.money);
+						total +=   parseFloat(item.money);
+						flows.push(flow);
 					})
-					if (total > _this.order.arrears) {
-						this.$message.warning("输入付款总金额大于应还金额");
+					debugger
+					if (total != _this.rechargeMoney) {
+						this.$message.warning("付款金额应等于充值金额");
 						return false;
 					}
-					_this.order.flows = flows;
+					_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.order,
+					data: _this.cardInfo,
 					url: url,
 					callback: function (data) {
 						if (_this.printPaper) {
@@ -264,7 +305,7 @@
 						}
 
 						if (parent.app) {
-							parent.app.orderQuery();
+							parent.app.vipInfoFn();
 						}
 
 						_this.closeFrame();
@@ -302,10 +343,7 @@
 					return;
 				}
 
-				if (rechargeMoney < 0.1) {
-					this.$message.warning("0.1元起充");
-					return;
-				}
+
 				if (item.type != '储值卡') {
 					this.$nextTick(function () {
 						if (item.isActive) {
@@ -328,9 +366,7 @@
 							for(var i = 0; i < payMoneys.length; i++) {
 								hasAmount += parseFloat(payMoneys[i].money);
 							}
-							if (_this.order.arrears - hasAmount > 0) {
-								Vue.set(item, 'money', _this.rechargeMoney - hasAmount);
-							}
+							Vue.set(item, 'money', _this.rechargeMoney - hasAmount);
 							_this.payMoneys.push(item);
 						}
 					});
@@ -339,6 +375,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);
+			},
 		}
 	});
 	//]]>

--
Gitblit v1.9.1