index.vue 3.0 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. console.log(res.data.msg)
  49. that.userInfoObj = res.data.msg
  50. }
  51. }
  52. });
  53. },
  54. getCash(){
  55. let that = this;
  56. if(that.money > 0){
  57. uni.request({
  58. url: getApp().globalData.shareUrl, //需要设置为全局
  59. method: 'POST',
  60. header: {
  61. 'content-type': 'application/x-www-form-urlencoded'
  62. },
  63. data: {
  64. method: 'tixian',
  65. timestamp: getApp().globalData.globalTimestamp, //Date.now()
  66. uid:getApp().globalData.user_id,
  67. num:that.money,
  68. sign: md5('tixian' + getApp().globalData.globalTimestamp)
  69. },
  70. success: res => {
  71. if (res.data.code === 200) {
  72. uni.showToast({
  73. title: '递交已申请',
  74. icon: 'none',
  75. duration:2000
  76. });
  77. that.money = 0;
  78. that.getUserInfo();
  79. }else{
  80. uni.showToast({
  81. title: res.data.msg,
  82. icon: 'none',
  83. duration:2000
  84. });
  85. }
  86. }
  87. });
  88. }else {
  89. uni.showToast({
  90. title: '您的提现金额不足',
  91. icon: 'none',
  92. duration:2000
  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>