浏览代码

部门新增比例

王涛 3 年之前
父节点
当前提交
1710dc9e2f

+ 1 - 0
package.json

@@ -51,6 +51,7 @@
         "nprogress": "0.2.0",
         "qrcode": "^1.5.0",
         "qrcodejs2": "0.0.2",
+        "qs": "^6.10.3",
         "quill": "1.3.7",
         "screenfull": "5.0.2",
         "sortablejs": "1.10.2",

+ 12 - 1
src/api/recharge/department.js

@@ -1,5 +1,5 @@
 import request from '@/utils/request'
-
+import { praseStrEmpty } from "@/utils/yongtian";
 // 新增
 export function addChannel(data) {
     return request({
@@ -39,4 +39,15 @@ export function deptJob(params) {
         method: 'post',
         params
     })
+}
+
+// 部门批量处理绑定充值比例
+export function updataByDept(query) {
+    console.log(query)
+    return request({
+        url: '/dxtop/staff/addListByDept',
+        method: 'put',
+        params: query
+        
+    })
 }

+ 109 - 5
src/views/recharge/department/index.vue

@@ -15,9 +15,19 @@
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
         <el-button type="primary" icon="el-icon-refresh" size="mini" @click="synchrodeptJob">部门信息同步</el-button>
+        <el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="batchChange(1)">部门充值比例绑定</el-button>
+        <el-button type="warning" icon="el-icon-remove-outline" size="mini" @click="batchChange(0)">部门充值比例解除</el-button>
       </el-form-item>
     </el-form>
-    <el-table  :data="adminList" height="calc(100vh - 10vh - 120px)">
+    <el-table  :data="adminList"  @current-change="selectBrand" height="calc(100vh - 10vh - 120px)">
+      <el-table-column
+        label="选择项"
+        width="80">
+        <template slot-scope="scope">
+          <el-radio v-model="tableRadio" :label="scope.row">{{""}}</el-radio>
+        </template>
+      </el-table-column>
+      <!-- <el-table-column type="selection" width="50" align="center" /> -->
       <el-table-column label="id" align="center" prop="id" show-overflow-tooltip />
       <el-table-column label="部门名称" align="center" prop="name"  show-overflow-tooltip />
       <el-table-column label="创建人" align="center" prop="createBy"  show-overflow-tooltip />
@@ -27,6 +37,21 @@
         </template>
       </el-table-column>
     </el-table>
+    <!-- 添加或修改参数配置对话框 -->
+    <el-dialog   :title="title" :visible.sync="open" width="600px" append-to-body :before-close="cancel" :close-on-click-modal="false"  >
+      <el-form ref="queryParams" :model="queryParams"  :rules="rules" label-width="120px" >
+        <el-form-item label="到账比例:" prop="id">
+          <el-select v-model="queryParams.id" style="width: 240px" placeholder="请选择到账比例" clearable size="small" >
+            <el-option :label="`${item.identity}:${item.proportion}`"  :value="item.id" v-for="(item, index) in radioList" :key="index" />
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm" v-if="!loading">确 定</el-button>
+        <el-button :loading="loading" type="primary" @click="submitForm" v-else>提交中...</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
     <pagination
       v-show="total>0"
       :total="total"
@@ -38,8 +63,9 @@
 </template>
 
 <script>
-import { listChannel, deptJob } from "@/api/recharge/department";
-
+import { listChannel, deptJob, updataByDept } from "@/api/recharge/department";
+import { allRadio } from "@/api/recharge/radio";
+import qs from 'qs'
 export default {
   name: "admin",
   data() {
@@ -74,13 +100,23 @@ export default {
         current: 1,
         size: 10,
         name: undefined,
-        aliasName: undefined,
+        id: undefined,
       },
+      //批量到账比例处理
+      staffList:{},
+      // 到账比例
+      radioList:[],
       // 表单参数
       form: {
         name:'',
-        aliasName:''
       },
+      // 表单校验
+      rules: {
+        id:[
+           { required: true, message: "充值比例不能为空", trigger: "change"},
+        ],
+      },
+      tableRadio: {},
     };
   },
   created() {
@@ -122,6 +158,74 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 单选框选中数据
+    selectBrand(row) {
+      this.tableRadio = row
+    },
+    /** 获取充值管理的数据用于修改赋值 */
+    getListczgl() {
+      allRadio().then(response => {
+        this.radioList = response.data.map(item=>{
+          return {
+            identity:item.identity,
+            proportion:item.proportion,
+            id:item.id
+          }
+        })
+      });
+    },
+    //批量处理
+    batchChange(change){
+      if(this.tableRadio){
+        if(change == "1"){
+            this.getListczgl()
+            this.open = true;
+            this.title = "修改参数";
+        }else{
+          this.loading = true;
+          this.staffList.deptId = this.tableRadio.did
+          this.staffList.radioId = 1
+          this.staffList.isBinding = 0
+          updataByDept(this.staffList).then(response =>{
+            this.loading = false;
+            this.msgSuccess(`${this.tableRadio.name} 解绑完成`)
+            this.getList();
+          }).catch(err=>{
+            this.loading = false;
+          })
+        }
+      }else{
+        this.$message.error('请勾选需要处理充值到账比例部门信息')
+      }
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["queryParams"].validate(valid => {
+        if (valid) {
+          if(this.queryParams.id){
+            this.loading = true;
+            
+            this.staffList.deptId = this.tableRadio.did
+            this.staffList.radioId = this.queryParams.id
+            this.staffList.isBinding = 1
+            updataByDept(this.staffList).then(response =>{
+              this.loading = false;
+              this.open = false;
+              this.msgSuccess(`${this.tableRadio.name} 绑定完成`)
+              this.getList();
+              this.reset()
+            }).catch(err=>{
+              this.loading = false;
+            })
+          }
+        }
+      })
+    },
   }
 };
 </script>

