withdraw.vue 16 KB

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