Procházet zdrojové kódy

消费记录、现金权限分离

wangtao před 3 roky
rodič
revize
bf8ba6b754

+ 26 - 0
src/api/recharge/consumption.js

@@ -0,0 +1,26 @@
+import request from '@/utils/request'
+
+// 查询
+export function listDetal(data) {
+    return request({
+        url: '/dxtop/dish/page',
+        method: 'post',
+        data: data
+    })
+}
+// // 修改
+// export function updataChannel(data) {
+//     return request({
+//         url: '/dxtop/order',
+//         method: 'put',
+//         data: data
+//     })
+// }
+// 导出
+export function exportDetail(data) {
+    return request({
+        url: '/dxtop/order/exportDetail',
+        method: 'post',
+        data: data,
+    })
+}

+ 13 - 5
src/api/recharge/department.js

@@ -42,12 +42,20 @@ export function deptJob(params) {
 }
 
 // 部门批量处理绑定充值比例
-export function updataByDept(query) {
-    console.log(query)
+export function updataByDept(data) {
     return request({
         url: '/dxtop/staff/addListByDept',
-        method: 'put',
-        params: query
-        
+        method: 'post',
+        data
+
+    })
+}
+// 部门批量处理绑定充值比例
+export function deptList(data) {
+    return request({
+        url: '/dxtop/dept/list',
+        method: 'post',
+        data
+
     })
 }

+ 2 - 1
src/main.js

@@ -16,7 +16,7 @@ import './assets/icons' // icon
 import './permission' // permission control
 import { getDicts } from "@/api/system/dict/data";
 import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, downloadBlob, handleTree } from "@/utils/yongtian";
+import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, downloadBlob, handleTree, handleTree2 } from "@/utils/yongtian";
 import Pagination from "@/components/Pagination";
 // 自定义表格工具组件
 import RightToolbar from "@/components/RightToolbar"
@@ -45,6 +45,7 @@ Vue.prototype.selectDictLabels = selectDictLabels
 Vue.prototype.download = download
 Vue.prototype.downloadBlob = downloadBlob
 Vue.prototype.handleTree = handleTree
+Vue.prototype.handleTree2 = handleTree2
 Vue.prototype.$echarts = echarts
 
 Vue.prototype.msgSuccess = function(msg, time) {

+ 51 - 0
src/utils/yongtian.js

@@ -191,3 +191,54 @@ export function handleTree(data, id, parentId, children) {
     }
     return tree;
 }
+/**
+ * 构造树型结构数据
+ * @param {*} data 数据源
+ * @param {*} id id字段 默认 'id'
+ * @param {*} parentId 父节点字段 默认 'parentId'
+ * @param {*} children 孩子节点字段 默认 'children'
+ */
+export function handleTree2(data, id, parentId, children) {
+    let config = {
+        id: id || 'id',
+        parentId: 'pid',
+        childrenList: children || 'children'
+    };
+
+    var childrenListMap = {};
+    var nodeIds = {};
+    var tree = [];
+
+    for (let d of data) {
+        let parentId = d[config.parentId];
+        if (childrenListMap[parentId] == null) {
+            childrenListMap[parentId] = [];
+        }
+        nodeIds[d[config.id]] = d;
+        childrenListMap[parentId].push(d);
+    }
+
+
+    for (let d of data) {
+        let parentId = d[config.parentId];
+        if (nodeIds[parentId] == null) {
+            tree.push(d);
+        }
+    }
+    for (let t of tree) {
+        adaptToChildrenList2(t);
+    }
+
+
+    function adaptToChildrenList2(o) {
+        if (childrenListMap[o[config.id]] !== null) {
+            o[config.childrenList] = childrenListMap[o[config.id]];
+        }
+        if (o[config.childrenList]) {
+            for (let c of o[config.childrenList]) {
+                adaptToChildrenList2(c);
+            }
+        }
+    }
+    return tree;
+}

+ 217 - 0
src/views/recharge/cash/index.vue

