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-erp/order/projService-list.html |    2 
 zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html     |  899 +++++++++++++++++++++++++++++++++++++++++++++++++++-----
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html   |   23 +
 3 files changed, 838 insertions(+), 86 deletions(-)

diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
index 1797130..a3bdf1c 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/orderXq-form.html
@@ -11,142 +11,889 @@
     <LINK rel="Bookmark" href="../images/favicon.ico">
     <!-- 本框架基本脚本和样式 -->
     <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script>
-    <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
     <script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script>
     <script type="text/javascript" th:src="@{/js/systools/MBase.js}"></script>
     <script type="text/javascript" th:src="@{/js/function/vip.js}"></script>
     <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}">
 
-    <script type="text/javascript" th:src="@{/js/function/vip.js}"></script>
     <script type="text/javascript" th:src="@{/js/function/meiduCommon.js}"></script>
     <title></title>
     <style>
         .ibox-content {
             background-color: rgba(240, 242, 245, 1);
         }
+        .aside label {
+            width: 100%;
+            margin: 5px 0 !important;
+        }
+        .arrears {
+            color: #E6A23C;
+        }
+
+        .paymethod ul {
+            padding: 0;
+            margin: 0;
+            height: 50px;
+        }
+        .paymethod ul li {
+            padding: 10px;
+            margin: 5px;
+            list-style:none;
+            float: left;
+            display: block;
+            cursor: pointer;
+            position: relative;
+            border: white 1px solid;
+        }
+        .paymethod ul li:hover {
+            border: #409EFF 1px solid;
+        }
+        .paymethod .active {
+            border: #409EFF 1px solid;
+        }
+        .paymethod .active::after {
+            content: '';
+            display: block;
+            height: 0px;
+            width: 0px;
+            position: absolute;
+            bottom: 0;
+            right: 0;
+            color:#fff;
+            /**对号大小*/
+            font-size: 10px;
+            line-height: 8px;
+            border: 3px solid;
+            border-color: transparent #4884ff #4884ff transparent;
+        }
+
+        .el-dialog__body {
+            padding-top: 10px !important;
+        }
     </style>
 </head>
 <div class="ibox-content" id="app">
     <el-container>
-        <el-header style="height: 210px; background-color: white; margin: 15px;">
-            <el-row style="line-height: 60px; padding-top: 20px;">
-                <el-col :span="1" style="font-size: 40px; color:#409EFF;">
-                    <i class="el-icon-s-order" type="primary"></i>
-                </el-col>
-                <el-col :span="10">
-                    <h1 style="line-height: 60px; margin: 0 0;">订单号:{{order.orderNo}}</h1>
-                </el-col>
-                <el-col :span="5" style="float: right; margin-right: 10px;">
-                    <el-button type="info" @click="printf">打印</el-button>
-                    <el-button type="danger" @click="toBack">返回</el-button>
+        <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">
+                        <el-col :span="7">
+                            <el-avatar :size="60" :src="circleUrl"></el-avatar>
+                        </el-col>
+                        <el-col :span="15" style="margin-left: 10px;">
+                            <label>{{vipInfo.vipName}}({{vipInfo.vipLevel == null ? '' : vipInfo.vipLevel.levelName}})</label>
+                            <label>{{vipInfo.vipNo}}</label>
+                        </el-col>
+                    </el-row>
+                    <el-row style="line-height: 20px;">
+                        <label>订单号: <span>{{order.orderNo}}</span></label>
+                        <label>下单顾问: <span>{{order.staffName}}</span></label>
+                        <label>消费门店: <span>{{order.shopShortName}}</span></label>
+                        <label>订单时间: <span>{{order.orderTime}}</span></label>
+                        <label>备  注: <span>{{order.remark}}</span></label>
+                    </el-row>
                 </el-col>
             </el-row>