+ 2 - 0
src/views/recharge/detailed/index.vue

@@ -87,6 +87,8 @@
       <el-table-column label="姓名" align="center" prop="userName"  show-overflow-tooltip />
       <el-table-column label="手机号" align="center" prop="userPhone" show-overflow-tooltip />
       <el-table-column label="充值金额" align="center" prop="money" show-overflow-tooltip />
+      <el-table-column label="到账金额" align="center" prop="realMoney" show-overflow-tooltip />
+      <el-table-column label="到账比例" align="center" prop="topRadio" show-overflow-tooltip />
       <el-table-column label="支付状态" align="center" prop="orderFlag" show-overflow-tooltip >
         <template slot-scope="scope">
           <span v-if="scope.row.orderFlag == 0" style="color:#909399">未支付</span>

+ 7 - 7
src/views/recharge/personnel/index.vue

@@ -35,8 +35,8 @@
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
         <el-button type="primary" icon="el-icon-refresh" size="mini" @click="synchroPersonnel">人员信息同步</el-button>
-        <el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="batchChange(0)">批量绑定</el-button>
-        <el-button type="primary" icon="el-icon-remove-outline" size="mini" @click="batchChange(1)">批量解除</el-button>
+        <el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="batchChange(1)">批量绑定</el-button>
+        <el-button type="warning" icon="el-icon-remove-outline" size="mini" @click="batchChange(0)">批量解除</el-button>
       </el-form-item>
     </el-form>
     <el-table  :data="adminList" @selection-change="handleSelectionChange" height="calc(100vh - 10vh - 120px)">
@@ -245,7 +245,7 @@ export default {
     //批量处理
     batchChange(change){
       if(this.ids.length>0){
-        if(change == 0){
+        if(change == "1"){
             this.open = true;
             this.title = "修改参数";
         }else{
@@ -254,12 +254,12 @@ export default {
             return {
               staffId:item.sid,
               radioId:item.radioId,
-              delFlag:change
+              delFlag:0
             }
           })
           staff(this.staffList).then(response =>{
             this.loading = false;
-            this.msgSuccess('批量处理完成')
+            this.msgSuccess('批量解绑完成')
             this.getList();
           }).catch(err=>{
             this.loading = false;
@@ -281,13 +281,13 @@ export default {
               return {
                 staffId:item.sid,
                 radioId:this.queryParams.id,
-                delFlag:0
+                delFlag:1
               }
             })
             staff(this.staffList).then(response =>{
               this.loading = false;
               this.open = false;
-              this.msgSuccess('批量处理完成')
+              this.msgSuccess('批量绑定完成')
               this.getList();
               this.reset()
             }).catch(err=>{