From 90ebe50085945f76743de252b7875e8f3f088eae Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Sun, 14 Mar 2021 19:53:38 +0800
Subject: [PATCH] 分销员后台0315

---
 zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html |  192 ++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 160 insertions(+), 32 deletions(-)

diff --git a/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html b/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html
index 8d2fe90..17e7e78 100644
--- a/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html
+++ b/zq-erp/src/main/resources/templates/views/admin/fenxiao/fenxiao-user.html
@@ -149,42 +149,58 @@
                 </el-tab-pane>
 
                 <el-tab-pane label="分佣方案" name="second">
-                    <template>
-                        <el-table
-                                :data="tableData"
-                                style="width: 100%"
-                                height="250">
+                    <el-row class="table-style" >
+                        <el-table id="proj" :data="fyfaList.rows"  :height="height">
                             <el-table-column
                                     prop="name"
-                                    label="方案名称"
-                                    width="180">
+                                    label="方案名称">
+                                <template slot-scope="scope">
+                                    <el-input class="edit-input" v-model="scope.row.name" placeholder="方案名称"></el-input>
+                                </template>
                             </el-table-column>
                             <el-table-column
-                                    prop="name"
-                                    label="推广提成%"
-                                    width="180">
+                                    prop="sealesCommission"
+                                    label="推广提成 %">
+                                <template slot-scope="scope">
+                                    <el-input class="edit-input" v-model="scope.row.sealesCommission" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="推广提成 %"></el-input>
+                                </template>
                             </el-table-column>
                             <el-table-column
-                                    prop="name"
-                                    label="邀请提成 %"
-                                    width="180">
+                                    prop="invitationCommission"
+                                    label="邀请提成 %">
+                                <template slot-scope="scope">
+                                    <el-input class="edit-input" v-model="scope.row.invitationCommission" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="邀请提成 %"></el-input>
+                                </template>
                             </el-table-column>
                             <el-table-column
-                                    prop="name"
-                                    label="等级条件(推广金额额)"
-                                    width="180">
+                                    prop="gradeCondition"
+                                    label="等级条件(推广金额)">
+                                <template slot-scope="scope">
+                                    <el-input class="edit-input" v-model="scope.row.gradeCondition" oninput ="value=value.replace(/[^0-9.]/g,'')" placeholder="等级条件(推广金额)"></el-input>
+                                </template>
                             </el-table-column>
-                            <el-table-column
-                                fixed="right"
-                                label="操作"
-                                width="100">
-                            <template slot-scope="scope">
-                                <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
-                                <el-button type="text" size="small">编辑</el-button>
-                            </template>
-                        </el-table-column>
+                            <el-table-column label="操作" width="240">
+                                <template slot-scope="scope">
+                                    <el-row style="display:flex;">
+                                        <el-button type="primary" v-if="scope.row.isDefault == 1" size="mini" @click="addFyfa()">新增</el-button>
+                                        <el-button type="primary" size="mini" @click="updateFyfa(scope.row)">保存</el-button>
+                                        <el-button type="primary" v-if="scope.row.isDefault == 2" size="mini" @click="delFyfa(scope.row)">删除</el-button>
+                                    </el-row>
+                                </template>
+                            </el-table-column>
                         </el-table>
-                    </template>
+                    </el-row>
+                    <el-row class="paginationStyle"  >
+                        <el-pagination background
+                                       @size-change="changePageSizelow"
+                                       @current-change="changeCurrentPagelow"
+                                       :current-page="fyfaList.currentPage"
+                                       :page-sizes="[10, 20, 30, 50]"
+                                       :page-size="fyfaList.pageSize"
+                                       layout="total, sizes, prev, pager, next, jumper"
+                                       :total="fyfaList.total">
+                        </el-pagination>
+                    </el-row>
                 </el-tab-pane>
 
                 <el-tab-pane label="推广文案" name="third">
@@ -196,6 +212,7 @@
                         <el-button type="primary" @click="submit()">保存</el-button>
                     </el-row>
                 </el-tab-pane>
+
                 <el-tab-pane label="分享图片上传" name="fourth">
                     <el-row>
                         <div class="ibox-content">
@@ -217,6 +234,7 @@
                         </div>
                     </el-row>
                 </el-tab-pane>
+
             </el-tabs>
         </el-row>
 </div>
