From 530885dff056bb75bea793a84db6ae486124a24a Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 09 Jan 2021 14:25:07 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html |   83 +++++++++++++++++++++++++++++++++++++++--
 1 files changed, 78 insertions(+), 5 deletions(-)

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 07843ca..29a923c 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
@@ -58,7 +58,7 @@
 	</style>
 </head>
 <div class="panel-body" id="app">
-	<el-dialog title="还款" :visible.sync="dialogSettleVisible" show-close>
+	<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;"><span style="color: red; font-size: 20px;">¥ {{order.arrears}}</span></el-col>
@@ -110,7 +110,7 @@
 		</el-row>
 
 		<el-row style="text-align: center; margin: 10px 0 0 0">
-			<el-button type="primary" @click="">确认收款</el-button>
+			<el-button type="primary" @click="submitBj">确认收款</el-button>
 		</el-row>
 	</el-dialog>
 </div>
@@ -164,15 +164,85 @@
 			},
 			treeSelect : [],
 			payMoneys : [],
-			printPaper : true,
+			printPaper : false,
 		},
 		created : function() {
 			this.order = /*[[${order}]]*/
 			this.getVipMoneyCards();
-
-			console.log(this.order)
 		},
 		methods : {
+			submitBj() {
+				let _this = this;
+				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.arrears) {
+						this.$message.warning("输入付款总金额大于应还金额");
+						return false;
+					}
+					_this.order.flows = flows;
+				} else {
+					this.$message.warning("请选择支付方式");
+					return false;
+				}
+
+				let url = basePath + "/admin/moneyCardUse/bj";
+
+				AjaxProxy.requst({
+					app: _this,
+					data: _this.order,
+					url: url,
+					callback: function (data) {
+						if (_this.printPaper) {
+							_this.print();
+						}
+
+						if(parent.myGrid) {
+							parent.myGrid.serchData();
+						}
+
+						if (parent.app) {
+							parent.app.orderQuery();
+						}
+
+						_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("请先挂单在打印");
+				}
+
+
+			},
 			getVipMoneyCards() {
 				let _this = this;
 				if (_this.order.vipId) {
@@ -278,6 +348,9 @@
 					_this.payMoneys.splice(index, 1);
 				}
 			},
+			closeFrame() {
+				parent.layer.close(parent.layer.getFrameIndex(window.name));
+			},
 		}
 	});
 	//]]>

--
Gitblit v1.9.1