wallet.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666666"></navbar>
  4. <view v-if="walletList.length>0">
  5. <view class="list" v-for="(item,index) in walletList" :key='item.id'>
  6. <view class="item">
  7. <view class="u-flex-center-sb u-181818">
  8. <view class="u-font26">{{item.mode}}</view>
  9. <view class="u-font36 u-bold u-FF0000" v-if="item.bill_type==1">+{{item.entry_value}}</view>
  10. <view class="u-font36 u-bold u-666" v-if="item.bill_type==0">-{{item.entry_value}}</view>
  11. </view>
  12. <view class="u-mt10 u-font22">{{item.format_create_time_millis}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <!-- 没有数据 -->
  17. <loadMore v-if="walletList.length>0" :status="status"></loadMore>
  18. <nodata v-else :config="{top:20,content:'暂无数据~'}"></nodata>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. config: {
  26. back: true, //false是tolbar页面 是则不写
  27. title: '钱包明细',
  28. color: '#1A1A1A',
  29. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  30. backgroundColor: [1, "#FFFFFF"],
  31. statusBarFontColor: '#1A1A1A'
  32. },
  33. walletList:[],
  34. params:{
  35. page:1,
  36. limit:20,
  37. },
  38. status:"more",
  39. totalPage:null,
  40. currPage:null,
  41. }
  42. },
  43. onReachBottom(e){
  44. if(this.totalPage<=this.currPage){
  45. this.status="noMore"
  46. }else{
  47. this.status = "more"
  48. this.params.page++
  49. this.getList()
  50. }
  51. },
  52. onLoad() {
  53. //获取钱包明细
  54. this.getList()
  55. },
  56. onPullDownRefresh() {
  57. this.params.page=1
  58. this.walletList=[]
  59. this.getList()
  60. },
  61. onReachBottom(e){
  62. if(this.totalPage<=this.currPage){
  63. this.status="noMore"
  64. }else{
  65. this.status="more"
  66. this.params.page++
  67. this.getList()
  68. }
  69. },
  70. methods:{
  71. getList(){
  72. this.$http.get('/usergains/userbill/page',this.params).then(res => {
  73. if(res&&res.code==200){
  74. console.log(res)
  75. uni.stopPullDownRefresh()
  76. this.walletList= this.walletList.concat( res.page.list)
  77. this.totalPage = res.page.totalPage
  78. this.currPage = res.page.currPage
  79. if(this.totalPage<=this.currPage){
  80. this.status="noMore";
  81. }else{
  82. this.status="more"
  83. }
  84. }
  85. })
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. .list{
  92. .item{
  93. padding:20rpx 30rpx 24rpx;
  94. border-bottom: 1rpx solid #E6E6E6;
  95. }
  96. }
  97. </style>