From 9c791d431038fe79a111805762ee2f42c96b51c5 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Mon, 08 Nov 2021 17:03:15 +0800 Subject: [PATCH] fix --- zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/bj-form.html | 108 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 97 insertions(+), 11 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..8265278 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> @@ -86,7 +86,7 @@ @check="(click, checked,$item)=>{handleCheckChange(click, checked,$item)}" :props="defaultProps"> </el-tree> - <li :class="{active : item.isActive}" v-if="item.value != '欠款'" slot="reference" @click="payMethodSelect(item, index)">{{item.value}}</li> + <li :class="{active : item.isActive}" slot="reference" @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> </el-popover> </span> </ul> @@ -99,7 +99,7 @@ <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.number="item.money"></el-input></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> @@ -110,7 +110,8 @@ </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-button type="danger" @click="cancelSubmit">取消</el-button> </el-row> </el-dialog> </div> @@ -129,32 +130,34 @@ order : "", 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: '团购' }, { value: '储值卡', + img: '/images/pay/card.png', isActive: false, type: '储值卡' - }, { - value: '欠款', - isActive: false, - type: '欠款' },], moneyCards : [], dialogSettleVisible : true, @@ -164,15 +167,88 @@ }, 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(); + } + }); + }, + cancelSubmit() { + this.closeFrame(); + }, + print() { + let _this = this; + if (_this.order.id) { + layer.open({ + type: 2, + title: "打印订单", + area: ['250px', '550px'], + maxmin: true, + content: [basePath + '/admin/order/printOrder?id=' + this.order.id], + cancel: function (index, layero) { + _this.closeFram(); + } + }); + } else { + this.$message.warning("请先挂单在打印"); + } + + + }, getVipMoneyCards() { let _this = this; if (_this.order.vipId) { @@ -227,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); } }); @@ -278,6 +361,9 @@ _this.payMoneys.splice(index, 1); } }, + closeFrame() { + parent.layer.close(parent.layer.getFrameIndex(window.name)); + }, } }); //]]> -- Gitblit v1.9.1