withdraw.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <view class="withdraw">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="withdraw-head d-flex a-center">
  6. <view class="withdraw-head-to">到账渠道</view>
  7. <!-- <view class="withdraw-head-way" style="color:#576B95">{{userInfo.esmUserInternal.bankname}} ({{userInfo.esmUserInternal.accountno.substring(userInfo.esmUserInternal.accountno.length - 4)}})</view> -->
  8. </view>
  9. <view style="color: #ACACAC;background-color: #F7F7F7;padding: 5upx 60upx;">注:仅支持整数,72小时内到账</view>
  10. <view class="withdraw-body">
  11. <text>提现金额</text>
  12. <view class="input-money">
  13. <text class="rmb">¥</text>
  14. <input disabled v-model.number="extract" type="text" @focus.prevent="stopKeyborad" class="t-input" />
  15. </view>
  16. <view class="info-money">
  17. <view v-if="is_out">
  18. <text class="info-money-num" style="color: #ff1e0f;">输入金额超过可提现余额,账户余额{{ pool }}元</text>
  19. </view>
  20. <view v-else-if="is_lowest">
  21. <text class="info-money-num" style="color: #ff1e0f;">最低{{ lowest }}元起提现,账户余额{{ pool }}元</text>
  22. </view>
  23. <view v-else>
  24. <text class="info-money-num">当前可提现余额{{ pool }}元,</text>
  25. <text class="info-money-all" @click="getAll">全部提现</text>
  26. </view>
  27. </view>
  28. <view :class="'tx' + (is_post ? '-active' : '')"><button @click="handleShowModel">提现</button></view>
  29. </view>
  30. <view :class="['keyboard', keyboradShow ? '' : 'active', isIphoneX ? 'isIphone' : '']">
  31. <block v-for="(item, index) in 9" :key="index">
  32. <view class="keyboard-item" @tap="keyboradKey(index + 1)">{{ index + 1 }}</view>
  33. </block>
  34. <view class="keyboard-item hide"></view>
  35. <view class="keyboard-item" @tap="keyboradKey(0)"><text>0</text></view>
  36. <view class="keyboard-item delte" @tap="keyboradDel()">
  37. <image class="img" src="/static/common/del.png" mode="aspectFill" :lazy-load="true"></image>
  38. </view>
  39. </view>
  40. <wyb-popup ref="withdrawPopup" type="center" height="480" width="680" radius="6" :maskClickClose="false">
  41. <view class="popup-content">
  42. <view class="withdrawHeader d-flex a-center j-center">提现确认</view>
  43. <view class="withdrawBody">
  44. <view>
  45. <text>提现金额:</text>
  46. <text class="text-red">{{ money }}元</text>
  47. </view>
  48. <view class="margin-top-sm">
  49. <text>实际到账:</text>
  50. <text class="text-red">{{ real_money }}元</text>
  51. </view>
  52. <view class="margin-top-sm">
  53. <text>服务费:</text>
  54. <text class="text-red">{{ service_fee }}元</text>
  55. </view>
  56. <view class="margin-top-sm">
  57. <text>服务费率:</text>
  58. <text class="text-red">{{ fee }}%</text>
  59. </view>
  60. </view>
  61. <view class="withdrawFooter d-flex a-center j-end">
  62. <view class="d-flex a-center j-center" @tap="closeWithdrawPopup">我再想想</view>
  63. <view class="d-flex a-center j-center" @tap="getMoney">确认提现</view>
  64. </view>
  65. </view>
  66. </wyb-popup>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. mapState
  72. } from "vuex"
  73. import wybPopup from '@/components/common/wyb-popup/wyb-popup.vue'
  74. export default {
  75. components: {
  76. wybPopup
  77. },
  78. computed: {
  79. ...mapState(['userInfo'])
  80. },
  81. data() {
  82. return {
  83. lowest: 0, //最低提现金额
  84. fee: 0, //提现费率
  85. pool: 0, //可提现余额
  86. extract: '', //选择的提现金额
  87. service_fee: 0.0, //提现服务费
  88. showModal: false,
  89. is_out: false,
  90. is_lowest: false,
  91. is_post: false,
  92. money: '', //提现金额
  93. real_money: '', //实际到账
  94. keyboradShow: false,
  95. isIphoneX: false,
  96. isRefuse: false
  97. };
  98. },
  99. watch: {
  100. extract(oldVal, newVal) {}
  101. },
  102. async onLoad() {
  103. await this.getPayAccount(); //获取可提现余额
  104. this.loadData();
  105. },
  106. methods: {
  107. // 可提现余额查询
  108. async getPayAccount() {
  109. let res = await this.$http.get('/insPayApply/payAccount?userid=' + this.userInfo.sysUser.id);
  110. this.pool = res.data.accountBalance;
  111. },
  112. showWithdrawPopup() {
  113. this.$refs.withdrawPopup.show() // 显示
  114. },
  115. closeWithdrawPopup() {
  116. this.$refs.withdrawPopup.hide() // 显示
  117. },
  118. loadData() {
  119. this.lowest = 10;
  120. this.fee = "0";
  121. // this.pool = "136.5";
  122. this.$nextTick(() => {
  123. this.keyboradShow = true;
  124. });
  125. },
  126. stopKeyborad() {
  127. uni.hideKeyboard();
  128. },
  129. keyboradKey(key) {
  130. this.extract = this.extract * 10 + key;
  131. this.checkMoney();
  132. },
  133. keyboradDel() {
  134. if (this.extract && this.extract > 0) {
  135. let val = parseInt(this.extract / 10);
  136. if (val == 0) val = '';
  137. this.extract = val;
  138. this.checkMoney();
  139. }
  140. },
  141. getAll() {
  142. this.extract = parseInt(this.pool);
  143. this.checkMoney();
  144. },
  145. checkMoney() {
  146. if (!this.extract || this.extract < this.lowest) {
  147. this.is_lowest = true;
  148. this.is_post = false;
  149. } else if (this.extract > this.pool) {
  150. this.is_out = true;
  151. this.is_lowest = false;
  152. this.is_post = false;
  153. } else {
  154. this.is_out = false;
  155. this.is_lowest = false;
  156. this.is_post = true;
  157. }
  158. if (parseFloat(this.extract).toString() == 'NaN') {
  159. this.is_post = false;
  160. uni.showToast({
  161. title: '输入金额不合法',
  162. icon: "none"
  163. });
  164. }
  165. },
  166. handleShowModel() {
  167. if (this.isRefuse) return;
  168. this.checkMoney();
  169. if (!this.is_post) return;
  170. this.money = this.extract;
  171. this.service_fee = Number((this.extract * (this.fee / 100)).toString().match(/^\d+(?:\.\d{0,2})?/));
  172. this.real_money = Number((this.extract - this.service_fee).toString().match(/^\d+(?:\.\d{0,2})?/));
  173. this.showWithdrawPopup();
  174. },
  175. async getMoney() {
  176. this.closeWithdrawPopup();
  177. if (this.isRefuse) return;
  178. this.isRefuse = true;
  179. let res = await this.$http.post('/insPayApply/applyPay?amount=' + this.real_money + '&userid=' + this
  180. .userInfo.sysUser.id);
  181. uni.showToast({
  182. title: '提现申请已提交,等待管理员处理',
  183. icon: "none",
  184. duration: 2000
  185. });
  186. setTimeout(() => {
  187. uni.navigateBack();
  188. }, 2000);
  189. }
  190. },
  191. async onPullDownRefresh() {
  192. this.extract = '';
  193. await this.getPayAccount();
  194. this.loadData();
  195. this.is_out = false;
  196. this.is_lowest = false;
  197. this.is_post = false;
  198. setTimeout(function() {
  199. uni.stopPullDownRefresh();
  200. }, 500);
  201. }
  202. };
  203. </script>
  204. <style scoped>
  205. page {
  206. background-color: #ededed;
  207. }
  208. .withdraw {
  209. padding: 20px;
  210. background-color: #ededed;
  211. position: absolute;
  212. width: 100%;
  213. height: 100%;
  214. box-sizing: border-box;
  215. }
  216. .withdraw-head {
  217. background-color: #f7f7f7;
  218. display: flex;
  219. align-content: center;
  220. padding: 10px 30px;
  221. font-size: 14px;
  222. }
  223. .withdraw-head-way {
  224. display: flex;
  225. flex-direction: column;
  226. align-content: center;
  227. margin-left: 20px;
  228. }
  229. .withdraw-head-way-1 {
  230. color: #576b95;
  231. margin-bottom: 10px;
  232. }
  233. .withdraw-head-way-1 .way-icon {
  234. width: 16px;
  235. height: 16px;
  236. margin-right: 5px;
  237. top: 2px;
  238. }
  239. .withdraw-head-way-2 {
  240. color: #acacac;
  241. font-size: 12px;
  242. }
  243. .withdraw-body {
  244. background-color: #fff;
  245. padding: 20px 30px;
  246. font-size: 28upx;
  247. }
  248. .withdraw-body .input-money {
  249. display: flex;
  250. align-content: center;
  251. font-weight: 600;
  252. border-bottom: 0.5px solid #eaeef1;
  253. }
  254. .withdraw-body .input-money .rmb {
  255. font-size: 2em;
  256. top: 10px;
  257. position: relative;
  258. }
  259. .withdraw-body .input-money .t-input {
  260. height: 1.9em;
  261. font-size: 2.5em;
  262. border: none;
  263. position: relative;
  264. left: 3.5%;
  265. outline: none;
  266. }
  267. .withdraw-body .info-money {
  268. margin-top: 10px;
  269. font-size: 12px;
  270. margin-bottom: 20px;
  271. }
  272. .withdraw-body .info-money-num {
  273. color: #b2b2b2;
  274. }
  275. .withdraw-body .info-money-all {
  276. color: #576b95;
  277. }
  278. .withdraw-body .tx button {
  279. color: #b2b2b2;
  280. font-size: 30upx;
  281. }
  282. .withdraw-body .tx-active button {
  283. font-size: 30upx;
  284. color: #fff;
  285. background: #1E85FE;
  286. }
  287. .withdraw .keyboard {
  288. position: fixed;
  289. bottom: 0;
  290. left: 0;
  291. width: 100%;
  292. background: #ebebeb;
  293. display: flex;
  294. justify-content: center;
  295. z-index: 2;
  296. flex-wrap: wrap;
  297. transition: all 0.2s ease-in 0.2s;
  298. }
  299. .withdraw .active {
  300. bottom: -400rpx;
  301. }
  302. .withdraw .keyboard-item {
  303. box-sizing: border-box;
  304. width: 250rpx;
  305. display: flex;
  306. flex-direction: column;
  307. justify-content: center;
  308. align-items: center;
  309. background: #fff;
  310. font-size: 40rpx;
  311. color: #333;
  312. height: 99rpx;
  313. border: 1rpx solid #ebebeb;
  314. border-top: none;
  315. border-left: none;
  316. }
  317. .withdraw .hide {
  318. opacity: 0;
  319. }
  320. .withdraw .delte {
  321. background: none;
  322. box-shadow: none;
  323. }
  324. .withdraw .delte image {
  325. width: 60rpx;
  326. height: 60rpx;
  327. }
  328. .withdraw .isIphone {
  329. padding-bottom: 68rpx !important;
  330. }
  331. .withdraw .fee em {
  332. font-size: 0.5rem;
  333. font-style: normal;
  334. }
  335. .popup-content .withdrawHeader {
  336. height: 100upx;
  337. background-color: #fff;
  338. color: #666666;
  339. font-size: 32upx;
  340. border-radius: 10upx;
  341. }
  342. .popup-content .withdrawBody {
  343. height: 220upx;
  344. padding: 25upx;
  345. background-color: #F8F8F8;
  346. }
  347. .popup-content .withdrawBody view>text:nth-of-type(1) {
  348. font-size: 26upx;
  349. }
  350. .popup-content .withdrawBody view.margin-top-sm {
  351. margin-top: 10upx;
  352. }
  353. .popup-content .withdrawBody .text-red {
  354. color: #E54D42;
  355. }
  356. .popup-content .withdrawFooter {
  357. height: 120upx;
  358. }
  359. .popup-content .withdrawFooter view {
  360. width: 120upx;
  361. height: 70upx;
  362. margin: 0upx 30upx;
  363. border-radius: 10upx;
  364. padding: 0upx 15upx;
  365. }
  366. .popup-content .withdrawFooter view:nth-of-type(1) {
  367. background-color: #f0f0f0;
  368. }
  369. .popup-content .withdrawFooter view:nth-of-type(2) {
  370. background-color: #1E85FE;
  371. color: #FFFFFF;
  372. }
  373. </style>