index.vue 4.4 KB

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