Merge branch 'bonus-jyy-smart-canteen' of http://192.168.0.75:3000/bonus/bonus-ui into bonus-jyy-smart-canteen
This commit is contained in:
commit
b7dd2a72f8
Binary file not shown.
|
|
@ -28,6 +28,12 @@
|
|||
@click="handleBatchEdit"
|
||||
>批量补贴</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
size="mini" type="primary"
|
||||
@click="handleImportRecharge"
|
||||
>导入充值</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
size="mini" type="danger"
|
||||
|
|
@ -44,13 +50,8 @@
|
|||
</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="userCode" :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">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phoneNumber) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -88,15 +89,15 @@
|
|||
<span>{{ (scope.row.redEnvelope/100).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column label="冻结金额" align="center" prop="accFreezeBalTotal" :show-overflow-tooltip="true">
|
||||
<el-table-column label="冻结金额" align="center" prop="accFreezeBalTotal" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ (scope.row.accFreezeBalTotal/100).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table-column>
|
||||
|
||||
<!-- <el-table-column label="账户有效期" align="center" prop="endDate" :show-overflow-tooltip="true" width="150"/> -->
|
||||
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<template slot-scope="scope" v-if="scope.$index!=10">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -127,10 +128,6 @@
|
|||
<template slot="label">用户编号</template>
|
||||
{{form.userId}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">员工编号</template>
|
||||
{{form.userCode}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">用户姓名</template>
|
||||
{{ form.nickName }}
|
||||
|
|
@ -179,10 +176,10 @@
|
|||
<template slot="label">红包余额</template>
|
||||
{{ (form.redEnvelope/100).toFixed(2) }}
|
||||
</el-descriptions-item> -->
|
||||
<!-- <el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">冻结金额</template>
|
||||
{{ (form.accFreezeBalTotal/100).toFixed(2) }}
|
||||
</el-descriptions-item> -->
|
||||
</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">
|
||||
|
|
@ -252,13 +249,8 @@
|
|||
<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="userCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户手机号" align="center" prop="phone" :show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phone) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -309,13 +301,8 @@
|
|||
<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="userCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户手机号" align="center" prop="phone" :show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phone) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -332,13 +319,8 @@
|
|||
<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="userCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户手机号" align="center" prop="phone" :show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phone) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -360,17 +342,13 @@
|
|||
|
||||
|
||||
<!-- 补贴清空对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="openClear" width="800px" append-to-body>
|
||||
<div style="width: 100%;height: 300px;overflow-y: auto;">
|
||||
<el-dialog :title="title" :visible.sync="openClear" width="900px" append-to-body>
|
||||
<div class="clear-dialog__body">
|
||||
<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.userCode}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">用户姓名</template>
|
||||
{{ form.nickName }}
|
||||
|
|
@ -419,29 +397,42 @@
|
|||
<template slot="label">红包余额</template>
|
||||
{{ (form.redEnvelope/100).toFixed(2) }}
|
||||
</el-descriptions-item> -->
|
||||
<!-- <el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">冻结金额</template>
|
||||
{{ (form.accFreezeBalTotal/100).toFixed(2) }}
|
||||
</el-descriptions-item> -->
|
||||
</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="clearType">
|
||||
<el-form ref="clearForm" :model="form" :rules="clearRules" label-width="0" class="clear-form">
|
||||
<el-form-item prop="clearType" class="clear-form__item">
|
||||
<div class="clear-form__row">
|
||||
<strong class="clear-form__label">清空</strong>
|
||||
<el-radio-group v-model="form.clearType">
|
||||
<el-radio :label="1">清空</el-radio>
|
||||
<el-radio :label="2">清空至</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<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, '').replace(/^(\d*\.\d{2}).*$/, '$1'))">
|
||||
<el-form-item prop="operateAmount" class="clear-form__item">
|
||||
<div class="clear-form__row clear-form__row--amount">
|
||||
<strong class="clear-form__label">操作金额</strong>
|
||||
<el-input
|
||||
v-model="form.operateAmount"
|
||||
placeholder="请输入操作金额"
|
||||
maxlength="9"
|
||||
clearable
|
||||
class="clear-form__input"
|
||||
:disabled="form.clearType === 1"
|
||||
@input="onOperateAmountInput">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-form> -->
|
||||
</div>
|
||||
<!-- <div v-if="form.clearType==1" style="color: red;">提示:清空多少元。例如填20,则清空20元</div>
|
||||
<div v-if="form.clearType==2" style="color: red;">提示:清空至多少元。例如填20,则清空超出20元的部分</div> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="clear-form__note">
|
||||
<div>如果选择清空:清空当前所有的补贴钱包</div>
|
||||
<div>如果选择清空至:清空超出填写金额的部分(例如填20,则清空超出20元的部分)</div>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitClearForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
|
|
@ -484,13 +475,8 @@
|
|||
<el-table :data="dialogTableData" height="300" ref="multipleTable2" :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="userCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户手机号" align="center" prop="phone" :show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phone) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -533,13 +519,8 @@
|
|||
<div style="font-weight: 600;">无效人数</div>
|
||||
<el-table :data="resultData2.errVOList" max-height="250">
|
||||
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="员工编号" align="center" prop="userCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户手机号" align="center" prop="phone" :show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phone) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -556,13 +537,8 @@
|
|||
<div style="font-weight: 600;">有效人数</div>
|
||||
<el-table :data="resultData2.successVoList" max-height="250">
|
||||
<el-table-column label="用户编号" align="center" prop="userId" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="员工编号" align="center" prop="userCode" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户手机号" align="center" prop="phone" :show-overflow-tooltip="true">
|
||||
<template scope="scope">
|
||||
<span>{{ hidePhone(scope.row.phone) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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">
|
||||
|
|
@ -582,6 +558,100 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 导入充值对话框 -->
|
||||
<el-dialog title="导入充值" :visible.sync="openImport" width="600px" append-to-body>
|
||||
<div style="padding: 20px;">
|
||||
<!-- 下载模板区域 -->
|
||||
<div style="margin-bottom: 30px; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px; text-align: center;">
|
||||
<i class="el-icon-download" style="font-size: 48px; color: #fff; margin-bottom: 10px;"></i>
|
||||
<div style="color: #fff; font-size: 16px; margin-bottom: 15px;">下载补贴充值导入模板</div>
|
||||
<el-button type="primary" size="mini" @click="downloadTemplate" style="background: #fff; color: #667eea; border: none;">
|
||||
<i class="el-icon-download"></i> 下载模板
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 文件上传区域 -->
|
||||
<div style="margin-bottom: 20px;">
|
||||
<div style="font-size: 14px; color: #606266; margin-bottom: 10px; font-weight: 500;">
|
||||
<i class="el-icon-upload2"></i> 上传文件
|
||||
</div>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:on-change="handleFileChange"
|
||||
:file-list="fileList"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
:disabled="fileList.length > 0"
|
||||
accept=".xlsx,.xls"
|
||||
drag
|
||||
style="width: 100%;"
|
||||
>
|
||||
<i class="el-icon-upload" style="font-size: 67px; color: #C0C4CC; margin: 40px 0 16px;"></i>
|
||||
<div class="el-upload__text" style="color: #606266;">
|
||||
将文件拖到此处,或<em>点击上传</em>
|
||||
</div>
|
||||
<div class="el-upload__tip" slot="tip" style="color: #909399; font-size: 12px; margin-top: 10px;">
|
||||
只能上传 Excel 文件(.xlsx/.xls),且不超过 10MB
|
||||
</div>
|
||||
</el-upload>
|
||||
</div>
|
||||
|
||||
<!-- 上传进度 -->
|
||||
<div v-if="uploadProgress > 0 && uploadProgress < 100" style="margin-bottom: 20px;">
|
||||
<el-progress :percentage="uploadProgress" :status="uploadProgress === 100 ? 'success' : ''"></el-progress>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleImportCancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submitUpload" :loading="uploading">开始上传</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 补贴充值预览对话框 -->
|
||||
<el-dialog title="补贴充值预览" :visible.sync="openImportPreview" width="800px" append-to-body>
|
||||
<div style="margin-bottom: 10px; text-align: center;">
|
||||
总记录数:{{ importPreviewData.totalCount || '--' }},
|
||||
有效记录数:{{ importPreviewData.validCount || '--' }},
|
||||
充值总额:{{ importPreviewData.validTotalAmount ? (importPreviewData.validTotalAmount/100).toFixed(2) : '--' }},
|
||||
无效记录数:{{ importPreviewData.invalidCount || '--' }}
|
||||
</div>
|
||||
<div v-if="importPreviewData.invalidList && importPreviewData.invalidList.length > 0" style="margin-bottom: 20px;">
|
||||
<div style="font-weight: 600; margin-bottom: 10px;">无效记录</div>
|
||||
<el-table :data="importPreviewData.invalidList" max-height="250">
|
||||
<!-- <el-table-column label="行号" align="center" prop="row" width="80" :show-overflow-tooltip="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="deptFullName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="充值金额" align="center" prop="amount" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.amount ? (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>
|
||||
<div v-if="importPreviewData.successVoList && importPreviewData.successVoList.length > 0">
|
||||
<div style="font-weight: 600; margin-bottom: 10px;">有效记录</div>
|
||||
<el-table :data="importPreviewData.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="amount" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.amount ? (scope.row.amount/100).toFixed(2) : '--' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="confirmImportSubmit" v-if="importPreviewData.validUserIdList && importPreviewData.validUserIdList.length > 0">继续</el-button>
|
||||
<el-button type="primary" @click="openImportPreview=false" v-else>确定</el-button>
|
||||
<el-button @click="openImportPreview=false">取消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -591,6 +661,10 @@
|
|||
import { accInfoPageApi, accInfoSumPageApi } from "@/api/accountCenter/manager";
|
||||
import { updateAccRechargeSingleApi,checkAccRechargeBatchApi,updateAccRechargeBatchApi,clearAccRechargeSingleApi,checkClearAccRechargeBatchApi,clearAccRechargeBatchApi } from "@/api/accountCenter/butie";
|
||||
import { decryptWithSM4,encryptWithSM4 } from '@/utils/sm';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { downloadFileByUrl } from '@/utils/download'
|
||||
import { download } from '@/utils/request';
|
||||
import request from '@/utils/request';
|
||||
export default {
|
||||
name: "",
|
||||
dicts: ['sys_user_type'],
|
||||
|
|
@ -641,6 +715,31 @@
|
|||
{ required: true, message: "金额不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
clearRules:{
|
||||
clearType:[
|
||||
{ required: true, message: "请选择清空方式", trigger: "change" }
|
||||
],
|
||||
operateAmount:[
|
||||
{ validator: (rule,value,callback)=>{
|
||||
if(this.form.clearType===2){
|
||||
if(value===null||value===undefined||value===""){
|
||||
callback(new Error("操作金额不能为空"));
|
||||
return;
|
||||
}
|
||||
const num = Number(value);
|
||||
if(isNaN(num)){
|
||||
callback(new Error("请输入数字"));
|
||||
return;
|
||||
}
|
||||
if(num < 0){
|
||||
callback(new Error("操作金额不能小于0"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}, trigger: "blur" }
|
||||
]
|
||||
},
|
||||
openBatch:false,
|
||||
openBatchClear:false,
|
||||
dialogParams: {
|
||||
|
|
@ -669,7 +768,15 @@
|
|||
openResult:false,
|
||||
resultData:{},
|
||||
openResult2:false,
|
||||
resultData2:{}
|
||||
resultData2:{},
|
||||
// 导入充值相关
|
||||
openImport: false,
|
||||
fileList: [],
|
||||
uploadProgress: 0,
|
||||
uploading: false,
|
||||
// 补贴充值预览相关
|
||||
openImportPreview: false,
|
||||
importPreviewData: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
|
@ -760,10 +867,20 @@
|
|||
handleClear(row) {
|
||||
this.reset();
|
||||
this.form = Object.assign({}, row)
|
||||
// this.$set(this.form,"clearType",1)
|
||||
this.$set(this.form,"clearType",1)
|
||||
this.$set(this.form,"operateAmount",null)
|
||||
this.$set(this.form,"amount",null)
|
||||
this.openClear = true;
|
||||
this.title = "补贴清空";
|
||||
this.$nextTick(()=>{
|
||||
if(this.$refs.clearForm){
|
||||
this.$refs.clearForm.clearValidate();
|
||||
}
|
||||
})
|
||||
},
|
||||
onOperateAmountInput(value) {
|
||||
const cleaned = (value || "").replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1');
|
||||
this.$set(this.form,"operateAmount", cleaned);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
|
|
@ -787,7 +904,7 @@
|
|||
// receiveEndDate:this.form.receiveEndDate,
|
||||
// validateDay:this.form.validateDay,
|
||||
userId:this.form.userId,
|
||||
amount:Number(this.form.amount*100).toFixed(0)
|
||||
amount:Number(this.form.amount*100)
|
||||
}
|
||||
updateAccRechargeSingleApi(param).then(response => {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
|
|
@ -800,14 +917,17 @@
|
|||
},
|
||||
/** 补贴清空提交按钮 */
|
||||
submitClearForm: function() {
|
||||
// this.$refs["form"].validate(valid => {
|
||||
// if (valid) {
|
||||
this.$modal.confirm('是否确认清空补贴?').then(() => {
|
||||
const doSubmit = () => {
|
||||
const confirmMsg = this.form.clearType === 2
|
||||
? `是否确认清空至 ${this.form.operateAmount} 元?`
|
||||
: '是否确认清空补贴?';
|
||||
this.$modal.confirm(confirmMsg).then(() => {
|
||||
let param = {
|
||||
userId:this.form.userId
|
||||
// ...this.form,
|
||||
// clearType:this.form.clearType,
|
||||
// amount:Number(this.form.amount*100)
|
||||
userId:this.form.userId,
|
||||
clearType:this.form.clearType
|
||||
}
|
||||
if(this.form.clearType === 2){
|
||||
param.operateAmount = Number(this.form.operateAmount*100)
|
||||
}
|
||||
clearAccRechargeSingleApi(param).then(response => {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
|
|
@ -815,8 +935,16 @@
|
|||
this.getList();
|
||||
});
|
||||
}).catch(() => {});
|
||||
// }
|
||||
// });
|
||||
}
|
||||
if(this.$refs["clearForm"]){
|
||||
this.$refs["clearForm"].validate(valid => {
|
||||
if (valid) {
|
||||
doSubmit();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
doSubmit();
|
||||
}
|
||||
},
|
||||
//批量补贴弹窗
|
||||
handleBatchEdit() {
|
||||
|
|
@ -886,13 +1014,13 @@
|
|||
this.$refs["batchForm"].validate(valid => {
|
||||
if (valid) {
|
||||
let param = {
|
||||
amount:Number(this.batchForm.amount*100).toFixed(0),
|
||||
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).toFixed(0)
|
||||
item.amount = Number(this.batchForm.amount*100)
|
||||
})
|
||||
if(this.resultData.errVOList.length==0){
|
||||
this.resultData.successVoList = this.batchList
|
||||
|
|
@ -968,6 +1096,276 @@
|
|||
},800)
|
||||
});
|
||||
},
|
||||
// 打开导入充值对话框
|
||||
handleImportRecharge() {
|
||||
this.openImport = true;
|
||||
this.fileList = [];
|
||||
this.uploadProgress = 0;
|
||||
this.uploading = false;
|
||||
this.importPreviewData = {};
|
||||
if (this.$refs.upload) {
|
||||
this.$refs.upload.clearFiles();
|
||||
}
|
||||
},
|
||||
// 文件选择变化
|
||||
handleFileChange(file, fileList) {
|
||||
// 限制只能选择一个文件
|
||||
if (fileList.length > 1) {
|
||||
this.fileList = [fileList[fileList.length - 1]];
|
||||
this.$refs.upload.fileList = [fileList[fileList.length - 1]];
|
||||
} else {
|
||||
this.fileList = fileList;
|
||||
}
|
||||
},
|
||||
// 下载模板
|
||||
downloadTemplate() {
|
||||
let url = window.location.origin + '/template/批量补贴导入.xlsx';
|
||||
console.log(url)
|
||||
downloadFileByUrl(url)
|
||||
},
|
||||
// 上传前验证
|
||||
beforeUpload(file) {
|
||||
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
||||
file.type === 'application/vnd.ms-excel' ||
|
||||
file.name.endsWith('.xlsx') ||
|
||||
file.name.endsWith('.xls');
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
|
||||
if (!isExcel) {
|
||||
this.$modal.msgError('只能上传 Excel 文件!');
|
||||
return false;
|
||||
}
|
||||
if (!isLt10M) {
|
||||
this.$modal.msgError('上传文件大小不能超过 10MB!');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
// 上传进度
|
||||
handleUploadProgress(event, file, fileList) {
|
||||
this.uploadProgress = Math.round(event.percent);
|
||||
},
|
||||
// 上传成功
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
this.uploading = false;
|
||||
this.uploadProgress = 100;
|
||||
// 兼容不同的响应格式
|
||||
const result = response.data || response;
|
||||
if (response.code === 200 || response.code === 0 || !response.code) {
|
||||
this.uploadResult = {
|
||||
success: true,
|
||||
data: result,
|
||||
message: response.msg || response.message || '导入成功'
|
||||
};
|
||||
this.$modal.msgSuccess('导入成功!');
|
||||
// 刷新列表
|
||||
setTimeout(() => {
|
||||
this.getList();
|
||||
}, 500);
|
||||
} else {
|
||||
this.uploadResult = {
|
||||
success: false,
|
||||
data: result,
|
||||
message: response.msg || response.message || '导入失败'
|
||||
};
|
||||
this.$modal.msgError(response.msg || response.message || '导入失败');
|
||||
}
|
||||
},
|
||||
// 上传失败
|
||||
handleUploadError(err, file, fileList) {
|
||||
this.uploading = false;
|
||||
this.uploadProgress = 0;
|
||||
this.uploadResult = {
|
||||
success: false,
|
||||
message: err.message || '上传失败,请重试'
|
||||
};
|
||||
this.$modal.msgError('上传失败,请重试');
|
||||
},
|
||||
// 提交上传(校验)
|
||||
submitUpload() {
|
||||
if (this.fileList.length === 0) {
|
||||
this.$modal.msgError('请先选择要上传的文件!');
|
||||
return;
|
||||
}
|
||||
const file = this.fileList[0].raw || this.fileList[0];
|
||||
if (!file) {
|
||||
this.$modal.msgError('文件不存在,请重新选择!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证文件类型和大小
|
||||
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
||||
file.type === 'application/vnd.ms-excel' ||
|
||||
file.name.endsWith('.xlsx') ||
|
||||
file.name.endsWith('.xls');
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
|
||||
if (!isExcel) {
|
||||
this.$modal.msgError('只能上传 Excel 文件!');
|
||||
return;
|
||||
}
|
||||
if (!isLt10M) {
|
||||
this.$modal.msgError('上传文件大小不能超过 10MB!');
|
||||
return;
|
||||
}
|
||||
|
||||
this.uploading = true;
|
||||
this.uploadProgress = 0;
|
||||
|
||||
// 使用FormData上传文件
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
// 调用校验接口
|
||||
request({
|
||||
url: '/smart-canteen/acc/subsidy/import/add/check',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'Authorization': 'Bearer ' + getToken()
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
if (progressEvent.total) {
|
||||
this.uploadProgress = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||
}
|
||||
}
|
||||
}).then(response => {
|
||||
this.uploading = false;
|
||||
this.uploadProgress = 100;
|
||||
|
||||
// 处理响应数据
|
||||
const result = response.data || response;
|
||||
if (response.code === 200 || response.code === 0) {
|
||||
// 组装预览数据,兼容批量补贴预览展示
|
||||
const amountMap = {};
|
||||
(result.sucVoListMap || []).forEach(item => {
|
||||
const key = Object.keys(item || {})[0];
|
||||
if (key) {
|
||||
amountMap[key] = item[key];
|
||||
}
|
||||
});
|
||||
const successVoList = (result.accInfoVOList || []).map(item => {
|
||||
const phoneNumber = item.phoneNumber ? decryptWithSM4(item.phoneNumber) : item.phoneNumber;
|
||||
return {
|
||||
...item,
|
||||
phoneNumber,
|
||||
amount: amountMap[item.userId] || amountMap[item.userId + ''] || item.amount
|
||||
};
|
||||
});
|
||||
const invalidList = [
|
||||
...(result.errVOList || []),
|
||||
...(result.invalidVOList || [])
|
||||
].map(item => ({
|
||||
...item,
|
||||
phoneNumber: item.phoneNumber ? decryptWithSM4(item.phoneNumber) : item.phoneNumber
|
||||
}));
|
||||
this.importPreviewData = {
|
||||
...result,
|
||||
totalCount: result.totalUserSum,
|
||||
successVoList,
|
||||
invalidList
|
||||
};
|
||||
// 关闭导入对话框,打开预览对话框
|
||||
this.openImport = false;
|
||||
this.openImportPreview = true;
|
||||
} else {
|
||||
this.$modal.msgError(response.msg || response.message || '校验失败');
|
||||
}
|
||||
}).catch(error => {
|
||||
this.uploading = false;
|
||||
this.uploadProgress = 0;
|
||||
this.$modal.msgError(error.message || '上传失败,请重试');
|
||||
});
|
||||
},
|
||||
// 确认提交导入
|
||||
confirmImportSubmit() {
|
||||
if (!this.importPreviewData.validUserIdList || this.importPreviewData.validUserIdList.length === 0) {
|
||||
this.$modal.msgError('没有有效的记录可以提交!');
|
||||
return;
|
||||
}
|
||||
|
||||
// 仅提交有效人员及金额明细
|
||||
const userIdAmountMap = (this.importPreviewData.successVoList || [])
|
||||
.filter(item => this.importPreviewData.validUserIdList.includes(String(item.userId)))
|
||||
.map(item => ({ [item.userId]: item.amount }));
|
||||
const param = {
|
||||
userIds: this.importPreviewData.validUserIdList,
|
||||
userIdAmountMap
|
||||
};
|
||||
|
||||
// 调用提交接口
|
||||
request({
|
||||
url: '/smart-canteen/acc/subsidy/batch/import/add',
|
||||
method: 'post',
|
||||
data: param,
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + getToken()
|
||||
}
|
||||
}).then(response => {
|
||||
if (response.code === 200 || response.code === 0) {
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
this.openImportPreview = false;
|
||||
this.getList();
|
||||
} else {
|
||||
this.$modal.msgError(response.msg || response.message || '提交失败');
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$modal.msgError(error.message || '提交失败,请重试');
|
||||
});
|
||||
},
|
||||
// 取消导入
|
||||
handleImportCancel() {
|
||||
this.openImport = false;
|
||||
this.fileList = [];
|
||||
this.uploadProgress = 0;
|
||||
this.uploading = false;
|
||||
this.importPreviewData = {};
|
||||
if (this.$refs.upload) {
|
||||
this.$refs.upload.clearFiles();
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.clear-dialog__body {
|
||||
width: 100%;
|
||||
padding: 0 4px 4px 0;
|
||||
}
|
||||
|
||||
.clear-form {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.clear-form__item {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.clear-form__row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.clear-form__row--amount .clear-form__input {
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
.clear-form__label {
|
||||
width: 80px;
|
||||
flex-shrink: 0;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.clear-form__input {
|
||||
width: 420px;
|
||||
}
|
||||
|
||||
.clear-form__note {
|
||||
color: red;
|
||||
margin-top: 6px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue