awards.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view>
  3. <view class="bg-img" style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/5f263a5a6e7c4f2493e0325f28ab659a-bgimg.png');height: 310upx;"></view>
  4. <view class="container" style="margin: -80upx 30upx 30upx 30upx;">
  5. <view class="padding">
  6. <text class="text-bold text-black padding-right-sm">账户热力值</text>
  7. <text class="text-bold" style="color: #f87a3a;">可兑换到账{{data.totalWithDraw}}元</text>
  8. </view>
  9. <view class="padding-lr flex justify-between align-center">
  10. <view>
  11. <text
  12. style="font-size: 60upx;font-family: PingFang SC;font-weight: 800;color: #F3484E;">{{data.usableHotValue}}</text>
  13. <text class="padding-left-xs"
  14. style="font-size: 24upx;font-family: PingFang SC;font-weight: 800;color: #878787;">热力值</text>
  15. </view>
  16. <button @click="doAwards" class="cu-btn round text-white" style="background-color: #f75757;width: 140upx;">提现</button>
  17. </view>
  18. <view style="margin: 10upx 20upx;">
  19. <u-line color="#e0e0e0"></u-line>
  20. </view>
  21. <view style="padding: 20upx 0upx 0upx 30upx;">
  22. <text class="title">已提现:</text>
  23. <text class="number">{{data.withdrawed}}</text>
  24. <text class="title padding-left-xs">元</text>
  25. </view>
  26. <view class="flex justify-between align-center">
  27. <view style="padding: 10upx 0upx 20upx 30upx;">
  28. <text class="title">可提现:</text>
  29. <text class="number">{{data.usableWithdraw}}</text>
  30. <text class="title padding-left-xs">元</text>
  31. </view>
  32. <view class="flex text-sm align-center">
  33. <block v-if="!$u.test.isEmpty(cardNumber)">
  34. <view class="padding-right-xs">已绑定卡号{{cardNumber}}</view>
  35. <button class="cu-btn sm round margin-right-sm" style="background-color: #f75757;color: #ffffff;" @click="changeNum">点击更换</button>
  36. </block>
  37. <block v-else>
  38. <button class="cu-btn sm round margin-right-sm" style="background-color: #f75757;color: #ffffff;" @click="changeNum">点击绑定</button>
  39. </block>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="container margin-lr">
  44. <view class="padding flex align-center">
  45. <view class="cuIcon-text text-bold padding-right-xs" style="font-size: 38upx;"></view>
  46. <view class="title">
  47. 提现明细
  48. </view>
  49. </view>
  50. <view v-for="(item, index) in list" :key="index" class="flex align-center justify-between padding-sm">
  51. <view class="padding-lr">
  52. <view class="title">
  53. {{item.note}}
  54. <text v-if="item.withdrawStatus==0" style="font-size: 28rpx;color: #ff9900;padding-left: 20rpx;font-weight: 500;">未发款</text>
  55. <text v-if="item.withdrawStatus==1" style="font-size: 28rpx;color: #19be6b;padding-left: 20rpx;font-weight: 500;">已发款</text>
  56. </view>
  57. <view class="padding-top-sm" style="font-size: 24upx;font-family: PingFang SC;font-weight: bold;color: #686868;">
  58. {{item.createTime}}</view>
  59. </view>
  60. <view class="padding-right">
  61. <text style="font-size: 36upx;font-family: PingFang SC;font-weight: bold;color: #F3484E;">+{{ +item.cashValue}}</text>
  62. <text class="text-bold padding-left-xs">元</text>
  63. </view>
  64. </view>
  65. <view class="padding-top-sm">
  66. </view>
  67. <u-loadmore :status="status" v-if="list.length>8"/>
  68. <view style="padding: 20upx;">
  69. <u-line color="#e0e0e0"></u-line>
  70. </view>
  71. </view>
  72. <view style="height: 30upx;"></view>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. userId: '',
  80. data: {},
  81. list:[],
  82. cardNumber: '',
  83. status: 'loadmore',
  84. current:1,
  85. cardInfo: {},
  86. }
  87. },
  88. onLoad() {
  89. this.init()
  90. },
  91. onReachBottom() {
  92. if(this.list.length<this.current*10){
  93. this.status = 'nomore';
  94. return
  95. }else{
  96. this.status = 'loading';
  97. this.current = ++ this.current;
  98. this.fetchData()
  99. }
  100. },
  101. onShow() {
  102. this.getCardInfo();
  103. if (this.canRest) {
  104. this.list=[]
  105. this.status='loadmore'
  106. this.current=1
  107. this.init()
  108. }
  109. this.canRest=true
  110. },
  111. methods: {
  112. getCardInfo() {
  113. let userId = uni.getStorageSync("userId");
  114. this.$u.api.bankCard.cardDetail({userId: userId}).then(res => {
  115. if (!this.$u.test.isEmpty(res.records[0])) {
  116. this.cardInfo = res.records[0];
  117. let cardNo = res.records[0].cardNo;
  118. this.cardNumber = "**** " + cardNo.substring(cardNo.length - 4, cardNo.length);
  119. }
  120. })
  121. },
  122. init(){
  123. this.userId = uni.getStorageSync("userId");
  124. if (!this.userId) {
  125. this.$u.toast('用户未登录')
  126. return
  127. }
  128. this.getBonus()
  129. this.fetchData()
  130. },
  131. getBonus() {
  132. this.$u.api.user.getBonus({
  133. userId: this.userId
  134. }).then(res => {
  135. this.data = res
  136. })
  137. },
  138. fetchData() {
  139. let params={
  140. size:10,
  141. userId: this.userId,
  142. current:this.current
  143. }
  144. this.$u.api.user.withdrawrecords(params).then(res => {
  145. this.list = [...this.list,...res.records]
  146. })
  147. },
  148. doAwards(){
  149. uni.navigateTo({
  150. url:"doAwards?userId="+this.userId
  151. })
  152. },
  153. changeNum(id) {
  154. if (this.$u.test.isEmpty(this.cardInfo)) {
  155. uni.navigateTo({
  156. url: "/pages/activityList/activity/bankCard"
  157. })
  158. } else {
  159. uni.navigateTo({
  160. url: "/pages/activityList/activity/bankCard?cardId=" + this.cardInfo.id
  161. })
  162. }
  163. }
  164. }
  165. }
  166. </script>
  167. <style>
  168. .container {
  169. background-color: #FFFFFF;
  170. border-radius: 16upx;
  171. box-shadow: 0px 3px 79px 0px rgba(132, 132, 132, 0.22);
  172. }
  173. .title {
  174. font-size: 28upx;
  175. font-family: PingFang SC;
  176. font-weight: 800;
  177. color: #000000;
  178. }
  179. .number {
  180. font-size: 30upx;
  181. font-family: PingFang SC;
  182. font-weight: 800;
  183. color: #F3484E;
  184. }
  185. </style>