From 15e19113558e46aaf8f7263a66730fc01aadf603 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 12 Jan 2021 10:25:20 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |  103 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 96 insertions(+), 7 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 3965187..663b815 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
@@ -138,6 +138,9 @@
                     </el-table>
                 </el-tab-pane>
                 <el-tab-pane label="业绩设置" name="second">
+                    <el-row>
+                        <el-button size="mini" type="primary" @click="saveAchieve">保存</el-button>
+                    </el-row>
                     <el-table
                             :data="achieveItems"
                             style="width: 100%">
@@ -160,25 +163,56 @@
                                 label="收款">
                         </el-table-column>
                         <el-table-column
-                                prop="achieveType"
+                                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="achieve"
                                 label="业绩">
+                            <template slot-scope="scope">
+                                <el-input v-model="scope.row.achieve"></el-input>
+                            </template>
                         </el-table-column>
                         <el-table-column
-                                prop="commission"
+                                prop="projPercentage"
                                 label="提成">
+                            <template slot-scope="scope">
+                                <el-input v-model="scope.row.projPercentage"></el-input>
+                            </template>
                         </el-table-column>
                         <el-table-column
-                                prop="staffId"
                                 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="text" size="small">分享</el-button>
-                                <el-button type="text" size="small">删除</el-button>
+                                <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>
@@ -237,8 +271,18 @@
         data : {
             vipInfo : "",
             order : "",
-            activeName : "first",
+            activeName : "second",
             circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
+            userList : [],
+            achieveTypeList : [
+                {
+                    "key" : "现金业绩",
+                    "value" : "现金业绩"
+                },{
+                    "key" : "划扣业绩",
+                    "value" : "划扣业绩"
+                },
+            ],
             orderItems : [],
             achieveItems : [],
             flowItems : [],
@@ -246,12 +290,15 @@
 
         },
         created : function() {
+            let _this = this;
             this.vipInfo = /*[[${vipInfo}]]*/
             this.order = /*[[${order}]]*/
             this.orderItems = /*[[${orderItems}]]*/
             this.payMethodItems = /*[[${payMethods}]]*/
             this.achieveItems = /*[[${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;
@@ -271,15 +318,57 @@
                     refund += item.amount;
                 }
             }
-            console.log(this.orderItems);
             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;
+                }
+            });
+
         },
         methods : {
             calOrderTotalFormatter(row, column) {
                 return row.count * row.price;
             },
+            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));
+                this.achieveItems.push(row2);
+            },
+            delAchieve(index, row) {
+                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.achieve = item.consume + item.cardCash;
+                }
+            },
             printf() {
                 var id = this.order.id;
                 layer.open({

--
Gitblit v1.9.1