From fb382d41749648456060afba37eb83c7a0873075 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 13 Apr 2021 19:22:15 +0800
Subject: [PATCH] add paiban items can modify

---
 zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 1 deletions(-)

diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
index 4ee39fd..dc6119c 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
@@ -101,6 +101,12 @@
                             </div>
                         </div>
                         <div class="form-group">
+                            <label class="col-md-1 control-label"></label>
+                            <div class="col-md-11">
+                                <el-button size="medium" type="primary" @click="addProjForm">新增项目</el-button>
+                            </div>
+                        </div>
+                        <div class="form-group">
                             <label class="col-md-1 control-label">服务设置</label>
                             <div class="col-md-11">
                                 <table class="table table-bordered">
@@ -110,6 +116,7 @@
                                         <th>服务时间</th>
                                         <th width="300px">美疗师</th>
                                         <th style="width: 100px;">提成</th>
+                                        <th>操作</th>
                                     </tr>
 
                                     <tr v-for="(item,index) in projService.serviceItems">
@@ -153,6 +160,10 @@
                                         <td>
                                             <el-input v-model="item.extract"></el-input>
                                         </td>
+                                        <td>
+                                            <el-button size="mini" type="danger"
+                                                    @click="handleDelete(index)">删除</el-button>
+                                        </td>
 
                                     </tr>
 
@@ -186,6 +197,7 @@
 </div>
 <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="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script>
 <script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script>
 <script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script>
@@ -201,6 +213,8 @@
             },
             //美疗师分配列表
             serviceItems: [],
+            // 删除的服务单明细
+            deleteItems : [],
             //美疗师
             beauty: [],
             pls: [],
@@ -339,6 +353,7 @@
                     devisionId: projService.devisionId,
                     yyTime: projService.yyTime,
                     serviceItems: serviceItems,
+                    deleteItems : _this.deleteItems,
                     //床位时间
                     bedState: {
                         startTime: startTime,
@@ -477,7 +492,93 @@
                 });
                 _this.projService.totalTime = totalTime;
                 _this.changeYyTime();
-            }
+            },
+            handleDelete : function(index) {
+                let _this = this;
+                var items = this.projService.serviceItems;
+                if (items.length > 1) {
+                    let delItem = items.splice(index, 1);
+                    if (delItem[0].servicesId) {
+                        AjaxProxy.requst({
+                            app: _this,
+                            url: basePath + "/admin/projService/delServiceOrderItems?id="+delItem[0].id,
+                            callback: function (data) {
+                                _this.$message({
+                                    message: data.info,
+                                    type: 'success'
+                                });
+                            }
+                        });
+                    }
+
+                } else {
+                    this.$message({
+                        message: '需保留一个项目',
+                        type: 'error'
+                    });
+                }
+            },
+            addProjForm() {
+                var vipId = this.projService.vipInfo.id;
+                layer.full(layer.open({
+                    type: 2,
+                    title: "添加项目",
+                    maxmin: true,
+                    area: [MUI.SIZE_L, '500px'],
+                    content: [basePath + '/admin/redirect/hive/beautySalon/yyServiceAddForm?id='+vipId]
+                }));
+            },
+            addProjItems(rows) {
+                let _this = this;
+                var serviceItems = this.projService.serviceItems;
+
+                for (let i = 0; i < rows.length; i++) {
+                    let row = rows[i]
+
+                    let flag = false;
+                    for (let j = 0; j < serviceItems.length; j++) {
+                        let item = serviceItems[j];
+                        if (item.puseId == row.projUse.id) {
+                            flag = true;
+                            break;
+                        }
+                    }
+
+                    if (flag) {
+                        continue;
+                    }
+
+                    let items = [];
+                    row.projUse.projInfo.name = row.name + "--" + row.projUse.projName;
+                    items.push({
+                        puseId : row.projUse.id,
+                        count : row.count,
+                        projUse : row.projUse,
+                        projInfo : row.projUse.projInfo
+                    });
+
+                    let data = {};
+                    data.id = _this.projService.id;
+                    data.state = _this.projService.state;
+                    data.serviceItems = items;
+
+                    AjaxProxy.requst({
+                        app: _this,
+                        data : data,
+                        url: basePath + "/admin/projService/addService",
+                        callback: function (data) {
+                            _this.$message({
+                                message: "添加成功",
+                                type: 'success'
+                            });
+
+                            _this.loadInfo();
+                        }
+                    });
+                }
+
+            },
+
 
         },
         filters:

--
Gitblit v1.9.1