cash_out.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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">
  8. <view class="form_group">
  9. <view class="lable re">提现金额</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 re">提现方式</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" v-if="platform.cashOutMoney > 0">最少提现金额:¥{{ platform.cashOutMoney }}起</view>
  35. <button class="btn" @click="save()">确认</button>
  36. <u-popup :show="show" round="15" mode="center" :closeable="true" :closeOnClickOverlay="false" :customStyle="{ width: '85%' }" @close="show = false">
  37. <view class="popup">
  38. <view class="mtt">提现</view>
  39. <view class="money">¥{{ item.money }}</view>
  40. <view>
  41. <view class="item">
  42. <text class="tt">服务费</text>
  43. <text class="la">¥{{ item.serviceMoney }}</text>
  44. </view>
  45. <view class="item">
  46. <text class="tt">费率</text>
  47. <text class="la">{{ platform.cashOutService || 0 }}%</text>
  48. </view>
  49. <view class="item">
  50. <text class="tt">实际到账</text>
  51. <text class="la">¥{{ item.realMoney }}</text>
  52. </view>
  53. </view>
  54. <button class="btn" @click="ok()">确定</button>
  55. </view>
  56. </u-popup>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. money: 0, //提现金额
  64. bankName: '', //是否填写银行卡
  65. item: { way: 0, money: '' },
  66. show: false,
  67. platform: { cashOutMoney: 0 }
  68. };
  69. },
  70. onShow() {
  71. this.money = uni.getStorageSync('money');
  72. this.bankName = uni.getStorageSync('bankName');
  73. },
  74. onLoad() {
  75. this.getPlatform();
  76. },
  77. methods: {
  78. //平台服务费信息
  79. getPlatform() {
  80. this.http.request({
  81. url: '/app/pay/getPlatform',
  82. success: (res) => {
  83. this.platform = res.data.data;
  84. }
  85. });
  86. },
  87. all() {
  88. this.item.money = this.money;
  89. },
  90. go() {
  91. uni.navigateTo({ url: '/pages/statement/user/info' });
  92. },
  93. save() {
  94. let rule = [{ name: 'money', checkType: 'notnull', errorMsg: '请输入提现金额' }];
  95. if (!this.verify.check(this.item, rule)) {
  96. uni.showModal({ content: this.verify.error, showCancel: false });
  97. return false;
  98. }
  99. if (this.item.way == 0 && !this.bankName) {
  100. uni.showModal({
  101. title: '提示',
  102. content: '请先填写银行卡信息',
  103. showCancel: false,
  104. success: (res) => {
  105. this.go();
  106. }
  107. });
  108. return;
  109. }
  110. this.item.serviceMoney = (this.item.money * (this.platform.cashOutService / 100)).toFixed(2);
  111. this.item.realMoney = (this.item.money - this.item.serviceMoney).toFixed(2);
  112. this.show = true;
  113. },
  114. ok() {
  115. this.http.request({
  116. url: '/app/pay/cashOut',
  117. data: this.item,
  118. method: 'POST',
  119. success: (res) => {
  120. //通知模板订阅消息
  121. uni.requestSubscribeMessage({
  122. tmplIds: ['PtdKbqfzmpvGsJPx_YekDX4-cljbhOXcvoUB3XJaVLg', 'NIqSQq0j765o9Iz9gMiSelnuxMgPIPeCnk3lvEnWJlo'],
  123. complete: (c) => {
  124. uni.showModal({
  125. title: '提示',
  126. content: '提现申请成功,等待平台审核打款',
  127. showCancel: false,
  128. success: (res) => {
  129. uni.$emit('payMoney');
  130. uni.navigateBack();
  131. }
  132. });
  133. }
  134. });
  135. }
  136. });
  137. }
  138. }
  139. };
  140. </script>
  141. <style lang="scss">
  142. .bgm {
  143. .input {
  144. width: 50%;
  145. }
  146. }
  147. .lit {
  148. padding: 15px 0px 15px 0px;
  149. border-bottom: 1px solid $line;
  150. .tb {
  151. padding-right: 6px;
  152. font-size: 25px;
  153. float: left;
  154. margin-top: -3px;
  155. }
  156. .desc {
  157. font-size: 13px;
  158. padding-left: 5px;
  159. color: #a8a8a8;
  160. }
  161. .check {
  162. float: right;
  163. color: $main-color;
  164. margin-top: -22px;
  165. font-size: 20px;
  166. }
  167. &:last-child {
  168. border: 0px;
  169. padding-bottom: 5px;
  170. }
  171. }
  172. </style>