Prechádzať zdrojové kódy

补贴金额可以为负数, 即线下退款,余额清0

(cherry picked from commit c90014f3bb2640f2f944267ebb343f39294dd596)
叶君翔 3 rokov pred
rodič
commit
d542932778
1 zmenil súbory, kde vykonal 206 pridanie a 34 odobranie
  1. 206 34
      web-ui/src/views/module/member/index.vue

+ 206 - 34
web-ui/src/views/module/member/index.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
-      <el-form-item label="代理商名称" prop="agentId">
-        <el-select v-model="queryParams.agentId" filterable clearable placeholder="请选择 / 输入代理商">
+      <el-form-item label="服务商名称" prop="agentId">
+        <el-select v-model="queryParams.agentId" filterable clearable placeholder="请选择 / 输入服务商">
           <el-option
             v-for="item in agentList"
             :key="item.id"
@@ -11,13 +11,23 @@
           </el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="员工名称" prop="personnelName">
+      <!-- <el-form-item label="员工名称" prop="personnelName">
         <el-input
           v-model="queryParams.personnelName"
           placeholder="请输入员工名称"
           clearable
           @keyup.enter.native="handleQuery"
         />
+      </el-form-item> -->
+      <el-form-item label="员工名称" prop="personnelId">
+        <el-select v-model="queryParams.personnelId" filterable clearable placeholder="请选择 / 输入员工">
+          <el-option
+            v-for="item in personnelList"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select>
       </el-form-item>
       <el-form-item label="昵称" prop="nickname">
         <el-input
@@ -56,7 +66,7 @@
           <el-option v-for="item in memberTypeOption" :key="item.value" :label="item.label" :value="item.value"/>
         </el-select>
       </el-form-item> -->
-      <el-form-item label="会员类型" prop="memberType" v-if="this.loginType != 2">
+      <el-form-item label="会员类型" prop="memberType">
         <el-select v-model="queryParams.memberType" placeholder="请选择类型" clearable >
           <el-option v-for="item in memberTypeOption" :key="item.value" :value="item.value" :label="item.label" />
         </el-select>
@@ -67,7 +77,7 @@
         </el-select>
       </el-form-item>
       <!-- <el-form-item>
-        <el-select v-model="queryParams.agentId" clearable placeholder="请选择代理商">
+        <el-select v-model="queryParams.agentId" clearable placeholder="请选择服务商">
           <el-option
             v-for="item in agentList"
             :key="item.id"
@@ -79,7 +89,7 @@
       <el-form-item>
         <el-button type="primary" icon="el-icon-search"  @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh"  @click="resetQuery">重置</el-button>
-        <el-button :disabled="this.ids.length == 0" type="primary" icon="el-icon-edit" @click="updateBatchAgent()" 
+        <el-button :disabled="this.ids.length == 0" type="primary" icon="el-icon-edit" @click="updateBatchAgent()"
         v-if="this.loginType != 2">批量编辑</el-button>
       </el-form-item>
     </el-form>
@@ -110,7 +120,7 @@
         </template>
       </el-table-column>
       <el-table-column label="昵称" align="center" prop="nickname" />
-      <el-table-column label="所属代理商" align="center" prop="agentNickName" >
+      <el-table-column label="所属服务商" align="center" prop="agentNickName" >
         <template slot-scope="scope">
           <span v-if="scope.row.agentNickName">{{scope.row.agentNickName}}</span>
           <span v-else>--</span>
@@ -156,7 +166,7 @@
         </template>
       </el-table-column>
       <el-table-column label="邀请码" align="center" prop="inviteCode" />
-      <!-- <el-table-column label="代理商名称" align="center" prop="agentNickName" v-if="user.type == 1" ></el-table-column> -->
+      <!-- <el-table-column label="服务商名称" align="center" prop="agentNickName" v-if="user.type == 1" ></el-table-column> -->
       <!-- <el-table-column label="状态" align="center" prop="status" v-if="this.loginType != 2">
         <template slot-scope="scope">
           <el-switch @change="updateStatus(scope.row.id,scope.row.status)" :active-value="1" :inactive-value="0"
