index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. let that = this;
  34. uni.request({
  35. url: getApp().globalData.shareUrl, //需要设置为全局
  36. method: 'POST',
  37. header: {
  38. 'content-type': 'application/x-www-form-urlencoded'
  39. },
  40. data: {
  41. method: 'getUserInfo',
  42. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  43. uid:getApp().globalData.user_id,
  44. sign: md5('getUserInfo' + getApp().globalData.globalTimestamp)
  45. },
  46. success: res => {
  47. if (res.data.code === 200) {
  48. that.userInfoObj = res.data.msg
  49. }
  50. }
  51. });
  52. },
  53. getCash(){
  54. let that = this;
  55. if(that.money > 0 && that.money <= that.userInfoObj.nowmoney){
  56. uni.request({
  57. url: getApp().globalData.shareUrl, //需要设置为全局
  58. method: 'POST',
  59. header: {
  60. 'content-type': 'application/x-www-form-urlencoded'
  61. },
  62. data: {
  63. method: 'tixian',
  64. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  65. uid:getApp().globalData.user_id,
  66. num:that.money,
  67. sign: md5('tixian' + getApp().globalData.globalTimestamp)
  68. },
  69. success: res => {
  70. if (res.data.code === 200) {
  71. uni.showToast({
  72. title:'递交已申请',
  73. icon: 'none',
  74. duration:2000
  75. });
  76. that.money = 0;
  77. that.getUserInfo();
  78. }else{
  79. uni.showToast({
  80. title: res.data.msg,
  81. icon: 'none',
  82. duration:2000
  83. });
  84. }
  85. }
  86. });
  87. }else {
  88. that.money = '';
  89. uni.showToast({
  90. title: '可提现金额不足,请重新填写',
  91. icon: 'none',
  92. duration:3000
  93. });
  94. }
  95. },
  96. getAll(){
  97. this.money = this.userInfoObj.nowmoney
  98. }
  99. }
  100. };
  101. </script>
  102. <style>
  103. .cash-out-box {
  104. width: 85%;
  105. height: 600rpx;
  106. background: #fff;
  107. border-radius: 15rpx;
  108. display: flex;
  109. flex-direction: column;
  110. align-items: center;
  111. margin: 5% auto;
  112. padding: 15px;
  113. }
  114. .cash-input-box {
  115. width: 100%;
  116. margin-top: 5%;
  117. border-bottom: 1px solid #dbdbdb;
  118. display: flex;
  119. align-items: center;
  120. height: 80rpx;
  121. }
  122. .cash-input-box text {
  123. margin-right: 2%;
  124. }
  125. .all-cash-out-box {
  126. margin-top: 3%;
  127. font-size: 28rpx;
  128. width: 99%;
  129. color: #999;
  130. }
  131. .cash-out-box button {
  132. background: #1a9ed3;
  133. color: #fff;
  134. width: 99%;
  135. margin-top: 5%;
  136. }
  137. </style>