@@ -238,17 +256,24 @@
     var app = new Vue({
         el: '#app',
         data: {
+            height:'calc(100vh - 240px)',
             fxy:[],
             fenxiaoGrade: "",
-            tableData:[],
             tgwa: "",
             activeName: 'first',
             multipleSelection: [],
-            jfyxq:[],
             fxtp:{},
-            jfdxj:[],
             mdjf:[],
             scjf:[],
+            //分佣方案
+            fyfaList:{
+                rows:[],
+                total:0,
+                pageSize:10,
+                currentPage:1,
+            },
+
+            //分销员管理
             shenheAgreeType : 2,
             shenheDisagreeType : 3,
             form:{
@@ -291,6 +316,7 @@
             loadInfo() {
                 let _this = this;
                 _this.loadParamSetting();
+                _this.loadFyfaSetting();
                 _this.getSalemanGradeList();
             },
             submittp(paramValue) {
@@ -311,6 +337,106 @@
             handleClick(row) {
                 console.log(row);
             },
+            //分佣方案
+            loadFyfaSetting() {
+                let _this = this;
+                let data=_this.getRequestParam();
+                data.pageSize=_this.fyfaList.pageSize;
+                data.pageNum=_this.fyfaList.currentPage;
+                AjaxProxy.requst({
+                    app: _this,
+                    data:data,
+                    url: basePath + '/fenXiao/fenXiaoUser/findFyfaManageList',
+                    callback: function (data) {
+                        _this.fyfaList.rows = data.rows;
+                        _this.fyfaList.total = data.total;
+                    }
+                });
+            },
+            changePageSizelow(val) {
+                this.fyfaList.pageSize = val;
+                this.loadFyfaSetting();
+            },
+            changeCurrentPagelow(val) {
+                this.fyfaList.currentPage = val;
+                this.loadFyfaSetting();
+            },
+            //新增
+            addFyfa(){
+                let _this = this;
+                AjaxProxy.requst({
+                    app: _this,
+                    data:[],
+                    url: basePath + '/fenXiao/fenXiaoUser/addFyfa',
+                    callback: function (data) {
+                        _this.$message.success(data.info);
+                    }
+                });
+                _this.loadFyfaSetting();
+            },
+            updateFyfa(row){
+                let _this = this;
+                let id = row.id;
+                let name = row.name;
+                let sealesCommission = row.sealesCommission;
+                let invitationCommission = row.invitationCommission;
+                let gradeCondition = row.gradeCondition;
+                let obj = {
+                    id: id,
+                    name: name,
+                    sealesCommission: sealesCommission,
+                    invitationCommission: invitationCommission,
+                    gradeCondition: gradeCondition,
+                }
+                AjaxProxy.requst({
+                    app: _this,
+                    data:obj,
+                    url: basePath + '/fenXiao/fenXiaoUser/updateFyfa',
+                    callback: function (data) {
+                        _this.$message.success(data.info);
+                        _this.loadFyfaSetting();
+                    }
+                });
+            },
+            //删除
+            delFyfa(row){
+                let _this = this;
+                _this.$confirm('是否删除?', '删除', {
+                    distinguishCancelAndClose: true,//设置关闭按钮和不通过按钮的区别
+                    confirmButtonText: '确认',
+                    cancelButtonText: '取消',
+                    type: 'info'
+                }).then(() => {
+                    //通过
+                    _this.delFyfaApply(row);
+                    _this.loadFyfaSetting();
+                }).catch(action => {
+                    //不通过
+                    if(action === 'cancel'){
+                        console.log("cancel");
+                    }else{
+                        //关闭按钮
+                        console.log("close");
+                        //this.$message({type: 'info',message: ''})
+                    }
+                });
+            },
+            delFyfaApply(row){
+                let _this = this;
+                let id = row.id;
+                let obj = {
+                    gradeId: id,
+                }
+                AjaxProxy.requst({
+                    app: _this,
+                    data:obj,
+                    url: basePath + '/fenXiao/fenXiaoUser/delFyfaApply',
+                    callback: function (data) {
+                        _this.$message.success(data.info);
+                    }
+                });
+            },
+            //分销员管理
             loadParamSetting() {
                 let _this = this;
                 let data=_this.getRequestParam();
@@ -433,7 +559,7 @@
                     url: basePath + '/fenXiao/fenXiaoUser/delSaleManGradeApply',
                     callback: function (data) {
                         _this.$message.success(data.info);
-                        this.loadParamSetting();
+                        _this.loadParamSetting();
                     }
                 });
             },
@@ -444,7 +570,7 @@
                     title: "修改等级",
                     maxmin: true,
                     area: [MUI.SIZE_L, '500px'],
-                    content : [ basePath + '/admin/redirect/fenxiao/fenxiao-update?userId=' + row.userId ]
+                    content : [ basePath + '/admin/redirect/fenxiao/fenxiao-update?userId=' + row.userId+'&applyId='+row.id ]
                 }));
             },
             //审核
@@ -471,8 +597,10 @@
             examineSaleManApply(row,type){
                 let _this = this;
                 let userId = row.userId;
+                let applyId = row.id;
                 let obj = {
                     userId: userId,
+                    applyId: applyId,
                     applyState: type,
                 }
                 AjaxProxy.requst({
@@ -481,7 +609,7 @@
                     url: basePath + '/fenXiao/fenXiaoUser/examineSaleManApply',
                     callback: function (data) {
                         _this.$message.success(data.info);
-                        this.loadParamSetting();
+                        _this.loadParamSetting();
                     }
                 });
             },

--
Gitblit v1.9.1