awards.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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" style="display: flex;">
  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 v-if="item.withdrawStatus==2" style="font-size: 28rpx;color: #F3484E;padding-left: 20rpx;font-weight: 500;">
  57. <text style="margin-right: 6rpx;">提现失败</text>
  58. <u-icon name="question-circle" @click="toast(item.failReason)"></u-icon>
  59. </view>
  60. </view>
  61. <view class="padding-top-sm" style="font-size: 24upx;font-family: PingFang SC;font-weight: bold;color: #686868;">
  62. {{item.createTime}}</view>
  63. </view>
  64. <view class="padding-right" v-if="item.withdrawStatus!=2">
  65. <text style="font-size: 36upx;font-family: PingFang SC;font-weight: bold;color: #F3484E;">+{{ +item.cashValue}}</text>
  66. <text class="text-bold padding-left-xs">元</text>
  67. </view>
  68. </view>
  69. <view class="padding-top-sm">
  70. </view>
  71. <u-loadmore :status="status" v-if="list.length>8"/>
  72. <view style="padding: 20upx;">
  73. <u-line color="#e0e0e0"></u-line>
  74. </view>
  75. </view>
  76. <view style="height: 30upx;"></view>
  77. </view>
  78. </template>
  79. <script>
  80. export default {
  81. data() {
  82. return {
  83. userId: '',
  84. data: {},
  85. list:[],
  86. cardNumber: '',
  87. status: 'loadmore',
  88. current:1,
  89. userInfo:{},
  90. withdrawLimit:false,
  91. bindCardLimit:false,
  92. cardInfo: {},
  93. }
  94. },
  95. onLoad() {
  96. this.init()
  97. },
  98. onReachBottom() {
  99. if(this.list.length<this.current*10){
  100. this.status = 'nomore';
  101. return
  102. }else{
  103. this.status = 'loading';
  104. this.current = ++ this.current;
  105. this.fetchData()
  106. }
  107. },
  108. onShow() {
  109. this.getCardInfo();
  110. if (this.canRest) {
  111. this.list=[]
  112. this.status='loadmore'
  113. this.current=1
  114. this.init()
  115. }
  116. this.canRest=true
  117. },
  118. methods: {
  119. getUserInfo(){
  120. let params={
  121. id:this.userId
  122. }
  123. this.$u.api.user.detail(params).then(res=>{
  124. this.userInfo=res
  125. if (res.limitTag.indexOf("withdraw_limit")!=-1) {
  126. this.withdrawLimit=true
  127. }
  128. if (res.limitTag.indexOf("bind_card_limit")!=-1) {
  129. this.bindCardLimit=true
  130. }
  131. })
  132. },
  133. toast(msg){
  134. this.$u.toast(msg)
  135. },
  136. getCardInfo() {
  137. let userId = uni.getStorageSync("userId");
  138. this.$u.api.bankCard.cardDetail({userId: userId}).then(res => {
  139. if (!this.$u.test.isEmpty(res.records[0])) {
  140. this.cardInfo = res.records[0];
  141. let cardNo = res.records[0].cardNo;
  142. this.cardNumber = "**** " + cardNo.substring(cardNo.length - 4, cardNo.length);
  143. }
  144. })
  145. },
  146. init(){
  147. this.userId = uni.getStorageSync("userId") || '1413461510759485442';
  148. if (!this.userId) {
  149. this.$u.toast('用户未登录')
  150. return
  151. }
  152. this.getBonus()
  153. this.fetchData()
  154. this.getUserInfo()
  155. },
  156. getBonus() {
  157. this.$u.api.user.getBonus({
  158. userId: this.userId
  159. }).then(res => {
  160. this.data = res
  161. })
  162. },
  163. fetchData() {
  164. let params={
  165. size:10,
  166. userId: this.userId,
  167. current:this.current
  168. }
  169. this.$u.api.user.withdrawrecords(params).then(res => {
  170. this.list = [...this.list,...res.records]
  171. })
  172. },
  173. doAwards(){
  174. if (this.withdrawLimit==true) {
  175. //不能绑卡
  176. this.$u.toast("提现失败,权限不足")
  177. return
  178. }
  179. if (!this.$u.test.isEmpty(this.cardInfo)) {
  180. uni.navigateTo({
  181. url:"doAwards?userId="+this.userId
  182. })
  183. }else{
  184. this.changeNum()
  185. }
  186. },
  187. changeNum(id) {
  188. if (this.bindCardLimit==true) {
  189. //不能绑卡
  190. this.$u.toast("绑卡失败,权限不足")
  191. return
  192. }
  193. if (this.$u.test.isEmpty(this.cardInfo)) {
  194. uni.navigateTo({
  195. url: "/pages/activityList/activity/bankCard"
  196. })
  197. } else {
  198. uni.navigateTo({
  199. url: "/pages/activityList/activity/bankCard?cardId=" + this.cardInfo.id
  200. })
  201. }
  202. }
  203. }
  204. }
  205. </script>
  206. <style>
  207. .container {
  208. background-color: #FFFFFF;
  209. border-radius: 16upx;
  210. box-shadow: 0px 3px 79px 0px rgba(132, 132, 132, 0.22);
  211. }
  212. .title {
  213. font-size: 28upx;
  214. font-family: PingFang SC;
  215. font-weight: 800;
  216. color: #000000;
  217. }
  218. .number {
  219. font-size: 30upx;
  220. font-family: PingFang SC;
  221. font-weight: 800;
  222. color: #F3484E;
  223. }
  224. </style>