withdraw.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <view class="main">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="canWithdrawCls">
  5. <view>
  6. <view>可提现服务积分:</view>
  7. <view class="canWithdrawCls_val"><text>{{walletInfo.commission_able}}</text></view>
  8. </view>
  9. <view class="u-mt20 markBox">
  10. <view class="u-mr30">待入账 <view><text></text>{{walletInfo.wait_account}}</view>
  11. </view>
  12. <view>冻结中 <view><text></text>{{walletInfo.freezing}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="withdrawCls">
  17. <view class="withdrawCls_lab">提现服务积分
  18. <!-- <text>(最低提现佣金1公益服务积分)</text> -->
  19. <text>(最低提现佣金{{walletInfo.min_extract}})</text>
  20. </view>
  21. <view class="withdrawCls_val">
  22. <!-- <text>¥</text> -->
  23. <input @input="getMoney" maxlength="10" type="digit" v-model="dataForm.public_service_points"
  24. placeholder-style="color:#CCCCCC" placeholder="提现服务积分" />
  25. </view>
  26. <view class="bg-fff">
  27. <view class="u-flex-center-sb u-1A1A1A" @click="openBankCard">
  28. <view class="u-flex">
  29. <text class="u-font30">提现方式</text>
  30. <view class="ml46 u-font28" v-if="bankCardList.length>0&&dataForm.payment_term== 2">
  31. <view>
  32. <image :src="bankIcon" class="img30"></image>
  33. <text class="u-ml20">{{dataForm.bank_name}}</text>
  34. </view>
  35. <view class="u-999 u-mt5 u-ml45 u-flex">
  36. 尾号
  37. <rich-text :nodes="$mUtil.cutOut(dataForm.withdraw_account)"></rich-text>
  38. 储蓄卡
  39. </view>
  40. </view>
  41. <view class="ml46 u-font28" v-if="bankCardList.length<=0&&dataForm.payment_term== 2">
  42. 添加银行卡
  43. </view>
  44. <view class="ml46 u-font28 sBox" v-if="dataForm.payment_term==1">
  45. <image :src="imgUrl+'/alipay.png'" class="img30"></image>
  46. 支付宝
  47. </view>
  48. <view class="ml46 u-font28 sBox" v-if="dataForm.payment_term==0">
  49. <image :src="imgUrl+'/weChat.png'" class="img30"></image>
  50. 微信
  51. </view>
  52. <view class="ml46 u-font28" v-if="dataForm.payment_term==4">
  53. 提现到公益积分
  54. </view>
  55. </view>
  56. <view class="iconfont u-font24 u-666"> &#xe6c7;</view>
  57. </view>
  58. <!--支付宝,微信-->
  59. <!-- <view class="zfb-wx" v-if="dataForm.payment_term != 2">
  60. <view class="u-flex-center-sb u-1A1A1A" @click="openBankCard">
  61. <view class="u-flex">
  62. <text class="u-font30 u-bold">提现方式</text>
  63. <view class="ml46 u-font28">
  64. <view v-if="dataForm.payment_term==1"><text class="iconfont u-font40 payIcon">&#xe627;</text> <text>支付宝</text></view>
  65. <view v-if="dataForm.payment_term==0"><text class="iconfont u-font40 wxIcon">&#xe606;</text> <text>微信</text></view>
  66. </view>
  67. </view>
  68. <view class="iconfont u-font24 u-666"> &#xe6c7;</view>
  69. </view>
  70. <view class="u-mt50 zhInput">
  71. <view class="u-flex-center">
  72. <view class="wt112">姓 名:</view>
  73. <input class="ml56" maxlength="16" @input="getName" :value="dataForm.payee" placeholder="请输入姓名" />
  74. </view>
  75. <view class="u-flex-center u-mt20">
  76. <view class="wt112">手机号:</view>
  77. <input class="ml56" maxlength="11" @input="getMobile" type="number" :value="dataForm.withdraw_mobile" placeholder="请输入手机号" />
  78. </view>
  79. <view class="u-flex-center u-mt20">
  80. <view class="wt112">{{dataForm.payment_term==1?'支付宝':'微信'}} :</view>
  81. <input class="ml56" maxlength="30" @input="getWithdrawAccount" :value="dataForm.withdraw_account" placeholder="请输入账号" />
  82. </view>
  83. </view>
  84. </view> -->
  85. </view>
  86. </view>
  87. <view class="btnBox">
  88. <view @click="requestWithdrawal">提交申请</view>
  89. </view>
  90. <uni-popup class="submit-popup" ref="submitPopup" type="center" :mask-click="false">
  91. <view class="content-box">
  92. <view class="title">提交完成</view>
  93. <view class="content">
  94. <image class="success-icon" src="/static/common/success-icon.png"></image>
  95. <view class="tip">
  96. </view>
  97. <button class="btn" @click="closePopup()">确 定</button>
  98. </view>
  99. </view>
  100. </uni-popup>
  101. <!-- <u-select v-model="show" :list="list" @confirm="getSel"></u-select> -->
  102. <!--弹窗选择银行卡-->
  103. <uniPopup type="bottom" ref="uniPopup">
  104. <view class="popup">
  105. <view class="bg-top">
  106. <text class="iconfont u-999" @click="close">&#xe612;</text>
  107. <text class="u-text-center ml200">选择优先付款方式</text>
  108. </view>
  109. <view class="bankCardList">
  110. <view v-for="(item,index) in bankCardList" :key="item.id">
  111. <!--index 下标,2 是类型自定义(下面支付宝,微信一样)-->
  112. <view class="item u-flex" @click="pitchOn(index,2)">
  113. <image :src="item.icon"></image>
  114. <view class="u-ml25 rh-br u-flex-sb">
  115. <view class="u-flex">
  116. <text>{{item.bank_name}}</text>
  117. (<rich-text :nodes="$mUtil.cutOut(item.card_num)"></rich-text>)
  118. </view>
  119. <text class="iconfont pull-right" v-if="pitchOnIndex==index">&#xe63e;</text>
  120. </view>
  121. </view>
  122. </view>
  123. <!--添加银行卡-->
  124. <view class="item u-flex" @click="goAddBankCard">
  125. <text class="iconfont">&#xe81a;</text>
  126. <view class="u-ml25 rh-br">
  127. <text>添加银行卡</text>
  128. </view>
  129. </view>
  130. <!--支付宝-->
  131. <view class="item u-flex" @click="pitchOn(-1,1)">
  132. <image :src="imgUrl+'/alipay.png'"></image>
  133. <view class="u-ml25 rh-br">
  134. <text>支付宝</text>
  135. <text class="iconfont pull-right" v-if="pitchOnIndex==-1">&#xe63e;</text>
  136. </view>
  137. </view>
  138. <view class="item u-flex" @click="pitchOn(-2,0)">
  139. <image :src="imgUrl+'/weChat.png'"></image>
  140. <view class="u-ml25 rh-br">
  141. <text>微信</text>
  142. <text class="iconfont pull-right" v-if="pitchOnIndex==-2">&#xe63e;</text>
  143. </view>
  144. </view>
  145. <view class="item u-flex" @click="pitchOn(-3,4)">
  146. <view class="u-ml25 rh-br">
  147. <text>提现到公益积分</text>
  148. <text class="iconfont pull-right" v-if="pitchOnIndex==-3">&#xe63e;</text>
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. </uniPopup>
  154. </view>
  155. </template>
  156. <script>
  157. export default {
  158. data() {
  159. return {
  160. config: {
  161. back: true,
  162. title: '提现',
  163. color: '#1A1A1A',
  164. backgroundColor: [1, "#ffffff"],
  165. statusBarFontColor: 'black',
  166. },
  167. value: "",
  168. show: false,
  169. dataForm: {
  170. public_service_points: '', //提现金额
  171. payment_term: 2, // * 收款方式: * 0微信, * 1支付宝, * 2银行线下 * 3现金支付
  172. payee: '', //收款人
  173. withdraw_account: '', //提现账户
  174. withdraw_mobile: '', //提现手机
  175. bank_name: '', //银行名称
  176. },
  177. bankIcon: '',
  178. pitchOnIndex: 0,
  179. addCard: true,
  180. walletInfo: {
  181. min_extract: 0,
  182. wait_account: 0,
  183. freezing: 0
  184. }, //账户信息
  185. imgUrl: this.$mConfig.staticUrl,
  186. bankCardList: [],
  187. }
  188. },
  189. onLoad() {
  190. let that = this
  191. //获取账户信息
  192. this.getAccountMsg()
  193. //获取银行卡列表
  194. this.getBankCardList()
  195. },
  196. methods: {
  197. //获取账户信息
  198. getAccountMsg() {
  199. this.$http.get('/withdraw/getWalletInfo', {}).then(async res => {
  200. if (res && res.code == 200) {
  201. if (res.data) {
  202. this.walletInfo = res.data
  203. }
  204. }
  205. })
  206. },
  207. //获取银行卡列表
  208. getBankCardList() {
  209. this.$http.get('/member/bankcard/bankCardList', {}).then(async res => {
  210. if (res && res.code == 200) {
  211. this.bankCardList = res.list
  212. //默认提方式为用户银行卡列表第一张银行卡
  213. if (res.list.length > 0) {
  214. this.dataForm.bank_name = res.list[0].bank_name
  215. this.dataForm.withdraw_account = res.list[0].card_num
  216. this.bankIcon = res.list[0].icon
  217. this.dataForm.payee = res.list[0].name
  218. this.dataForm.withdraw_mobile = res.list[0].mobile
  219. this.dataForm.user_bank_id = this.bankCardList[0].id
  220. }
  221. }
  222. })
  223. },
  224. //打开弹窗银行卡列表
  225. openBankCard() {
  226. this.$refs.uniPopup.open();
  227. // console.log(this.pitchOnIndex)
  228. },
  229. //关闭弹窗
  230. close() {
  231. this.$refs.uniPopup.close();
  232. },
  233. //选择提现方式
  234. pitchOn(index, type) {
  235. this.pitchOnIndex = index
  236. this.dataForm.payment_term = type
  237. if (type == 2) {
  238. this.dataForm.bank_name = this.bankCardList[index].bank_name
  239. this.dataForm.withdraw_account = this.bankCardList[index].card_num
  240. this.bankIcon = this.bankCardList[index].icon
  241. this.dataForm.user_bank_id = this.bankCardList[index].id
  242. } else {
  243. this.dataForm.user_bank_id = null
  244. }
  245. this.$refs.uniPopup.close();
  246. },
  247. //跳转提现明细
  248. goWdDetail() {
  249. uni.navigateTo({
  250. url: "wdDetail"
  251. })
  252. },
  253. //跳到添加银行卡
  254. goAddBankCard() {
  255. uni.navigateTo({
  256. url: "/pages/user/bankCard/addBankCard"
  257. })
  258. },
  259. //跳转到钱包明细
  260. goWallet() {
  261. uni.navigateTo({
  262. url: "./wallet"
  263. })
  264. },
  265. //获取输入提现金额
  266. getMoney(e) {
  267. e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
  268. //重新赋值给input
  269. this.$nextTick(() => {
  270. this.dataForm.public_service_points = e.target.value ?e.target.value*1:''
  271. })
  272. },
  273. //获取提现人姓名
  274. // getName(e) {
  275. // // console.log(e.target.value)
  276. // this.dataForm.payee = e.target.value
  277. // },
  278. // getMobile(e){
  279. // this.dataForm.withdraw_mobile = e.target.value
  280. // },
  281. //获取提现人账号
  282. // getWithdrawAccount(e) {
  283. // this.dataForm.withdraw_account = e.target.value
  284. // },
  285. //申请提现
  286. requestWithdrawal() {
  287. if (!this.dataForm.public_service_points) {
  288. this.$mUtil.toast('请输入提现服务积分')
  289. return false
  290. }
  291. if (this.dataForm.public_service_points < this.walletInfo.min_extract) {
  292. this.$mUtil.toast('提现金额超出您的最低提现服务积分')
  293. return false
  294. }
  295. if (this.dataForm.payment_term === '') {
  296. this.$mUtil.toast('请选择提现方式')
  297. return false
  298. }
  299. if (this.dataForm.payment_term == 2) {
  300. if (!this.dataForm.bank_name) {
  301. this.$mUtil.toast('请先添加银行卡')
  302. return false
  303. }
  304. }
  305. // if (this.dataForm.payment_term == 0 || this.dataForm.payment_term == 1) {
  306. // if (!this.dataForm.payee) {
  307. // this.$mUtil.toast('请输入姓名')
  308. // return false
  309. // }
  310. // if(!this.dataForm.withdraw_mobile.match(this.$mConfig.telRegex)){
  311. // this.$mUtil.toast('请输入正确手机号')
  312. // return false
  313. // }
  314. // if (!this.dataForm.withdraw_account) {
  315. // this.$mUtil.toast('请输入账户')
  316. // return false
  317. // }
  318. // }
  319. //
  320. this.$http.post('/withdraw/memberWithdraw', this.dataForm).then(async res => {
  321. if (res && res.code == 200) {
  322. this.$mUtil.toast('申请成功')
  323. setTimeout(() => {
  324. uni.navigateBack({
  325. success: () => {
  326. let page = getCurrentPages().pop(); //跳转页面成功之后
  327. if (!page) {
  328. return;
  329. } else {
  330. page.onLoad(page.options); // page自带options对象.
  331. }
  332. }
  333. })
  334. }, 2000)
  335. } else {
  336. this.$mUtil.toast(res.msg)
  337. }
  338. })
  339. }
  340. }
  341. }
  342. </script>
  343. <style lang="scss" scoped>
  344. .canWithdrawCls {
  345. font-size: 28rpx;
  346. color: #1A1A1A;
  347. padding: 60rpx;
  348. border-bottom: 8rpx solid #F5F5F5;
  349. .markBox {
  350. text {
  351. display: inline-block;
  352. width: 10rpx;
  353. }
  354. }
  355. >view {
  356. display: flex;
  357. .canWithdrawCls_val {
  358. font-size: 24rpx;
  359. align-items: baseline;
  360. text {
  361. font-size: 36rpx;
  362. color: #FF0000;
  363. }
  364. }
  365. >view {
  366. display: flex;
  367. text {
  368. font-size: 24rpx;
  369. color: #808080;
  370. }
  371. >view {
  372. color: #808080;
  373. }
  374. }
  375. }
  376. }
  377. .withdrawCls {
  378. padding: 40rpx 60rpx;
  379. .withdrawCls_lab {
  380. font-size: 28rpx;
  381. color: #1A1A1A;
  382. text {
  383. color: #808080;
  384. }
  385. }
  386. .withdrawCls_val {
  387. display: flex;
  388. align-items: center;
  389. font-size: 60rpx;
  390. padding: 30rpx 0;
  391. border-bottom: 3rpx dashed #808080;
  392. text {
  393. color: #181818;
  394. }
  395. input {
  396. margin-left: 10rpx;
  397. font-size: 42rpx;
  398. }
  399. }
  400. .withdrawTypeCls {
  401. display: flex;
  402. justify-content: space-between;
  403. margin-top: 40rpx;
  404. .withdrawTypeCls_lab {
  405. font-size: 30rpx;
  406. color: #1A1A1A;
  407. }
  408. .withdrawTypeCls_val {
  409. font-size: 28rpx;
  410. color: #999999;
  411. .selLab {
  412. color: #1A1A1A;
  413. }
  414. }
  415. .withdrawTypeCls_dir {
  416. color: #808080;
  417. }
  418. }
  419. }
  420. .btnBox {
  421. position: fixed;
  422. bottom: 0;
  423. left: 0;
  424. width: 100%;
  425. background: #FFFFFF;
  426. padding: 30rpx 30rpx 60rpx 30rpx;
  427. >view {
  428. display: flex;
  429. justify-content: center;
  430. align-items: center;
  431. font-size: 32rpx;
  432. color: #FFFFFF;
  433. padding: 20rpx 0;
  434. background: #0B844A;
  435. border-radius: 40rpx;
  436. }
  437. }
  438. .content-box {
  439. width: 440rpx;
  440. padding-bottom: 50rpx;
  441. }
  442. .bg-fff {
  443. background-color: #FFFFFF;
  444. padding: 26rpx 0rpx 36rpx;
  445. border-radius: 0rpx 0rpx 18px 18rpx;
  446. }
  447. .ml46 {
  448. margin-left: 46rpx;
  449. }
  450. .apply-btn {
  451. margin-top: 80rpx;
  452. button {
  453. background: #0B844A;
  454. color: #FFFFFF;
  455. }
  456. }
  457. .zfb-wx {
  458. padding-bottom: 24rpx;
  459. .payIcon {
  460. color: #00aaef;
  461. font-size: 32rpx;
  462. margin-right: 18rpx;
  463. }
  464. .wxIcon {
  465. color: rgb(37, 171, 56);
  466. font-size: 32rpx;
  467. margin-right: 18rpx;
  468. }
  469. }
  470. .zhInput input {
  471. width: 62%;
  472. height: 70rpx;
  473. line-height: 70rpx;
  474. padding: 0rpx 20rpx;
  475. border: 1rpx solid #D9D9D9;
  476. border-radius: 6rpx;
  477. }
  478. .popup {
  479. width: 100%;
  480. .bg-top {
  481. background-color: #F5F5F5;
  482. padding: 20rpx 30rpx;
  483. border-radius: 18rpx 18rpx 0px 0px;
  484. }
  485. .bankCardList {
  486. background-color: #FFFFFF;
  487. padding: 0rpx 30rpx;
  488. padding-bottom: 185rpx;
  489. .item {
  490. height: 84rpx;
  491. line-height: 84rpx;
  492. image {
  493. width: 48rpx;
  494. height: 42rpx;
  495. // margin-top: 20rpx;
  496. vertical-align: bottom;
  497. }
  498. .rh-br {
  499. width: 100%;
  500. border-bottom: 1rpx solid #E6E6E6;
  501. }
  502. .pull-right {
  503. float: right !important;
  504. }
  505. }
  506. }
  507. }
  508. .ml56 {
  509. margin-left: 56rpx;
  510. }
  511. .ml200 {
  512. margin-left: 200rpx;
  513. }
  514. .wt112 {
  515. width: 140rpx;
  516. }
  517. .img30 {
  518. width: 30rpx;
  519. height: 30rpx;
  520. }
  521. .wd-bgImg {
  522. position: relative;
  523. padding: 25rpx 0rpx;
  524. image {
  525. width: 100%;
  526. height: 200rpx;
  527. vertical-align: bottom;
  528. }
  529. .moneyInfo {
  530. position: absolute;
  531. top: 25rpx;
  532. width: 92%;
  533. .mt40 {
  534. margin-top: 40rpx;
  535. }
  536. .detail-btn button {
  537. height: 56rpx;
  538. line-height: 30rpx;
  539. border-radius: 28px;
  540. opacity: 0.82;
  541. padding: 10rpx 30rpx;
  542. background-color: #EED9A9;
  543. color: #0B844A;
  544. }
  545. }
  546. }
  547. .wdInput {
  548. background-color: #FFFFFF;
  549. border-radius: 18rpx 18rpx 0px 0rpx;
  550. padding: 40rpx 22rpx 32rpx;
  551. .input {
  552. height: 80rpx;
  553. line-height: 80rpx;
  554. font-size: 60rpx;
  555. border-bottom: 1rpx solid #D9D9D9;
  556. padding-bottom: 25rpx;
  557. input {
  558. height: 80rpx;
  559. line-height: 80rpx;
  560. font-size: 36rpx;
  561. }
  562. }
  563. }
  564. .u-flex-sb {
  565. display: flex;
  566. justify-content: space-between;
  567. }
  568. .sBox {
  569. display: flex;
  570. align-items: center;
  571. >image {
  572. margin-right: 10rpx;
  573. }
  574. }
  575. </style>