-            <el-row class="order-info" type="flex" justify="space-around"  style="height: 150px; padding: 30px 30px;">
-                <el-col :span="5">
-                    <p>顾问姓名:{{order.staffName}}</p>
-                    <p>会员姓名:{{order.vipName}}</p>
-                    <p>会员编号:{{order.vipNo}}</p>
-                </el-col>
-                <el-col :span="5">
-                    <p>卡支付:{{order.cardPay}}</p>
-                    <p>现金支付:{{order.cashPay}}</p>
-                    <p>备注:{{order.remark}}</p>
-                </el-col>
-                <el-col :span="10">
-                    <el-col :span="6">
-                        <p>欠款总额</p>
-                        <h2>¥ {{order.arrears}}</h2>
-                    </el-col>
-                    <el-col :span="6">
-                        <p>折后总额</p>
-                        <h2>¥ {{order.zkTotal}}</h2>
-                    </el-col>
-                    <el-col :span="6">
-                        <p>订单总额</p>
-                        <h2>¥ {{order.total}}</h2>
-                    </el-col>
+            <el-row style="padding: 10px; border-bottom: #E4E7ED 1px solid;">
+                <el-col :span="24">
+                    <el-row>
+                        <el-col :span="6" style="text-align: right;">
+                            <label>总金额</label>
+                            <label>整单折扣</label>
+                            <label style="font-size: 14px;">应收金额</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}}</label>
+                            <label>¥ {{order.arrears}}</label>
+                            <label>¥ {{order.repay}}</label>
+                            <label v-if="order.refund != 0">¥ {{order.refund}}</label>
+                        </el-col>
+                    </el-row>
                 </el-col>
             </el-row>
-        </el-header>
-        <el-main style="background-color: white; margin: 15px; padding: 20px 30px;">
+            <el-row style="padding: 10px; border-bottom: #E4E7ED 1px solid;">
+                <el-col :span="24">
+                    <el-row>
+                        <h3>收款明细</h3>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="6" style="text-align: right;">
+                            <label v-for="(item, index) in payMethodItems">{{item.payMethod}}</label>
+                        </el-col>
+                        <el-col :span="14" style="text-align: right;">
+                            <label v-for="(item, index) in payMethodItems">¥ {{item.amount}}</label>
+                        </el-col>
+                    </el-row>
+                </el-col>
+            </el-row>
+            <el-row type="flex" justify="center" style="margin: 20px;">
+                <el-button size="medium" type="primary">打印</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="goods">
-                    <el-table :data="orderData"
+                <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="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>
+                    <el-row v-show="!isRefund">
+                        <el-table
+                                :data="orderItems"
+                                style="width: 100%">
+                            <el-table-column
+                                    type="index"
+                                    width="50">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="shoppingGoods.code"
+                                    label="产品编号"
+                                    width="100">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="shoppingGoods.name"
+                                    label="产品名称"
+                                    width="280">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="shoppingGoods.goodType"
+                                    label="产品类型">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="price"
+                                    label="单价">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="count"
+                                    label="数量">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="zkPrice"
+                                    label="折扣单价">
+                            </el-table-column>
+                            <el-table-column  label="小计" :formatter="calOrderTotalFormatter">
+                            </el-table-column>
+                        </el-table>
+                    </el-row>
+                    <el-row v-show="isRefund">
+                        <el-table
+                                :data="orderItems"
+                                style="width: 100%">
+                            <el-table-column
+                                    type="index"
+                                    width="50">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="shoppingGoods.code"
+                                    label="产品编号"
+                                    width="100">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="shoppingGoods.name"
+                                    label="产品名称"
+                                    width="280">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="shoppingGoods.goodType"
+                                    label="产品类型">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="zkPrice"
+                                    label="单价">
+                            </el-table-column>
+                            <el-table-column
+                                    prop="count"
+                                    label="可退数量">
+                            </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>
+                                </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>
+                                </template>
+                            </el-table-column>
+                            <el-table-column label="是否退库存" align="center">
+                                <template slot-scope="scope">
+                                    <el-checkbox v-model="scope.row.returnStore" v-if="scope.row.type == '家居产品' && scope.row.count > 0"></el-checkbox>
+                                </template>
+                            </el-table-column>
+                        </el-table>
+
+                        <el-checkbox v-model="isReturnAchieve">退业绩</el-checkbox>
+
+                        <el-row v-if="isReturnAchieve">
+                            <el-table
+                                    :data="achieveItems"
+                                    style="width: 100%">
+                                <el-table-column
+                                        type="index"
+                                        width="50">
+                                </el-table-column>
+                                <el-table-column
+                                        prop="goodsNo"
+                                        label="产品编号"
+                                        width="100">
+                                </el-table-column>
+                                <el-table-column
+                                        prop="goodsName"
+                                        label="产品名称"
+                                        width="200">
+                                </el-table-column>
+                                <el-table-column
+                                        prop="zkTotal"
+                                        label="收款">
+                                </el-table-column>
+                                <el-table-column
+                                        prop="t3"
+                                        label="业绩类型">
+                                </el-table-column>
+                                <el-table-column
+                                        prop="t1"
+                                        label="原业绩">
+                                </el-table-column>
+                                <el-table-column
+                                        prop="projPercentage"
+                                        label="原提成">
+                                </el-table-column>
+                                <el-table-column label="业绩">
+                                    <template slot-scope="scope">
+                                        <el-input v-model="scope.row.returnAchieve" v-if="scope.row.zkTotal != 0"></el-input>
+                                    </template>
+                                </el-table-column>
+                                <el-table-column label="提成">
+                                    <template slot-scope="scope">
+                                        <el-input v-model="scope.row.returnCommission" v-if="scope.row.zkTotal != 0"></el-input>
+                                    </template>
+                                </el-table-column>
+                                <el-table-column
+                                        label="员工" prop="meiliao">
+                                </el-table-column>
+                            </el-table>
+                        </el-row>
+                    </el-row>
+                </el-tab-pane>
+                <el-tab-pane label="业绩设置" name="second">
+                    <el-row>
+                        <el-button size="mini" type="primary" @click="saveAchieve" v-if="order.statu == '已付款'">保存</el-button>
+                    </el-row>
+                    <el-table
+                            :data="achieveItems"
                             style="width: 100%">
                         <el-table-column
