doAwards.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view>
  3. <view class="bg-img flex justify-center align-center" style="background-image: url('https://upload-file-data.obs.cn-south-1.myhuaweicloud.com/97d63ec49f544a33a6a8cc3c0b64b17a-songRankBgImg.png');height: 302upx;">
  4. <view class="text-white" >
  5. <text class="text-lg">提现金额:</text>
  6. <text style="font-size: 60rpx;">¥{{total}}</text>
  7. </view>
  8. </view>
  9. <view v-if="list" class="card" v-for="(item,index) in list" :key="index">
  10. <view class="left">
  11. <view>
  12. 活动名称:
  13. <text class="text-red">{{item.activityName}}</text>
  14. </view>
  15. <view>
  16. 可用热力:
  17. <text class="text-red">{{item.usableHotValue}}</text>
  18. </view>
  19. <view>
  20. 可提余额:
  21. <text class="text-red">¥{{item.usableCash}}</text>
  22. </view>
  23. </view>
  24. <view class="right">
  25. <u-number-box v-model="withdrawList[index].totalCash" :positive-integer="false" :index="index" :min="0" :max="max(item.usableCash)" :input-width="100" :input-height="60"></u-number-box>
  26. <text class="padding-left-sm text-red">元</text>
  27. </view>
  28. </view>
  29. <view class="" style="height: 140rpx;"></view>
  30. <view class="footer-fixed flex align-center justify-between padding bg-white" style="border-top: 1rpx solid #e5e5e5;z-index: 9;">
  31. <view class="flex align-center" style="width: 60%;">
  32. <view>提现密码:</view>
  33. <u-input v-model="password" type="password" :password-icon="true" placeholder="请输入提现密码" :clearable="false" />
  34. </view>
  35. <button class="cu-btn round text-white theme-bg-color" style="width: 180upx;height: 80upx;"
  36. @click="withdraw">确认提现</button>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import md5Libs from "uview-ui/libs/function/md5";
  42. export default {
  43. computed:{
  44. max(){
  45. return data=>{
  46. if (this.$u.test.isEmpty(data)) {
  47. return 0
  48. }
  49. return parseInt(data)
  50. }
  51. },
  52. total:{
  53. get(){
  54. let total=0
  55. this.withdrawList.forEach(item=>{
  56. total+=item.totalCash
  57. })
  58. return total
  59. }
  60. }
  61. },
  62. data() {
  63. return {
  64. password: '',
  65. userId:'',
  66. list:[],
  67. withdrawList:[]
  68. }
  69. },
  70. onLoad(options) {
  71. this.userId=options.userId
  72. if (!this.userId) {
  73. this.$u.toast('用户未登录')
  74. return
  75. }
  76. this.fetchList()
  77. },
  78. methods: {
  79. fetchList(){
  80. let params={
  81. userId:this.userId,
  82. size:500
  83. }
  84. this.$u.api.user.statisticalList(params).then(res=>{
  85. this.list=res.records
  86. this.withdrawList=[]
  87. this.list.forEach(item=>{
  88. let obj={
  89. id:item.id,
  90. userId:item.userId,
  91. activityId:item.activityId,
  92. totalCash:0,
  93. }
  94. this.withdrawList.push(obj)
  95. })
  96. })
  97. },
  98. withdraw(){
  99. if (this.total<=0) {
  100. this.$u.toast("请输入正确的兑换金额")
  101. return
  102. }
  103. this.$u.api.user.withdraw(this.withdrawList).then(res=>{
  104. if (res) {
  105. this.$dialog.showModal(res+",请耐心等待",false).then(res=>{
  106. uni.navigateBack({
  107. delta:1
  108. })
  109. })
  110. }
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss">
  117. .card{
  118. margin: 15rpx;
  119. padding: 15rpx;
  120. border-radius: 12rpx;
  121. background-color: #FFFFFF;
  122. display: flex;
  123. justify-content: space-between;
  124. .left{
  125. display: flex;
  126. flex-direction: column;
  127. view{
  128. padding: 7rpx 0;
  129. }
  130. }
  131. .right{
  132. display: flex;
  133. justify-content: center;
  134. align-items: center;
  135. }
  136. }
  137. </style>