doAwards.vue 3.7 KB

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