From bdd8e7862158b296f1930e4fa3a8a55fe109e058 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 20 Jan 2021 16:24:13 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
index 5453505..d8f00fe 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -140,7 +140,7 @@
             <el-tabs v-model="activeName" @tab-click="handleClick">
                 <el-tab-pane label="订单明细" name="first">
                     <el-row>
-                        <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款</el-button>
+                        <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款<span v-if="totalRefund"> ¥ {{totalRefund}}</span></el-button>
                         <el-button size="mini" type="danger" @click="isRefund = false" v-if="isRefund">取消</el-button>
                         <el-button size="mini" type="primary" @click="isRefund = true" v-if="order.statu == '已付款' && !isRefund">退款</el-button>
                     </el-row>
@@ -214,12 +214,12 @@
                             </el-table-column>
                             <el-table-column label="退款单价">
                                 <template slot-scope="scope">
-                                    <el-input v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input>
+                                    <el-input @change="calRefund" v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input>
                                 </template>
                             </el-table-column>
                             <el-table-column label="退款数量">
                                 <template slot-scope="scope">
-                                    <el-input v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input>
+                                    <el-input @change="calRefund" v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input>
                                 </template>
                             </el-table-column>
                             <el-table-column label="是否退库存" align="center">
@@ -493,6 +493,7 @@
             payMethodItems : [],
             isRefund : false,
             isReturnAchieve : false,
+            totalRefund : "",
             payMethods: [{
                 value: '现金支付',
                 img: '/images/pay/cash.png',
@@ -545,6 +546,17 @@
 
         },
         methods : {
+            calRefund() {
+                let _this = this;
+                var total = 0;
+                _this.orderItems.forEach(item => {
+                    if (item.refundPrice && item.refundCount) {
+                        total += parseFloat(item.refundPrice * item.refundCount);
+                    }
+                })
+
+                _this.totalRefund = total;
+            },
             queryOrderDetailData(param) {
                 let _this = this;
                 AjaxProxy.requst({
@@ -680,6 +692,11 @@
                         this.$message.warning("输入付款总金额与应付金额不符");
                         return false;
                     }
+
+                    if(_this.order.zkTotal - _this.order.refund - _this.order.arrears < total) {
+                        this.$message.warning("退款金额不能超过收款金额");
+                        return false;
+                    }
                     _this.data.flows = flows;
                     return true;
                 } else {

--
Gitblit v1.9.1