@@ -0,0 +1,217 @@
+<template>
+  <div class="app-container" v-loading="loading">
+    <el-form :model="form" :rules="rules" ref="form" label-width="140px">
+      <el-form-item label="姓名:" prop="userName">
+        <el-input
+          v-model.trim="form.userName"
+          placeholder="请输入姓名"
+          clearable
+          :readonly=true
+        />
+      </el-form-item>
+      <el-form-item label="手机号码:" prop="userPhone">
+        <el-input
+          v-model.trim="form.userPhone"
+          placeholder="请输入手机号码"
+          clearable
+          maxlength="11"
+          minlength="11"
+          type="text"
+          onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"
+        />
+      </el-form-item>
+      <el-form-item label="充值金额:" prop="money">
+        <el-input  v-model.trim="form.money"  placeholder="请输入充值金额" type="tel"   @input="inputMoney" min="0.10" />
+      </el-form-item>
+      <el-form-item label="充值到账比例:" prop="proportion">
+        <el-input
+          v-model.trim="form.proportion"
+          placeholder="充值到账比例"
+          clearable
+          :disabled="true"
+        />
+      </el-form-item>
+
+      <el-form-item label-width="0" style="margin-top:50px;" class="payTypeClass" prop="payType">
+        <!-- <img src="../../../assets/images/xj.png" alt="" @click="form.payType = 1" v-if="form.payType !== 1">
+        <img src="../../../assets/images/xj-c.png" alt="" v-if="form.payType === 1"> -->
+        <!-- <img src="../../../assets/images/wx.png" alt="" @click="form.payType = 2" v-if="form.payType !== 2">
+        <img src="../../../assets/images/wx-c.png" alt="" v-if="form.payType === 2">
+        <img src="../../../assets/images/zfb.png" alt="" @click="form.payType = 3" v-if="form.payType !== 3">
+        <img src="../../../assets/images/zfb-c.png" alt="" v-if="form.payType === 3"> -->
+      </el-form-item>
+      <el-form-item label-width="0" style="margin-top:50px;">
+        <el-button type="primary" @click="submitForm" style="width:100%">充值</el-button>
+      </el-form-item>
+    </el-form>
+    <div class="qrcode" ref="qrCodeUrl"></div>
+    <img :src="codeUrl" alt="请扫描二维码支付" v-if="codeUrl" title="请扫描二维码支付">
+  </div>
+</template>
+
+<script>
+import QRCode from 'qrcodejs2'
+import { order, topScanPayApi } from "@/api/recharge/userRecharge";
+import { validatePhone } from "@/utils/validate2";
+export default {
+  name: "admin",
+  data() {
+    return {
+      loading:true,
+      // 表单参数
+      form: {
+        userPhone:'',
+        userName:'',
+        money:'',
+        proportion:'',
+        payType:0,
+        userId:undefined,
+        scene:1
+      },
+      formSubmit:{
+        userPhone:'',
+        userName:'',
+        money:'',
+        payType:0,
+        userId:undefined,
+        scene:1
+      },
+      codeUrl:null,
+      // 表单校验
+      rules: {
+        userPhone: [
+          { required: true, message: "手机号码不能为空", trigger: "blur",  },
+          { validator: validatePhone,  trigger: "blur" },
+
+        ],
+        userName: [
+          { required: true, message: "姓名不能为空", trigger: "blur" }
+        ],
+        money: [
+          { required: true, message: "充值金额不能为空", trigger: "blur" },
+        ],
+        // proportion: [
+        //   { required: true, message: "充值到账比例不能为空,请返回页面绑定比例关系", trigger: "blur" }
+        // ],
+        payType: [
+          { required: true, message: "请选择支付方式", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created(){
+    if(localStorage.getItem("chongzhi")){
+      this.loading = false
+      let obj = JSON.parse(localStorage.getItem("chongzhi"))
+      this.form.userName = obj.name
+      this.form.proportion = obj.proportion
+      this.form.userId = obj.sid
+      this.form.userPhone = obj.contacts
+      localStorage.removeItem('chongzhi')
+    }else{
+      this.$message.error('请从人员信息充值入口进入该页面')
+      setTimeout(() =>{
+        this.$router.push({path:'personnel'})
+      },1500)
+    }
+  },
+  methods: {
+    creatQrCode(url) {
+      var qrcode = new QRCode(this.$refs.qrCodeUrl, {
+          text: url, // 需要转换为二维码的内容
+          width: 250,
+          height: 250,
+          colorDark: '#000000',
+          colorLight: '#ffffff',
+          correctLevel: QRCode.CorrectLevel.H
+      })
+      this.msgSuccess("已生成支付二维码,请扫描二维码进行支付。");
+      this.loading = false
+    },
+    inputMoney(e){ //金额充值效验
+      var val = e.replace(/(^\s*)|(\s*$)/g, "")
+      if (!val) {
+        this.form.money = '';
+        return
+      }
+      var reg = /[^\d.]/g
+      // 只能是数字和小数点,不能是其他输入
+      val = val.replace(reg, "")
+      // // 保证第一位只能是数字,不能是点
+      val = val.replace(/^\./g, "");
+      // // 小数只能出现1位
+      val = val.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
+      // // 小数点后面保留2位
+      val = val.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3');
+      if(val.indexOf("0") == 0){
+        if(val.length == 2){
+          val = "0."
+        }
+      }
+      this.$nextTick(() => {
+          this.form.money = val;
+      })
+	  },
+    forceUpdate(){ //重置form
+      this.form = JSON.parse(JSON.stringify(this.form));
+    },
+
+    /** 提交按钮 */
+    submitForm(row) {
+      this.form.payType = 1
+      if(this.form.money == 0){
+        this.msgError("充值金额不能为0元")
+      }else{
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+
+            this.loading = true
+
+            this.formSubmit.userPhone = this.form.userPhone
+            this.formSubmit.userName = this.form.userName
+            this.formSubmit.money = Number(this.form.money).toFixed(2)
+            this.formSubmit.payType = this.form.payType
+            this.formSubmit.userId = this.form.userId
+            this.formSubmit.userId = this.form.userId
+            if (this.form.payType === 1) { //后台现金
+              order(this.formSubmit).then(response => {
+                this.msgSuccess("已生成支付订单");
+                this.codeUrl = '';
+                this.loading = false
+              });
+            }
+            this.reset()
+          }
+        })
+      }
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        userPhone:'',
+        userName:'',
+        money:'',
+        payType:0,
+      };
+      this.resetForm("form");
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.app-container{
+  padding-top: 50px;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+}
+.payTypeClass{
+  img{
+    width: 120px;
+    height: 90px;
+    margin: 0 10px;
+  }
+}
+</style>

+ 233 - 0
src/views/recharge/consumption/index.vue

@@ -0,0 +1,233 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
+      <el-form-item label="姓名" prop="nameOrPhone" label-width="40px">
+        <el-input
+          v-model.trim="queryParams.nameOrPhone"
+          placeholder="请输入姓名"
+          clearable
+          size="small"
+          style="width: 160px"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+
+
+      <el-form-item label="消费时间">
+         <el-date-picker
+         style="margin-top:5px;"
+          v-model="dateRange"
+          size="small"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <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="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['system:admin:export']"
+        >导出</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table v-loading="loading" :data="adminList" height="calc(100vh  - 10vh - 170px)">
+      <el-table-column label="姓名" align="center" prop="name"  show-overflow-tooltip />
+      <el-table-column label="卡编号" align="center" prop="cardNo" show-overflow-tooltip />
+      <el-table-column label="消费金额(元)" align="center" prop="amt" show-overflow-tooltip />
+      <el-table-column label="消费终端名称" align="center" prop="termName" show-overflow-tooltip />
+      <el-table-column label="消费类型" align="center" prop="shopName" show-overflow-tooltip />
+      <el-table-column label="交易类型" align="center" prop="type" show-overflow-tooltip >
+         <template slot-scope="scope">
+          <span v-if="scope.row.type == 1" style="color:#409EFF">消费</span>
+          <span v-if="scope.row.type == 1001" style="color:#F56C6C">消费撤单</span>
+        </template>
+      </el-table-column>
+
+
+
+      <el-table-column label="餐饮时段" align="center" prop="amt" show-overflow-tooltip >
+        <template slot-scope="scope">
+          <span v-if="scope.row.part == 0" style="color:#909399">早餐</span>
+          <span v-if="scope.row.part == 1" style="color:#E6A23CC">午餐</span>
+          <span v-if="scope.row.part == 2" style="color:#409EFF">晚餐</span>
+          <span v-if="scope.row.part == 3" style="color:#F56C6C">夜宵</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="余额(元)" align="center" prop="balance" show-overflow-tooltip />
+      <el-table-column label="创建时间" align="center" prop="createTime"  show-overflow-tooltip >
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime) }}</span>
+        </template>
+      </el-table-column>
+
+    </el-table>
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.current"
+      :limit.sync="queryParams.size"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listDetal, exportDetail, updataChannel } from "@/api/recharge/consumption";
+
+export default {
+  name: "admin",
+  data() {
+    return {
+      // 导出遮罩层
+      exportLoading: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 参数表格数据
+      adminList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 日期范围
+      dateRange: [],
+      // 查询参数
+      queryParams: {
+        current: 1,
+        size: 10,
+        nameOrPhone: undefined,
+
+      },
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    //强制el-input刷新
+    onInput(){
+        this.$forceUpdate();
+    },
+    /** 查询参数列表 */
+    getList() {
+      this.loading = true;
+      this.queryParams.params =undefined
+      listDetal(this.addDateRange(this.queryParams,this.dateRange,'section')).then(response => {
+          this.adminList = response.data.records;
+          this.total = response.data.total;
+          this.loading = false;
+        }
+      );
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        ids: undefined,
+        name: undefined,
+        topChannelName: undefined,
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.current = 1;
+      this.getList();
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      Object.assign(this.form, row.id ? this.adminList.find(val=>val.id === row.id) : this.adminList.find(val=>val.id === this.ids[0]))
+      updataChannel(this.form).then(response => {
+        this.msgSuccess("修改成功");
+        this.getList();
+      });
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.dateRange = [];
+      this.queryParams.startMoney = undefined;
+      this.queryParams.endMoney = undefined;
+      this.queryParams.startTime = undefined;
+      this.queryParams.endTime = undefined;
+      this.queryParams.payType = undefined;
+      this.queryParams.userName = undefined;
+      this.queryParams.userPhone = undefined;
+      this.queryParams.orderFlag = undefined;
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      let queryParams = {...this.queryParams};
+      delete queryParams.current
+      delete queryParams.size
+      this.exportLoading = true;
+      exportDetail(queryParams).then(response =>{
+        this.exportLoading = false;
+        localStorage.setItem('fileExportId', response.data)
+        this.$router.push({path:'/recharge/fileExport'})
+      })
+      // this.$confirm('是否确认导出数据?', "警告", {
+      //   confirmButtonText: "确定",
+      //   cancelButtonText: "取消",
+      //   type: "warning"
+      // }).then(() => {
+      //   this.exportLoading = true;
+      //   return exportDetail(queryParams);
+      // }).then(res => {
+      //   this.downloadBlob(res)
+      //   this.exportLoading = false;
+      // }).catch(() => {
+      //   this.exportLoading = false;
+      // });
+    }
+
+    //   exportDetail(queryParams).then(res => {
+    //       this.$router.push({path:'/recharge/detailed'})
+    //       localStorage.setItem('fileExportId', msg)
+    //       // // this.downloadBlob(res)
+    //       // this.exportLoading = false;
+    //     }).catch(() => {
+    //       // this.exportLoading = false;
+    //     });
+    //     // exportDetail(queryParams).then(response =>{
+    //     //   this.$router.push({path:'/recharge/detailed'})
+    //     //   localStorage.setItem('fileExportId', msg)
+    //     // }).catch(err =>{
+
+    //     // })
+    //     // localStorage.setItem("timeout","大于10s")
+    //   //  this.$confirm('是否确认导出数据?', "警告", {
+    //   //     confirmButtonText: "确定",
+    //   //     cancelButtonText: "取消",
+    //   //     type: "warning"
+    //   //   }).then(() => {
+    //   //     this.exportLoading = true;
+    //   //     return exportDetail(queryParams);
+    //   //   }).then(res => {
+    //   //     // this.downloadBlob(res)
+    //   //     this.exportLoading = false;
+    //   //   }).catch(() => {
+    //   //     this.exportLoading = false;
+    //   //   });
+    // },
+  }
+};
+</script>

+ 211 - 29
src/views/recharge/department/index.vue

@@ -19,16 +19,13 @@
         <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"  @current-change="selectBrand" height="calc(100vh - 10vh - 120px)" row-key="did"
+    <el-table  :data="adminList"  ref="tableRef" :header-cell-class-name="cellClass"
+    @select="handletableSelect"
+
+          @selection-change="handletableSelectionChange" height="calc(100vh - 10vh - 120px)" row-key="id"
       :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
-      <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 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 />
@@ -64,7 +61,8 @@
 </template>
 
 <script>
-import { listChannel, deptJob, updataByDept } from "@/api/recharge/department";
+import { listChannel, deptJob, updataByDept, deptList } from "@/api/recharge/department";
+import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
 import { allRadio } from "@/api/recharge/radio";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
@@ -121,20 +119,185 @@ export default {
         ],
       },
       tableRadio: {},
