withdraw.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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 = this.amount;
  267. this.checkMoney();
  268. },
  269. //提现
  270. async handleShowModel() {
  271. let params = {
  272. actualFee: this.extract,
  273. bankNumber: this.bankCardInfo.bankNumber,
  274. bankAccount: this.bankCardInfo.bankAccount,
  275. bankAddress: this.bankCardInfo.bankAddress,
  276. realUserName: this.bankCardInfo.realUserName,
  277. }
  278. let res = await this.$http.post('/sysAgencyFeeApproval/add', params);
  279. if (res.code == '200') {
  280. uni.showToast({
  281. title: res.msg,
  282. icon: "none"
  283. });
  284. setTimeout(() => {
  285. return uni.navigateTo({
  286. url: "pages/my/my"
  287. })
  288. // return uni.navigateBack(1);
  289. }, 2000);
  290. }
  291. },
  292. //金额计算
  293. checkMoney() {
  294. this.is_out = false;
  295. this.is_lowest = false;
  296. this.is_post = true;
  297. if (!this.extract || parseFloat(this.extract) < parseFloat(this.lowest)) {
  298. this.is_lowest = true;
  299. this.is_post = false;
  300. } else if (parseFloat(this.extract) > parseFloat(this.amount)) {
  301. this.is_out = true;
  302. this.is_lowest = false;
  303. this.is_post = false;
  304. } else {
  305. this.is_out = false;
  306. this.is_lowest = false;
  307. this.is_post = true;
  308. }
  309. if (parseFloat(this.extract).toString() == 'NaN') {
  310. this.is_post = false;
  311. uni.showToast({
  312. title: '输入金额不合法',
  313. icon: "none"
  314. });
  315. }
  316. },
  317. StringSlice(val) {
  318. let data = val.slice(-4)
  319. return data
  320. },
  321. async getMoney() {
  322. this.closeWithdrawPopup();
  323. if (this.isRefuse) return;
  324. this.isRefuse = true;
  325. let res = await this.$http.post('/insPayApply/applyPay?amount=' + this.real_money + '&userid=' + this
  326. .userInfo.sysUser.id);
  327. uni.showToast({
  328. title: '提现申请已提交,等待管理员处理',
  329. icon: "none",
  330. duration: 2000
  331. });
  332. setTimeout(() => {
  333. uni.navigateBack();
  334. }, 2000);
  335. }
  336. },
  337. async onPullDownRefresh() {
  338. this.extract = '';
  339. await this.getPayAccount();
  340. this.loadData();
  341. this.is_out = false;
  342. this.is_lowest = false;
  343. this.is_post = false;
  344. setTimeout(function() {
  345. uni.stopPullDownRefresh();
  346. }, 500);
  347. }
  348. };
  349. </script>
  350. <style lang="scss" scoped>
  351. page {
  352. background-color: #F8FAFE;
  353. }
  354. /deep/ .uni-scroll-view-content {
  355. background-color: #F8FAFE;
  356. }
  357. .bankCardPopup {
  358. padding: 10px 16px;
  359. background-color: #F8FAFE;
  360. .bankAdd {
  361. background-color: #fff;
  362. font-size: 15px;
  363. width: 100%;
  364. color: #333;
  365. padding: 15px 8px;
  366. }
  367. .title {
  368. color: #000;
  369. font-weight: bold;
  370. padding-bottom: 10px;
  371. font-size: 15px;
  372. text:last-child {
  373. font-size: 12px;
  374. color: rgba(51, 51, 51, 0.8);
  375. font-weight: 400;
  376. }
  377. }
  378. .scroll {
  379. min-height: 200px;
  380. overflow-y: auto;
  381. }
  382. .PopupSet {
  383. width: 100%;
  384. height: auto;
  385. background: #FFFFFF;
  386. border-radius: 6px;
  387. padding: 18rpx 16rpx;
  388. .setLeft {
  389. width: 35px;
  390. height: 30px;
  391. margin-right: 5px;
  392. margin-right: 20px;
  393. margin-top: 2px;
  394. image {
  395. width: 100%;
  396. height: 100%;
  397. }
  398. }
  399. .setRight {
  400. width: 100%;
  401. border-bottom: 1px solid #f2f2f2;
  402. padding-bottom: 10px;
  403. text {
  404. font-size: 12px;
  405. color: rgba(51, 51, 51, 0.6);
  406. }
  407. text:first-child {
  408. font-size: 15px;
  409. color: #333333;
  410. font-weight: bold;
  411. }
  412. }
  413. }
  414. }
  415. .withdraw {
  416. background-color: #ededed;
  417. position: absolute;
  418. width: 100%;
  419. height: 100%;
  420. box-sizing: border-box;
  421. }
  422. .withdraw-head {
  423. background-color: #F8FAFE;
  424. padding: 16px;
  425. border-top-left-radius: 10px;
  426. border-top-right-radius: 10px;
  427. font-size: 14px;
  428. .withdraw-head-to {
  429. font-size: 16px;
  430. font-weight: bold;
  431. color: #333333;
  432. }
  433. }
  434. .withdraw-head-way {
  435. display: flex;
  436. flex-direction: column;
  437. align-content: center;
  438. margin-left: 20px;
  439. }
  440. .withdraw-head-way-1 {
  441. color: #576b95;
  442. margin-bottom: 10px;
  443. }
  444. .withdraw-head-way-1 .way-icon {
  445. width: 16px;
  446. height: 16px;
  447. margin-right: 5px;
  448. top: 2px;
  449. }
  450. .withdraw-head-way-2 {
  451. color: #acacac;
  452. font-size: 12px;
  453. }
  454. .withdraw-body {
  455. background-color: #fff;
  456. padding: 12px 16px;
  457. font-size: 28upx;
  458. box-shadow: 0px 4px 10px 0px #DAE3F4;
  459. border-top-left-radius: 10px;
  460. border-top-right-radius: 10px;
  461. margin-top: -20px;
  462. height: calc(100vh - 170px);
  463. }
  464. .withdraw-body .input-money {
  465. display: flex;
  466. align-content: center;
  467. font-weight: 600;
  468. border-bottom: 0.5px solid #eaeef1;
  469. }
  470. .withdraw-body .input-money .rmb {
  471. font-size: 2.6em;
  472. position: relative;
  473. }
  474. .withdraw-body .input-money .t-input {
  475. height: 1.9em;
  476. font-size: 2.5em;
  477. border: none;
  478. position: relative;
  479. left: 3.5%;
  480. outline: none;
  481. }
  482. .withdraw-body .info-money {
  483. margin-top: 10px;
  484. font-size: 12px;
  485. margin-bottom: 20px;
  486. }
  487. .withdraw-body .info-money-num {
  488. color: rgba(51, 51, 51, 0.6);
  489. font-size: 13px;
  490. }
  491. .withdraw-body .info-money-all {
  492. color: #2D4D89;
  493. }
  494. .withdraw-body .tx button {
  495. color: #b2b2b2;
  496. font-size: 30upx;
  497. }
  498. .withdraw-body .tx-active button {
  499. font-size: 30upx;
  500. color: #fff;
  501. background: #1E85FE;
  502. }
  503. .withdraw .keyboard {
  504. height: 210px;
  505. width: 100%;
  506. position: fixed;
  507. bottom: 0;
  508. left: 0;
  509. width: 100%;
  510. background: #F7F7F7;
  511. z-index: 2;
  512. padding: 23rpx 16rpx 0rpx 16rpx;
  513. transition: all 0.2s ease-in 0.2s;
  514. }
  515. .Withdrawal {
  516. width: 100%;
  517. height: 141px;
  518. background: #0052FF;
  519. border-radius: 4px;
  520. text-align: center;
  521. line-height: 286rpx;
  522. color: #fff;
  523. font-size: 20px;
  524. font-weight: 500;
  525. margin-bottom: 8px;
  526. }
  527. .withdraw .keyboard-item {
  528. box-sizing: border-box;
  529. width: 32.33%;
  530. display: flex;
  531. flex-direction: column;
  532. justify-content: center;
  533. align-items: center;
  534. background: #ffffff;
  535. font-size: 40rpx;
  536. color: #333;
  537. height: 84rpx;
  538. border-top: none;
  539. border-left: none;
  540. border-radius: 4px;
  541. }
  542. .keyboard-item:active {
  543. background-color: #e6e5ea;
  544. }
  545. .withdraw .hide {
  546. opacity: 0;
  547. }
  548. .withdraw .delte {
  549. background: none;
  550. box-shadow: none;
  551. }
  552. .withdraw .delte image {
  553. width: 60rpx;
  554. height: 60rpx;
  555. }
  556. .withdraw .isIphone {
  557. padding-bottom: 68rpx !important;
  558. }
  559. .withdraw .fee em {
  560. font-size: 0.5rem;
  561. font-style: normal;
  562. }
  563. .popup-content .withdrawHeader {
  564. height: 100upx;
  565. background-color: #fff;
  566. color: #666666;
  567. font-size: 32upx;
  568. border-radius: 10upx;
  569. }
  570. .bankLogo {
  571. width: 25px;
  572. height: 25px;
  573. margin-right: 8px;
  574. }
  575. .bankName {
  576. text:first-child {
  577. margin-bottom: 10px;
  578. line-height: 1;
  579. font-weight: bold;
  580. font-size: 16px;
  581. }
  582. text:last-child {
  583. margin-bottom: 20px;
  584. font-size: 12px;
  585. color: #999;
  586. }
  587. }
  588. .popup-content .withdrawBody {
  589. height: 220upx;
  590. padding: 25upx;
  591. background-color: #F8F8F8;
  592. }
  593. .popup-content .withdrawBody view>text:nth-of-type(1) {
  594. font-size: 26upx;
  595. }
  596. .popup-content .withdrawBody view.margin-top-sm {
  597. margin-top: 10upx;
  598. }
  599. .popup-content .withdrawBody .text-red {
  600. color: #E54D42;
  601. }
  602. .popup-content .withdrawFooter {
  603. height: 120upx;
  604. }
  605. .popup-content .withdrawFooter view {
  606. width: 120upx;
  607. height: 70upx;
  608. margin: 0upx 30upx;
  609. border-radius: 10upx;
  610. padding: 0upx 15upx;
  611. }
  612. .popup-content .withdrawFooter view:nth-of-type(1) {
  613. background-color: #f0f0f0;
  614. }
  615. .popup-content .withdrawFooter view:nth-of-type(2) {
  616. background-color: #1E85FE;
  617. color: #FFFFFF;
  618. }
  619. </style>