memberAccount.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <!-- 我的账户 -->
  2. <template>
  3. <view>
  4. <global-loading />
  5. <view v-if="ifShow" class="container">
  6. <view class="balance">
  7. </view>
  8. <view class="balanceInfo">
  9. <view class="infoBox">
  10. <view v-if="accountInfo.price != null" class="cur-balance">{{ accountInfo.price }}</view>
  11. <view v-else class="cur-balance">0.00</view>
  12. <view class="mar-top-20">余额</view>
  13. </view>
  14. </view>
  15. <view class="balance-operation">
  16. <view class="item-btn" @click="memberAccountWithdraw">
  17. <image class="item-btn-icon" src="../../static/images/origin/withdraw.png" mode="widthFix"></image>
  18. <view class="item-btn-text">提现</view>
  19. <image class="item-btn-right" src="../../static/images/origin/greyArrow.png" mode="widthFix"></image>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. const NET = require('../../utils/request')
  27. const API = require('../../config/api')
  28. export default {
  29. filters: {
  30. parseMoney(money) {
  31. return parseFloat(money / 100).toFixed(2)
  32. }
  33. },
  34. data() {
  35. return {
  36. accountInfo: [],
  37. ifShow: false
  38. }
  39. },
  40. onShow() {
  41. this.getBalance()
  42. },
  43. onBackPress(e) {
  44. if (e.from === 'navigateBack') {
  45. return false
  46. }
  47. this.back()
  48. return true
  49. },
  50. methods: {
  51. back() {
  52. uni.switchTab({
  53. url: '../../pages/tabbar/user/index'
  54. })
  55. },
  56. getBalance() {
  57. const _ = this
  58. // uni.showLoading({
  59. // mask: true,
  60. // title: '加载中...'
  61. // })
  62. NET.request(API.GetDistributor, {}, 'GET').then((res) => {
  63. uni.hideLoading()
  64. this.ifShow = true
  65. _.accountInfo = res.data
  66. })
  67. .catch((res) => {
  68. })
  69. },
  70. memberAccountWithdraw() {
  71. if (this.accountInfo.price <= 0) {
  72. uni.showToast({
  73. title: '您暂时没有余额,不能提现',
  74. duration: 2000,
  75. icon: 'none'
  76. })
  77. } else {
  78. uni.navigateTo({
  79. url: 'withdraw'
  80. })
  81. }
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. page {
  88. background: #F8F8F8;
  89. }
  90. .container {
  91. background: #f8f8f8;
  92. .balance {
  93. display: block;
  94. height: 400rpx;
  95. background: url("../../static/images/origin/bankBg.png") no-repeat left top;
  96. background-size: cover;
  97. text-align: center;
  98. padding: 100rpx 20rpx 0 20rpx;
  99. }
  100. .balanceInfo {
  101. width: 712rpx;
  102. background: url("../../static/images/origin/accountBg.png") no-repeat left top;
  103. height: 342rpx;
  104. background-size: cover;
  105. margin: -300rpx auto 0 auto;
  106. display: flex;
  107. justify-content: center;
  108. align-items: center;
  109. border-radius: 20rpx;
  110. .infoBox {
  111. text-align: center;
  112. .cur-balance {
  113. font-size: 60rpx;
  114. color: #71521B;
  115. }
  116. }
  117. }
  118. .balance-operation {
  119. margin-top: 38rpx;
  120. padding: 0 24rpx;
  121. .item-btn {}
  122. }
  123. }
  124. .item-btn {
  125. width: 100%;
  126. height: 100upx;
  127. display: flex;
  128. flex-direction: row;
  129. align-items: center;
  130. box-sizing: border-box;
  131. background-color: #fff;
  132. padding: 0 30upx;
  133. .item-btn-icon {
  134. width: 90upx;
  135. height: 90upx;
  136. }
  137. .item-btn-text {
  138. font-size: 28upx;
  139. margin-left: 20upx;
  140. font-weight: 500;
  141. flex: 1;
  142. color: rgba(102, 102, 102, 1);
  143. }
  144. .item-btn-right {
  145. width: 60upx;
  146. height: 60upx;
  147. }
  148. }
  149. .mt20 {
  150. margin-top: 20upx;
  151. }
  152. .mt1 {
  153. margin-top: 1upx;
  154. }
  155. </style>