mybag.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view>
  3. <view class="padding bg-themeRed">
  4. <view class="text-center padding-top">
  5. <view class="text-sl padding-bottom-xs">{{userinfo.balance}}</view>
  6. <view>
  7. 余额
  8. </view>
  9. <button class="cu-btn round" @tap="goPage('/pages/my/getmoney')">我要提现</button>
  10. </view>
  11. <view class="flex solid-bottom padding-top justify-between">
  12. <view>上月获得:<text>{{month_balance}}</text> 元</view>
  13. <view>累计已获:<text>{{userinfo.balance_total}}</text> 元</view>
  14. </view>
  15. </view>
  16. <view class="cu-list menu">
  17. <block v-for="(item,index) in plist" :key="index">
  18. <view class="cu-item">
  19. <view class="content padding-tb-sm padding-right-sm">
  20. <view>
  21. {{item.title}}
  22. </view>
  23. <view class="text-gray text-sm">{{item.createtime}}</view>
  24. <view class="text-gray text-sm">
  25. {{item.remark}}
  26. </view>
  27. </view>
  28. <view class="action text-red" v-if="item.value>0">+{{item.value}}元</view>
  29. <view class="action text-red" v-else>{{item.value}}元</view>
  30. </view>
  31. </block>
  32. </view>
  33. <uni-load-more :status="pstatus"></uni-load-more>
  34. </view>
  35. </template>
  36. <script>
  37. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  38. var _this;
  39. export default {
  40. components: {
  41. uniLoadMore
  42. },
  43. data() {
  44. return {
  45. userinfo: {},
  46. month_balance: 0,
  47. pstatus: 'more',
  48. ppage: 1,
  49. psize: 20,
  50. plist: []
  51. };
  52. },
  53. onLoad: function(){
  54. _this = this;
  55. },
  56. onShow: function() {
  57. _this.userinfo = _this.checkLogin("/pages/my/mybag");
  58. if (_this.userinfo===false){
  59. return false;
  60. }
  61. _this.myBag();
  62. },
  63. onPullDownRefresh: function() {
  64. _this.ppage = 1;
  65. _this.pstatus = 'more';
  66. _this.plist = [];
  67. _this.getMore();
  68. },
  69. onReachBottom: function() {
  70. if (_this.pstatus !== 'more') {
  71. return;
  72. }
  73. _this.getMore();
  74. },
  75. methods: {
  76. getMore: function() {
  77. _this.$req.ajax({
  78. path: "my/getbag",
  79. data: {
  80. ppage: _this.ppage,
  81. psize: _this.psize,
  82. userid: _this.userinfo.id
  83. }
  84. }).then((data) => {
  85. _this.pstatus = data.pstatus;
  86. _this.plist = _this.plist.concat(data.plist);
  87. _this.ppage += 1;
  88. uni.stopPullDownRefresh();
  89. }).catch((err) => {
  90. uni.showModal({
  91. title: '信息提示',
  92. content: err,
  93. showCancel: false
  94. });
  95. });
  96. },
  97. myBag: function() {
  98. _this.$req.ajax({
  99. path: "my/mybag",
  100. data: {
  101. userid: _this.userinfo.id
  102. }
  103. }).then((data) => {
  104. _this.userinfo = data.user;
  105. _this.month_balance = data.month_balance;
  106. _this.getMore();
  107. }).catch((err) => {
  108. uni.showModal({
  109. title: '信息提示',
  110. content: err,
  111. showCancel: false
  112. });
  113. });
  114. },
  115. goPage: function(pageurl) {
  116. uni.navigateTo({
  117. url: pageurl,
  118. fail: function() {
  119. uni.switchTab({
  120. url: pageurl
  121. });
  122. }
  123. });
  124. },
  125. }
  126. }
  127. </script>
  128. <style>
  129. </style>