index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <view class="main">
  3. <view class="mcard">
  4. <view class="money">{{ item.money }}</view>
  5. <view class="desc">账户余额(元)</view>
  6. <view class="flex">
  7. <view class="f">
  8. <button class="btn" style="background-color: #607d8b" @click="go('/pages/user/money/cash_out')">
  9. <text class="icon">&#xe612;</text>
  10. <text>提现</text>
  11. </button>
  12. </view>
  13. <view class="f">
  14. <button class="btn" @click="go('/pages/user/money/add')">
  15. <text class="icon">&#xe7c4;</text>
  16. <text>充值</text>
  17. </button>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="tab">
  22. <u-tabs :list="type" @click="click($event, 'type')"></u-tabs>
  23. </view>
  24. <view class="list">
  25. <view class="item" v-for="(item, index) in list" :key="index">
  26. <view class="title">{{ item.title }}</view>
  27. <view class="desc">
  28. <text v-if="item.state == 0 && item.type == 0" style="color: #f44336">未支付</text>
  29. <text v-if="item.state == 1 && item.type == 0" style="color: #4caf50">充值成功</text>
  30. <text v-if="item.state == 1 && item.type == 1" style="color: #4caf50">兼职支出</text>
  31. <text v-if="item.state == 0 && item.type == 2" style="color: #f44336">提现审核中...</text>
  32. <text v-if="item.state == 1 && item.type == 2" style="color: #4caf50">提现成功</text>
  33. <text v-if="item.state == 1 && item.type == 3" style="color: #4caf50">兼职收入</text>
  34. <text v-if="item.state == 2 && item.type == 2" style="color: #f44336" @click="popup(item.msg)">
  35. <text class="icon" style="padding-right: 5px">&#xe610;</text>
  36. <text>提现失败,退回余额</text>
  37. </text>
  38. <text v-if="item.state == 1 && item.type == 4" style="color: #4caf50">退款成功</text>
  39. <text>{{ item.createTime }}</text>
  40. </view>
  41. <view class="price">
  42. <text v-if="item.type == 0 || item.type == 3" style="color: orangered">+{{ item.money }}元</text>
  43. <text v-if="item.type == 1 || item.type == 4" style="color: darkgray">-{{ item.money }}元</text>
  44. <text v-if="item.type == 2 && item.state == 0" style="color: darkgray">-{{ item.money }}元</text>
  45. <text v-if="item.type == 2 && item.state == 1" style="color: darkgray">-{{ item.money }}元</text>
  46. <text v-if="item.type == 2 && item.state == 2" style="color: #f44336">+{{ item.money }}元</text>
  47. </view>
  48. </view>
  49. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  50. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. item: {},
  59. current: 0,
  60. type: [
  61. { name: '全部', value: '' },
  62. { name: '充值', value: 0 },
  63. { name: '支出', value: 1 },
  64. { name: '提现', value: 2 },
  65. { name: '收入', value: 3 },
  66. { name: '退款', value: 4 }
  67. ],
  68. list: [],
  69. param: { pageNum: 1, pageSize: 10 },
  70. loadMore: true
  71. };
  72. },
  73. onLoad(e) {
  74. this.getInfo();
  75. this.getData();
  76. uni.$on('payMoney', (res) => {
  77. this.getInfo();
  78. this.refresh();
  79. });
  80. },
  81. methods: {
  82. getInfo() {
  83. this.http.request({
  84. url: '/app/user/info',
  85. success: (res) => {
  86. this.item = res.data.data;
  87. uni.setStorageSync('money', res.data.data.money || 0);
  88. }
  89. });
  90. },
  91. getData() {
  92. this.http.request({
  93. url: '/app/pay/list',
  94. data: this.param,
  95. loading: 'false',
  96. success: (res) => {
  97. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  98. this.list.push(...res.data.rows);
  99. }
  100. });
  101. },
  102. click(e) {
  103. this.param.type = e.value;
  104. this.refresh();
  105. },
  106. popup(msg) {
  107. uni.showModal({ title: '提示', content: msg, showCancel: false });
  108. },
  109. go(url) {
  110. uni.navigateTo({ url: url });
  111. },
  112. //刷新数据
  113. refresh() {
  114. this.loadMore = true;
  115. this.param.pageNum = 1;
  116. this.list = [];
  117. this.getData();
  118. }
  119. },
  120. //下拉刷新
  121. onPullDownRefresh() {
  122. setTimeout(() => {
  123. this.refresh();
  124. uni.stopPullDownRefresh();
  125. }, 1000);
  126. },
  127. //上拉加载
  128. onReachBottom() {
  129. if (this.loadMore) {
  130. this.param.pageNum++;
  131. this.getData();
  132. }
  133. }
  134. };
  135. </script>
  136. <style lang="scss">
  137. .list {
  138. background-color: white;
  139. border-radius: 8px;
  140. padding: 15px 15px 15px 15px;
  141. .item {
  142. padding: 15px 0px 15px 0px;
  143. border-bottom: 1px solid $line;
  144. padding-bottom: 10px;
  145. &:first-child {
  146. padding-top: 0px;
  147. }
  148. &:last-child {
  149. border: 0px;
  150. padding-bottom: 5px;
  151. }
  152. .title {
  153. width: 70%;
  154. }
  155. .desc {
  156. font-size: 14px;
  157. padding-top: 5px;
  158. color: $font-c;
  159. text {
  160. padding-right: 15px;
  161. }
  162. }
  163. .price {
  164. float: right;
  165. margin-top: -45px;
  166. }
  167. }
  168. }
  169. </style>