index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <view :style="viewColor">
  3. <view class='cash-withdrawal' :hidden='!loading'>
  4. <view class='nav acea-row row-between-wrapper'>
  5. <view class='name'>提现至</view>
  6. <view class='input'>
  7. <view class="more-content" @click="goPay(currentTab)">
  8. <view class="more-content-left">
  9. <view class="type-icon" :style="[{backgroundColor: handlePayColor()}]">
  10. <view class="iconfont bankicon" :class="navList[currentTab]['icon']"></view>
  11. </view>
  12. <text>{{navList[currentTab]["name"]}}</text>
  13. </view>
  14. <view class="moreicon">
  15. <view class='iconfont icon-jiantou'></view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class='wrapper'>
  21. <view :hidden='currentTab != 0' class='list'>
  22. <form @submit="subCash" report-submit='true'>
  23. <view class='item acea-row row-between-wrapper'>
  24. <view class='name'>持卡人</view>
  25. <view class='input'><input placeholder='请输入持卡人姓名' placeholder-class='placeholder' name="real_name" v-model="real_name"></input></view>
  26. </view>
  27. <view class='item acea-row row-between-wrapper'>
  28. <view class='name'>卡号</view>
  29. <view class='input'><input type='number' placeholder='请填写卡号' placeholder-class='placeholder' name="bank_code" v-model="bank_code"></input></view>
  30. </view>
  31. <view class='item acea-row row-between-wrapper' v-if="array.length>0">
  32. <view class='name'>银行</view>
  33. <view class='input'>
  34. <picker @change="bindPickerChange" :value="index" :range="array" range-key="name">
  35. <text class='Bank'>{{array[index]["name"]}}</text>
  36. <text class='iconfont icon-qiepian38'></text>
  37. </picker>
  38. </view>
  39. </view>
  40. <view class='item acea-row row-between-wrapper'>
  41. <view class='name'>支行信息</view>
  42. <view class='input'><input placeholder='请输入支行信息' placeholder-class='placeholder' name="bank_address" v-model="bank_address"></input></view>
  43. </view>
  44. <view class='item acea-row row-between-wrapper'>
  45. <view class='name'>提现</view>
  46. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="extract_price"
  47. type='digit' v-model="extract_price"></input></view>
  48. </view>
  49. <view class='tip mt25'>
  50. 当前可提现金额: <text class="price">¥{{userInfo.brokerage_price}},</text>冻结佣金:¥{{userInfo.lock_brokerage}}
  51. </view>
  52. <view class='tip'>
  53. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  54. </view>
  55. <view class="btn-submit">
  56. <button formType="submit" :disabled="load" class='bnt b-color' :class="load ? 'disabled' : ''" >提现</button>
  57. </view>
  58. </form>
  59. </view>
  60. <view :hidden='currentTab != 1' class='list'>
  61. <form @submit="subCash" report-submit='true'>
  62. <view v-if="!sys_extension_type" class="">
  63. <view class='item acea-row row-between-wrapper'>
  64. <view class='name'>账号</view>
  65. <view class='input'><input placeholder='请填写您的微信账号' placeholder-class='placeholder' name="wechat"></input></view>
  66. </view>
  67. <view class='item acea-row row-between-wrapper'>
  68. <view class='name'>提现</view>
  69. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="extract_price"
  70. type='digit' v-model="extract_price"></input></view>
  71. </view>
  72. <view class='item acea-row row-between-wrapper uploadItem'>
  73. <view class='name'>收款码</view>
  74. <view class='input upload acea-row row-middle'>
  75. <view class='picture' v-for="(item,index) in pics" :key="index">
  76. <image :src='item'></image>
  77. <text class='iconfont icon-guanbi1' @click='DelPic(index)'></text>
  78. </view>
  79. <view class='picture acea-row row-center-wrapper row-column' @click='uploadpic' v-if="pics.length < 1">
  80. <text class='iconfont icon-icon25201'></text>
  81. <view>上传图片</view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class='tip mt25'>
  86. 当前可提现金额: <text class="price">¥{{userInfo.brokerage_price}},</text>冻结佣金:¥{{userInfo.lock_brokerage}}
  87. </view>
  88. <view class='tip'>
  89. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  90. </view>
  91. <button formType="submit" :disabled="load" class='bnt b-color' :class="load ? 'disabled' : ''" >提现</button>
  92. </view>
  93. <view v-else class="auto_arrival">
  94. <view class='tip'>当前可提现金额: <text class="price">¥{{userInfo.brokerage_price}}</text>
  95. </view>
  96. <view class='input'><input placeholder-class='placeholder1' name="extract_price"
  97. type='digit' :placeholder="placeholderValue" @focus="placeholderValue = ''" v-model="extract_price"></input>
  98. </view>
  99. <view class="btn-submit">
  100. <button formType="submit" :disabled="load" class='bnt b-color' :class="load ? 'disabled' : ''" >提现</button>
  101. </view>
  102. </view>
  103. </form>
  104. </view>
  105. <view :hidden='currentTab != 2' class='list'>
  106. <form @submit="subCash" report-submit='true'>
  107. <view class='item acea-row row-between-wrapper'>
  108. <view class='name'>账号</view>
  109. <view class='input'><input placeholder='请填写您的支付宝账号' placeholder-class='placeholder' name="alipay_code"></input></view>
  110. </view>
  111. <view class='item acea-row row-between-wrapper'>
  112. <view class='name'>提现</view>
  113. <view class='input'><input :placeholder='"最低提现金额"+minPrice' placeholder-class='placeholder' name="extract_price"
  114. type='digit' v-model="extract_price"></input></view>
  115. </view>
  116. <view class='item acea-row row-between-wrapper uploadItem'>
  117. <view class='name'>收款码</view>
  118. <view class='input upload acea-row row-middle'>
  119. <view class='picture' v-for="(item,index) in pics" :key="index">
  120. <image :src='item'></image>
  121. <text class='iconfont icon-guanbi1' @click='DelPic(index)'></text>
  122. </view>
  123. <view class='picture acea-row row-center-wrapper row-column' @click='uploadpic' v-if="pics.length < 1">
  124. <text class='iconfont icon-icon25201'></text>
  125. <view>上传图片</view>
  126. </view>
  127. </view>
  128. </view>
  129. <view class='tip mb25'>
  130. 当前可提现金额: <text class="price">¥{{userInfo.brokerage_price}},</text>冻结佣金:¥{{userInfo.lock_brokerage}}
  131. </view>
  132. <view class='tip' v-if="userInfo.broken_day>0">
  133. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  134. </view>
  135. <view class="btn-submit">
  136. <button formType="submit" :disabled="load" class='bnt b-color' :class="load ? 'disabled' : ''" >提现</button>
  137. </view>
  138. </form>
  139. </view>
  140. </view>
  141. </view>
  142. <cash :payMode='pay_type' :pay_close="pay_close" @payClose="payClose" @onChangeFun="onChangeFun" :order_id="currentTab"></cash>
  143. </view>
  144. </template>
  145. <script>
  146. // +----------------------------------------------------------------------
  147. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  148. // +----------------------------------------------------------------------
  149. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  150. // +----------------------------------------------------------------------
  151. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  152. // +----------------------------------------------------------------------
  153. // | Author: CRMEB Team <admin@crmeb.com>
  154. // +----------------------------------------------------------------------
  155. import {
  156. extractCash,
  157. extractBank,
  158. getUserInfo,
  159. spreadInfo,
  160. getBankInfo
  161. } from '@/api/user.js';
  162. import { mapGetters } from "vuex";
  163. import cash from '@/components/cash';
  164. import { configMap } from '@/utils';
  165. import { toLogin } from '@/libs/login.js';
  166. export default {
  167. components: {
  168. cash,
  169. },
  170. data() {
  171. return {
  172. navList: [{
  173. 'id': '0',
  174. 'ids': 1,
  175. 'name': '银行卡',
  176. 'icon': 'icon-yinhangqia',
  177. 'bg_color': '#FE960F'
  178. },
  179. {
  180. 'id': '1',
  181. 'ids': 2,
  182. 'name': '微信',
  183. 'icon': 'icon-weixin2',
  184. 'bg_color': '#41B035'
  185. },
  186. {
  187. 'id': '2',
  188. 'ids': 3,
  189. 'name': '支付宝',
  190. 'icon': 'icon-icon34',
  191. 'bg_color': '#00A9F2'
  192. }
  193. ],
  194. currentTab: '0',
  195. extract_price: '',
  196. index: 0,
  197. array: [], //提现银行
  198. minPrice: 0.00, //最低提现金额
  199. userInfo: [],
  200. isClone: false,
  201. loading: true,
  202. load: false,
  203. pics: [], //收款码
  204. extract_pic: '',
  205. placeholderValue: '0.00',
  206. payColor: '',
  207. pay_close: false,
  208. real_name: '',
  209. bank_address: '',
  210. bank_code: '',
  211. pay_type: []
  212. };
  213. },
  214. computed: {
  215. ...mapGetters(['isLogin','viewColor']),
  216. ... configMap(['sys_extension_type', 'withdraw_type'])
  217. },
  218. watch: {
  219. withdraw_type: {
  220. handler(){
  221. this.loadType()
  222. },
  223. immediate: true
  224. }
  225. },
  226. onLoad() {
  227. if (this.isLogin) {
  228. this.getUserInfo();
  229. this.getUserExtractBank();
  230. this.getBankInfo();
  231. } else {
  232. toLogin()
  233. }
  234. },
  235. methods: {
  236. loadType(){
  237. this.pay_type = []
  238. let withdrawType = this.withdraw_type
  239. if (withdrawType.length > 0) {
  240. this.navList.map((value, index) => {
  241. withdrawType.map(val => {
  242. if (value.ids == val) {
  243. this.pay_type.push(value)
  244. }
  245. })
  246. })
  247. }
  248. this.currentTab = this.pay_type[0].id
  249. },
  250. /*获取之前提交过的银行卡信息*/
  251. getBankInfo(){
  252. let that = this;
  253. getBankInfo().then(res => {
  254. let info = res.data;
  255. console.log(info)
  256. that.real_name = info.real_name;
  257. that.bank_name = info.bank_name;
  258. that.bank_code = info.bank_code;
  259. that.bank_address = info.bank_address;
  260. });
  261. },
  262. getUserExtractBank: function() {
  263. let that = this;
  264. extractBank().then(res => {
  265. let array = res.data;
  266. that.$set(that, 'array', array);
  267. });
  268. },
  269. /**
  270. * 获取个人用户信息
  271. */
  272. getUserInfo: function() {
  273. let that = this;
  274. spreadInfo().then(res => {
  275. that.userInfo = res.data;
  276. that.minPrice = res.data.user_extract_min;
  277. });
  278. },
  279. swichNav: function(current) {
  280. this.currentTab = current;
  281. this.load = false;
  282. },
  283. bindPickerChange: function(e) {
  284. this.index = e.detail.value;
  285. },
  286. handlePayColor: function() {
  287. let str = ''
  288. if (this.currentTab == 1) {
  289. str = '#41B035'
  290. } else if (this.currentTab == 2) {
  291. str = '#00A9F2'
  292. } else {
  293. str = '#FE960F '
  294. }
  295. return str
  296. },
  297. uploadpic: function() {
  298. let that = this;
  299. that.$util.uploadImageOne('upload/image', function(res) {
  300. that.pics.push(res.data.path);
  301. that.$set(that, 'pics', that.pics);
  302. that.$set(that, 'extract_pic', that.pics[0])
  303. });
  304. },
  305. /**
  306. * 删除图片
  307. *
  308. */
  309. DelPic: function(index) {
  310. let that = this,
  311. pic = this.pics[index];
  312. that.pics.splice(index, 1);
  313. that.$set(that, 'pics', that.pics);
  314. },
  315. subCash: function(e) {
  316. let that = this,
  317. value = e.detail.value;
  318. if(that.load) return;
  319. if (that.currentTab == 0) { //银行卡
  320. if (value.real_name.length == 0) return this.$util.Tips({
  321. title: '请填写持卡人姓名'
  322. });
  323. if (value.bank_code.length == 0) return this.$util.Tips({
  324. title: '请填写卡号'
  325. });
  326. value.extract_type = 'bank';
  327. value.bank_name = (that.array && that.array.length) ? that.array[that.index].name : '';
  328. } else if (that.currentTab == 1) { //微信
  329. value.extract_type = 'weixin';
  330. if(!this.sys_extension_type){
  331. value.extract_pic = that.extract_pic
  332. if (value.wechat.length == 0) return this.$util.Tips({
  333. title: '请填写微信号'
  334. });
  335. if (value.extract_pic.length == 0) return this.$util.Tips({
  336. title: '请上传收款码'
  337. });
  338. }
  339. } else if (that.currentTab == 2) { //支付宝
  340. value.extract_type = 'alipay';
  341. value.extract_pic = that.extract_pic
  342. if (value.alipay_code.length == 0) return this.$util.Tips({
  343. title: '请填写账号'
  344. });
  345. if (value.extract_pic.length == 0) return this.$util.Tips({
  346. title: '请上传收款码'
  347. });
  348. }
  349. if (value.extract_price.length == 0) return this.$util.Tips({
  350. title: '请填写提现金额'
  351. });
  352. if (Number(value.extract_price) < that.minPrice) return this.$util.Tips({
  353. title: '提现金额不能低于' + that.minPrice
  354. });
  355. value.extract_type = this.currentTab
  356. that.load = true;
  357. if(that.sys_extension_type && that.currentTab == 1)
  358. value = {extract_price: e.detail.value.extract_price, extract_type: 3}
  359. extractCash(value).then(res => {
  360. that.getUserInfo();
  361. that.load = false;
  362. that.$util.Tips({
  363. title: res.message,
  364. icon: 'success'
  365. });
  366. setTimeout(function(){
  367. uni.navigateTo({
  368. url: '/pages/users/user_spread_user/index'
  369. });
  370. },1000)
  371. }).catch(err => {
  372. that.load = false;
  373. return that.$util.Tips({
  374. title: err
  375. });
  376. });
  377. },
  378. /**
  379. * 打开支付组件
  380. *
  381. */
  382. goPay: function(pay_price) {
  383. this.$set(this, 'pay_close', true);
  384. },
  385. /**
  386. * 关闭支付组件
  387. *
  388. */
  389. payClose: function() {
  390. this.pay_close = false;
  391. },
  392. onChangeFun: function(e) {
  393. let opt = e;
  394. let action = opt.action || null;
  395. let value = opt.value != undefined ? opt.value : null;
  396. (action && this[action]) && this[action](value);
  397. this.currentTab = opt.type
  398. },
  399. }
  400. }
  401. </script>
  402. <style lang="scss" scoped>
  403. page {
  404. background-color: #F5F5F5 !important;
  405. }
  406. .mt25{
  407. margin-top: 25rpx;
  408. }
  409. .cash-withdrawal .nav {
  410. height: 130rpx;
  411. padding: 0 30rpx;
  412. font-size: 30rpx;
  413. margin-bottom: 20rpx;
  414. background-color: #fff;
  415. }
  416. .b-color{background-color: var(--view-theme);}
  417. .cash-withdrawal .nav .input {
  418. width: 505rpx;
  419. .more-content{
  420. display: flex;
  421. align-items: center;
  422. .more-content-left{
  423. width: 90%;
  424. .type-icon{
  425. display: inline-block;
  426. width: 56rpx;
  427. height: 56rpx;
  428. text-align: center;
  429. line-height: 56rpx;
  430. background-color: #FE960F;
  431. margin-right: 20rpx;
  432. border-radius: 50%;
  433. .bankicon{
  434. font-size: 36rpx;
  435. color: #FFFFFF;
  436. }
  437. }
  438. }
  439. .moreicon{
  440. width: 10%;
  441. text-align: right;
  442. }
  443. }
  444. }
  445. .cash-withdrawal .nav .item {
  446. font-size: 26rpx;
  447. flex: 1;
  448. text-align: center;
  449. }
  450. .cash-withdrawal .nav .item~.item {
  451. border-left: 1px solid #f0f0f0;
  452. }
  453. .cash-withdrawal .nav .item .iconfont {
  454. width: 40rpx;
  455. height: 40rpx;
  456. border-radius: 50%;
  457. border: 2rpx solid #e93323;
  458. text-align: center;
  459. line-height: 37rpx;
  460. margin: 0 auto 6rpx auto;
  461. font-size: 22rpx;
  462. box-sizing: border-box;
  463. }
  464. .cash-withdrawal .nav .item .iconfont.on {
  465. background-color: #e93323;
  466. color: #fff;
  467. border-color: #e93323;
  468. }
  469. .cash-withdrawal .nav .item .line {
  470. width: 2rpx;
  471. height: 20rpx;
  472. margin: 0 auto;
  473. transition: height 0.3s;
  474. }
  475. .cash-withdrawal .nav .item .line.on {
  476. height: 39rpx;
  477. }
  478. .cash-withdrawal .wrapper .list {
  479. padding: 0 30rpx;
  480. background-color: #fff;
  481. }
  482. .cash-withdrawal .wrapper .list .item {
  483. border-bottom: 1px solid #eee;
  484. height: 107rpx;
  485. font-size: 30rpx;
  486. color: #333;
  487. &.uploadItem {
  488. border-bottom: none;
  489. height: auto;
  490. .name {
  491. height: 107rpx;
  492. }
  493. }
  494. }
  495. .picture {
  496. width: 70px;
  497. height: 70px;
  498. margin: 0 0 17px 0;
  499. position: relative;
  500. font-size: 11px;
  501. color: #bbb;
  502. border: 0.5px solid #ddd;
  503. box-sizing: border-box;
  504. margin-top: 40rpx;
  505. uni-image,image {
  506. width: 100%;
  507. height: 100%;
  508. border-radius: 1px;
  509. }
  510. .icon-guanbi1 {
  511. font-size: 22px;
  512. position: absolute;
  513. top: -10px;
  514. right: -10px;
  515. color: #fc4141;
  516. }
  517. }
  518. .cash-withdrawal .wrapper .list .item .name {
  519. width: 130rpx;
  520. }
  521. .cash-withdrawal .wrapper .list .item .input {
  522. width: 505rpx;
  523. }
  524. .cash-withdrawal .wrapper .list .item .input .placeholder {
  525. color: #bbb;
  526. }
  527. .cash-withdrawal .placeholder1 {
  528. font-size: 46rpx;
  529. }
  530. .cash-withdrawal .wrapper .list .tip {
  531. font-size: 26rpx;
  532. color: #999;
  533. margin-bottom: 25rpx;
  534. }
  535. .cash-withdrawal .wrapper .list .btn-submit{
  536. background-color: #F5F5F5;
  537. margin: 0 -30rpx;
  538. padding: 64rpx 30rpx;
  539. }
  540. .cash-withdrawal .wrapper .list .bnt {
  541. font-size: 32rpx;
  542. color: #fff;
  543. width: 690rpx;
  544. height: 90rpx;
  545. text-align: center;
  546. border-radius: 50rpx;
  547. line-height: 90rpx;
  548. /deep/ &.disabled {
  549. background: #E3E3E3!important;
  550. pointer-events: none;
  551. }
  552. }
  553. .cash-withdrawal .wrapper .list .tip2 {
  554. font-size: 26rpx;
  555. color: #999;
  556. text-align: center;
  557. margin: 44rpx 0 20rpx 0;
  558. }
  559. .cash-withdrawal .wrapper .list .value {
  560. height: 135rpx;
  561. line-height: 135rpx;
  562. border-bottom: 1px solid #eee;
  563. width: 690rpx;
  564. margin: 0 auto;
  565. }
  566. .cash-withdrawal .wrapper .list .value input {
  567. font-size: 80rpx;
  568. color: #282828;
  569. height: 135rpx;
  570. text-align: center;
  571. }
  572. .cash-withdrawal .wrapper .list .value .placeholder2 {
  573. color: #bbb;
  574. }
  575. .price {
  576. color: var(--view-priceColor);
  577. }
  578. .Bank {
  579. display: block;
  580. width: 100%;
  581. text-overflow: ellipsis;
  582. overflow: hidden;
  583. white-space: nowrap;
  584. }
  585. .auto_arrival{
  586. text-align: center;
  587. padding: 20rpx 0 0 0;
  588. .input{
  589. width: 100%;
  590. border-bottom: 1px solid #eee;
  591. margin-top: 10rpx;
  592. color: #999;
  593. height: 120rpx;
  594. /deep/uni-input,input{
  595. height: 120rpx;
  596. font-size: 40rpx;
  597. }
  598. }
  599. }
  600. uni-toast.uni-mask{
  601. background-color: rgba(0,0,0,0.5) !important;
  602. }
  603. </style>