withdraw.vue 16 KB

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