balance-detail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view>
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="balance-top">
  5. <text class="balance-title">余额(元)</text>
  6. <text class="balance-nums">{{ $addDecimals(balance , 2) }}</text>
  7. <view class="balance-btns">
  8. <view class="balance-btn" @click.stop="goBalancePay()">
  9. 去充值
  10. </view>
  11. <!-- <view class="balance-btn exchange-btn" @click.stop="goBalanceExchange()">
  12. 余额转赠
  13. </view> -->
  14. </view>
  15. </view>
  16. <consume-list title="余额明细" :status="status" :list="pointsList" :keys="{title:'remark',time:'formatCreateTimeMillis',val:'entryValue',type:'billType'}"></consume-list>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. refillCardInfo
  22. } from "@/api/personal-center.js"
  23. import {
  24. getAccountInfo
  25. } from "@/api/login.js"
  26. export default {
  27. data() {
  28. return {
  29. balance: 0,
  30. config: {
  31. back: true, //false是tolbar页面 是则不写
  32. title: '我的余额',
  33. color: '#1A1A1A',
  34. // autoBack:true,
  35. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  36. backgroundColor: [1, "#fff"],
  37. statusBarFontColor: '#1A1A1A'
  38. },
  39. params: {
  40. page: 1,
  41. limit: 10
  42. },
  43. pointsList:[],
  44. status: 'loading', //more|loading|noMore
  45. };
  46. },
  47. onShow() {
  48. this.getUserInfo()
  49. this.params.page = 1;
  50. this.pointsList = [];
  51. this.getList();
  52. },
  53. onReachBottom() {
  54. if ( this.status !== 'loading' && this.status !== 'noMore') {
  55. this.params.page++
  56. this.getList()
  57. }
  58. },
  59. onPullDownRefresh() {
  60. this.params.page = 1
  61. this.pointsList = []
  62. this.getList()
  63. },
  64. methods: {
  65. getList(){
  66. this.status = 'loading';
  67. this.$http.get(refillCardInfo, this.params).then((res) => {
  68. if (res && res.code == 200) {
  69. uni.stopPullDownRefresh()
  70. this.pointsList = this.pointsList.concat(res.page.list);
  71. if (res.page.totalPage <= res.page.currPage) {
  72. this.status = 'noMore'
  73. } else {
  74. this.status = 'more'
  75. }
  76. }
  77. });
  78. },
  79. //获取个人信息
  80. getUserInfo() {
  81. this.$http.get(getAccountInfo).then(res => {
  82. if (res && res.code == 200) {
  83. this.balance = res.data.balance;
  84. uni.setStorageSync("personal", res.data)
  85. } else {
  86. this.isLogin = false
  87. }
  88. })
  89. },
  90. // 余额充值
  91. goBalancePay() {
  92. uni.navigateTo({
  93. url: "/pages/user/Pay",
  94. fail: err => {
  95. console.log('goBalanceExchange = ', err)
  96. }
  97. })
  98. },
  99. // 余额转赠
  100. goBalanceExchange() {
  101. uni.navigateTo({
  102. url: "/pages/user/balance-exchange",
  103. fail: err => {
  104. console.log('goBalanceExchange = ', err)
  105. }
  106. })
  107. },
  108. }
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. .balance-top {
  113. width: 100%;
  114. min-height: 365rpx;
  115. background-color: #FA6138;
  116. display: flex;
  117. flex-direction: column;
  118. align-items: center;
  119. justify-content: center;
  120. padding: 50rpx 60rpx 113rpx;
  121. font-family: PingFang SC, PingFang SC-Regular;
  122. font-weight: 400;
  123. color: #ffffff;
  124. .balance-title {
  125. font-size: 28rpx;
  126. }
  127. .balance-nums {
  128. font-size: 50rpx;
  129. }
  130. .balance-btns {
  131. width: 100%;
  132. display: flex;
  133. justify-content: space-between;
  134. align-items: center;
  135. padding: 30rpx 0 50rpx;
  136. .balance-btn {
  137. width: 270rpx;
  138. height: 70rpx;
  139. background: #FA6138;
  140. border: 1rpx solid #ffffff;
  141. border-radius: 36rpx;
  142. text-align: center;
  143. line-height: 68rpx;
  144. font-size: 26rpx;
  145. }
  146. .exchange-btn {
  147. background-color: #fff;
  148. color: #FA6138;
  149. }
  150. }
  151. // <view class="balance-top">
  152. // <text class="balance-title">余额(元)</text>
  153. // <text class="balance-nums">4974.00</text>
  154. // <view class="balance-btns">
  155. // <view class="balance-btn">
  156. // 去充值
  157. // </view>
  158. // <view class="balance-btn">
  159. // 余额转赠
  160. // </view>
  161. // </view>
  162. // </view>
  163. }
  164. </style>