withdraw.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <view class="withdraw">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <view class="withdraw-head dis f-c" @click="bankCardOption">
  6. <text class="withdraw-head-to mb-2">到账银行卡</text>
  7. <view class="dis a-start j-s">
  8. <view class="dis j-s a-start">
  9. <image class="bankLogo" :src="bankCardInfo.logo" mode=""></image>
  10. <view class="dis a-start f-c bankName" v-if="bankCardInfo.bankAccount && bankCardInfo.bankNumber">
  11. <text>{{bankCardInfo.bankAccount}}(****{{bankCardInfo.bankNumber.slice(-4)}})</text>
  12. <text>注:仅支持整数,72小时内到账</text>
  13. </view>
  14. </view>
  15. <u-icon name="arrow-right" color="#999" size="30"></u-icon>
  16. </view>
  17. </view>
  18. <view class="withdraw-body">
  19. <text style="font-size: 15px;color: #333;">提现金额</text>
  20. <view class="input-money">
  21. <text class="rmb">¥</text>
  22. <input disabled v-model.number="extract" type="text" @focus.prevent="stopKeyborad" class="t-input" />
  23. </view>
  24. <view class="info-money">
  25. <view v-if="is_out">
  26. <text class="info-money-num" style="color: #ff1e0f;">输入金额超过可提现余额,账户余额{{ amount }}元</text>
  27. </view>
  28. <view v-else-if="is_lowest">
  29. <text class="info-money-num" style="color: #ff1e0f;">最低{{ lowest }}元起提现,账户余额{{ amount }}元</text>
  30. </view>
  31. <view v-else>
  32. <text class="info-money-num">当前可提现余额{{ amount }}元,</text>
  33. <text class="info-money-all" @click="getAll">全部提现</text>
  34. </view>
  35. </view>
  36. <view class="dis j-s" :class="['keyboard', keyboradShow ? '' : 'active', isIphoneX ? 'isIphone' : '']">
  37. <view class="dis a-s j-s f-wrap" style="width: 80%;">
  38. <block v-for="(item, index) in 9" :key="index">
  39. <view class="keyboard-item" @tap="keyboradKey(index + 1)">{{ index + 1 }}</view>
  40. </block>
  41. <view class="keyboard-item" style="width: 66%;" @tap="keyboradKey(0)"><text>0</text></view>
  42. <view class="keyboard-item ">.</view>
  43. </view>
  44. <view class="dis f-c j-s" style="margin-left: 8px;width: 20%;">
  45. <view class="keyboard-item " @tap="keyboradDel()" style="width: 100%;">
  46. <image src="/static/image/bindBank/Frame.png" mode="aspectFill" :lazy-load="true"
  47. style="width: 26px;height: 26px;">
  48. </image>
  49. </view>
  50. <u-button class="Withdrawal" type="primary" :disabled="!is_post"
  51. @click="handleShowModel">提现</u-button>
  52. </view>
  53. </view>
  54. <!-- <view :class="'tx' + (is_post ? '-active' : '')"><button @click="handleShowModel">提现</button></view> -->
  55. </view>
  56. <u-popup v-model="bankCardListShow" mode="bottom" height="660" border-radius="20">
  57. <view class="bankCardPopup dis f-c j-s a-c">
  58. <view class="title dis f-c a-c">
  59. <text>选择到账银行卡</text>
  60. <text>请留意各银行到账时间</text>
  61. </view>
  62. <scroll-view scroll-y="true" class="" style="height:auto;background-color: #fff;border-radius: 6px;
  63. position: relative;">
  64. <view class="PopupSet">
  65. <view class=" dis j-s" v-for="(bankitem,bankindex) in bankCardList" :key="bankitem.id"
  66. @click="bankCardPopupClick(bankitem)">
  67. <view class="setLeft">
  68. <image :src="bankitem.logo" mode="" style="width: 100%;height: 100%;"></image>
  69. </view>
  70. <view class="setRight dis j-s a-c">
  71. <view class="dis f-c">
  72. <text v-if="bankitem.bankAccount && bankitem.bankNumber">
  73. {{bankitem.bankAccount.slice(-4)}} 储蓄卡({{bankitem.bankNumber.slice(-4)}})</text>
  74. <text>72小时到账</text>
  75. </view>
  76. <u-icon v-if="bankCardInfo.id==bankitem.id" name="checkbox-mark" color="#0052FF"
  77. size="50"></u-icon>
  78. </view>
  79. </view>
  80. </view>
  81. </scroll-view>
  82. <view class="bankAdd dis j-s a-c" @click="bank">
  83. <view class="dis a-c">
  84. <image src="/static/image/bindBank/add.png" mode=""
  85. style="width: 20px;height: 20px;margin-right: 20px;">
  86. </image>
  87. <text>添加银行卡提现</text>
  88. </view>
  89. <u-icon name="arrow-right" color="#999" size="30"></u-icon>
  90. </view>
  91. </view>
  92. </u-popup>
  93. </view>
  94. </template>
  95. <script>
  96. import {
  97. mapState
  98. } from "vuex"
  99. import wybPopup from '@/components/common/wyb-popup/wyb-popup.vue'
  100. export default {
  101. components: {
  102. wybPopup
  103. },
  104. computed: {
  105. ...mapState(['userInfo'])
  106. },
  107. data() {
  108. return {
  109. bankList: [{
  110. bankName: "中国邮政储蓄银行",
  111. logo: "/static/image/bankLogo/youzheng.png",
  112. background: "linear-gradient(90deg, rgba(79, 136, 69, 0.7) 0%, #4f8845 100%)"
  113. },
  114. {
  115. bankName: "中国工商银行",
  116. logo: "/static/image/bankLogo/youzheng.png",
  117. background: "linear-gradient(90deg, rgba(177, 0, 13, 0.7) 0%, #b1000d 100%)"
  118. },
  119. {
  120. bankName: "中国农业银行",
  121. logo: "/static/image/bankLogo/youzheng.png",
  122. background: "linear-gradient(90deg, rgba(86,152, 130, 0.7) 0%, #569882 100%)"
  123. },
  124. {
  125. bankName: "中国银行",
  126. logo: "/static/image/bankLogo/youzheng.png",
  127. background: "linear-gradient(90deg, rgba(157, 32, 40, 0.7) 0%, #9d2028 100%)"
  128. },
  129. {
  130. bankName: "中国建设银行",
  131. logo: "/static/image/bankLogo/jianshe.png",
  132. background: "linear-gradient(90deg, rgba(6, 89, 159, 0.7) 0%, #06569F 100%)"
  133. },
  134. {
  135. bankName: "招商银行",
  136. logo: "/static/image/bankLogo/youzheng.png",
  137. background: "linear-gradient(90deg, rgba(197, 0, 25, 0.7) 0%, #c50019 100%)"
  138. },
  139. {
  140. bankName: "中国民生银行",
  141. logo: "/static/image/bankLogo/youzheng.png",
  142. background: "linear-gradient(90deg, rgba(84,149, 92, 0.7) 0%, #54955c 100%)"
  143. },
  144. {
  145. bankName: "中国光大银行",
  146. logo: "/static/image/bankLogo/youzheng.png",
  147. background: "linear-gradient(90deg, rgba(93, 30, 131, 0.7) 0%, #5d1e83 100%)"
  148. },
  149. {
  150. bankName: "中信银行",
  151. logo: "/static/image/bankLogo/youzheng.png",
  152. background: "linear-gradient(90deg, rgba(184, 0,22, 0.7) 0%, #b80016 100%)"
  153. },
  154. {
  155. bankName: "华夏银行",
  156. logo: "/static/image/bankLogo/youzheng.png",
  157. background: "linear-gradient(90deg, rgba(216, 12, 24, 0.7) 0%, #d80c18 100%)"
  158. },
  159. {
  160. bankName: "中国交通银行",
  161. logo: "/static/image/bankLogo/youzheng.png",
  162. background: "linear-gradient(90deg, rgba(33, 58, 120, 0.7) 0%, #213a78 100%)"
  163. },
  164. ],
  165. lowest: 0, //最低提现金额
  166. amount: 500, //可提现余额
  167. extract: '', //选择的提现金额
  168. amountStatus: "", //提现类型
  169. is_out: false,
  170. is_lowest: false,
  171. is_post: false,
  172. money: '', //提现金额
  173. real_money: '', //实际到账
  174. keyboradShow: false,
  175. isIphoneX: false,
  176. isRefuse: false,
  177. bankCardList: [],
  178. bankCardInfo: {},
  179. bankCardListShow: false, //银行卡选择
  180. };
  181. },
  182. watch: {
  183. extract(oldVal, newVal) {}
  184. },
  185. async onLoad(params) {
  186. if (!!params.amount) {
  187. this.amount = params.amount
  188. this.amountStatus = params.amountStatus
  189. }
  190. this.loadData();
  191. this.getbankCard();
  192. },
  193. methods: {
  194. bank() {
  195. this.navigate({
  196. url: "/pages/wallet/bindBank"
  197. }, "navigateTo", true);
  198. },
  199. bankCardPopupClick(info) {
  200. this.bankCardInfo = info;
  201. this.bankCardListShow = false;
  202. },
  203. bankCardOption() {
  204. this.bankCardListShow = true;
  205. },
  206. async getbankCard() {
  207. let res = await this.$http.get('/userBank/getUserBankList');
  208. this.bankList.map(val => {
  209. res.data.map(ele => {
  210. if (val.bankName == ele.bankAccount) {
  211. ele.logo = val.logo;
  212. return ele;
  213. }
  214. })
  215. })
  216. let bankinfo = res.data.find(val => val.isDefault == 1)
  217. if (bankinfo) {
  218. this.bankCardInfo = bankinfo;
  219. } else {
  220. this.bankCardInfo = res.data[0]
  221. }
  222. this.bankCardList = res.data;
  223. },
  224. loadData() {
  225. this.lowest = 50;
  226. this.$nextTick(() => {
  227. this.keyboradShow = true;
  228. });
  229. },
  230. //隐藏原生
  231. stopKeyborad() {
  232. uni.hideKeyboard();
  233. },
  234. //输入事件
  235. keyboradKey(key) {
  236. this.extract = this.extract * 10 + key;
  237. this.checkMoney();
  238. },
  239. //键盘递减事件
  240. keyboradDel() {
  241. if (this.extract && this.extract > 0) {
  242. let val = parseInt(this.extract / 10);
  243. this.extract = val;
  244. this.checkMoney();
  245. }
  246. },
  247. //全部提现
  248. getAll() {
  249. this.extract = parseInt(this.amount);
  250. this.checkMoney();
  251. },
  252. //提现
  253. async handleShowModel() {
  254. let params = {
  255. amount: this.extract,
  256. amountStatus: this.amountStatus,
  257. fromBankCardId: this.bankCardInfo.id,
  258. }
  259. let res = await this.$http.post('/sysUserAccount/insert', params);
  260. if (res.code == '200') {
  261. uni.showToast({
  262. title: res.msg,
  263. icon: "none"
  264. });
  265. setTimeout(() => {
  266. return uni.navigateBack();
  267. }, 2000);
  268. }
  269. },
  270. //金额计算
  271. checkMoney() {
  272. if (!this.extract || this.extract < this.lowest) {
  273. this.is_lowest = true;
  274. this.is_post = false;
  275. } else if (this.extract > this.amount) {
  276. this.is_out = true;
  277. this.is_lowest = false;
  278. this.is_post = false;
  279. } else {
  280. this.is_out = false;
  281. this.is_lowest = false;
  282. this.is_post = true;
  283. }
  284. if (parseFloat(this.extract).toString() == 'NaN') {
  285. this.is_post = false;
  286. uni.showToast({
  287. title: '输入金额不合法',
  288. icon: "none"
  289. });
  290. }
  291. },
  292. StringSlice(val) {
  293. let data = val.slice(-4)
  294. return data
  295. },
  296. async getMoney() {
  297. this.closeWithdrawPopup();
  298. if (this.isRefuse) return;
  299. this.isRefuse = true;
  300. let res = await this.$http.post('/insPayApply/applyPay?amount=' + this.real_money + '&userid=' + this
  301. .userInfo.sysUser.id);
  302. uni.showToast({
  303. title: '提现申请已提交,等待管理员处理',
  304. icon: "none",
  305. duration: 2000
  306. });
  307. setTimeout(() => {
  308. uni.navigateBack();
  309. }, 2000);
  310. }
  311. },
  312. async onPullDownRefresh() {
  313. this.extract = '';
  314. await this.getPayAccount();
  315. this.loadData();
  316. this.is_out = false;
  317. this.is_lowest = false;
  318. this.is_post = false;
  319. setTimeout(function() {
  320. uni.stopPullDownRefresh();
  321. }, 500);
  322. }
  323. };
  324. </script>
  325. <style lang="scss" scoped>
  326. page {
  327. background-color: #F8FAFE;
  328. }
  329. /deep/ .uni-scroll-view-content {
  330. background-color: #F8FAFE;
  331. }
  332. .bankCardPopup {
  333. padding: 10px 16px;
  334. background-color: #F8FAFE;
  335. .bankAdd {
  336. background-color: #fff;
  337. font-size: 15px;
  338. width: 100%;
  339. color: #333;
  340. padding: 15px 8px;
  341. }
  342. .title {
  343. color: #000;
  344. font-weight: bold;
  345. padding-bottom: 10px;
  346. font-size: 15px;
  347. text:last-child {
  348. font-size: 12px;
  349. color: rgba(51, 51, 51, 0.8);
  350. font-weight: 400;
  351. }
  352. }
  353. .scroll {
  354. min-height: 200px;
  355. overflow-y: auto;
  356. }
  357. .PopupSet {
  358. width: 100%;
  359. height: auto;
  360. background: #FFFFFF;
  361. border-radius: 6px;
  362. padding: 18rpx 16rpx;
  363. .setLeft {
  364. width: 35px;
  365. height: 30px;
  366. margin-right: 5px;
  367. margin-right: 20px;
  368. margin-top: 2px;
  369. image {
  370. width: 100%;
  371. height: 100%;
  372. }
  373. }
  374. .setRight {
  375. width: 100%;
  376. border-bottom: 1px solid #f2f2f2;
  377. padding-bottom: 10px;
  378. text {
  379. font-size: 12px;
  380. color: rgba(51, 51, 51, 0.6);
  381. }
  382. text:first-child {
  383. font-size: 15px;
  384. color: #333333;
  385. font-weight: bold;
  386. }
  387. }
  388. }
  389. }
  390. .withdraw {
  391. background-color: #ededed;
  392. position: absolute;
  393. width: 100%;
  394. height: 100%;
  395. box-sizing: border-box;
  396. }
  397. .withdraw-head {
  398. background-color: #F8FAFE;
  399. padding: 16px;
  400. border-top-left-radius: 10px;
  401. border-top-right-radius: 10px;
  402. font-size: 14px;
  403. .withdraw-head-to {
  404. font-size: 16px;
  405. font-weight: bold;
  406. color: #333333;
  407. }
  408. }
  409. .withdraw-head-way {
  410. display: flex;
  411. flex-direction: column;
  412. align-content: center;
  413. margin-left: 20px;
  414. }
  415. .withdraw-head-way-1 {
  416. color: #576b95;
  417. margin-bottom: 10px;
  418. }
  419. .withdraw-head-way-1 .way-icon {
  420. width: 16px;
  421. height: 16px;
  422. margin-right: 5px;
  423. top: 2px;
  424. }
  425. .withdraw-head-way-2 {
  426. color: #acacac;
  427. font-size: 12px;
  428. }
  429. .withdraw-body {
  430. background-color: #fff;
  431. padding: 12px 16px;
  432. font-size: 28upx;
  433. box-shadow: 0px 4px 10px 0px #DAE3F4;
  434. border-top-left-radius: 10px;
  435. border-top-right-radius: 10px;
  436. margin-top: -20px;
  437. height: calc(100vh - 170px);
  438. }
  439. .withdraw-body .input-money {
  440. display: flex;
  441. align-content: center;
  442. font-weight: 600;
  443. border-bottom: 0.5px solid #eaeef1;
  444. }
  445. .withdraw-body .input-money .rmb {
  446. font-size: 2.6em;
  447. position: relative;
  448. }
  449. .withdraw-body .input-money .t-input {
  450. height: 1.9em;
  451. font-size: 2.5em;
  452. border: none;
  453. position: relative;
  454. left: 3.5%;
  455. outline: none;
  456. }
  457. .withdraw-body .info-money {
  458. margin-top: 10px;
  459. font-size: 12px;
  460. margin-bottom: 20px;
  461. }
  462. .withdraw-body .info-money-num {
  463. color: rgba(51, 51, 51, 0.6);
  464. font-size: 13px;
  465. }
  466. .withdraw-body .info-money-all {
  467. color: #2D4D89;
  468. }
  469. .withdraw-body .tx button {
  470. color: #b2b2b2;
  471. font-size: 30upx;
  472. }
  473. .withdraw-body .tx-active button {
  474. font-size: 30upx;
  475. color: #fff;
  476. background: #1E85FE;
  477. }
  478. .withdraw .keyboard {
  479. height: 210px;
  480. width: 100%;
  481. position: fixed;
  482. bottom: 0;
  483. left: 0;
  484. width: 100%;
  485. background: #F7F7F7;
  486. z-index: 2;
  487. padding: 23rpx 16rpx 0rpx 16rpx;
  488. transition: all 0.2s ease-in 0.2s;
  489. }
  490. .Withdrawal {
  491. width: 100%;
  492. height: 141px;
  493. background: #0052FF;
  494. border-radius: 4px;
  495. text-align: center;
  496. line-height: 286rpx;
  497. color: #fff;
  498. font-size: 20px;
  499. font-weight: 500;
  500. margin-bottom: 8px;
  501. }
  502. .withdraw .keyboard-item {
  503. box-sizing: border-box;
  504. width: 32.33%;
  505. display: flex;
  506. flex-direction: column;
  507. justify-content: center;
  508. align-items: center;
  509. background: #ffffff;
  510. font-size: 40rpx;
  511. color: #333;
  512. height: 84rpx;
  513. border-top: none;
  514. border-left: none;
  515. border-radius: 4px;
  516. }
  517. .keyboard-item:active {
  518. background-color: #e6e5ea;
  519. }
  520. .withdraw .hide {
  521. opacity: 0;
  522. }
  523. .withdraw .delte {
  524. background: none;
  525. box-shadow: none;
  526. }
  527. .withdraw .delte image {
  528. width: 60rpx;
  529. height: 60rpx;
  530. }
  531. .withdraw .isIphone {
  532. padding-bottom: 68rpx !important;
  533. }
  534. .withdraw .fee em {
  535. font-size: 0.5rem;
  536. font-style: normal;
  537. }
  538. .popup-content .withdrawHeader {
  539. height: 100upx;
  540. background-color: #fff;
  541. color: #666666;
  542. font-size: 32upx;
  543. border-radius: 10upx;
  544. }
  545. .bankLogo {
  546. width: 25px;
  547. height: 25px;
  548. margin-right: 8px;
  549. }
  550. .bankName {
  551. text:first-child {
  552. margin-bottom: 10px;
  553. line-height: 1;
  554. font-weight: bold;
  555. font-size: 16px;
  556. }
  557. text:last-child {
  558. margin-bottom: 20px;
  559. font-size: 12px;
  560. color: #999;
  561. }
  562. }
  563. .popup-content .withdrawBody {
  564. height: 220upx;
  565. padding: 25upx;
  566. background-color: #F8F8F8;
  567. }
  568. .popup-content .withdrawBody view>text:nth-of-type(1) {
  569. font-size: 26upx;
  570. }
  571. .popup-content .withdrawBody view.margin-top-sm {
  572. margin-top: 10upx;
  573. }
  574. .popup-content .withdrawBody .text-red {
  575. color: #E54D42;
  576. }
  577. .popup-content .withdrawFooter {
  578. height: 120upx;
  579. }
  580. .popup-content .withdrawFooter view {
  581. width: 120upx;
  582. height: 70upx;
  583. margin: 0upx 30upx;
  584. border-radius: 10upx;
  585. padding: 0upx 15upx;
  586. }
  587. .popup-content .withdrawFooter view:nth-of-type(1) {
  588. background-color: #f0f0f0;
  589. }
  590. .popup-content .withdrawFooter view:nth-of-type(2) {
  591. background-color: #1E85FE;
  592. color: #FFFFFF;
  593. }
  594. </style>