balance.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="balance">
  3. <view class="balance_head">
  4. <view class="balance_head_bj center">
  5. <text>{{ balancePrice }}</text>
  6. <text>余额</text>
  7. </view>
  8. <view class="balance_head_ul flex" style="justify-content: center;">
  9. <!-- <view class="balance_head_li center" v-for="(item,index) in 2" :key='index' @click="changeBalance(index)"> {{ index == 0 ? '转到钱包' : '提现' }}</view> -->
  10. <!-- <view class="balance_head_li center" @click="changeBalance(0)">转到钱包</view> -->
  11. <!-- <view style="width: 10px;"></view> -->
  12. <!-- <view class="balance_head_li center" @click="carpassList">卡密充值记录</view> -->
  13. </view>
  14. </view>
  15. <view class="balance_main">
  16. <view class="balance_main_head flexs">
  17. <view class="balance_main_li center" v-for="(item, index) in 2" :key="index" :class="{ active: index == i }" @click="changeI(index)">
  18. {{ index == 0 ? '收入' : '支出' }}
  19. </view>
  20. </view>
  21. <view class="balance_main_list">
  22. <view class="balance_main_list_li flex" v-for="(item, index) in balanceList" :key="index">
  23. <view class="balance_main_list_li_con">
  24. <view class="balance_main_list_li_name">{{ item.type }}</view>
  25. <view class="balance_main_list_li_time">时间:{{ item.create_time }}</view>
  26. </view>
  27. <view class="balance_main_list_li_price" :class="{ blue: i == 1 }">{{ item.money }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. i: 0, //
  38. page: 1, //页码
  39. pages: null, //总页数
  40. balanceList: [], //
  41. balancePrice: '' //余额详情
  42. };
  43. },
  44. methods: {
  45. //选择哪个
  46. changeBalance(index) {
  47. uni.navigateTo({ url: index == 0 ? '/pages/me/out' : '/pages/me/goldDeposit' });
  48. },
  49. //切换
  50. changeI(index) {
  51. this.i = index;
  52. this.page = 1;
  53. this.balanceList = [];
  54. this.getBalanceList();
  55. },
  56. //
  57. getBalanceList() {
  58. this.$api.myBalance({ page: this.page, type: this.i == 0 ? 'in' : 'out', msg: '数据加载中' }).then(res => {
  59. uni.stopPullDownRefresh();
  60. if (res.code === 1) {
  61. this.balancePrice = res.data.balance;
  62. this.pages = res.data.record.last_page;
  63. this.balanceList = this.page == 1 ? res.data.record.data : [...this.balanceList, ...res.data.record.data];
  64. }
  65. });
  66. },
  67. //卡密充值记录列表
  68. carpassList() {
  69. uni.navigateTo({
  70. url: '/pages/me/carpassList/carpassList'
  71. });
  72. }
  73. },
  74. onLoad() {
  75. this.getBalanceList();
  76. },
  77. onPullDownRefresh() {
  78. this.page = 1;
  79. this.balanceList = [];
  80. this.getBalanceList();
  81. },
  82. onReachBottom() {
  83. if (this.page < this.pages) {
  84. this.page++;
  85. this.getBalanceList();
  86. }
  87. }
  88. };
  89. </script>
  90. <style lang="scss">
  91. .balance {
  92. padding: 0 30rpx;
  93. .balance_head {
  94. .balance_head_bj {
  95. height: 220rpx;
  96. margin-bottom: 30rpx;
  97. background: url(https://www.chaomangdao.com/image/yuebeijing@2x.png) no-repeat;
  98. background-size: cover;
  99. flex-direction: column;
  100. text {
  101. color: #ffffff;
  102. &:first-child {
  103. font-size: 60rpx;
  104. font-weight: bold;
  105. }
  106. &:last-child {
  107. font-size: 28rpx;
  108. margin-top: 30rpx;
  109. }
  110. }
  111. }
  112. .balance_head_li {
  113. width: 330rpx;
  114. height: 78rpx;
  115. margin-bottom: 20rpx;
  116. color: #ffffff;
  117. font-size: 30rpx;
  118. border-radius: 39rpx;
  119. &:first-child {
  120. background: -webkit-linear-gradient(60deg, #ffb0d0 0%, #ff67a4 100%);
  121. margin-right: 10rpx;
  122. }
  123. &:last-child {
  124. background: -webkit-linear-gradient(0deg, #89f7fe 0%, #66a6ff 100%);
  125. margin-left: 10rpx;
  126. }
  127. }
  128. }
  129. }
  130. .balance_main_head {
  131. background: #ffffff;
  132. border-radius: 10rpx 10rpx 0rpx 0rpx;
  133. border-bottom: 2rpx solid #fafafa;
  134. .balance_main_li {
  135. width: 50%;
  136. height: 80rpx;
  137. font-size: 30rpx;
  138. }
  139. .active {
  140. color: #fff;
  141. position: relative;
  142. font-weight: bold;
  143. background: -webkit-linear-gradient(0deg, #89f7fe 0%, #66a6ff 100%);
  144. &::after {
  145. position: absolute;
  146. content: '';
  147. bottom: 0;
  148. left: 50%;
  149. transform: translateX(-50%);
  150. width: 40rpx;
  151. height: 4rpx;
  152. background: #89f7fe;
  153. border-radius: 2rpx;
  154. }
  155. }
  156. }
  157. .balance_main_list {
  158. background: #ffffff;
  159. border-radius: 0rpx 0rpx 10rpx 10rpx;
  160. .balance_main_list_li {
  161. padding: 20rpx 30rpx;
  162. border-bottom: 2rpx solid #fafafa;
  163. .balance_main_list_li_name {
  164. color: #666666;
  165. font-size: 26rpx;
  166. margin-bottom: 20rpx;
  167. }
  168. .balance_main_list_li_time {
  169. color: #999999;
  170. }
  171. .balance_main_list_li_price {
  172. color: #ff4891;
  173. font-size: 30rpx;
  174. }
  175. .blue {
  176. color: #327cf6;
  177. }
  178. }
  179. }
  180. </style>