withdraw.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <template>
  2. <view class="pay">
  3. <view class="pays">
  4. <view class="mm">
  5. <!-- <input type="text" v-model="form.openingBank" placeholder="请输入开户行" @focus="getLast"/>
  6. <input type="text" v-model="form.bankAccount" placeholder="请输入您要提现的银行卡号" /> -->
  7. <view class="title">
  8. 到账银行卡
  9. </view>
  10. <view class="select_bank" @click="isSelect = true">
  11. <view class="blank_logo">
  12. <image src="../../static/identify/rest.png" alt="" />
  13. </view>
  14. <view class="blank_num">
  15. {{blank}}<br />
  16. <text>注:仅支持整数,72小时内到账</text>
  17. </view>
  18. <view class="toggle">
  19. <image src="../../static/identify/more.png" alt="" />
  20. </view>
  21. </view>
  22. </view>
  23. <view class="money">
  24. <view class="withdraw">
  25. 提现金额
  26. </view>
  27. <view class="inp">
  28. <text>¥</text>
  29. <input ref="goldInput" type="number" v-model="form.dPrice" :maxlength="String(getAmount).length" @input="inputGold"/>
  30. </view>
  31. <view class="balance" v-if="getAmount>0">可提现金额为 {{getAmount}} 元 ,<text @click="allBalance">全部提现</text></view>
  32. <view class="balance" v-else>暂无可提现余额</view>
  33. <br />
  34. <!-- <view class="balance"> 订单收益七天后可提现</view> -->
  35. <!-- <view class="balance" >不可提现:{{dBalance - getAmount}} 元</text></view> -->
  36. </view>
  37. <view class="btn">
  38. <view class="paybtn" @click="submit">申请提现</view>
  39. </view>
  40. <view class="log" @click="history">
  41. 提现记录
  42. </view>
  43. </view>
  44. <view class="popup" @click="isSelect = false" v-if="isSelect">
  45. <view class="select_blank" @click.stop>
  46. <view class="popup_title">
  47. 选择提现银行卡<br />
  48. <text>请留意各银行到账时间</text>
  49. </view>
  50. <view class="popup_content">
  51. <view class="blannk_card">
  52. <view class="card_list">
  53. <view class="card" v-for="(item,index) in blankList" :key="index" @click="selectBlank(item)">
  54. <view class="card_left">
  55. <image :src="item.img" mode=""></image>
  56. </view>
  57. <view class="card_name">
  58. {{item.bankName}}({{item.bankCardNum.slice(-4)}})
  59. <text>72小时到账</text>
  60. </view>
  61. <view class="card_select">
  62. <image :src="item.bankLogo" mode="" v-if="item.check"></image>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="add_btn" @click="addBlank">
  67. <view class="add_left">
  68. <image src="../../static/other/add_blank.png" mode=""></image>
  69. 添加银行卡提现
  70. </view>
  71. <view class="add_right">
  72. <image src="../../static/identify/more.png" mode=""></image>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <!-- <view class="popup" v-if="isLast">
  80. <view class="histroy">
  81. <view class="title">
  82. 已有提交信息,是否继续使用
  83. </view>
  84. <view class="content">
  85. 开户行:{{openingBank}}
  86. </view>
  87. <view class="content">
  88. 银行卡号:{{bankAccount}}
  89. </view>
  90. <view class="btn_box">
  91. <view class="btn" @click="cancel">
  92. 取消
  93. </view>
  94. <view class="btn success" @click="use">
  95. 使用
  96. </view>
  97. </view>
  98. </view>
  99. </view> -->
  100. </view>
  101. </template>
  102. <script>
  103. import {
  104. pay,
  105. getInfo,
  106. withdraw,
  107. last,
  108. myBank
  109. } from '../../api/index.js'
  110. export default {
  111. data() {
  112. return {
  113. isSelect: false,
  114. placeholder: '转出金额',
  115. money: '',
  116. getAmount: '',
  117. dBalance: '',
  118. form: {
  119. cOpenId: uni.getStorageSync('wx_copenid'),
  120. dPrice: null,
  121. },
  122. isLast: false,
  123. bankAccount: '',
  124. openingBank: '',
  125. blank:'选择银行卡',
  126. blankList: []
  127. }
  128. },
  129. methods: {
  130. addBlank() {
  131. uni.navigateTo({
  132. url: './add_blank',
  133. })
  134. this.isSelect = false
  135. },
  136. history() {
  137. uni.navigateTo({
  138. url: '/pages/my/history'
  139. })
  140. },
  141. getLast() {
  142. let data = {}
  143. data.cOpenId = uni.getStorageSync('wx_copenid')
  144. last(data).then(res => {
  145. if (res.data.code == 200) {
  146. this.isLast = true
  147. this.openingBank = res.data.data.openingBank
  148. this.bankAccount = res.data.data.bankAccount
  149. } else {
  150. return
  151. }
  152. })
  153. },
  154. selectBlank(item) {
  155. this.blankList.forEach(i => {
  156. i.check = false;
  157. });
  158. item.check = true
  159. this.isSelect = false
  160. console.log(item)
  161. this.blank = item.bankName +'('+ '****' + ' '+item.bankCardNum.slice(-4)+')'
  162. this.form.bankId = item.bankId
  163. this.form.bankAccount = item.bankCardNum
  164. this.form.openingBank = item.openingBank
  165. },
  166. //实时更新剩余金豆
  167. inputGold(event) {
  168. if (this.form.dPrice > this.getAmount) {
  169. this.form.dPrice = this.getAmount
  170. this.$nextTick(() => {
  171. this.$refs.goldInput.value = this.getAmount;
  172. });
  173. }
  174. },
  175. cancel() {
  176. this.isLast = false
  177. },
  178. use() {
  179. this.isLast = false
  180. this.form.openingBank = this.openingBank
  181. this.form.bankAccount = this.bankAccount
  182. },
  183. allBalance() {
  184. this.form.dPrice = this.getAmount
  185. },
  186. getbank(){
  187. myBank().then(res => {
  188. console.log(res)
  189. this.blankList = res.data.data
  190. })
  191. },
  192. info() {
  193. getInfo().then(res => {
  194. this.getAmount = res.data.data.getAmount.toFixed(2)
  195. this.dBalance = res.data.data.dBalance.toFixed(2)
  196. })
  197. },
  198. submit() {
  199. this.form.cOpenId = uni.getStorageSync('wx_copenid')
  200. // if (this.form.openingBank == '') {
  201. // uni.showToast({
  202. // title: '请输入开户行',
  203. // icon: 'none'
  204. // })
  205. // return; // 格式不符合要求
  206. // }
  207. // var regex = /^[0-9]{13,19}$/;
  208. // if (!regex.test(this.form.bankCardNum)) {
  209. // uni.showToast({
  210. // title: '请输入正确的银行卡号',
  211. // icon: 'none'
  212. // })
  213. // return; // 格式不符合要求
  214. // }
  215. // if (this.form.dMoney <= 0) {
  216. // uni.showToast({
  217. // title: '请输入金额',
  218. // icon: 'none'
  219. // })
  220. // return
  221. // } else if (this.form.dMoney > this.dBalance) {
  222. // uni.showToast({
  223. // title: '输入金额超出账户余额',
  224. // icon: 'none'
  225. // })
  226. // return
  227. // } else {
  228. withdraw(this.form).then(res => {
  229. // console.log(res,"提现")
  230. if (res.data.code == 200) {
  231. uni.showToast({
  232. title: '已提交审核!',
  233. })
  234. setTimeout(() => {
  235. uni.navigateBack()
  236. }, 1000)
  237. } else {
  238. uni.showToast({
  239. title: res.data.msg,
  240. icon: 'none'
  241. })
  242. }
  243. })
  244. // }
  245. },
  246. },
  247. onLoad() {
  248. // this.getLast()
  249. },
  250. onShow() {
  251. this.info()
  252. this.getbank()
  253. }
  254. }
  255. </script>
  256. <style lang="scss" scoped>
  257. .pay {
  258. width: 100vw;
  259. height: 100vh;
  260. .pays {
  261. // padding: 80rpx 30rpx;
  262. .mm {
  263. width: 100%;
  264. height: 242rpx;
  265. background-color: #F8FAFE;
  266. padding: 40rpx;
  267. box-sizing: border-box;
  268. .title {
  269. font-weight: 700;
  270. font-size: 32rpx;
  271. color: #000000;
  272. line-height: 36rpx;
  273. margin-bottom: 34rpx;
  274. }
  275. .select_bank {
  276. width: 100%;
  277. display: flex;
  278. justify-content: space-between;
  279. .blank_logo {
  280. margin-right: 16rpx;
  281. image {
  282. width: 40rpx;
  283. height: 40rpx;
  284. }
  285. }
  286. .blank_num {
  287. flex: 1;
  288. font-size: 32rpx;
  289. color: #000000;
  290. line-height: 36rpx;
  291. text {
  292. font-size: 28rpx;
  293. color: #666666;
  294. line-height: 36rpx;
  295. display: inline-block;
  296. margin-top: 22rpx;
  297. }
  298. }
  299. .toggle {
  300. image {
  301. width: 32rpx;
  302. height: 32rpx;
  303. }
  304. }
  305. }
  306. }
  307. .log {
  308. width: 100%;
  309. text-align: center;
  310. margin-top: 30rpx;
  311. font-size: 24rpx;
  312. color: #21899e;
  313. }
  314. // input {
  315. // background-color: #f8f8f8;
  316. // padding: 20rpx;
  317. // text-align: center;
  318. // margin-bottom: 30rpx;
  319. // }
  320. .money {
  321. margin-top: 32rpx;
  322. padding: 0px 40rpx;
  323. .withdraw {
  324. font-size: 30rpx;
  325. color: #000000;
  326. line-height: 36rpx;
  327. }
  328. .inp {
  329. height: 90rpx;
  330. font-weight: 600;
  331. font-size: 52rpx;
  332. color: #333333;
  333. line-height: 61rpx;
  334. display: flex;
  335. align-items: center;
  336. border-bottom: 1px solid #E1E1E1;
  337. input {
  338. flex: 1;
  339. height: 100%;
  340. background-color: #fff;
  341. text-align: left;
  342. margin-left: 12rpx;
  343. font-size: 52rpx;
  344. }
  345. }
  346. .my {
  347. font-size: 24rpx;
  348. margin-bottom: 10rpx;
  349. }
  350. .balance {
  351. margin-top: 16rpx;
  352. font-size: 28rpx;
  353. color: #999999;
  354. line-height: 36rpx;
  355. text {
  356. color: #00B8B0;
  357. margin-left: 10rpx;
  358. }
  359. }
  360. }
  361. .btn {
  362. margin: 0 auto;
  363. width: 100%;
  364. margin-top: 632rpx;
  365. padding: 0px 40rpx;
  366. box-sizing: border-box;
  367. .paybtn {
  368. height: 76rpx;
  369. background: linear-gradient(90deg, #1AD7CE 0%, #21C9C1 100%);
  370. border-radius: 106rpx;
  371. text-align: center;
  372. color: #fff;
  373. line-height: 76rpx;
  374. }
  375. .log {
  376. font-size: 28rpx;
  377. color: #00B8B0;
  378. }
  379. }
  380. }
  381. .popup {
  382. width: 100%;
  383. height: 100%;
  384. position: fixed;
  385. top: 0;
  386. left: 0;
  387. background-color: rgba(0, 0, 0, 0.5);
  388. display: flex;
  389. align-items: end;
  390. .select_blank {
  391. width: 100%;
  392. height: 774rpx;
  393. background: #F3FFFE;
  394. border-radius: 32px 32px 0px 0px;
  395. display: flex;
  396. flex-direction: column;
  397. .popup_title {
  398. width: 100%;
  399. height: 148rpx;
  400. font-size: 34rpx;
  401. color: #000000;
  402. line-height: 36rpx;
  403. font-weight: 700;
  404. background-color: #fff;
  405. border-radius: 32px 32px 0px 0px;
  406. text-align: center;
  407. padding: 32rpx;
  408. box-sizing: border-box;
  409. text {
  410. display: inline-block;
  411. font-size: 28rpx;
  412. color: #666666;
  413. line-height: 36rpx;
  414. font-weight: 400;
  415. margin-top: 12rpx;
  416. }
  417. }
  418. .popup_content {
  419. flex: 1;
  420. .blannk_card {
  421. width: 670rpx;
  422. height: 450rpx;
  423. background: linear-gradient(35deg, #FFFFFF 0%, #E4FFFD 100%);
  424. box-shadow: 0px 4rpx 12rpx 0px rgba(88, 209, 187, 0.1);
  425. border-radius: 16rpx;
  426. border: 1px solid #D5F5F4;
  427. margin: 40rpx auto 0px;
  428. padding: 24rpx;
  429. display: flex;
  430. flex-direction: column;
  431. .card_list {
  432. flex: 1;
  433. overflow-y: auto;
  434. margin-bottom: 20rpx;
  435. .card {
  436. width: 100%;
  437. height: 100rpx;
  438. display: flex;
  439. align-items: center;
  440. justify-content: space-between;
  441. border-bottom: 1px solid #EEEEEE;
  442. margin-bottom: 20rpx;
  443. padding-bottom: 20rpx;
  444. box-sizing: border-box;
  445. .card_left {
  446. width: 40rpx;
  447. height: 100%;
  448. margin-right: -150rpx;
  449. image {
  450. width: 40rpx;
  451. height: 40rpx;
  452. }
  453. }
  454. .card_name {
  455. width: 402rpx;
  456. height: 100%;
  457. font-size: 30rpx;
  458. color: #333333;
  459. line-height: 35rpx;
  460. display: flex;
  461. flex-direction: column;
  462. justify-content: space-between;
  463. text {
  464. display: inline-block;
  465. margin-top: 4rpx;
  466. font-size: 24rpx;
  467. color: rgba(51, 51, 51, 0.6);
  468. line-height: 28rpx;
  469. }
  470. }
  471. .card_select {
  472. width: 48rpx;
  473. height: 48rpx;
  474. image {
  475. width: 48rpx;
  476. height: 48rpx;
  477. }
  478. }
  479. }
  480. }
  481. .add_btn {
  482. width: 100%;
  483. height: 42rpx;
  484. display: flex;
  485. align-items: center;
  486. justify-content: space-between;
  487. .add_left {
  488. display: flex;
  489. align-items: center;
  490. font-size: 30rpx;
  491. color: #333333;
  492. line-height: 35rpx;
  493. image {
  494. width: 40rpx;
  495. height: 40rpx;
  496. margin-right: 20rpx;
  497. }
  498. }
  499. .add_right {
  500. image {
  501. width: 32rpx;
  502. height: 32rpx;
  503. }
  504. }
  505. }
  506. }
  507. }
  508. }
  509. }
  510. }
  511. </style>