@@ -179,13 +189,13 @@
             @click="updateStatus(scope.row.id,scope.row.status)"
           >
             <!-- <span v-if="scope.row.status == 1" style="color:red">禁用</span>
-            <span v-if="scope.row.status == 0">启用</span> -->    
+            <span v-if="scope.row.status == 0">启用</span> -->
             <span :style="scope.row.status === 1 ? 'color: red;' : ''">{{scope.row.status === 1 ? '禁用' : '启用'}}</span>
           </el-button>
           <el-button
             size="mini"
             type="text"
-            v-if="loginType != 2"
+            v-if="loginType != 2 && scope.row.memberType != 3"
             @click="subsidy(scope.row)"
           >补贴金额</el-button>
           <el-button
@@ -193,8 +203,8 @@
             type="text"
             icon="el-icon-edit"
             @click="updateAgent(scope.row)"
-            v-if="scope.row.agentId == null && scope.row.memberType != 3 && loginType != 2"
-          >绑定代理商</el-button>
+            v-if="scope.row.agentId == null && scope.row.memberType == 1 && loginType != 2"
+          >绑定服务商</el-button>
           <!-- <el-button
             size="mini"
             type="text"
@@ -214,16 +224,16 @@
       @pagination="getList"
     />
 
-    <!-- 添加或修改代理商对话框 -->
+    <!-- 添加或修改服务商对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="140px">
-        <el-form-item label="代理商"  v-if="user.type != 2">
+        <el-form-item label="服务商"  v-if="user.type != 2">
           <el-select v-model="form.agentId" placeholder="请选择" filterable @change="changeAgent" clearable>
             <el-option v-for="item in agentList" :key="item.id" :label="item.name" :value="item.id">
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="所属员工"  v-if="user.type != 2 && form.memberType == 1">
+        <el-form-item label="所属员工"  v-if="user.type != 2">
           <el-select v-model="form.personnelId" placeholder="请选择" filterable clearable>
             <el-option v-for="item in personnelOption" :key="item.id" :label="item.name" :value="item.id">
             </el-option>
@@ -236,7 +246,7 @@
       </div>
     </el-dialog>
 
-    <el-dialog title="补贴金额" :visible.sync="subsidyOpen" width="700px" append-to-body>
+    <!-- <el-dialog title="补贴金额" :visible.sync="subsidyOpen" width="700px" append-to-body>
       <el-form ref="dataForm" :model="dataForm" :rules="dataRules" label-width="140px">
         <el-form-item label="金额(单位:元)">
           <el-input-number :min="0" :max="99999" placeholder="请输入补贴金额" :precision="2" v-model="dataForm.amount" controls-position="right">
@@ -247,7 +257,53 @@
         <el-button type="primary" @click="submitDataForm">确 定</el-button>
         <el-button @click="cancelData">取 消</el-button>
       </div>
-    </el-dialog>
+    </el-dialog> -->
+
+    <el-dialog title="补贴金额" :visible.sync="subsidyOpen" width="700px">
+      <el-dialog
+        width="30%"
+        title="验证码验证"
+        :visible.sync="codeOpen"
+        append-to-body
+        class="onlyThree">
+
+        <div class="self-wrapper">
+          <h3 style="margin-top:5px;margin-left:10px">验证码:</h3>
+					<el-input class="onlyTwo" v-for="i in 6"
+							  :key="i"
+							  :class="[{'is-selected': i == state.selectIndex}]"
+                @input="selfFocus(i)"
+                :ref="`input${i}`"
+                v-model="state.selectList[i-1]"
+                :placeholder="state.tip[i-1]"
+                maxlength= "1" />
+				</div>
+
+        <div slot="footer" class="dialog-footer">
+          <el-button type="primary" @click="submitDataForm">确 定</el-button>
+          <el-button @click="cancelData">取 消</el-button>
+        </div>
+      </el-dialog>
+
+      <el-form ref="dataForm" :model="dataForm" :rules="dataRules" label-width="140px">
+        <el-form-item label="金额(单位:元)" prop="amount">
+          <el-input-number placeholder="请输入补贴金额" :precision="2" v-model="dataForm.amount" controls-position="right">
+          </el-input-number>
+        </el-form-item>
+
+        <el-form-item label="理由" prop="reason">
+          <el-input maxlength="20" placeholder="请输入理由" v-model="dataForm.reason" type="textarea" :rows="2" style="width:450px">
+          </el-input>
+        </el-form-item>
+      </el-form>
+
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="subsidyOpen = false">取 消</el-button>
+        <el-button type="primary" @click="sendCode">验证码验证</el-button>
+      </div>
+  </el-dialog>
+
+
   </div>
 </template>
 