+      deptIds:[],//部门绑定集合,
+      deptIdsb:[],//部门绑定集合,
+      tableSelect:[],
     };
   },
   created() {
     this.getList();
   },
   methods: {
+    //去除全选
+    cellClass(row) {
+        if (row.columnIndex === 0) {
+            return 'disabledCheck';
+        }
+    },
+    // 当用户手动勾选数据行的 Checkbox 时触发的事件
+    handletableSelect(selection, row) {
+      if (row.children) { //只对有子节点的行响应
+        // if (row.isChecked === undefined) row.isChecked = true
+        if (!row.isChecked) {   //由行数据中的元素isChecked判断当前是否被选中
+          this.traverseChildNodes(row.children, this.$refs.tableRef, true)
+          row.isChecked = true; //当前行isChecked标志元素切换为false
+        } else {
+          this.traverseChildNodes(row.children, this.$refs.tableRef, false)
+          row.isChecked = false;
+        }
+      }
+      // 处理父级选择逻辑
+      // tableSelect 字段是 handletableSelectionChange 回调回来的
+      // 如果不用 this.$nextTick 无法获取到正确数据
+      this.$nextTick(() => {
+        // 递归寻找当前子节点的父级节点
+        let getParentNode = function (data, id) {
+          for (let i in data) {
+            if (data.hasOwnProperty(i)) {
+              if (data[i].id === id) {
+                return [data[i]]
+              }
+              if (data[i].children) {
+                let node = getParentNode(data[i].children, id);
+                if (node !== undefined) {
+                  return node.concat(data[i])
+                }
+              }
+            }
+          }
+        }
+        // 设置checkbox半选择状态
+        // 此处的传入的id就是匹配表格id字段的
+        let updateCheckboxIndeterminate = function (id, isIndeterminate) {
+          setTimeout(() => {
+            // el-table不支持checkbox半选 目前方案是遍历dom获取行节点设置样式
+            let elementsRow = document.getElementsByClassName("el-table__row");
+            for (let i = 0; i < elementsRow.length; i++) {
+              let element = elementsRow.item(i);
+              // tips: 通过其他手段设置行内row-id的 以下代码需要修改
+              let childNode = element.childNodes.item(1); // row-key 字段在dom中的索引   第二列=1
+              if (childNode.innerText === `${id}`) {
+                let td = element.childNodes.item(0) // 获取要设置半选中状态的checkbox
+                let div = td.firstChild; // <div class="cell">
+                let label = div.firstChild; // <label class="el-checkbox">
+                let span = label.firstChild; // <span class="el-checkbox__input">
+                if (isIndeterminate)
+                  span.classList.add("is-indeterminate")  // 设置半选中状态
+                else
+                  span.classList.remove("is-indeterminate")  // 取消半选中状态
+              }
+            }
+          }, 1)
+
+        }
+        let parentNode = getParentNode(this.$refs.tableRef.data, row.id)
+        // > 1 说明节点有子节点
+        if (parentNode.length > 1) {
+          // 提取兄弟节点ids
+          let siblingNodeIds = parentNode[1].children.map(item => item.id)
+          // 提取全选所选择项的ids
+          let checkedIds = this.tableSelect.map(item => item.id)
+          // 获取兄弟行选择数
+          let siblingNodeCheckedIds = siblingNodeIds.filter(id => checkedIds.indexOf(id) !== -1)
+          if (siblingNodeCheckedIds.length === siblingNodeIds.length) {
+            // 兄弟节点选择数===兄弟节点数   全选
+            updateCheckboxIndeterminate(parentNode[1].id, false)
+            parentNode[1].isChecked = true
+            this.$refs.tableRef.toggleRowSelection(parentNode[1], true)
+          } else if (siblingNodeCheckedIds.length === 0) {
+            // 兄弟节点选择数===0   全不选
+            parentNode[1].isChecked = false
+            this.$refs.tableRef.toggleRowSelection(parentNode[1], false)
+            updateCheckboxIndeterminate(parentNode[1].id, false)
+          } else if (siblingNodeCheckedIds.length < siblingNodeIds.length) {
+            parentNode[1].isChecked = true
+            this.$refs.tableRef.toggleRowSelection(parentNode[1], true)
+            for (let i = 0; i < parentNode.length; i++) {
+              if (i > 0) updateCheckboxIndeterminate(parentNode[i].id, true)
+            }
+          }
+        }
+      })
+    },
+    // 当用户手动勾选全选 Checkbox 时触发的事件
+    handletableSelectAll(selection) {
+      this.$refs.tableRef.data.map(items => {
+        if (items.children && items.children.length > 0) {
+          if (!items.isChecked) {
+            this.$refs.tableRef.toggleRowSelection(items, true);
+            items.isChecked = true
+            this.traverseChildNodes(items.children, this.$refs.tableRef, true)
+            this.deptIds.push(items.did)
+          } else {
+            this.$refs.tableRef.toggleRowSelection(items, false);
+            items.isChecked = false;
+            this.traverseChildNodes(items.children, this.$refs.tableRef, false)
+            this.deptIds=[]
+          }
+        } else {
+
+        }
+      })
+      console.log(this.deptIds)
+    },
+    // 当选择项发生变化时会触发该事件
+    handletableSelectionChange(selection) {
+      // let that = this
+      // selection.forEach(item => {
+      //   that.deptIdsb.push(item.did);
+      // });
+      // setTimeout(()=>{
+      //   var newArr = that.deptIdsb.filter(function(item,index){
+      //     return that.deptIdsb.indexOf(item) === index;  // 因为indexOf 只能查找到第一个
+      //   });
+      //   console.log(newArr)
+      // },1)
+
+      // let arr = []
+      // for(let i =0;i<selection.length;i++){
+      //   arr.push(selection[i].did)
+
+      // }
+      //  console.log(arr)
+      // if(this.deptIds.length>0){
+
+      // }else{
+      //   this.deptIds.push(selection[0].did)
+      // }
+
+      // console.log(selection)
+      // console.log(this.deptIds)
+      // let that = this
+      // setTimeout(()=>{
+      //   that.tableSelect = selection
+      //   console.log(that.tableSelect,Date.parse(new Date()))
+      // })
+
+      // this.deptIds = []
+      // this.deptIds.push(selection)
+      // setTimeout(()=>{
+      //   console.log(this.deptIds)
+      // },1)
+
+      // this.tableSelect = selection
+    },
+    // 递归设置子节点
+    traverseChildNodes(children, ref, selected) {
+      children.map(item => {
+        ref.toggleRowSelection(item, selected);
+        item.isChecked = selected;
+        if (item.children) {
+          this.traverseChildNodes(item.children, ref, selected)
+        }
+      })
+    },
+
     /** 查询参数列表 */
     getList() {
       this.loading = true;
-      listChannel(this.addDateRange(this.queryParams)).then(response => {
-        this.adminList = this.handleTree(response.data.records, "did");
-          // this.adminList = response.data.records;
-          // this.total = response.data.total;
-           this.loading = false;
+      deptList(this.addDateRange(this.queryParams)).then(response => {
+        this.adminList = this.handleTree2(response.data, "id");
+        this.loading = false;
         }
       );
     },
@@ -186,19 +349,30 @@ export default {
     },
     //批量处理
     batchChange(change){
+      this.staffList.deptIds = []
+      if(this.$refs.tableRef.selection.length>0){
+
+      }else{
+        this.msgError("请选择部门")
+      }
       if(this.tableRadio){
         if(change == "1"){
-            this.getListczgl()
-            this.open = true;
-            this.title = "修改参数";
+          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 =>{
+          let formData = new FormData();
+          let arr = []
+          for(let i = 0;i<this.$refs.tableRef.selection.length;i++){
+            arr.push(this.$refs.tableRef.selection[i].did)
+          }
+          formData.append('deptIds[]',arr);
+          formData.append('radioId',1);
+          formData.append('isBinding',0);
+          updataByDept(formData).then(response =>{
             this.loading = false;
-            this.msgSuccess(`${this.tableRadio.name} 解绑完成`)
+            this.msgSuccess(`解绑完成`)
             this.getList();
           }).catch(err=>{
             this.loading = false;
@@ -210,18 +384,22 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
+      let formData = new FormData();
+      let arr = []
+      for(let i = 0;i<this.$refs.tableRef.selection.length;i++){
+        arr.push(this.$refs.tableRef.selection[i].did)
+      }
+      formData.append('deptIds[]',arr);
       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 =>{
+            formData.append('radioId',this.queryParams.id);
+            formData.append('isBinding',1);
+            updataByDept(formData).then(response =>{
               this.loading = false;
               this.open = false;
-              this.msgSuccess(`${this.tableRadio.name} 绑定完成`)
+              this.msgSuccess(`绑定完成`)
               this.getList();
               this.reset()
             }).catch(err=>{
@@ -235,6 +413,10 @@ export default {
 };
 </script>
 <style lang="scss" scoped>
+ // 深度选择器 去掉全选按钮
+            ::v-deep .el-table .disabledCheck .cell .el-checkbox__inner {
+                display: none;
+            }
 // .el-button--primary{color:#50B300;border:1px solid #50B300;background: #fff;}
 // .el-button--primary:hover{color:#fff;border:1px solid #50B300;background: #50B300;}
 </style>

+ 10 - 10
src/views/recharge/detailed/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
-      <el-form-item label="姓名" prop="userName">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
+      <el-form-item label="姓名" prop="userName" label-width="40px">
         <el-input
           v-model.trim="queryParams.userName"
           placeholder="请输入姓名"
@@ -11,7 +11,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="手机号" prop="userPhone">
+      <el-form-item label="手机号" prop="userPhone">
         <el-input
           v-model.trim="queryParams.userPhone"
           placeholder="请输入手机号"
@@ -21,14 +21,14 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="支付方式" prop="payType">
+      <el-form-item label="支付方式" prop="payType">
          <el-select v-model="queryParams.payType" style="width: 160px" placeholder="请选择支付方式" clearable size="small">
           <el-option label="现金支付" :value="1"/>
           <el-option label="微信" :value="2"/>
           <el-option label="支付宝" :value="3"/>
         </el-select>
       </el-form-item>
-      <el-form-item label="支付状态" prop="orderFlag">
+      <el-form-item label="支付状态" prop="orderFlag">
         <el-select v-model="queryParams.orderFlag" style="width: 160px" placeholder="请选择支付状态" clearable size="small">
           <el-option label="未支付" :value="0"/>
           <el-option label="支付等待中" :value="1"/>
@@ -39,7 +39,7 @@
           <el-option label="已成功" :value="6"/>
         </el-select>
       </el-form-item>
-      <el-form-item label="支付金额" prop="Money">
+      <el-form-item label="支付金额" prop="Money">
         <el-input-number
           v-model="queryParams.startMoney"
           clearable
@@ -56,7 +56,7 @@
           style="width: 140px"
           @keyup.enter.native="handleQuery"></el-input-number>
       </el-form-item>
-      <el-form-item label="支付时间">
+      <el-form-item label="支付时间">
          <el-date-picker
          style="margin-top:5px;"
           v-model="dateRange"
@@ -86,8 +86,8 @@
     <el-table v-loading="loading" :data="adminList" height="calc(100vh  - 10vh - 170px)">
       <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="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">
@@ -115,7 +115,7 @@
         </template>
       </el-table-column>
       <el-table-column label="充值渠道" align="center" prop="channelName"  show-overflow-tooltip />
-      <el-table-column label="时间" align="center" prop="createTime"  show-overflow-tooltip >
+      <el-table-column label="创建时间" align="center" prop="createTime"  show-overflow-tooltip >
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
         </template>

+ 16 - 3
src/views/recharge/personnel/index.vue

@@ -44,7 +44,7 @@
       <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="dept"  show-overflow-tooltip />
-      
+
       <!-- <el-table-column label="人员信息" align="center" prop="identity"  show-overflow-tooltip /> -->
       <el-table-column label="手机号" align="center" prop="contacts"  show-overflow-tooltip />
       <el-table-column label="卡号" align="center" prop="cardId"  show-overflow-tooltip />
@@ -58,7 +58,15 @@
             type="text"
             icon="el-icon-link"
             @click="radio(scope.row)"
-          >充值</el-button>
+            v-hasPermi="['recharge:role:wz']"
+          >微信、支付宝充值</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-link"
+            @click="cash(scope.row)"
+            v-hasPermi="['recharge:role:x']"
+          >现金</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -231,11 +239,16 @@ export default {
       this.resetForm("queryForm");
       this.handleQuery();
     },
-    /** 充值跳转 */
+    /** 微信支付宝充值跳转 */
     radio(row){
       this.$router.push({path:'userRecharge'})
       localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
     },
+    /** 现金充值跳转 */
+    cash(row){
+      this.$router.push({path:'cash'})
+      localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
+    },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item);

+ 2 - 2
src/views/recharge/qrCode/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="86px">
       <el-form-item label="二维码名称" prop="name">
         <el-input
           v-model.trim="queryParams.name"
@@ -262,7 +262,7 @@ export default {
         }
       });
     },
-    
+
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;

+ 6 - 6
src/views/recharge/radio/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="身份信息" prop="identity">
         <el-input
           v-model.trim="queryParams.identity"
@@ -165,7 +165,7 @@ export default {
   created() {
     this.getList();
     this.proportionListF()
-    
+
   },
   methods: {
     proportionListF(){ //充值比例
@@ -246,7 +246,7 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       Object.assign(this.form, row.id ? this.adminList.find(val=>val.id === row.id) : this.adminList.find(val=>val.id === this.ids[0]))
-      
+
       if(this.ids.length>1){
         this.open2 = true;
       }else{
@@ -302,8 +302,8 @@ export default {
           }
         });
       }
-      
-      
+
+
     },
     /** 删除按钮操作 */
     handleDelete(row) {
@@ -321,4 +321,4 @@ export default {
     },
   }
 };
-</script>
+</script>

+ 2 - 2
src/views/recharge/reportForm/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
-      <el-form-item label="时间">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
+      <el-form-item label="时间" label-width="40px">
          <el-date-picker
           style="margin-top:5px;"
           v-model="dateRange"

+ 1 - 1
src/views/system/menu/index.vue

@@ -275,7 +275,7 @@ export default {
       queryParams: {
         menuName: undefined,
         visible: undefined,
-        visible: 0 // 将菜单栏不需要的隐藏 ,打开时不需要此参数
+        //visible: 0 // 将菜单栏不需要的隐藏 ,打开时不需要此参数
       },
       // 表单参数
       form: {},

+ 1 - 1
src/views/system/product/index.vue

@@ -94,7 +94,7 @@
                 :on-change="handleChange"
                 :file-list="fileList"
                 :auto-upload="false"
-                accept=".jpg,.jpeg,.JPG,.JPEG,.PNG,.png,.GIF,.gif"   
+                accept=".jpg,.jpeg,.JPG,.JPEG,.PNG,.png,.GIF,.gif"
                 >
                 <el-button size="small" type="primary">点击上传</el-button>
               </el-upload>