balance-examine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <div class="page-box" v-loading="loading > 0">
  3. <Header :title="title"></Header>
  4. <div class="container">
  5. <div class="content">
  6. <!-- 表格 -->
  7. <div class="filter-box">
  8. <div class="filter">
  9. <div class="filter-item">
  10. <div class="label">用户ID:</div>
  11. <el-input
  12. class="input"
  13. v-model="filter.uid"
  14. placeholder="请输入内容"
  15. size="small"
  16. ></el-input>
  17. </div>
  18. <div class="filter-item">
  19. <div class="label">审核状态:</div>
  20. <el-select
  21. v-model="filter.status"
  22. size="small"
  23. class="select"
  24. placeholder="请选择"
  25. >
  26. <el-option
  27. v-for="item in statusType"
  28. :key="item.value"
  29. :label="item.name"
  30. :value="item.value"
  31. >
  32. </el-option>
  33. </el-select>
  34. </div>
  35. <div class="filter-item">
  36. <div class="label">申请时间:</div>
  37. <el-date-picker
  38. v-model="date"
  39. type="datetimerange"
  40. align="right"
  41. unlink-panels
  42. class="date-input"
  43. range-separator="至"
  44. start-placeholder="开始日期"
  45. end-placeholder="结束日期"
  46. value-format="yyyy-MM-dd HH:mm:ss"
  47. :default-time="['00:00:00', '23:59:59']"
  48. size="small"
  49. >
  50. </el-date-picker>
  51. </div>
  52. </div>
  53. <div class="btn-box">
  54. <button class="search" @click="search">筛选</button>
  55. <button class="reset" @click="reset">重置</button>
  56. <button class="search" style="margin-left: 60px" @click="order2excel">导出</button>
  57. </div>
  58. </div>
  59. <el-table
  60. :data="list"
  61. class="table no-border-table"
  62. ref="table"
  63. :header-cell-style="{
  64. border: 'none',
  65. color: '#333',
  66. background: '#f6f6f6',
  67. borderBottom: '1px solid #E8E8E8',
  68. height: '54px',
  69. }"
  70. :row-style="{
  71. height: '54px',
  72. }"
  73. >
  74. <el-table-column
  75. prop="created"
  76. align="center"
  77. label="提审时间"
  78. ></el-table-column>
  79. <el-table-column
  80. prop="uid"
  81. align="center"
  82. label="用户ID"
  83. ></el-table-column>
  84. <el-table-column
  85. prop="amount"
  86. align="center"
  87. label="充值金额/元"
  88. ></el-table-column>
  89. <el-table-column
  90. prop="thirdId"
  91. align="center"
  92. label="充值单号"
  93. ></el-table-column>
  94. <el-table-column prop="status" align="center" label="审核状态">
  95. <div slot-scope="scope">
  96. {{ statusMap[scope.row.status] }}
  97. </div>
  98. </el-table-column>
  99. <el-table-column prop="amount" align="center" label="截图凭证">
  100. <div slot-scope="scope">
  101. <!-- <img class="master-pic" :src="scope.row.pic" alt="" /> -->
  102. <el-image
  103. class="master-pic"
  104. :src="scope.row.pic"
  105. :preview-src-list="[scope.row.pic]"
  106. >
  107. </el-image>
  108. </div>
  109. </el-table-column>
  110. <el-table-column label="操作" align="center" width="180">
  111. <div
  112. slot-scope="scope"
  113. style="display: flex; justify-content: center"
  114. v-if="scope.row.status === 0"
  115. >
  116. <button
  117. size="mini"
  118. class="table-btn"
  119. @click="handleAudit(scope.row.id, 1)"
  120. >
  121. 通过
  122. </button>
  123. <button
  124. size="mini"
  125. class="table-btn"
  126. @click="handleAudit(scope.row.id, 2)"
  127. >
  128. 拒绝
  129. </button>
  130. </div>
  131. </el-table-column>
  132. </el-table>
  133. </div>
  134. <!-- 分页按钮 -->
  135. <div class="footer">
  136. <el-pagination
  137. @current-change="handleCurrentChange"
  138. :current-page.sync="currentPage"
  139. background
  140. layout="total, prev, pager, next, jumper"
  141. :page-size="size"
  142. :total="total"
  143. ></el-pagination>
  144. </div>
  145. </div>
  146. <el-dialog
  147. :show-close="false"
  148. :close-on-click-modal="false"
  149. title="生成中..."
  150. :visible.sync="showProgressDialog"
  151. width="30%"
  152. center
  153. >
  154. <el-progress
  155. :percentage="progress"
  156. :text-inside="true"
  157. :stroke-width="18"
  158. ></el-progress>
  159. </el-dialog>
  160. </div>
  161. </template>
  162. <script type="text/ecmascript-6">
  163. import Header from '../../components/common/header';
  164. import myUtils from '../../components/common/whatever2excel';
  165. export default {
  166. components: {
  167. Header
  168. },
  169. name: 'balanceExamine',
  170. data() {
  171. return {
  172. currentPage: 1, // 当前页码
  173. size: 20, // 每页条数
  174. total: 0, // 总页数
  175. loading: 0, // 加载中
  176. title: {
  177. // 页面标题
  178. firstTitile: '资金管理',
  179. secondTitle: '余额充值审核'
  180. },
  181. filter: {
  182. uid: null,
  183. status: null
  184. },
  185. statusType: [
  186. {
  187. name: '全部',
  188. value: null
  189. },
  190. {
  191. name: '待审核',
  192. value: 0
  193. },
  194. {
  195. name: '审核通过',
  196. value: 1
  197. },
  198. {
  199. name: '审核拒绝',
  200. value: 2
  201. }
  202. ],
  203. statusMap: {
  204. 0: '待审核',
  205. 1: '审核通过',
  206. 2: '审核拒绝'
  207. },
  208. list: [], // 用户列表
  209. date: [],
  210. showProgressDialog: false,
  211. progress: 0
  212. };
  213. },
  214. mounted() {
  215. // 获取列表
  216. this.getList();
  217. },
  218. computed: {},
  219. methods: {
  220. // 切换页码
  221. handleCurrentChange(page) {
  222. this.currentPage = page;
  223. this.getList();
  224. },
  225. // 获取提现列表
  226. getList() {
  227. this.filter.begin = this.date[0] || '';
  228. this.filter.end = this.date[1] || '';
  229. this.loading++;
  230. this.httpGet(this.$root.xxRechargeList, {
  231. page: this.currentPage,
  232. size: this.size,
  233. ...this.filter
  234. }).then(
  235. (res) => {
  236. this.loading--;
  237. this.list = res.list;
  238. this.total = res.total;
  239. },
  240. (res) => {
  241. this.loading--;
  242. this.$message.error(res);
  243. }
  244. );
  245. },
  246. // 过滤
  247. search() {
  248. this.currentPage = 1;
  249. this.getList();
  250. },
  251. // 重置过滤
  252. reset() {
  253. this.filter = {};
  254. this.date = [];
  255. this.getList();
  256. },
  257. handleAudit(id, status) {
  258. this.$confirm(
  259. `<p class='title'><i class='icon el-icon-question'></i>提醒</p><p class='text'>确定要${
  260. status === 1 ? '通过' : '驳回'
  261. }该审核吗?</p>`,
  262. {
  263. confirmButtonText: '确定',
  264. cancelButtonText: '取消',
  265. cancelButtonClass: 'cancel-btn',
  266. confirmButtonClass: 'confirm-btn',
  267. customClass: 'confirm-box',
  268. dangerouslyUseHTMLString: true,
  269. showClose: false,
  270. type: 'none'
  271. }
  272. ).then(() => {
  273. this.loading++;
  274. this.httpPut(this.$root.xxRechargeAudit, {
  275. id,
  276. status
  277. }).then(
  278. (res) => {
  279. this.$message({
  280. message: '操作成功',
  281. type: 'success'
  282. });
  283. this.loading--;
  284. this.getList();
  285. },
  286. (res) => {
  287. this.loading--;
  288. this.$message.error(res);
  289. }
  290. );
  291. });
  292. },
  293. async order2excel() {
  294. this.loading++;
  295. let list = [];
  296. let totalPage = null;
  297. let data = {
  298. page: this.currentPage,
  299. size: this.size,
  300. ...this.filter
  301. };
  302. await this.httpGet(this.$root.xxRechargeList, data).then(
  303. (res) => {
  304. this.loading--;
  305. totalPage = Math.ceil(parseInt(res.total) / this.size);
  306. },
  307. () => {
  308. this.loading--;
  309. }
  310. );
  311. this.showProgressDialog = true;
  312. this.progress = 0;
  313. await this.getAllPages(totalPage, list).then(
  314. () => {
  315. this.showProgressDialog = false;
  316. this.jsonFormatAndToExcel(list);
  317. },
  318. (err) => {
  319. console.error(err);
  320. this.showProgressDialog = false;
  321. }
  322. );
  323. },
  324. async getAllPages(totalPage, list) {
  325. for (let i = 1; i <= totalPage; i++) {
  326. let data = {
  327. page: i,
  328. size: this.size,
  329. ...this.filter
  330. };
  331. await this.httpGet(this.$root.xxRechargeList, data).then((res) => {
  332. list.push(...res.list);
  333. this.progress = Math.floor((i / totalPage) * 100);
  334. console.log('page' + i, list.length);
  335. });
  336. // console.log(5555, list);
  337. }
  338. },
  339. jsonFormatAndToExcel(list) {
  340. let formatList = [];
  341. list.forEach((item) => {
  342. let obj = {
  343. 提审时间: item.created,
  344. 用户ID: item.uid,
  345. '充值金额/元': item.amount,
  346. 充值单号: item.thirdId,
  347. 审核状态: this.statusMap[item.status]
  348. };
  349. formatList.push(obj);
  350. });
  351. myUtils.json2excel(formatList);
  352. }
  353. }
  354. };
  355. </script>
  356. <style lang="stylus" rel="stylesheet/stylus">
  357. @import '~assets/public.styl';
  358. </style>
  359. <style lang="stylus" rel="stylesheet/stylus" scoped>
  360. @import '~assets/main.styl';
  361. .page-box {
  362. height: 100%;
  363. width: 100%;
  364. flex-y(flex-start, flex-start);
  365. overflow-y: hidden;
  366. background: bg-color;
  367. .container {
  368. box-sizing: border-box;
  369. height: 100%;
  370. width: 100%;
  371. overflow-y: auto;
  372. flex-y(flex-start, flex-start);
  373. padding: 10px;
  374. // content 表格
  375. .content {
  376. flex: 1;
  377. width: 100%;
  378. font-size: 14px;
  379. background: white;
  380. box-sizing: border-box;
  381. padding: 24px 32px;
  382. border-radius: 2px;
  383. // 按钮
  384. .btn {
  385. width: 100px;
  386. height: 32px;
  387. line-height: 32px;
  388. confirm-btn();
  389. font-size: 14px;
  390. margin: 16px 0;
  391. }
  392. // 表格按钮
  393. .table-btn {
  394. // width: 65px;
  395. height: 24px;
  396. line-height: 24px;
  397. color: gray3;
  398. font-size: 12px;
  399. margin-right: 8px;
  400. cancel-btn();
  401. padding: 0 8px;
  402. }
  403. .filter-item {
  404. margin-right: 12px;
  405. }
  406. .select, .input {
  407. width: 125px;
  408. }
  409. .date-input {
  410. width: 360px;
  411. }
  412. .btn-box {
  413. margin: 0;
  414. }
  415. .table {
  416. margin-top: 24px !important;
  417. .master-pic {
  418. width: auto;
  419. height: 36px;
  420. }
  421. }
  422. }
  423. }
  424. .footer {
  425. width: 100%;
  426. padding: 24px;
  427. box-sizing: border-box;
  428. flex-x(flex-end);
  429. background: white;
  430. }
  431. .dialog-content {
  432. flex-y();
  433. }
  434. .form {
  435. width: 100%;
  436. flex-center();
  437. margin: 8px 0;
  438. }
  439. }
  440. </style>