-                                prop="shoppingGoods.name"
-                                label="商品名称"
-                                width="300">
+                                type="index"
+                                width="50">
                         </el-table-column>
                         <el-table-column
-                                prop="price"
-                                label="单价"
-                                width="80">
+                                prop="goodsNo"
+                                label="产品编号"
+                                width="180">
                         </el-table-column>
                         <el-table-column
-                                prop="count"
-                                label="购买数量">
+                                prop="goodsName"
+                                label="产品名称"
+                                width="180">
                         </el-table-column>
                         <el-table-column
-                                prop="zkPrice"
-                                label="折后金额">
+                                prop="zkTotal"
+                                label="收款">
                         </el-table-column>
                         <el-table-column
-                                prop="cardPay"
-                                label="卡付款">
+                                prop="t3"
+                                label="业绩类型">
+                            <template slot-scope="scope">
+                                <el-select v-model="scope.row.t3" placeholder="请选择业绩类型">
+                                    <el-option
+                                            v-for="item in achieveTypeList"
+                                            :key="item.key"
+                                            :label="item.value"
+                                            :value="item.key">
+                                    </el-option>
+                                </el-select>
+                            </template>
                         </el-table-column>
                         <el-table-column
-                                prop="cashPay"
-                                label="现金付款">
+                                prop="achieve"
+                                label="业绩">
+                            <template slot-scope="scope">
+                                <el-input v-model="scope.row.t1"></el-input>
+                            </template>
                         </el-table-column>
                         <el-table-column
-                                prop="arrears"
-                                label="欠款">
+                                prop="projPercentage"
+                                label="提成">
+                            <template slot-scope="scope">
+                                <el-input v-model="scope.row.projPercentage"></el-input>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                                label="员工">
+                            <template slot-scope="scope">
+                                <el-select v-model="scope.row.beaultId" placeholder="请选择员工">
+                                    <el-option
+                                            v-for="item in userList"
+                                            :key="item.suId"
+                                            :label="item.suName"
+                                            :value="item.suId">
+                                    </el-option>
+                                </el-select>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="操作">
+                            <template slot-scope="scope">
+                                <el-button type="primary" v-if="scope.row.isShare"
+                                           size="mini"
+                                           @click="delAchieve(scope.$index, scope.row)">删除
+                                </el-button>
+                                <el-tooltip content="分享业绩" placement="top">
+                                    <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
+                                               size="mini" type="primary"></el-button>
+                                </el-tooltip>
+                            </template>
                         </el-table-column>
                     </el-table>
                 </el-tab-pane>
