index.vue 4.7 KB

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