From 4f1a0c89b40a99e7e3b6ec72b42a1b9d6bac971a Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 28 Jan 2021 15:36:19 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |   52 ++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 12 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 6b88037..bd63766 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
@@ -22,7 +22,7 @@
         .ibox-content {
             background-color: rgba(240, 242, 245, 1);
         }
-        label {
+        .aside label {
             width: 100%;
             margin: 5px 0 !important;
         }
@@ -74,7 +74,7 @@
 </head>
 <div class="ibox-content" id="app">
     <el-container>
-        <el-aside style="width: 300px; background-color: white; padding: 10px;">
+        <el-aside class="aside" style="width: 300px; background-color: white; padding: 10px;">
             <el-row style="border-bottom: #E4E7ED 1px solid;">
                 <el-col :span="20" style="padding: 10px;">
                     <el-row type="flex" align="middle">
@@ -104,15 +104,15 @@
                             <label style="font-size: 14px;">应收金额</label>
                             <label>欠款</label>
                             <label>已还</label>
-                            <label>退款</label>
+                            <label v-if="order.refund != 0">退款</label>
                         </el-col>
                         <el-col :span="14" style="text-align: right;">
                             <label>¥ {{order.total}}</label>
-                            <label>¥ {{order.zkTotal - order.total}}</label>
+                            <label>¥ {{(order.zkTotal - order.total).toFixed(2)}}</label>
                             <label>¥ {{order.zkTotal}}</label>
                             <label>¥ {{order.arrears}}</label>
                             <label>¥ {{order.repay}}</label>
-                            <label>¥ {{order.refund}}</label>
+                            <label v-if="order.refund != 0">¥ {{order.refund}}</label>
                         </el-col>
                     </el-row>
                 </el-col>
@@ -133,14 +133,14 @@
                 </el-col>
             </el-row>
             <el-row type="flex" justify="center" style="margin: 20px;">
-                <el-button size="medium" type="primary">打印</el-button>
+                <el-button size="medium" type="primary" @click="printf">打印</el-button>
             </el-row>
         </el-aside>
         <el-main style="background-color: white; margin-right: 15px; margin-left: 15px; padding: 20px 30px;">
             <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">
@@ -381,6 +381,10 @@
                                 width="300">
                         </el-table-column>
                         <el-table-column
+                                prop="createTime"
+                                label="交易时间">
+                        </el-table-column>
+                        <el-table-column
                                 prop="flowType"
                                 label="交易类型">
                         </el-table-column>
@@ -430,7 +434,7 @@
                                          @check="(click, checked,$item)=>{handleCheckChange(click, checked,$item)}"
                                          :props="defaultProps">
                                 </el-tree>
-                                <li :class="{active : item.isActive}" slot="reference" @click="payMethodSelect(item, index)"><div style="line-height: 30px;"><img style="width: 25px; height: 25px;" :src="item.img"><span style="line-height: 30px; margin-left: 5px;">{{item.value}}</span></div></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>
@@ -493,6 +497,7 @@
             payMethodItems : [],
             isRefund : false,
             isReturnAchieve : false,
+            totalRefund : "",
             payMethods: [{
                 value: '现金支付',
                 img: '/images/pay/cash.png',
@@ -525,7 +530,7 @@
                 type: '储值卡'
             }, ],
 
-            dialogSettleVisible : true,
+            dialogSettleVisible : false,
             moneyCards: [],
             defaultProps: {
                 children: 'children',
@@ -545,6 +550,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 +696,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 {
@@ -771,6 +792,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.refundMoney - hasAmount > 0) {
+                                Vue.set(item, 'money', _this.refundMoney - hasAmount);
+                            }
                             _this.payMoneys.push(item);
                         }
                     });
@@ -874,7 +902,7 @@
                 var id = this.order.id;
                 layer.open({
                     type: 2,
-                    title: "打印服务单",
+                    title: "打印订单",
                     area: ['250px', '550px'],
                     maxmin: true,
                     content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id]

--
Gitblit v1.9.1