-                <el-tab-pane label="业绩" name="yj">业绩</el-tab-pane>
+                <el-tab-pane label="交易流水" name="third">
+                    <el-table
+                            :data="flowItems"
+                            style="width: 100%">
+                        <el-table-column
+                                type="index"
+                                width="50">
+                        </el-table-column>
+                        <el-table-column
+                                prop="orderNo"
+                                label="订单号"
+                                width="180">
+                        </el-table-column>
+                        <el-table-column
+                                prop="flowContent"
+                                label="交易内容"
+                                width="300">
+                        </el-table-column>
+                        <el-table-column
+                                prop="flowType"
+                                label="交易类型">
+                        </el-table-column>
+                        <el-table-column
+                                prop="amount"
+                                label="交易金额">
+                        </el-table-column>
+                        <el-table-column
+                                prop="payMethod"
+                                label="支付方式">
+                        </el-table-column>
+                        <el-table-column
+                                prop="flowNo"
+                                label="流水号">
+                        </el-table-column>
+                    </el-table>
+                </el-tab-pane>
             </el-tabs>
         </el-main>
     </el-container>
+
+    <el-dialog title="退款" :visible.sync="dialogSettleVisible">
+        <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;">¥ {{refundMoney}}</span></el-col>
+        </el-row>
+
+        <el-row type="flex" align="middle" style="padding: 10px 0;">
+            <el-col :span="5" style="text-align: center;">退款方式</el-col>
+            <el-col class="paymethod" :span="18">
+                <el-row>
+                    <ul>
+                        <span v-for="(item, index) in payMethods">
+                            <el-popover
+                                    :disabled="item.type != '储值卡'"
+                                    placement="bottom"
+                                    trigger="hover"
+                                    @hide="popoverHide(item)">
+                                <el-row style="text-align: center;"><span style="padding: 0 0 10px 0; display: block; font-size: 12px;">选择储值卡支付方式</span></el-row>
+                                <el-tree :data="moneyCards"
+                                         show-checkbox
+                                         default-expand-all
+                                         node-key="id"
+                                         ref="tree"
+                                         check-strictly
+                                         highlight-current
+                                         @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=" 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>
+                </el-row>
+            </el-col>
+        </el-row>
+
+        <el-row type="flex" align="middle" style="padding: 10px 0 50px 0;">
+            <el-col :span="5" style="text-align: center;">退款方式</el-col>
+            <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="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>
+
+<!--        <el-row style="text-align: center; margin: 20px 0 10px 0">-->
+<!--            <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
+<!--        </el-row>-->
+
+        <el-row style="text-align: center; margin: 10px 0 0 0">
+            <el-button type="primary" @click="confirmSubmit">确认收款</el-button>
+        </el-row>
+    </el-dialog>
 </div>
 </body>
 
