From 69d8c54fe4d0c90de196f3d92f74933d06529902 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 11 Jan 2021 18:36:37 +0800
Subject: [PATCH] modify

---
 zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java                   |    3 +
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html |   90 +++++++++++++++++++++++++++--
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html   |   43 +++++++++++++-
 zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java |   19 -----
 4 files changed, 127 insertions(+), 28 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java b/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
index 782fd14..262e6e7 100644
--- a/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
+++ b/zq-erp/src/main/java/com/matrix/system/constance/Dictionary.java
@@ -558,5 +558,8 @@
 
 	String ORDER_TYPE_SEAL="订单";
 	String ORDER_TYPE_SERVICE="服务单";
+
+	String ACHIEVE_TYPE_CASH = "现金业绩";
+	String ACHIEVE_TYPE_CARD = "划扣业绩";
 	
 }
diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
index db870b7..520998d 100644
--- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/AchieveNewServiceImpl.java
@@ -264,24 +264,9 @@
         achieveNew.setT2(orderItem.getIsFree());
         // 根据商品类型设置业绩类型
 
-        String goodType = shoppingGoodsDao.selectById(orderItem.getGoodsId()).getGoodType();
-        if (orderItem.getPayMethod().equals(Dictionary.PAY_TYPE_MOENY)
-                && Dictionary.SHOPPING_GOODS_TYPE_XM.equals(goodType)) {
-            // 现金支付设置现金单次
-            achieveNew.setProjCash(Double.parseDouble(achieveNew.getT1()));
-
-        } else if (orderItem.getPayMethod().equals(Dictionary.PAY_TYPE_MOENY)
-                && Dictionary.SHOPPING_GOODS_TYPE_JJCP.equals(goodType)) {
-            // 设置现金产品
-            achieveNew.setGoodsCash(Double.parseDouble(achieveNew.getT1()));
-        } else if (orderItem.getPayMethod().equals(Dictionary.PAY_TYPE_MOENY)
-                && (Dictionary.SHOPPING_GOODS_TYPE_TC.equals(goodType)
-                || Dictionary.SHOPPING_GOODS_TYPE_CZK.equals(goodType)
-                || Dictionary.SHOPPING_GOODS_TYPE_ZHK.equals(goodType)
-                || Dictionary.SHOPPING_GOODS_TYPE_TCK.equals(goodType))) {
-            // 设置卡项
+        if (Dictionary.ACHIEVE_TYPE_CASH.equals(achieveNew.getT3())){
             achieveNew.setCardCash(Double.parseDouble(achieveNew.getT1()));
-        } else if (!orderItem.getPayMethod().equals(Dictionary.PAY_TYPE_CARD)) {
+        } else {
             // 设置划扣金额
             achieveNew.setConsume(Double.parseDouble(achieveNew.getT1()));
         }
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
index 351359d..a87b6c8 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/order-form.html
@@ -414,14 +414,34 @@
                                 prop="orderItem.payMoney"
                                 label="收款">
                         </el-table-column>
+
                         <el-table-column
-                                label="业绩">
+                                label="业绩类型" width="150">
+                            <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
+                                label="业绩" width="100">
                             <template slot-scope="scope">
                                 <el-input v-model="scope.row.achieveMoney"></el-input>
                             </template>
                         </el-table-column>
                         <el-table-column
-                                label="员工">
+                                label="提成">
+                            <template slot-scope="scope">
+                                <el-input v-model="scope.row.commission"></el-input>
+                            </template>
+                        </el-table-column>
+                        <el-table-column
+                                label="员工" width="130">
                             <template slot-scope="scope">
                                 <el-select v-model="scope.row.saleId" placeholder="请选择员工">
                                     <el-option
@@ -434,7 +454,7 @@
                             </template>
                         </el-table-column>
                         <el-table-column
-                                width="200"
+                                width="150"
                                 label="操作">
                             <template slot-scope="scope">
                                 <el-button type="primary" v-if="scope.row.isShare"
@@ -583,6 +603,15 @@
                 type: '欠款'
             },],
             achieveList: [],
+            achieveTypeList : [
+                {
+                    "key" : "现金业绩",
+                    "value" : "现金业绩"
+                },{
+                    "key" : "划扣业绩",
+                    "value" : "划扣业绩"
+                },
+            ],
             //会员可用的充值卡
             moneyCards: [],
             //门店信息
@@ -652,6 +681,8 @@
                                         staff: _this.loginUser,
                                         saleId: _this.loginUser.suId,
                                         achieveMoney: item.payMoney,
+                                        commission : 0,
+                                        t3 : '现金业绩',
                                         isShare: false,
                                     });
                                 });
@@ -790,6 +821,8 @@
                         staff: this.loginUser,
                         saleId: this.loginUser.suId,
                         achieveMoney: item.payMoney,
+                        t3 : '现金业绩',
+                        commission : 0,
                         isShare: false,
                     });
                     this.order.items.push(item);
@@ -912,7 +945,9 @@
                             if (item.uuid == achieve.orderItem.uuid) {
                                 let achieveNew = {
                                     beaultId: achieve.saleId,
-                                    t1: achieve.achieveMoney
+                                    t1: achieve.achieveMoney,
+                                    t3: achieve.t3,
+                                    projPercentage: achieve.commission,
                                 };
                                 item.achaeveList.push(achieveNew);
                                 break;
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..3a9153b 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">保存</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"
+                                           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,22 @@
 
         },
         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;
+
+            var achieveDel = false;
+            if (this.achieveItems.length > 1) {
+                achieveDel = true;
+            }
+            this.achieveItems.forEach(item=>{
+                item.achieve = item.consume + item.cardCash;
+                item.isShare = achieveDel;
+            })
             this.order.orderTime = moment(this.order.orderTime).format("YYYY-MM-DD HH:mm");
 
             var arrears = 0;
@@ -271,14 +325,30 @@
                     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;
+            },
+            shareAchieve(index, row) {
+                var row2 = JSON.parse(JSON.stringify(row));
+                this.achieveItems.push(row2);
+            },
+            delAchieve(index, row) {
+                this.achieveItems.splice(index, 1);
             },
             printf() {
                 var id = this.order.id;
@@ -290,6 +360,12 @@
                     content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id]
                 });
             },
+            checkAchieveIsDel(items) {
+                var orderItems = [];
+                for(var i = 0; i < items.length; i++) {
+                    var item = items[i];
+                }
+            },
             handleClick() {
 
             },

--
Gitblit v1.9.1