index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <div class="app-container" v-loading="loading">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
  4. <el-form-item label="人员名称" prop="name">
  5. <el-input
  6. v-model.trim="queryParams.name"
  7. placeholder="请输入人员名称"
  8. clearable
  9. size="medium"
  10. style="width: 150px"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="手机号" prop="phone">
  15. <el-input
  16. v-model.trim="queryParams.phone"
  17. placeholder="请输入手机号"
  18. clearable
  19. size="medium"
  20. style="width: 140px"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="卡号" prop="card">
  25. <el-input
  26. v-model.trim="queryParams.card"
  27. placeholder="请输入卡号"
  28. clearable
  29. size="medium"
  30. style="width: 140px"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  37. <el-button type="primary" icon="el-icon-refresh" size="mini" @click="synchroPersonnel" v-hasPermi="['recharge:batch:synchro']">人员信息同步</el-button>
  38. <el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="batchChange(1)" v-hasPermi="['recharge:batch:binding']">批量绑定</el-button>
  39. <el-button type="warning" icon="el-icon-remove-outline" size="mini" @click="batchChange(0)" v-hasPermi="['recharge:batch:relieve']">批量解除</el-button>
  40. <el-upload
  41. ref="upload"
  42. class="upload-demo"
  43. action="#"
  44. :limit = 1
  45. :on-change="handleChange"
  46. :auto-upload="false"
  47. accept=".xlsx,.xls"
  48. style="display:inline-block;margin-left:10px;vertical-align: top;"
  49. v-hasPermi="['recharge:batch:recharge']"
  50. >
  51. <el-button size="mini" type="warning">上传充值文件</el-button>
  52. </el-upload>
  53. </el-form-item>
  54. </el-form>
  55. <el-table :data="adminList" @selection-change="handleSelectionChange" height="calc(100vh - 10vh - 120px)">
  56. <el-table-column type="selection" width="50" align="center" />
  57. <el-table-column label="id" align="center" prop="id" show-overflow-tooltip />
  58. <el-table-column label="人员名称" align="center" prop="name" show-overflow-tooltip />
  59. <el-table-column label="部门" align="center" prop="dept" show-overflow-tooltip />
  60. <!-- <el-table-column label="人员信息" align="center" prop="identity" show-overflow-tooltip /> -->
  61. <el-table-column label="手机号" align="center" prop="contacts" show-overflow-tooltip />
  62. <el-table-column label="卡号" align="center" prop="cardId" show-overflow-tooltip />
  63. <el-table-column label="余额(元)" align="center" prop="balance" show-overflow-tooltip />
  64. <el-table-column label="充值到账比例" align="center" prop="proportion" show-overflow-tooltip />
  65. <el-table-column label="创建时间" align="center" prop="createTime" show-overflow-tooltip />
  66. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  67. <template slot-scope="scope">
  68. <el-button
  69. size="mini"
  70. type="text"
  71. icon="el-icon-link"
  72. @click="radio(scope.row)"
  73. v-hasPermi="['recharge:role:wz']"
  74. >微信、支付宝充值</el-button>
  75. <el-button
  76. size="mini"
  77. type="text"
  78. icon="el-icon-link"
  79. @click="cash(scope.row)"
  80. v-hasPermi="['recharge:role:x']"
  81. >现金</el-button>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <!-- 报表异常信息-->
  86. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :before-close="cancel" :close-on-click-modal="false" >
  87. <el-table :data="errList" @selection-change="handleSelectionChange" height="500px">
  88. <el-table-column label="序号" align="left" show-overflow-tooltip min-width="50px">
  89. <template slot-scope="scop">
  90. {{scop.$index+1}}
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="姓名" align="center" prop="userName" show-overflow-tooltip />
  94. <el-table-column label="手机号" align="center" prop="userPhone" show-overflow-tooltip />
  95. <el-table-column label="订单金额(元)" align="center" prop="money" show-overflow-tooltip />
  96. <el-table-column label="异常提示" align="center" prop="errorMessage" show-overflow-tooltip min-width="150%">
  97. <template slot-scope="scop">
  98. <span class="danger ">{{scop.row.errorMessage}}</span>
  99. </template>
  100. </el-table-column>
  101. </el-table>
  102. </el-dialog>
  103. <pagination
  104. v-show="total>0"
  105. :total="total"
  106. :page.sync="queryParams.current"
  107. :limit.sync="queryParams.size"
  108. @pagination="getList"
  109. />
  110. </div>
  111. </template>
  112. <script>
  113. import { listChannel, personJob, staff } from "@/api/recharge/personnel";
  114. import { uploadFile } from "@/api/system/product";
  115. import { allRadio } from "@/api/recharge/radio";
  116. export default {
  117. name: "admin",
  118. data() {
  119. return {
  120. // 遮罩层
  121. loading: true,
  122. // 导出遮罩层
  123. exportLoading: false,
  124. dialogFormVisible:false,
  125. // 选中数组id
  126. ids: [],
  127. // 非单个禁用
  128. single: true,
  129. // 非多个禁用
  130. multiple: true,
  131. // 显示搜索条件
  132. showSearch: true,
  133. // 总条数
  134. total: 0,
  135. // 参数表格数据
  136. adminList: [],
  137. // 弹出层标题
  138. title: "异常信息",
  139. // 是否显示弹出层
  140. open: false,
  141. // 类型数据字典
  142. typeOptions: [],
  143. // 日期范围
  144. dateRange: [],
  145. // 查询参数
  146. queryParams: {
  147. current: 1,
  148. size: 10,
  149. name: undefined,
  150. aliasName: undefined,
  151. startTime: undefined,
  152. endTime: undefined,
  153. identity: undefined,
  154. proportion: undefined,
  155. id:undefined,
  156. phone:undefined,
  157. card:undefined
  158. },
  159. // 表单参数
  160. form: {
  161. name:'',
  162. aliasName:''
  163. },
  164. // 到账比例
  165. radioList:[
  166. ],
  167. //批量到账比例处理
  168. staffList:[],
  169. // 表单校验
  170. rules: {
  171. id:[
  172. { required: true, message: "充值比例不能为空", trigger: "change"},
  173. ],
  174. },
  175. limit:100,
  176. num:0,
  177. // 文件显示
  178. fileList:[{"url":''}],
  179. errList:[],//异常信息
  180. };
  181. },
  182. created() {
  183. this.getList();
  184. this.getListczgl();
  185. },
  186. methods: {
  187. //上传文件
  188. handleChange(param){
  189. this.limit = 1
  190. this.num++
  191. if(this.num>1){
  192. this.num = 0
  193. return false
  194. }else{
  195. let data = new FormData()// FormData 对象
  196. data.append('file', param.raw)
  197. uploadFile(data).then(res=>{
  198. if(res.status == "SUCCESS" && res.data.length>0){
  199. this.msgSuccess('充值文件上传成功,部分用户充值成功')
  200. this.errList = res.data
  201. this.open = true
  202. }else if(res.status == "SUCCESS" && res.data.length == "0"){
  203. this.msgSuccess('充值文件上传成功,文件用户均已充值完成')
  204. }else{
  205. }
  206. this.$refs.upload.submit();
  207. }).catch(err=>{
  208. this.$refs.upload.submit();
  209. })
  210. }
  211. },
  212. forceUpdate(){ //重置form
  213. this.form = JSON.parse(JSON.stringify(this.form));
  214. },
  215. /** 查询参数列表 */
  216. getList() {
  217. this.loading = true;
  218. listChannel(this.addDateRange(this.queryParams)).then(response => {
  219. this.adminList = response.data.records;
  220. for(let i =0;i<this.adminList.length;i++){
  221. this.adminList[i].dept = JSON.parse(this.adminList[i].dept).name
  222. }
  223. this.total = response.data.total;
  224. this.loading = false;
  225. }
  226. );
  227. },
  228. /** 获取充值管理的数据用于修改赋值 */
  229. getListczgl() {
  230. allRadio().then(response => {
  231. this.radioList = response.data.map(item=>{
  232. return {
  233. identity:item.identity,
  234. proportion:item.proportion,
  235. id:item.id
  236. }
  237. })
  238. });
  239. },
  240. // 取消按钮
  241. cancel() {
  242. this.open = false;
  243. this.reset();
  244. },
  245. // 表单重置
  246. reset() {
  247. this.form = {
  248. ids: undefined,
  249. name: undefined,
  250. aliasName: undefined,
  251. adminType: "Y",
  252. proportion:undefined,
  253. id:undefined
  254. };
  255. this.staffList = []
  256. this.resetForm("form");
  257. },
  258. // 同步人员信息
  259. synchroPersonnel(){
  260. if(this.queryParams.name){
  261. personJob({"blurry":this.queryParams.name}).then(response =>{
  262. this.getList();
  263. })
  264. localStorage.setItem("timeout","大于10s")
  265. this.msgSuccess('请在定时任务中人员信息中,选择点击更多--调度日志查询同步进度 ', 5000)
  266. this.$router.push({path:'/system/job/jobTaskIndex'})
  267. localStorage.setItem('personnel', 1)
  268. }else{
  269. this.$message.error('同步人员信息不能为空')
  270. }
  271. },
  272. /** 搜索按钮操作 */
  273. handleQuery() {
  274. this.queryParams.current = 1;
  275. this.getList();
  276. },
  277. /** 重置按钮操作 */
  278. resetQuery() {
  279. this.dateRange = [];
  280. this.resetForm("queryForm");
  281. this.handleQuery();
  282. },
  283. /** 微信支付宝充值跳转 */
  284. radio(row){
  285. this.$router.push({path:'userRecharge'})
  286. localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
  287. },
  288. /** 现金充值跳转 */
  289. cash(row){
  290. this.$router.push({path:'cash'})
  291. localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
  292. },
  293. // 多选框选中数据
  294. handleSelectionChange(selection) {
  295. this.ids = selection.map(item => item);
  296. this.single = selection.length != 1;
  297. this.multiple = !selection.length;
  298. },
  299. //批量处理
  300. batchChange(change){
  301. if(this.ids.length>0){
  302. if(change == "1"){
  303. this.open = true;
  304. this.title = "修改参数";
  305. }else{
  306. this.loading = true;
  307. this.staffList = this.ids.map(item=>{
  308. return {
  309. staffId:item.sid,
  310. radioId:item.radioId,
  311. delFlag:0
  312. }
  313. })
  314. staff(this.staffList).then(response =>{
  315. this.loading = false;
  316. this.msgSuccess('批量解绑完成')
  317. this.getList();
  318. }).catch(err=>{
  319. this.loading = false;
  320. })
  321. }
  322. }else{
  323. this.$message.error('请勾选需要批量处理充值到账比例人员信息')
  324. }
  325. },
  326. /** 提交按钮 */
  327. submitForm() {
  328. this.$refs["queryParams"].validate(valid => {
  329. if (valid) {
  330. if(this.queryParams.id){
  331. this.loading = true;
  332. this.staffList = this.ids.map(item=>{
  333. return {
  334. staffId:item.sid,
  335. radioId:this.queryParams.id,
  336. delFlag:1
  337. }
  338. })
  339. staff(this.staffList).then(response =>{
  340. this.loading = false;
  341. this.open = false;
  342. this.msgSuccess('批量绑定完成')
  343. this.getList();
  344. this.reset()
  345. }).catch(err=>{
  346. this.loading = false;
  347. })
  348. }
  349. }
  350. })
  351. },
  352. }
  353. };
  354. </script>
  355. <style lang="scss" >
  356. .el-select-dropdown__item.selected{
  357. font-weight: none !important;
  358. }
  359. </style>