user_withdraw_code.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!-- 账户明细 -->
  2. <template>
  3. <view class="user-withdraw-code">
  4. <mescroll-body ref="mescrollRef" @init="mescrollInit" @up="upCallback" :up="upOption"
  5. @down="downCallback">
  6. <view class="list p-t-20">
  7. <view class="item bg-white" v-for="(item,index) in list" :key="index">
  8. <router-link :to="{path: '/bundle/pages/widthdraw_result/widthdraw_result', query: {id: item.id}}">
  9. <view class="flex row-between">
  10. <view class="md ">{{item.desc}}</view>
  11. <view>
  12. <text class="xxl">-{{item.money}}</text>
  13. </view>
  14. </view>
  15. <view class="flex row-between">
  16. <view class="xs muted">{{item.create_time}}</view>
  17. <view class="xs" :style="{color: [styleWithdrawStatus(item.status)]}">{{item.status_text}}</view>
  18. </view>
  19. <view class="m-t-10 sm primary" v-if="item.description && item.status == 4">
  20. {{item.description}}
  21. </view>
  22. </router-link>
  23. </view>
  24. </view>
  25. </mescroll-body>
  26. </view>
  27. </template>
  28. <script>
  29. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  30. import {
  31. getWithdrawRecords
  32. } from "@/api/user"
  33. export default {
  34. mixins: [MescrollMixin], // 使用mixin
  35. data() {
  36. return {
  37. upOption: {
  38. empty: {
  39. icon: '/static/images/order_null.png',
  40. tip: '暂无记录', // 提示
  41. }
  42. },
  43. list: [], // 列表数据--全部
  44. };
  45. },
  46. methods: {
  47. // 上拉加载
  48. upCallback(page) {
  49. const pageNum = page.num; // 页码, 默认从1开始
  50. const pageSize = page.size; // 页长, 默认每页10条
  51. getWithdrawRecords({
  52. page_size: pageSize,
  53. page_no: pageNum,
  54. }).then(({
  55. data
  56. }) => {
  57. if (page.num == 1) this.list = [];
  58. const curPageData = data.list;
  59. const curPageLen = curPageData.length;
  60. const hasNext = !!data.more;
  61. this.list = this.list.concat(curPageData);
  62. this.mescroll.endSuccess(curPageLen, hasNext);
  63. }).catch(() => {
  64. this.mescroll.endErr()
  65. })
  66. },
  67. styleWithdrawStatus(status) {
  68. switch(status) {
  69. case 1: return '#0CC21E';
  70. case 2: return '#666666';
  71. case 3: return '#FF2C3C';
  72. case 4: return '#FF2C3C';
  73. }
  74. }
  75. },
  76. onLoad(options) {
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .user-withdraw-code {
  82. .item {
  83. padding: 22rpx 30rpx;
  84. &:not(:last-of-type) {
  85. border-bottom: $-solid-border;
  86. }
  87. }
  88. }
  89. </style>