index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view class="cash-out-box">
  3. <view style="color:#666;font-size: 32rpx;">
  4. 提现申请需要审核,请耐心等待,注意查收微信红包。
  5. </view>
  6. <view class="cash-input-box">
  7. <text>¥</text>
  8. <input type="number" v-model="money">
  9. </view>
  10. <view class="all-cash-out-box">
  11. <text>当前积分为{{userInfoObj.scorenumber || '0'}},可抵现金{{userInfoObj.nowmoney || '0'}},</text>
  12. <text style="color: #1a9ed3;" @click.stop="getAll">全部提现</text>
  13. </view>
  14. <button type="primary" @click="getCash">提现</button>
  15. </view>
  16. </template>
  17. <script>
  18. var md5 = require('../../../../common/md5.js')
  19. export default {
  20. data() {
  21. return {
  22. money:'',
  23. userInfoObj:{},
  24. };
  25. },
  26. onLoad() {
  27. },
  28. onShow() {
  29. this.getUserInfo();
  30. },
  31. methods: {
  32. getUserInfo(){
  33. uni.showLoading({
  34. title: '加载中',
  35. });
  36. let that = this;
  37. uni.request({
  38. url: getApp().globalData.shareUrl, //需要设置为全局
  39. method: 'POST',
  40. header: {
  41. 'content-type': 'application/x-www-form-urlencoded'
  42. },
  43. data: {
  44. method: 'getUserInfo',
  45. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  46. uid:getApp().globalData.user_id,
  47. sign: md5('getUserInfo' + getApp().globalData.globalTimestamp)
  48. },
  49. success: res => {
  50. if (res.data.code === 200) {
  51. uni.hideLoading();
  52. that.userInfoObj = res.data.msg
  53. }
  54. }
  55. });
  56. },
  57. getCash(){
  58. let that = this;
  59. if(that.money > 0 && that.money <= that.userInfoObj.nowmoney){
  60. uni.request({
  61. url: getApp().globalData.shareUrl, //需要设置为全局
  62. method: 'POST',
  63. header: {
  64. 'content-type': 'application/x-www-form-urlencoded'
  65. },
  66. data: {
  67. method: 'tixian',
  68. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  69. uid:getApp().globalData.user_id,
  70. num:that.money,
  71. sign: md5('tixian' + getApp().globalData.globalTimestamp)
  72. },
  73. success: res => {
  74. if (res.data.code === 200) {
  75. uni.showToast({
  76. title: '递交已申请',
  77. icon: 'none',
  78. duration:2000
  79. });
  80. that.money = 0;
  81. that.getUserInfo();
  82. }else{
  83. uni.showToast({
  84. title: res.data.msg,
  85. icon: 'none',
  86. duration:2000
  87. });
  88. }
  89. }
  90. });
  91. }else {
  92. that.money = '';
  93. uni.showToast({
  94. title: '可提现金额不足,请重新填写',
  95. icon: 'none',
  96. duration:3000
  97. });
  98. }
  99. },
  100. getAll(){
  101. this.money = this.userInfoObj.nowmoney
  102. }
  103. }
  104. };
  105. </script>
  106. <style>
  107. .cash-out-box {
  108. width: 85%;
  109. height: 600rpx;
  110. background: #fff;
  111. border-radius: 15rpx;
  112. display: flex;
  113. flex-direction: column;
  114. align-items: center;
  115. margin: 5% auto;
  116. padding: 15px;
  117. }
  118. .cash-input-box {
  119. width: 100%;
  120. margin-top: 5%;
  121. border-bottom: 1px solid #dbdbdb;
  122. display: flex;
  123. align-items: center;
  124. height: 80rpx;
  125. }
  126. .cash-input-box text {
  127. margin-right: 2%;
  128. }
  129. .all-cash-out-box {
  130. margin-top: 3%;
  131. font-size: 28rpx;
  132. width: 99%;
  133. color: #999;
  134. }
  135. .cash-out-box button {
  136. background: #1a9ed3;
  137. color: #fff;
  138. width: 99%;
  139. margin-top: 5%;
  140. }
  141. </style>