+<script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script>
+<script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script>
+<script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script>
 <script type="text/javascript" th:src="@{/js/plugin/LodopFuncs.js}"></script>
 <script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
 <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:src="@{/js/systools/MJsBase.js}"></script>
 <script type="text/javascript"  th:inline="javascript">
     //<![CDATA[
     var app = new Vue({
         el : "#app",
         data : {
-            activeName : "goods",
+            orderParam : "",
+            vipInfo : "",
             order : "",
-            orderItems : "",
-            cards : "",
-            orderData : []
+            activeName : "first",
+            circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
+            userList : [],
+            achieveTypeList : [
+                {
+                    "key" : "现金业绩",
+                    "value" : "现金业绩"
+                },{
+                    "key" : "划扣业绩",
+                    "value" : "划扣业绩"
+                },
+            ],
+            orderItems : [],
+            achieveItems : [],
+            flowItems : [],
+            payMethodItems : [],
+            isRefund : false,
+            isReturnAchieve : false,
+            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: '储值卡'
+            }, ],
+
+            dialogSettleVisible : false,
+            moneyCards: [],
+            defaultProps: {
+                children: 'children',
+                label: 'showLable'
+            },
+            treeSelect : [],
+            payMoneys : [],
+            printPaper : true,
+            refundMoney : 0,
+            data : {},
+
         },
         created : function() {
-            this.order = /*[[${order}]]*/
-            this.orderItems = /*[[${orderItems}]]*/
-            this.cards = /*[[${cards}]]*/
+            let _this = this;
+            this.orderParam = /*[[${orderParam}]]*/
+            this.queryOrderDetailData(this.orderParam);
 
-            this.orderData = this.order.items;
         },
         methods : {
-            handleClick(tab, event) {
+            queryOrderDetailData(param) {
+                let _this = this;
+                AjaxProxy.requst({
+                    app: _this,
+                    data: {id: param, orderNo:param},
+                    contentType: 'application/x-www-form-urlencoded',
+                    url: basePath + '/admin/order/findOrderDetailByIdOrNo',
+                    callback: function (data) {
+                        console.log(data);
+                        var mapInfo = data.mapInfo;
+                        _this.vipInfo = mapInfo.vipInfo;
+                        _this.order = mapInfo.order;
+                        _this.orderItems = mapInfo.orderItems;
+                        _this.payMethodItems = mapInfo.payMethods;
+                        _this.achieveItems = mapInfo.achieveList;
+
+                        _this.flowItems = _this.order.flows;
+
+                        _this.checkAchieveIsDel(_this.achieveItems);
+                        _this.order.orderTime = moment(_this.order.orderTime).format("YYYY-MM-DD HH:mm");
+
+                        var arrears = 0;
+                        var refund = 0;
+                        var repay = 0;
+                        for(var i = 0; i < _this.flowItems.length; i++) {
+                            var item = _this.flowItems[i];
+                            if (item.payMethod === '欠款') {
+                                arrears += item.amount;
+                            }
+
+                            if (item.flowType === '还款') {
+                                repay += item.amount;
+                            }
+
+                            if (item.flowType === '退款') {
+                                refund += item.amount;
+                            }
+                        }
+                        _this.order.arrears = arrears;
+                        _this.order.refund = refund;
+                        _this.order.repay = repay;
+
+                        //获取用户列表
+                        AjaxProxy.requst({
+                            app: _this,
+                            url: basePath + '/admin/shopAll',
+                            callback: function (data) {
+                                _this.userList = data.rows;
+                            }
+                        });
+                        _this.getVipMoneyCards();
+                    }
+                });
+            },
+            confirmSubmit() {
+                let _this = this;
+                _this.data.oldOrderId = _this.order.id;
+                _this.data.vipId = _this.vipInfo.id;
+
+                if(!_this.payMethodFlow()) {
+                    return;
+                }
+
+                let orderItems = _this.orderItems;
+                let dataItems = [];
+                for(var i = 0; i < orderItems.length; i++) {
+                    let item = orderItems[i];
+                    if (item.refundPrice && item.refundCount) {
+                        let achieveList = []
+                        if (_this.isReturnAchieve) {
+                            for(var j = 0; j < _this.achieveItems.length; j++) {
+                                let achieveItem = _this.achieveItems[j];
+                                if (achieveItem.returnAchieve || achieveItem.returnCommission) {
+                                    achieveItem.t1 = achieveItem.returnAchieve ?  achieveItem.returnAchieve : 0;
+                                    achieveItem.projPercentage = achieveItem.returnCommission ? achieveItem.returnCommission : 0;
+                                    achieveList.push(achieveItem);
+                                }
+                            }
+
+                            item.achaeveList = achieveList;
+                        }
+                        if (item.returnStore) {
+                            item.isReturnStore = 'Y';
+                        } else {
+                            item.isReturnStore = 'N';
+                        }
+
+                        item.preCount = item.count;
+                        item.count = item.refundCount;
+                        item.zkPrice = item.refundPrice;
+                        item.cashPay = 0;
+                        item.cardPay = 0;
+                        item.oldItemId = item.id;
+                        dataItems.push(item);
+                    }
+                }
+
+                _this.data.items = dataItems;
+                AjaxProxy.requst({
+                    app: _this,
+                    data: _this.data,
+                    contentType: 'application/json',
+                    url: basePath + '/admin/order/refundOrder',
+                    callback: function (data) {
+                        _this.isRefund = false;
+                        _this.dialogSettleVisible = false;
+                        _this.queryOrderDetailData(_this.data.oldOrderId);
+                    }
+                });
+
+            },
+            payMethodFlow() {
+                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 = parseFloat(item.money);
+                        if (item.type == '储值卡'){
+                            flow.isGift = item.isGift;
+                            flow.cardId = item.id;
+                        }
+                        total += parseFloat(item.money);
+                        flows.push(flow)
+                    })
+                    if (total != _this.refundMoney) {
+                        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 {
+                    this.$message.warning("请选择支付方式");
+                    return false;
+                }
+            },
+            openPayMoneyDialog() {
+                let _this = this;
+                let items = this.orderItems;
+                _this.refundMoney = 0;
+
+                for(var i = 0; i < items.length; i++) {
+                    let item = items[i]
+                    if (item.refundPrice && item.refundCount) {
+                        if (!item.refundPrice > 0 && !item.refundCount > 0) {
+                            _this.$message.error("退款金额或退款数量须大于0");
+                            return;
+                        }
+
+                        if (item.refundCount > item.count) {
+                            _this.$message.error("输入正确的退款数量");
+                            return;
+                        }
+
+                        _this.refundMoney += parseFloat(item.refundPrice * item.refundCount);
+                    }
+                }
+
+                if (_this.refundMoney == 0) {
+                    _this.$message.error("请输入退款金额或退款数量");
+                    return;
+                }
+                _this.dialogSettleVisible = true;
+            },
+            calOrderTotalFormatter(row, column) {
+                return row.count * row.price;
+            },
+            getVipMoneyCards() {
+                let _this = this;
+                if (_this.order.vipId) {
+                    AjaxProxy.requst({
+                        app: _this,
+                        data: {vipId: _this.order.vipId},
+                        contentType: 'application/x-www-form-urlencoded',
+                        url: basePath + '/admin/moneyCardUse/getUseMoneyCard',
+                        callback: function (data) {
+                            if (data.rows.length > 0) {
+                                data.rows.forEach(function (item, index, input) {
+                                    item.showLable = item.cardName + "-余额:" + (item.realMoney)
+                                    item.uuid = MTools.uuid();
+                                    if (item.giftMoney != 0) {
+                                        var children = [];
+                                        var gift = {};
+                                        gift.id = item.id;
+                                        gift.giftMoney = item.giftMoney;
+                                        gift.showLable = item.cardName + '-赠送金额' + item.giftMoney;
+                                        gift.cardName = item.cardName;
+                                        gift.isGift = 1;
+                                        gift.uuid = MTools.uuid();
+                                        children.push(gift);
+                                        item.children = children;
+                                    }
+                                });
+                                _this.moneyCards = data.rows;
+                            }
+                        }
+                    });
+                }
+            },
+            payMethodSelect(item, index) {
+                let _this = this;
+                let payMoneys = _this.payMoneys;
+                if (item.type != '储值卡') {
+                    this.$nextTick(function () {
+                        if (item.isActive) {
+                            Vue.set(item,'isActive',false);
+                            var index = -1;
+                            for (var i = 0; i < payMoneys.length; i++) {
+                                let payMoney = payMoneys[i];
+                                if (payMoney.value == item.value) {
+                                    index = i;
+                                    break;
+                                }
+                            }
+
+                            if (index > -1) {
+                                _this.payMoneys.splice(index, 1)
+                            }
+                        } 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);
+                        }
+                    });
+                }
+            },
+            popoverHide(item) {
+                if(this.treeSelect.length <= 0) {
+                    Vue.set(item, 'isActive', false)
+                } else {
+                    Vue.set(item, 'isActive', true)
+                }
+            },
+            handleCheckChange(clickNode, checked) {
+                let _this = this;
+
+                let nodes = checked.checkedNodes;
+                _this.treeSelect = nodes;
+                var index = -1;
+                // 判断点击节点是否在已展示支付方式中
+                for(var i = 0; i < _this.payMoneys.length; i++) {
+                    let node = _this.payMoneys[i];
+                    if (node.uuid === clickNode.uuid) {
+                        index = i;
+                        break;
+                    }
+                }
+
+                // 若点击节点在选中节点中,且已展示支付方式不存在,则添加
+                if (nodes.indexOf(clickNode) > -1 && index === -1) {
+                    var node = clickNode;
+                    var item = {};
+                    if (node.isGift) {
+                        item.value = node.cardName;
+                        item.balance = node.giftMoney;
+                        item.isGift = 'Y';
+                    } else {
+                        item.value = node.cardName;
+                        item.balance = node.realMoney;
+                        item.isGift = 'N';
+                    }
+                    item.type = '储值卡';
+                    item.id = node.id;
+                    item.uuid = clickNode.uuid;
+                    _this.payMoneys.push(item);
+                }
+
+                // 若点击节点不存在选中节点中,且已展示支付方式中存在,则移除
+                if (nodes.indexOf(clickNode) === -1 && index > -1) {
+                    _this.payMoneys.splice(index, 1);
+                }
+            },
+            closeFrame() {
+                parent.layer.close(parent.layer.getFrameIndex(window.name));
+            },
+            saveAchieve() {
+                let _this = this;
+                AjaxProxy.requst({
+                    app: _this,
+                    data: _this.achieveItems,
+                    contentType: 'application/json',
+                    url: basePath + '/admin/achieve/add',
+                    callback: function (data) {
+                        _this.$message.success(data.info);
+                    }
+                });
+            },
+            shareAchieve(index, row) {
+                var row2 = JSON.parse(JSON.stringify(row));
+                row2.id = null;
+                row2.isShare = true;
+                this.achieveItems.push(row2);
+            },
+            delAchieve(index, row) {
+                let _this = this;
+                if (row.id) {
+                    AjaxProxy.requst({
+                        app: _this,
+                        url: basePath + '/admin/achieve/del?id=' + row.id,
+                        callback: function (data) {
+                        }
+                    });
+                }
+
+                _this.achieveItems.splice(index, 1);
+            },
+            checkAchieveIsDel(items) {
+                var achieveIds = [];
+                for(var i = 0; i < items.length; i++) {
+                    var item = items[i];
+                    if(achieveIds.indexOf(item.orderItemId) === -1) {
+                        achieveIds.push(item.orderItemId);
+                        item.isShare = false;
+                    } else {
+                        item.isShare = true;
+                    }
+
+                    item.t1 = item.consume + item.cardCash;
+                }
             },
             printf() {
-                var id = 1;
+                var id = this.order.id;
                 layer.open({
                     type: 2,
                     title: "打印服务单",
                     area: ['250px', '550px'],
                     maxmin: true,
-                    content: [basePath + '/admin/redirect/hive/beautySalon/print-service?id=' + id]
+                    content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id]
                 });
+            },
+            handleClick() {
+
             },
             toBack() {
                 MTools.closeForm();
@@ -154,17 +901,5 @@
         }
     });
     //]]>
-    function print() {
-        var id=$("#orderId").val();
-        layer.open({
-            type: 2,
-            title: "打印订单",
-            area: ['250px', '550px'],
-            maxmin: true,
-            content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id]
-        });
-    };
-
-
 </script>
 </html>
\ No newline at end of file
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/projService-list.html b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/projService-list.html
index 72e8f44..8aa79f5 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/projService-list.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive-erp/order/projService-list.html
@@ -54,7 +54,7 @@
                 <select class="form-control" name="state" id="state">
                     <option value="">-- 请选择服务状态 --</option>
                     <option value="待预约">待预约</option>
-                    <option value="预约成功待处理">预约成功待处理</option>
+<!--                    <option value="预约成功待处理">预约成功待处理</option>-->
                     <option value="预约失败">预约失败</option>
                     <option value="预约取消">预约取消</option>
                     <option value="需配料">需配料</option>
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