doAwards.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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
  31. class="footer-fixed flex align-center justify-end padding bg-white"
  32. style="padding: 30rpx;;border-top: 1rpx solid #e5e5e5;z-index: 9;">
  33. <button class="cu-btn round text-white theme-bg-color" style="width: 180upx;height: 80upx;"
  34. @click="withdraw">确认提现</button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. computed:{
  41. max(){
  42. return data=>{
  43. if (this.$u.test.isEmpty(data)) {
  44. return 0
  45. }
  46. return parseInt(data)
  47. }
  48. },
  49. total:{
  50. get(){
  51. let total=0
  52. this.withdrawList.forEach(item=>{
  53. total+=item.totalCash
  54. })
  55. return total
  56. }
  57. }
  58. },
  59. data() {
  60. return {
  61. userId:'',
  62. list:[],
  63. withdrawList:[]
  64. }
  65. },
  66. onLoad(options) {
  67. this.userId=options.userId
  68. if (!this.userId) {
  69. this.$u.toast('用户未登录')
  70. return
  71. }
  72. this.fetchList()
  73. },
  74. methods: {
  75. fetchList(){
  76. let params={
  77. userId:this.userId,
  78. size:500
  79. }
  80. this.$u.api.user.statisticalList(params).then(res=>{
  81. this.list=res.records
  82. this.withdrawList=[]
  83. this.list.forEach(item=>{
  84. let obj={
  85. id:item.id,
  86. userId:item.userId,
  87. activityId:item.activityId,
  88. totalCash:0,
  89. }
  90. this.withdrawList.push(obj)
  91. })
  92. })
  93. },
  94. withdraw(){
  95. if (this.total<=0) {
  96. this.$u.toast("请输入正确的兑换金额")
  97. return
  98. }
  99. this.$u.api.user.withdraw(this.withdrawList).then(res=>{
  100. console.log(res);
  101. if (res) {
  102. this.$dialog.showModal("兑换成功,请耐心等待1~3个工作日",false).then(res=>{
  103. uni.navigateBack({
  104. delta:1
  105. })
  106. })
  107. }
  108. })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss">
  114. .card{
  115. margin: 15rpx;
  116. padding: 15rpx;
  117. border-radius: 12rpx;
  118. background-color: #FFFFFF;
  119. display: flex;
  120. justify-content: space-between;
  121. .left{
  122. display: flex;
  123. flex-direction: column;
  124. view{
  125. padding: 7rpx 0;
  126. }
  127. }
  128. .right{
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. }
  133. }
  134. </style>