@@ -262,6 +318,12 @@ export default {
   },
   data() {
     return {
+      state: {
+        selectIndex: undefined,
+        selectList: [],
+        tip: ['请', '输', '入', '验', '证', '码'],
+        mobile: '18550206905'
+      },
       // 登录的角色
       loginType: 2,
       agentList: [],
@@ -287,6 +349,7 @@ export default {
       // 遮罩层
       loading: true,
       agentList:[],
+      personnelList: [],
       // 选中数组
       ids: [],
       // 非单个禁用
@@ -304,6 +367,7 @@ export default {
       // 是否显示弹出层
       open: false,
       subsidyOpen: false,
+      codeOpen: false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -338,22 +402,28 @@ export default {
         inviteCode: undefined,
         status: undefined,
         personnelName: undefined,
+        personnelId: undefined
       },
       // 表单参数
       form: {},
       dataForm: {
         id: undefined,
-        amount: undefined
+        amount: undefined,
+        code: undefined,
+        reason: undefined
       },
       // 表单校验
       rules: {
         agentId: [
-          { required: true, message: "代理商Id不能为空", trigger: "blur" }
+          { required: true, message: "服务商Id不能为空", trigger: "blur" }
         ]
       },
       dataRules: {
         amount: [
           { required: true, message: "补贴金额不能为空", trigger: "blur" }
+        ],
+        reason: [
+          { required: true, message: "补贴理由不能为空", trigger: "blur" }
         ]
       },
     };
@@ -368,9 +438,48 @@ export default {
         this.agentList = data.list.rows
         this.type = data.type
       }
-    })
+    });
+
+    this.$http.get(`/module/personnel/personnelList`).then(({data}) => {
+      console.log('data2', data)
+      if (data) {
+        console.log('data', data)
+        this.personnelList = data
+      }
+    });
   },
   methods: {
+    selfFocus(i){
+      let val = this.state.selectList[i-1]
+      if(val.trim() && i < 6){
+        this.$refs[`input${i+1}`][0].focus()
+      }
+      if(!val.trim() && i > 1){
+        this.$refs[`input${i-1}`][0].focus()
+      }
+    },
+    sendCode() {
+      this.state.selectList = []
+      if(this.dataForm.amount == undefined) {
+        this.$message.error("补贴金额不能为空!");
+        return;
+      }
+
+      // if(this.dataForm.amount <= 0) {
+      //   this.$message.error("输入金额必须大于0元!");
+      //   return;
+      // }
+
+      if(this.dataForm.reason == undefined) {
+        this.$message.error("补贴理由不能为空!");
+        return;
+      }
+
+      this.$http.post("/module/member/sendCode?mobile=" + this.state.mobile).then(( { data }) => {
+        console.log('code', data)
+      });
+      this.codeOpen = true
+    },
     changeAgent() {
       this.personnelOption = [];
       this.form.personnelId = undefined;
@@ -378,7 +487,7 @@ export default {
         this.personnelOption = response.data
         console.log("option2", this.personnelOption)
       });
-      
+
     },
     getAgents(){
        this.$http
@@ -398,15 +507,22 @@ export default {
       } else {
         return 1;//可勾选
       }
-         
+
     },
 
     subsidy(row) {
+      this.dataForm = {
+        id: undefined,
+        amount: undefined,
+        code: undefined,
+        reason: undefined
+      };
+
       this.dataForm.id = row.id;
       console.log(row.id)
       this.subsidyOpen = true;
     },
