withdraw.vue 16 KB

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