index.vue 19 KB

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