getmoney.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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">{{user_balance}}</view>
  6. <view>
  7. 余额
  8. </view>
  9. </view>
  10. <view class="cu-list grid col-3 no-border">
  11. <view class="cu-item" v-for="(v,k) in param">
  12. <view class="money-box" @click="cash(k)">
  13. {{v.money}}元
  14. <view class="cu-tag badge">
  15. {{v.type == 1 ? '总共' : '每天'}}
  16. {{v.num}}次
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="cu-list menu">
  23. <block v-for="(item,index) in plist" :key="index">
  24. <view class="cu-item">
  25. <view class="content padding-tb-sm padding-right-sm">
  26. <view>
  27. {{item.remark}}
  28. </view>
  29. <view class="text-gray text-sm">{{item.createtime}}</view>
  30. </view>
  31. <view class="action">{{item.money}}元</view>
  32. </view>
  33. </block>
  34. </view>
  35. <uni-load-more :status="pstatus"></uni-load-more>
  36. </view>
  37. </template>
  38. <script>
  39. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  40. import { userInfo } from "os";
  41. var _this;
  42. export default {
  43. components: {
  44. uniLoadMore
  45. },
  46. data() {
  47. return {
  48. userinfo: {},
  49. param: [],
  50. pstatus: 'more',
  51. ppage: 1,
  52. psize: 20,
  53. plist: []
  54. };
  55. },
  56. onLoad: function(){
  57. _this = this;
  58. _this.userinfo = _this.checkLogin("/pages/my/getmoney");
  59. if (_this.userinfo===false){
  60. return false;
  61. }
  62. _this.myGetmoney();
  63. },
  64. onPullDownRefresh: function() {
  65. _this.ppage = 1;
  66. _this.pstatus = 'more';
  67. _this.plist = [];
  68. _this.getMore();
  69. },
  70. onReachBottom: function() {
  71. if (_this.pstatus !== 'more') {
  72. return;
  73. }
  74. _this.getMore();
  75. },
  76. methods: {
  77. getMore: function() {
  78. _this.$req.ajax({
  79. path: "my/getmoneylist",
  80. data: {
  81. ppage: _this.ppage,
  82. psize: _this.psize,
  83. userid: _this.userinfo.id
  84. }
  85. }).then((data) => {
  86. _this.pstatus = data.pstatus;
  87. _this.plist = _this.plist.concat(data.plist);
  88. _this.ppage += 1;
  89. uni.stopPullDownRefresh();
  90. }).catch((err) => {
  91. uni.showModal({
  92. title: '信息提示',
  93. content: err,
  94. showCancel: false
  95. });
  96. });
  97. },
  98. myGetmoney: function() {
  99. _this.$req.ajax({
  100. path: "my/getmoneyparam",
  101. data: {
  102. userid: _this.userinfo.id
  103. }
  104. }).then((data) => {
  105. if (data.getmoney.length === 0) {
  106. uni.showModal({
  107. title: '信息提示',
  108. content: '请联系管理员配置参数',
  109. showCancel: false,
  110. success: (res) => {
  111. uni.navigateBack();
  112. }
  113. });
  114. return false;
  115. }
  116. _this.param = data.getmoney;
  117. _this.getMore();
  118. }).catch((err) => {
  119. uni.showModal({
  120. title: '信息提示',
  121. content: err,
  122. showCancel: false
  123. });
  124. });
  125. },
  126. cash: function(index) {
  127. uni.showModal({
  128. title: '信息提示',
  129. content: '确定要提现?',
  130. showCancel: true,
  131. success: (res) => {
  132. _this.$req.ajax({
  133. path: "my/cash",
  134. data: {
  135. index: index,
  136. userid: _this.userinfo.id
  137. }
  138. }).then((data) => {
  139. _this.userinfo = data;
  140. uni.setStorageSync('userinfo', data);
  141. _this.ppage = 1;
  142. _this.pstatus = 'more';
  143. _this.plist = [];
  144. _this.getMore();
  145. uni.showModal({
  146. title: '提现成功',
  147. content: '到账略有延迟,如果长时间未到账,请联系管理员',
  148. showCancel: false
  149. });
  150. }).catch((err) => {
  151. uni.showModal({
  152. title: '信息提示',
  153. content: err,
  154. showCancel: false
  155. });
  156. });
  157. }
  158. });
  159. }
  160. },
  161. computed: {
  162. user_balance() {
  163. let balance = parseFloat(this.userinfo.balance);
  164. return balance.toFixed(2);
  165. }
  166. }
  167. }
  168. </script>
  169. <style>
  170. .money-box{width:80%;height:60rpx;line-height:60rpx;margin:0 auto;border-radius: 5rpx;border:1rpx solid #eee;font-size:40rpx;color:black;}
  171. </style>