integral-list.vue 11 KB

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