doAwards.vue 3.5 KB

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