bonus-ui/src/views/accountCenter/account/accountManager/index.vue

943 lines
42 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="关键字" prop="searchValue">
<el-input v-model="queryParams.searchValue" placeholder="请输入用户姓名,编号,手机号" maxlength="20" clearable style="width: 240px"/>
</el-form-item>
<el-form-item label="账户状态" prop="accountStatusList">
<el-select v-model="queryParams.accountStatusList" style="width: 240px" clearable>
<el-option label="正常" value="0"></el-option>
<el-option label="停用" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属组织" prop="deptIdList">
<el-cascader v-model="queryParams.deptIdList"
:options="deptOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:props="{
multiple: true,
emitPath: false,// 若设置 false则只返回该节点的值只返回最后选择的id
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
value:'id',label:'label'
}" clearable collapse-tags >
</el-cascader>
</el-form-item>
<el-form-item label="用户类别" prop="userType">
<el-select v-model="queryParams.userType" placeholder="用户类别" style="width: 240px" clearable>
<el-option
v-for="dict in dict.type.sys_user_type"
:key="dict.value"
:label="dict.label"
:value="Number(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
size="mini" type="primary"
@click="handleBatchEdit"
>批量补贴</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="800">
<el-table-column label="序号" align="center" width="80" type="index" fixed="left">
<template scope="scope">
<span v-if="!scope.row.userId">合计:</span>
<span v-else>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" width="120" fixed="left"/>
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" width="120" fixed="left"/>
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="所属组织" align="center" prop="deptName" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="用户类别" align="center" prop="userType" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_type" :value="scope.row.userType"/>
</template>
</el-table-column>
<el-table-column label="卡物理号" align="center" prop="serialNum" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="账户总余额" align="center" prop="accBalTotal" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope">
<span>{{ (scope.row.accBalTotal/100).toFixed(2) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="可用总余额" align="center" prop="accAvailableBal" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope">
<span>{{ (scope.row.accAvailableBal/100).toFixed(2) }}</span>
</template>
</el-table-column> -->
<el-table-column label="个人钱包余额" align="center" prop="walletBal" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope">
<span>{{ (scope.row.walletBal/100).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column label="补贴钱包余额" align="center" prop="subsidyBal" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope">
<span>{{ (scope.row.subsidyBal/100).toFixed(2) }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="红包余额" align="center" prop="redEnvelope" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<span>{{ (scope.row.redEnvelope/100).toFixed(2) }}</span>
</template>
</el-table-column> -->
<el-table-column label="账户状态" align="center" prop="accountStatus" :show-overflow-tooltip="true" width="140">
<template slot-scope="scope">
<el-switch v-model="scope.row.accountStatus" v-if="scope.row.userId"
active-text="启用" inactive-text="停用"
:active-value="0" :inactive-value="1" @change="handleStatusChange(scope.row)">
</el-switch>
</template>
</el-table-column>
<el-table-column label="账户有效期" align="center" prop="endDate" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="操作" align="center" width="240" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope" v-if="scope.row.userId">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>详情</el-button>
<el-button
size="mini"
type="text"
@click="handleSendCard(scope.row)"
>发卡</el-button>
<el-button
size="mini"
type="text"
@click="handleSubsidy(scope.row)"
>补贴</el-button>
<el-button
size="mini"
type="text"
@click="handleRecharge(scope.row)"
>充值</el-button>
<el-button
size="mini"
type="text"
@click="handleTake(scope.row)"
>提现</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 查看对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-descriptions class="margin-top" title="基本信息" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">用户编号</template>
{{form.userId}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户姓名</template>
{{ form.nickName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户手机号</template>
{{ form.phoneNumber }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">账户状态</template>
<span v-if="form.accountStatus==0">正常</span>
<span v-if="form.accountStatus==1">停用</span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">所属组织</template>
{{ form.deptName }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" title="账户信息" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">账户总余额</template>
{{ (form.accBalTotal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">可用总余额</template>
{{ (form.accAvailableBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">个人钱包余额</template>
{{ (form.walletBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">补贴钱包余额</template>
{{ (form.subsidyBal/100).toFixed(2) }}
</el-descriptions-item>
</el-descriptions>
<!-- <div style="margin: 10px 0;font-weight: bold;font-size: 16px;color: #000;">账户允许最低余额与有效期</div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="个人钱包" prop="walletLimitBalance">
<el-input v-model="form.walletLimitBalance" placeholder="请输入允许最低余额" maxlength="8" clearable style="width: 300px;"
@input="(v)=>(form.walletLimitBalance=v.replace(/[^\d.]/g,''))"/>
</el-form-item>
<el-form-item label="补贴钱包" prop="subLimitBalance">
<el-input v-model="form.subLimitBalance" placeholder="请输入允许最低余额" maxlength="8" clearable style="width: 300px;"
@input="(v)=>(form.subLimitBalance=v.replace(/[^\d.]/g,''))"/>
</el-form-item>
<el-form-item label="有账户有效期" prop="accEndDate">
<el-date-picker
v-model="form.accEndDate"
type="date" :picker-options="pickerOptions" value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-form> -->
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 发卡 -->
<el-dialog title="发卡" :visible.sync="openCard" width="500px" append-to-body>
<el-form ref="cardForm" :model="cardForm" :rules="cardRules" label-width="100px">
<el-form-item label="物理卡号" prop="serialNum">
<el-input v-model="cardForm.serialNum" placeholder="请输入物理卡号" maxlength="20" clearable style="width: 300px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSendCard">确 定</el-button>
<el-button @click="openCard=false">取 消</el-button>
</div>
</el-dialog>
<!-- 补贴对话框 -->
<el-dialog :title="title" :visible.sync="openSubsidy" width="800px" append-to-body>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-descriptions class="margin-top" title="账户信息" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">用户编号</template>
{{form.userId}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户姓名</template>
{{ form.nickName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">所属组织</template>
{{ form.deptName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户手机号</template>
{{ form.phoneNumber }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">账户状态</template>
<!-- {{ form.accountStatusName }} -->
<span v-if="form.accountStatus==0">正常</span>
<span v-if="form.accountStatus==1">停用</span>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户类别</template>
<dict-tag :options="dict.type.sys_user_type" :value="form.userType"/>
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" title="账户钱包" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">账户总余额</template>
{{ (form.accBalTotal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">可用总余额</template>
{{ (form.accAvailableBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">个人钱包余额</template>
{{ (form.walletBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">补贴钱包余额</template>
{{ (form.subsidyBal/100).toFixed(2) }}
</el-descriptions-item>
</el-descriptions>
<div style="margin: 10px 0;font-weight: bold;font-size: 16px;color: #000;"></div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="补贴金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入补贴金额" maxlength="9" clearable style="width: 300px;"
@input="(v)=>(form.amount=v.replace(/[^\d.]/g,''))">
<template slot="append">元</template>
</el-input>
</el-form-item>
<div style="padding-left: 40px;">
确认补贴后,将为该员工账户增加相应补贴金额
</div>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitSubsidy">确 定</el-button>
<el-button @click="openSubsidy=false">取 消</el-button>
</div>
</el-dialog>
<!-- 批量补贴 -->
<el-dialog title="批量补贴" :visible.sync="openBatch" width="900px" append-to-body>
<div style="width: 100%;height: 600px;overflow-y: auto;">
<div style="height: 30px;padding-left: 10px;line-height: 30px;margin: 10px 0;font-size: 14px;color: #000;background: #e7f0fa;border-left: 3px solid #4b80fd;">第一步:选择用户</div>
<el-form :model="dialogParams" ref="dialogParams" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="searchValue">
<el-input v-model="dialogParams.searchValue" placeholder="请输入用户姓名,编号,手机号" maxlength="20" clearable style="width: 240px"/>
</el-form-item>
<el-form-item label="" prop="deptIdList">
<el-cascader v-model="dialogParams.deptIdList"
:options="deptOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
placeholder="所属组织"
:props="{
multiple: true,
emitPath: false,// 若设置 false则只返回该节点的值只返回最后选择的id
checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的
value:'id',label:'label'
}" clearable collapse-tags >
</el-cascader>
</el-form-item>
<el-form-item label="" prop="userType">
<el-select v-model="dialogParams.userType" placeholder="用户类别" style="width: 240px" clearable>
<el-option
v-for="dict in dict.type.sys_user_type"
:key="dict.value"
:label="dict.label"
:value="Number(dict.value)"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDialogQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-table :data="dialogTableData" height="300" ref="multipleTable1" :row-key="(row)=>{return row.accountId}" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" />
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" />
<el-table-column label="所属组织" align="center" prop="deptName" :show-overflow-tooltip="true" />
<el-table-column label="用户类别" align="center" prop="userType" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_type" :value="scope.row.userType"/>
</template>
</el-table-column>
</el-table>
<pagination
v-show="dialogTotal>0"
:total="dialogTotal"
:page.sync="dialogParams.pageNum"
:limit.sync="dialogParams.pageSize"
@pagination="getDialogList"
/>
<div style="height: 30px;padding-left: 10px;line-height: 30px;margin: 20px 0;font-size: 14px;color: #000;background: #e7f0fa;border-left: 3px solid #4b80fd;">第二步:输入金额</div>
<el-form ref="batchForm" :model="batchForm" :rules="batchRules" label-width="100px">
<el-form-item label="补贴金额" prop="amount">
<el-input v-model="batchForm.amount" placeholder="请输入补贴金额" maxlength="9" clearable style="width: 300px;"
@input="(v)=>(batchForm.amount=v.replace(/[^\d.]/g,''))">
<template slot="append">元</template>
</el-input>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmBatchCheck">确 定</el-button>
<el-button @click="openBatch=false">取 消</el-button>
</div>
</el-dialog>
<el-dialog title="批量补贴预览" :visible.sync="openResult" width="800px" append-to-body>
<div style="margin-bottom: 10px;">总人数: {{resultData.totalUserSum || '--' }} 补贴人数:{{resultData.validCount || '--' }} 补贴总额:{{(resultData.validTotalAmount/100) || '--' }} 无效人数:{{resultData.invalidCount || '--'}}</div>
<div style="font-weight: 600;">无效人数</div>
<el-table :data="resultData.errVOList" max-height="250">
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" />
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" />
<el-table-column label="所属组织" align="center" prop="deptFullName" :show-overflow-tooltip="true" />
<el-table-column label="用户类别" align="center" prop="userType" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_type" :value="scope.row.userType"/>
</template>
</el-table-column>
<el-table-column label="金额" align="center" prop="amount" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.amount/100).toFixed(2) }}</span>
</template>
</el-table-column>
<el-table-column label="失败原因" align="center" prop="errorMessage" :show-overflow-tooltip="true"/>
</el-table>
<div style="font-weight: 600;">有效人数</div>
<el-table :data="resultData.successVoList" max-height="250">
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" />
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="用户手机号" align="center" prop="phoneNumber" :show-overflow-tooltip="true" />
<el-table-column label="所属组织" align="center" prop="deptFullName" :show-overflow-tooltip="true" />
<el-table-column label="用户类别" align="center" prop="userType" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_user_type" :value="scope.row.userType"/>
</template>
</el-table-column>
<el-table-column label="金额" align="center" prop="amount" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.amount/100).toFixed(2) }}</span>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="openResult=false" v-if="resultData.validUserIdList&&resultData.validUserIdList.length==0">确 定</el-button>
<el-button type="primary" @click="confirmBatchEdit" v-else>继 续</el-button>
<el-button @click="openResult=false">取 消</el-button>
</div>
</el-dialog>
<!-- 充值对话框 -->
<el-dialog :title="title" :visible.sync="openRecharge" width="800px" append-to-body>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-descriptions class="margin-top" title="账户信息" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">用户编号</template>
{{form.userId}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户姓名</template>
{{ form.nickName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">所属组织</template>
{{ form.deptName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户手机号</template>
{{ form.phoneNumber }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">账户状态</template>
{{ form.accountStatusName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户类别</template>
{{ form.userTypeName }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" title="账户钱包" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">账户总余额</template>
{{ (form.accBalTotal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">可用总余额</template>
{{ (form.accAvailableBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">个人钱包余额</template>
{{ (form.walletBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">补贴钱包余额</template>
{{ (form.subsidyBal/100).toFixed(2) }}
</el-descriptions-item>
</el-descriptions>
<div style="margin: 20px 0;font-weight: bold;font-size: 16px;color: #000;"></div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="充值金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入充值金额" maxlength="9" clearable style="width: 300px;"
@input="(v)=>(form.amount=v.replace(/[^\d.]/g,''))">
<template slot="append">元</template>
</el-input>
</el-form-item>
<div style="padding-left: 40px;">
确认充值后,将为该员工个人钱包账户增加相应金额
</div>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitRecharge">确 定</el-button>
<el-button @click="openRecharge=false">取 消</el-button>
</div>
</el-dialog>
<!-- 提现对话框 -->
<el-dialog :title="title" :visible.sync="openTake" width="800px" append-to-body>
<div style="width: 100%;height: 400px;overflow-y: auto;">
<el-descriptions class="margin-top" title="账户信息" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">用户编号</template>
{{form.userId}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户姓名</template>
{{ form.nickName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">所属组织</template>
{{ form.deptName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户手机号</template>
{{ form.phoneNumber }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">账户状态</template>
{{ form.accountStatusName }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">用户类别</template>
{{ form.userTypeName }}
</el-descriptions-item>
</el-descriptions>
<el-descriptions class="margin-top" title="账户钱包" :column="2" size="small" border>
<el-descriptions-item>
<template slot="label">账户总余额</template>
{{ (form.accBalTotal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">可用总余额</template>
{{ (form.accAvailableBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">个人钱包余额</template>
{{ (form.walletBal/100).toFixed(2) }}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">补贴钱包余额</template>
{{ (form.subsidyBal/100).toFixed(2) }}
</el-descriptions-item>
</el-descriptions>
<div style="margin: 20px 0;font-weight: bold;font-size: 16px;color: #000;"></div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="提现金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入提现金额" maxlength="9" clearable style="width: 300px;"
@input="(v)=>(form.amount=v.replace(/[^\d.]/g,''))">
<template slot="append">元</template>
</el-input>
</el-form-item>
<div style="padding-left: 40px;">
用于个人充值金额的提现操作
</div>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitTake">确 定</el-button>
<el-button @click="openTake=false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { deptTreeSelect } from '@/api/system/user'
import { accInfoPageApi, accInfoSumPageApi,updateAccInfoSingleApi,updateAccInfoBatchApi,updateAccStateApi } from "@/api/accountCenter/manager";
import { updateAccRechargeSingleApi,checkAccRechargeBatchApi,updateAccRechargeBatchApi } from "@/api/accountCenter/butie";
import { rechargeAccWalletApi,withdrawAccWalletApi } from "@/api/accountCenter/manager";
import { accCardApi } from "@/api/accountCenter/card";
export default {
name: "",
dicts: ['sys_user_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
//表格数据
tableListData: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
//下拉选数据
deptOptions:[],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
accountStatusList:null,
deptIdList:[],
searchValue:null,
userType:null
},
cancelCount:0,
expiredCount:0,
// 表单参数
form: {},
pickerOptions:{
//禁用当前日期之前的日期
disabledDate(time) {
//Date.now()是javascript中的内置函数它返回自1970年1月1日00:00:00 UTC以来经过的毫秒数。
return time.getTime() < Date.now() - 8.64e7;
}
},
openBatch:false,
dialogParams: {
pageNum: 1,
pageSize: 10,
accountStatusList:[],
deptIdList:[],
searchValue:null,
userType:null
},
dialogTableData:[],
dialogTotal: 0,
batchForm:{
remark:"",
receiveEndDate:"",
validateDay:"",
amount:0
},
batchRules: {
amount: [
{ required: true, message: "金额不能为空", trigger: "blur" }
]
},
batchIds:[],
batchList:[],
openResult:false,
resultData:{},
openCard:false,//发卡弹窗
cardForm:{
serialNum:null
},
cardRules: {
serialNum: [
{ required: true, message: "卡号不能为空", trigger: "blur" }
]
},
openSubsidy:false,
openRecharge:false,
openTake:false,
// 表单校验
rules: {
amount: [
{ required: true, message: "金额不能为空", trigger: "blur" }
]
},
};
},
created() {
this.getDeptTree()
this.getList();
},
methods: {
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then((response) => {
this.deptOptions = this.filterTree(response.data)
})
},
filterTree(nodes) {
return nodes
.map((node) => {
if (node.children) {
node.children = this.filterTree(node.children)
}
return node
})
.filter((node) => node.status !== '1')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 查询列表 */
getList() {
console.log(this.queryParams)
this.loading = true;
let param = {
"pageNum": this.queryParams.pageNum,
"pageSize": this.queryParams.pageSize,
"accountStatusList": [],
"deptIdList": this.queryParams.deptIdList,
"searchValue": this.queryParams.searchValue,
"userType": this.queryParams.userType
}
if(this.queryParams.accountStatusList){
param.accountStatusList = [this.queryParams.accountStatusList]
}
accInfoPageApi(param).then(response => {
this.tableListData = response.rows;
this.total = Number(response.total);
accInfoSumPageApi(param).then(response => {
this.tableListData.push(response.data)
});
this.loading = false;
});
},
/** 停用(启用)按钮操作 */
handleStatusChange(row) {
let text = row.accountStatus == '0' ? '启用' : '停用'
let param = {
accountStatus:row.accountStatus,
userId:row.userId
}
this.$modal.confirm('确认要"' + text + '吗?').then(function() {
return updateAccStateApi(param)
}).then(() => {
this.$modal.msgSuccess(text + '成功')
}).catch(function() {
row.accountStatus = row.accountStatus === '0' ? '1' : '0'
})
},
//发卡按钮
handleSendCard(row){
this.cardForm = {
serialNum:null
};
this.resetForm("cardForm");
this.cardForm.accountId = row.accountId;
this.openCard=true;
},
// 发卡弹窗-确认按钮
submitSendCard(){
this.$refs["cardForm"].validate(valid => {
if (valid) {
let param = {
...this.cardForm
}
accCardApi(param).then(response => {
this.$modal.msgSuccess("发卡成功");
this.openCard = false;
this.getList();
});
}
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = Object.assign({}, row)
this.$set(this.form,"accEndDate",row.endDate)
this.$set(this.form,"subLimitBalance",(row.minSubBalLimit/100).toFixed(2))
this.$set(this.form,"walletLimitBalance",(row.minWalletBalLimit/100).toFixed(2))
this.open = true;
this.title = "查看";
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {};
this.resetForm("form");
},
/** 提交按钮 */
submitForm: function() {
// this.$refs["form"].validate(valid => {
// if (valid) {
// let param = {
// ...this.form,
// subLimitBalance:this.form.subLimitBalance*100,
// walletLimitBalance:this.form.walletLimitBalance*100
// }
// updateAccInfoSingleApi(param).then(response => {
// this.$modal.msgSuccess("修改成功");
this.open = false;
// this.getList();
// });
// }
// });
},
//补贴按钮操作
handleSubsidy(row){
this.form = {};
this.resetForm("form");
this.form = Object.assign({}, row)
this.openSubsidy=true
this.title = "补贴";
},
//补贴确认操作
submitSubsidy(){
this.$refs["form"].validate(valid => {
if (valid) {
let param = {
userId:this.form.userId,
amount:Number(this.form.amount*100)
}
updateAccRechargeSingleApi(param).then(response => {
this.$modal.msgSuccess("操作成功");
this.openSubsidy = false;
this.getList();
});
}
});
},
//充值按钮操作
handleRecharge(row){
this.form = {};
this.resetForm("form");
this.form = Object.assign({}, row)
this.openRecharge=true
this.title = "充值";
},
//充值确认操作
submitRecharge(){
this.$refs["form"].validate(valid => {
if (valid) {
let param = {
userId:this.form.userId,
amount:Number(this.form.amount*100)
}
rechargeAccWalletApi(param).then(response => {
this.$modal.msgSuccess("操作成功");
this.openRecharge = false;
this.getList();
});
}
});
},
//提现按钮操作
handleTake(row){
this.form = {};
this.resetForm("form");
this.form = Object.assign({}, row)
this.openTake=true
this.title = "提现";
},
//提现确认操作
submitTake(){
this.$refs["form"].validate(valid => {
if (valid) {
let param = {
userId:this.form.userId,
amount:Number(this.form.amount*100)
}
withdrawAccWalletApi(param).then(response => {
this.$modal.msgSuccess("操作成功");
this.openTake = false;
this.getList();
});
}
});
},
//-----批量操作------
//批量补贴弹窗
handleBatchEdit() {
this.resetForm("dialogParams");
this.getDialogList()
this.batchIds = []
this.batchList = []
this.batchForm = {
amount:null
}
this.resetForm("batchForm");
this.openBatch = true;
setTimeout(()=>{
this.$refs.multipleTable1.clearSelection()
},300)
},
//弹窗搜索
handleDialogQuery(){
this.dialogParams.pageNum = 1;
this.getDialogList();
},
//批量弹窗表格查询
getDialogList(){
let param = {
"pageNum": this.dialogParams.pageNum,
"pageSize": this.dialogParams.pageSize,
"accountStatusList": [],
"deptIdList": this.dialogParams.deptIdList,
"searchValue": this.dialogParams.searchValue,
"userType": this.dialogParams.userType
}
accInfoPageApi(param).then(response => {
this.dialogTableData = response.rows;
this.dialogTotal = Number(response.total);
});
},
//批量弹窗勾选
handleSelectionChange(selection){
this.batchIds = selection.map((item) => item.userId)
this.batchList = selection
},
//批量补贴校验
confirmBatchCheck(){
if(this.batchIds.length>0){
this.$refs["batchForm"].validate(valid => {
if (valid) {
let param = {
amount:Number(this.batchForm.amount*100),
userIds:this.batchIds
}
checkAccRechargeBatchApi(param).then(response => {
this.resultData = response.data
this.batchList.forEach(item=>{
item.amount = Number(this.batchForm.amount*100)
})
if(this.resultData.errVOList.length==0){
this.resultData.successVoList = this.batchList
}else if(this.resultData.errVOList.length>0){
this.resultData.errVOList.forEach(item=>{
let hasIndex = this.batchList.findIndex(v=>v.userId==item.userId)
this.batchList.splice(hasIndex,1)
})
this.resultData.successVoList = this.batchList
}
this.openResult = true
this.openBatch = false;
});
}
});
}else{
this.$modal.msgError("请先勾选账户!");
}
},
//批量补贴提交
confirmBatchEdit(){
let param = {
amount:this.resultData.amount,
userIds:this.resultData.validUserIdList
}
updateAccRechargeBatchApi(param).then(response => {
this.$modal.msgSuccess("操作成功");
setTimeout(()=>{
this.openResult = false;
this.getList();
},500)
});
},
}
};
</script>