withdraw.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  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 v-model.number="extract" type="text" @input="arrinput" 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. is_out: false,
  169. is_lowest: false,
  170. is_post: false,
  171. money: '', //提现金额
  172. real_money: '', //实际到账
  173. keyboradShow: false,
  174. isIphoneX: false,
  175. isRefuse: false,
  176. bankCardList: [],
  177. bankCardInfo: {},
  178. bankCardListShow: false, //银行卡选择
  179. };
  180. },
  181. watch: {
  182. extract(oldVal, newVal) {}
  183. },
  184. async onLoad(params) {
  185. if (!!params.amount) {
  186. this.amount = params.amount
  187. }
  188. this.loadData();
  189. this.getbankCard();
  190. },
  191. methods: {
  192. arrinput(val) {
  193. console.log(val);
  194. },
  195. bank() {
  196. this.navigate({
  197. url: "/pages/wallet/bindBank"
  198. }, "navigateTo", true);
  199. },
  200. bankCardPopupClick(info) {
  201. this.bankCardInfo = info;
  202. this.bankCardListShow = false;
  203. },
  204. bankCardOption() {
  205. this.bankCardListShow = true;
  206. },
  207. async getbankCard() {
  208. let res = await this.$http.post('/userBank/getUserBankList', {
  209. auditStatus: "1",
  210. });
  211. this.bankList.map(val => {
  212. res.data.map(ele => {
  213. if (val.bankName == ele.bankAccount) {
  214. ele.logo = val.logo;
  215. return ele;
  216. }
  217. })
  218. })
  219. let bankinfo = res.data.find(val => val.isDefault == 1)
  220. if (bankinfo) {
  221. this.bankCardInfo = bankinfo;
  222. } else {
  223. this.bankCardInfo = res.data[0]
  224. }
  225. this.bankCardList = res.data;
  226. },
  227. loadData() {
  228. this.lowest = 20;
  229. this.$nextTick(() => {
  230. this.keyboradShow = true;
  231. });
  232. },
  233. //隐藏原生
  234. stopKeyborad() {
  235. uni.hideKeyboard();
  236. },
  237. //输入事件
  238. keyboradKey(key) {
  239. this.extract = this.extract * 10 + key;
  240. this.checkMoney();
  241. },
  242. //键盘递减事件
  243. keyboradDel() {
  244. if (this.extract && this.extract > 0) {
  245. let val = parseInt(this.extract / 10);
  246. this.extract = val;
  247. this.checkMoney();
  248. }
  249. },
  250. //全部提现
  251. getAll() {
  252. this.extract = parseInt(this.amount);
  253. this.checkMoney();
  254. },
  255. //提现
  256. async handleShowModel() {
  257. let params = {
  258. amount: this.extract,
  259. fromBankCardId: this.bankCardInfo.bankNumber,
  260. }
  261. let res = await this.$http.post('/sysUserAccount/insert', params);
  262. if (res.code == '200') {
  263. uni.showToast({
  264. title: res.msg,
  265. icon: "none"
  266. });
  267. setTimeout(() => {
  268. return uni.navigateBack(1);
  269. }, 2000);
  270. }
  271. },
  272. //金额计算
  273. checkMoney() {
  274. if (!this.extract || this.extract < this.lowest) {
  275. this.is_lowest = true;
  276. this.is_post = false;
  277. } else if (this.extract > this.amount) {
  278. this.is_out = true;
  279. this.is_lowest = false;
  280. this.is_post = false;
  281. } else {
  282. this.is_out = false;
  283. this.is_lowest = false;
  284. this.is_post = true;
  285. }
  286. if (parseFloat(this.extract).toString() == 'NaN') {
  287. this.is_post = false;
  288. uni.showToast({
  289. title: '输入金额不合法',
  290. icon: "none"
  291. });
  292. }
  293. },
  294. StringSlice(val) {
  295. let data = val.slice(-4)
  296. return data
  297. },
  298. async getMoney() {
  299. this.closeWithdrawPopup();
  300. if (this.isRefuse) return;
  301. this.isRefuse = true;
  302. let res = await this.$http.post('/insPayApply/applyPay?amount=' + this.real_money + '&userid=' + this
  303. .userInfo.sysUser.id);
  304. uni.showToast({
  305. title: '提现申请已提交,等待管理员处理',
  306. icon: "none",
  307. duration: 2000
  308. });
  309. setTimeout(() => {
  310. uni.navigateBack();
  311. }, 2000);
  312. }
  313. },
  314. async onPullDownRefresh() {
  315. this.extract = '';
  316. await this.getPayAccount();
  317. this.loadData();
  318. this.is_out = false;
  319. this.is_lowest = false;
  320. this.is_post = false;
  321. setTimeout(function() {
  322. uni.stopPullDownRefresh();
  323. }, 500);
  324. }
  325. };
  326. </script>
  327. <style lang="scss" scoped>
  328. page {
  329. background-color: #F8FAFE;
  330. }
  331. /deep/ .uni-scroll-view-content {
  332. background-color: #F8FAFE;
  333. }
  334. .bankCardPopup {
  335. padding: 10px 16px;
  336. background-color: #F8FAFE;
  337. .bankAdd {
  338. background-color: #fff;
  339. font-size: 15px;
  340. width: 100%;
  341. color: #333;
  342. padding: 15px 8px;
  343. }
  344. .title {
  345. color: #000;
  346. font-weight: bold;
  347. padding-bottom: 10px;
  348. font-size: 15px;
  349. text:last-child {
  350. font-size: 12px;
  351. color: rgba(51, 51, 51, 0.8);
  352. font-weight: 400;
  353. }
  354. }
  355. .scroll {
  356. min-height: 200px;
  357. overflow-y: auto;
  358. }
  359. .PopupSet {
  360. width: 100%;
  361. height: auto;
  362. background: #FFFFFF;
  363. border-radius: 6px;
  364. padding: 18rpx 16rpx;
  365. .setLeft {
  366. width: 35px;
  367. height: 30px;
  368. margin-right: 5px;
  369. margin-right: 20px;
  370. margin-top: 2px;
  371. image {
  372. width: 100%;
  373. height: 100%;
  374. }
  375. }
  376. .setRight {
  377. width: 100%;
  378. border-bottom: 1px solid #f2f2f2;
  379. padding-bottom: 10px;
  380. text {
  381. font-size: 12px;
  382. color: rgba(51, 51, 51, 0.6);
  383. }
  384. text:first-child {
  385. font-size: 15px;
  386. color: #333333;
  387. font-weight: bold;
  388. }
  389. }
  390. }
  391. }
  392. .withdraw {
  393. background-color: #ededed;
  394. position: absolute;
  395. width: 100%;
  396. height: 100%;
  397. box-sizing: border-box;
  398. }
  399. .withdraw-head {
  400. background-color: #F8FAFE;
  401. padding: 16px;
  402. border-top-left-radius: 10px;
  403. border-top-right-radius: 10px;
  404. font-size: 14px;
  405. .withdraw-head-to {
  406. font-size: 16px;
  407. font-weight: bold;
  408. color: #333333;
  409. }
  410. }
  411. .withdraw-head-way {
  412. display: flex;
  413. flex-direction: column;
  414. align-content: center;
  415. margin-left: 20px;
  416. }
  417. .withdraw-head-way-1 {
  418. color: #576b95;
  419. margin-bottom: 10px;
  420. }
  421. .withdraw-head-way-1 .way-icon {
  422. width: 16px;
  423. height: 16px;
  424. margin-right: 5px;
  425. top: 2px;
  426. }
  427. .withdraw-head-way-2 {
  428. color: #acacac;
  429. font-size: 12px;
  430. }
  431. .withdraw-body {
  432. background-color: #fff;
  433. padding: 12px 16px;
  434. font-size: 28upx;
  435. box-shadow: 0px 4px 10px 0px #DAE3F4;
  436. border-top-left-radius: 10px;
  437. border-top-right-radius: 10px;
  438. margin-top: -20px;
  439. height: calc(100vh - 170px);
  440. }
  441. .withdraw-body .input-money {
  442. display: flex;
  443. align-content: center;
  444. font-weight: 600;
  445. border-bottom: 0.5px solid #eaeef1;
  446. }
  447. .withdraw-body .input-money .rmb {
  448. font-size: 2.6em;
  449. position: relative;
  450. }
  451. .withdraw-body .input-money .t-input {
  452. height: 1.9em;
  453. font-size: 2.5em;
  454. border: none;
  455. position: relative;
  456. left: 3.5%;
  457. outline: none;
  458. }
  459. .withdraw-body .info-money {
  460. margin-top: 10px;
  461. font-size: 12px;
  462. margin-bottom: 20px;
  463. }
  464. .withdraw-body .info-money-num {
  465. color: rgba(51, 51, 51, 0.6);
  466. font-size: 13px;
  467. }
  468. .withdraw-body .info-money-all {
  469. color: #2D4D89;
  470. }
  471. .withdraw-body .tx button {
  472. color: #b2b2b2;
  473. font-size: 30upx;
  474. }
  475. .withdraw-body .tx-active button {
  476. font-size: 30upx;
  477. color: #fff;
  478. background: #1E85FE;
  479. }
  480. .withdraw .keyboard {
  481. height: 210px;
  482. width: 100%;
  483. position: fixed;
  484. bottom: 0;
  485. left: 0;
  486. width: 100%;
  487. background: #F7F7F7;
  488. z-index: 2;
  489. padding: 23rpx 16rpx 0rpx 16rpx;
  490. transition: all 0.2s ease-in 0.2s;
  491. }
  492. .Withdrawal {
  493. width: 100%;
  494. height: 141px;
  495. background: #0052FF;
  496. border-radius: 4px;
  497. text-align: center;
  498. line-height: 286rpx;
  499. color: #fff;
  500. font-size: 20px;
  501. font-weight: 500;
  502. margin-bottom: 8px;
  503. }
  504. .withdraw .keyboard-item {
  505. box-sizing: border-box;
  506. width: 32.33%;
  507. display: flex;
  508. flex-direction: column;
  509. justify-content: center;
  510. align-items: center;
  511. background: #ffffff;
  512. font-size: 40rpx;
  513. color: #333;
  514. height: 84rpx;
  515. border-top: none;
  516. border-left: none;
  517. border-radius: 4px;
  518. }
  519. .keyboard-item:active {
  520. background-color: #e6e5ea;
  521. }
  522. .withdraw .hide {
  523. opacity: 0;
  524. }
  525. .withdraw .delte {
  526. background: none;
  527. box-shadow: none;
  528. }
  529. .withdraw .delte image {
  530. width: 60rpx;
  531. height: 60rpx;
  532. }
  533. .withdraw .isIphone {
  534. padding-bottom: 68rpx !important;
  535. }
  536. .withdraw .fee em {
  537. font-size: 0.5rem;
  538. font-style: normal;
  539. }
  540. .popup-content .withdrawHeader {
  541. height: 100upx;
  542. background-color: #fff;
  543. color: #666666;
  544. font-size: 32upx;
  545. border-radius: 10upx;
  546. }
  547. .bankLogo {
  548. width: 25px;
  549. height: 25px;
  550. margin-right: 8px;
  551. }
  552. .bankName {
  553. text:first-child {
  554. margin-bottom: 10px;
  555. line-height: 1;
  556. font-weight: bold;
  557. font-size: 16px;
  558. }
  559. text:last-child {
  560. margin-bottom: 20px;
  561. font-size: 12px;
  562. color: #999;
  563. }
  564. }
  565. .popup-content .withdrawBody {
  566. height: 220upx;
  567. padding: 25upx;
  568. background-color: #F8F8F8;
  569. }
  570. .popup-content .withdrawBody view>text:nth-of-type(1) {
  571. font-size: 26upx;
  572. }
  573. .popup-content .withdrawBody view.margin-top-sm {
  574. margin-top: 10upx;
  575. }
  576. .popup-content .withdrawBody .text-red {
  577. color: #E54D42;
  578. }
  579. .popup-content .withdrawFooter {
  580. height: 120upx;
  581. }
  582. .popup-content .withdrawFooter view {
  583. width: 120upx;
  584. height: 70upx;
  585. margin: 0upx 30upx;
  586. border-radius: 10upx;
  587. padding: 0upx 15upx;
  588. }
  589. .popup-content .withdrawFooter view:nth-of-type(1) {
  590. background-color: #f0f0f0;
  591. }
  592. .popup-content .withdrawFooter view:nth-of-type(2) {
  593. background-color: #1E85FE;
  594. color: #FFFFFF;
  595. }
  596. </style>