brokerage_tx_log.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <style>
  2. .m-app{width:100vw}
  3. /* 头部 */
  4. .app-header{width:100%;background: #ffffff;height:42px;position: relative;}
  5. button.back-btn{width:18px;height:18px;position: absolute;top:12px;left:12px;z-index: 1;}
  6. button.back-btn image{width:18px;height:18px;display: block;}
  7. button.share-btn{width:18px;height:18px;position: absolute;top:12px;right:12px;z-index: 1;}
  8. button.share-btn image{width:18px;height:18px;display: block;}
  9. .app-title{color:#333333;font-size: 16px;font-weight: 700;text-align: center;width:100%;height:42px;line-height: 42px;position: relative;}
  10. .top-nav{width:calc(100% - 12px);padding-left: 12px;white-space: nowrap;padding-top: 10px;background: #ffffff;}
  11. button.top-nav-btn{height:35px;position: relative;display: inline-block;margin-right: 50px;}
  12. button.top-nav-btn:last-child{margin-right: 12px;}
  13. button.top-nav-btn text.ntitle{height:35px;line-height: 35px;text-align: center;color:#3f454b;font-size: 14px;width:100%;}
  14. button.top-nav-btn text.bline{height:3px;width:100%;position: absolute;bottom:0px;left:0px;}
  15. button.top-nav-btn.active text.ntitle{color:#ff383e;}
  16. button.top-nav-btn.active text.bline{background: #ff383e;}
  17. /* 滚动内容区域 */
  18. scroll-view.mid-body{width:100%;height:calc(100vh - 10px);margin-top: 10px;
  19. /* #ifdef H5 */
  20. height:calc(100vh - 42px - 10px);
  21. /* #endif */
  22. }
  23. .data-main{background: #ffffff;padding: 0px 12px;}
  24. .data-item{padding: 15px 0px;border-bottom:1px solid #f0f0f0;}
  25. .data-item:last-child{border-bottom:0px}
  26. .data-item-l{width:calc(100% - 80px)}
  27. .log-title{width:100%;font-size: 14px;color:#333333;text-align: left;}
  28. .log-time{width:100%;font-size: 12px;color:#999999;height:12px;line-height: 12px;text-align: left;margin-top: 10px;}
  29. .data-item-r{width:80px;text-align: right;color:#019560;font-size: 15px;}
  30. .data-shenhe{ color:red; text-align: right; font-size: 14px; margin-top: 5px;}
  31. .data-ok{ color: #007AFF;}
  32. </style>
  33. <template>
  34. <view class="m-app">
  35. <scroll-view class="mid-body" scroll-y="true" @scrolltolower="loadMoreData">
  36. <view class="data-main">
  37. <view class="data-item fx-r fx-bc" v-for="(item,index) in data">
  38. <view class="data-item-l">
  39. <view class="log-title">兑换到{{item.bankname}}账号:{{item.account}},姓名:{{item.name}}</view>
  40. <view class="log-time">兑换时间:{{item.addtime}}</view>
  41. </view>
  42. <view>
  43. <view class="data-item-r">{{item.money}}</view>
  44. <view class="data-shenhe" v-if="item.state == 0">待审核</view>
  45. <view class="data-ok" v-if="item.state == 1">已兑换</view>
  46. <view class="data-ok" v-if="item.state == 2">兑换失败</view>
  47. </view>
  48. </view>
  49. </view>
  50. </scroll-view>
  51. </view>
  52. </template>
  53. <script>
  54. import {mapState,mapMutations } from 'vuex';
  55. var page = 1;//页码
  56. var isLoad = false;//加载
  57. var isFoot = false;//是否到底
  58. export default {
  59. computed: mapState(['user']),
  60. data() {
  61. return {
  62. data:[],
  63. type :"",
  64. page:{
  65. isFirst:false,
  66. isLoad:false,
  67. isFoot:false,
  68. page:1
  69. }
  70. }
  71. },
  72. onLoad(options) {
  73. this.type = options.type || '';
  74. this.checkUserLogin({page:this,fn:this.initView});
  75. },
  76. onReachBottom() {
  77. console.log(this.page.isFoot);
  78. if(this.page.isFoot || this.page.isLoad) {
  79. return;
  80. }
  81. this.page.page ++;
  82. this.getData();
  83. },
  84. methods: {
  85. ...mapMutations(['checkUserLogin']),
  86. /**
  87. * 加载基础配置
  88. */
  89. initView:function(){
  90. this.getData(true);
  91. },
  92. /**
  93. * 获取数据
  94. */
  95. getData:function(isPull = false){
  96. if(this.page.isLoad) return;
  97. this.page.isLoad = true;
  98. if(isPull) {
  99. this.page.page = 1;
  100. this.page.isLoad = false;
  101. this.page.isFoot = false;
  102. }
  103. uni.showLoading({ title: '获取数据中..' });
  104. var post = {};
  105. post.page = this.page.page;
  106. post.type = this.type;
  107. this
  108. .request
  109. .post("userBrokerageTxLog",post)
  110. .then(res => {
  111. uni.hideLoading();
  112. this.page.isFirst = true;
  113. this.page.isLoad = false;
  114. if(isPull) {
  115. this.data = res.data.list;
  116. } else {
  117. this.data = this.data.concat(res.data.list);
  118. }
  119. //是否到底
  120. if(res.data.list.length != res.data.pageSize) {
  121. this.page.isFoot = true;
  122. }
  123. })
  124. .catch(res=>{
  125. console.log(res);
  126. uni.hideLoading();
  127. uni.showModal({title: '系统提示',content: '加载失败,返回在尝试',showCancel: false});
  128. });
  129. }
  130. }
  131. }
  132. </script>