cash_out.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="main">
  3. <view class="mcard">
  4. <view class="money">{{ money }}</view>
  5. <view class="desc">可提现余额(元)</view>
  6. </view>
  7. <view class="mcard mt10 pd0 pt5">
  8. <view class="form_group">
  9. <view class="lable">提现金额</view>
  10. <view class="bgm">
  11. <input type="digit" v-model="item.money" placeholder="请输入提现金额" class="input" />
  12. <view class="msg" @click="all()">提现全部</view>
  13. </view>
  14. </view>
  15. <view class="form_group">
  16. <view class="lable">提现方式</view>
  17. <view class="item">
  18. <view class="lit" @click="item.way = 0">
  19. <text class="icon tb" style="color: #ff9800">&#xe635;</text>
  20. <view class="title">
  21. <text>提现到银行卡</text>
  22. <text class="desc" @click="go()">{{ bankName ? '查看' : '(未填)' }}</text>
  23. </view>
  24. <text class="icon check" v-if="item.way == 0">&#xe612;</text>
  25. </view>
  26. <view class="lit" @click="item.way = 1">
  27. <text class="icon tb" style="color: #4caf50">&#xe620;</text>
  28. <view class="title">提现到微信</view>
  29. <text class="icon check" v-if="item.way == 1">&#xe612;</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="bz">
  35. <text class="icon">&#xe694;</text>
  36. <text v-if="platform.cashOutMoney > 0">单次最少提现金额:¥{{ platform.cashOutMoney }}起</text>
  37. <text v-if="platform.cashOutMaxMoney">,单次最大提现金额:¥{{ platform.cashOutMaxMoney }}</text>
  38. </view>
  39. <button class="btn" @click="save()">确认</button>
  40. <u-popup :show="show" round="15" mode="center" :closeable="true" :closeOnClickOverlay="false" :customStyle="{ width: '85%' }" @close="show = false">
  41. <view class="popup">
  42. <view class="mtt">提现</view>
  43. <view class="money">¥{{ item.money }}</view>
  44. <view>
  45. <view class="item">
  46. <text class="tt">服务费</text>
  47. <text class="la">¥{{ item.serviceMoney }}</text>
  48. </view>
  49. <view class="item">
  50. <text class="tt">费率</text>
  51. <text class="la">{{ platform.cashOutService || 0 }}%</text>
  52. </view>
  53. <view class="item">
  54. <text class="tt">实际到账</text>
  55. <text class="la">¥{{ item.realMoney }}</text>
  56. </view>
  57. </view>
  58. <button class="btn" @click="ok()">确定</button>
  59. </view>
  60. </u-popup>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. money: 0, //提现金额
  68. bankName: '', //是否填写银行卡
  69. item: { way: 0, money: '' },
  70. show: false,
  71. platform: { cashOutMoney: 0 }
  72. };
  73. },
  74. onShow() {
  75. this.money = uni.getStorageSync('money');
  76. this.bankName = uni.getStorageSync('bankName');
  77. },
  78. onLoad() {
  79. this.getPlatform();
  80. },
  81. methods: {
  82. //平台服务费信息
  83. getPlatform() {
  84. this.http.request({
  85. url: '/app/common/getPlatform',
  86. success: (res) => {
  87. this.platform = res.data.data;
  88. }
  89. });
  90. },
  91. all() {
  92. this.item.money = this.money;
  93. },
  94. go() {
  95. uni.navigateTo({ url: '/pages/statement/user/info' });
  96. },
  97. save() {
  98. let rule = [{ name: 'money', checkType: 'notnull', errorMsg: '请输入提现金额' }];
  99. if (!this.verify.check(this.item, rule)) {
  100. uni.showModal({ content: this.verify.error, showCancel: false });
  101. return false;
  102. }
  103. if (this.item.way == 0 && !this.bankName) {
  104. uni.showModal({
  105. title: '提示',
  106. content: '请先填写银行卡信息',
  107. showCancel: false,
  108. success: (res) => {
  109. this.go();
  110. }
  111. });
  112. return;
  113. }
  114. this.item.serviceMoney = (this.item.money * (this.platform.cashOutService / 100)).toFixed(2);
  115. this.item.realMoney = (this.item.money - this.item.serviceMoney).toFixed(2);
  116. this.show = true;
  117. },
  118. ok() {
  119. this.http.request({
  120. url: '/app/pay/cashOut',
  121. data: this.item,
  122. method: 'POST',
  123. success: (res) => {
  124. //通知模板订阅消息
  125. uni.requestSubscribeMessage({
  126. tmplIds: ['PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg', 'NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo'],
  127. complete: (c) => {
  128. uni.showModal({
  129. title: '提示',
  130. content: '提现申请成功,等待平台审核打款',
  131. showCancel: false,
  132. success: (res) => {
  133. uni.$emit('payMoney');
  134. uni.navigateBack();
  135. }
  136. });
  137. }
  138. });
  139. }
  140. });
  141. }
  142. }
  143. };
  144. </script>
  145. <style lang="scss">
  146. .bgm {
  147. .input {
  148. width: 50%;
  149. }
  150. }
  151. </style>