-    
+
     updateStatus(id, status) {
       // if(){
       //   return
@@ -441,8 +557,8 @@ export default {
         });
       }).catch((err) => {
         console.log(err)
-      }) 
-      
+      })
+
     },
     /** 查询会员列表 */
     getList() {
@@ -459,9 +575,10 @@ export default {
       this.reset();
     },
     cancelData() {
-      this.subsidyOpen = false;
-      this.dataForm.amount = undefined;
-      this.dataForm.id = undefined;
+      // this.subsidyOpen = false;
+      this.codeOpen = false;
+      // this.dataForm.amount = undefined;
+      //this.dataForm.id = undefined;
     },
     // 表单重置
     reset() {
@@ -524,7 +641,7 @@ export default {
     },
     /** 详情按钮操作 */
     handleUpdate(row) {
-      this.$router.push({ path: '/member/edit', query: { id: row.id } })
+      this.$router.push({ path: '/member/member/edit', query: { id: row.id } })
     },
     /** 修改按钮操作 */
     updateAgent(row) {
@@ -534,17 +651,17 @@ export default {
         // this.form = response.data;
         this.form = Object.assign({}, { personnelId: '' }, response.data);
         this.open = true;
-        this.title = "绑定代理商";
+        this.title = "绑定服务商";
       });
     },
     updateBatchAgent() {
       this.reset();
       this.open = true;
-      this.title = "批量编辑代理商"
+      this.title = "批量编辑服务商"
     },
     /** 提交按钮 */
     submitForm() {
-      if(this.title == "批量编辑代理商") {
+      if(this.title == "批量编辑服务商") {
         if(this.ids.length > 0) {
           updateBatchAgent(this.ids, this.form.agentId, this.form.personnelId).then(response => {
             this.msgSuccess("修改成功");
@@ -573,7 +690,18 @@ export default {
       }
     },
     submitDataForm() {
-      this.$confirm('是否给改用户补贴' + this.dataForm.amount +'元', "提示", {
+
+      console.log('selectList', this.state.selectList)
+      if(this.state.selectList.length > 0) {
+        this.dataForm.code = this.state.selectList.join(',').replace(/,/g,'');
+        console.log('code', this.dataForm.code)
+      }else {
+        this.$message.error("验证码不能为空!");
+        return
+      }
+
+      this.dataForm.mobile = this.state.mobile;
+      this.$confirm('是否给该用户补贴' + this.dataForm.amount +'元', "提示", {
           confirmButtonText: "确定",
           cancelButtonText: "取消",
           type: "warning"
@@ -586,7 +714,8 @@ export default {
                   message: '操作成功!'
                 });
                 this.subsidyOpen = false;
-                this.getList(); 
+                this.codeOpen = false;
+                this.getList();
             } else {
               this.$message.error(data.msg);
             }
@@ -628,3 +757,46 @@ export default {
   }
 };
 </script>
+
+<style lang="scss">
+    .onlyTwo.el-input {
+      width: 50px;
+
+      .el-input__inner {
+        border-radius: 0;
+      }
+
+      &:first-of-type {
+        .el-input__inner {
+          border-radius: 10px 0 0 10px;
+        }
+      }
+
+      &:last-of-type {
+        .el-input__inner {
+          border-radius: 0 10px 10px 0;
+        }
+      }
+
+      &+.el-input {
+        margin-left: -1px;
+      }
+
+      &.is-selected {
+        z-index: 2;
+      }
+    }
+
+    .onlyThree.el-dialog__body {
+        display: flex;
+        justify-content: center;
+        align-content: center;
+    }
+</style>
+
+<style lang="scss" scoped>
+  .self-wrapper {
+    display: flex;
+    // margin-top: 20px;
+  }
+</style>