sbIndex.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='cash-withdrawal'>
  4. <!-- <view class='nav acea-row' v-if="navList.length>1">
  5. <view v-for="(item,index) in navList" :key="index" class='item fontcolor' @click="swichNav(item.id)">
  6. <view class='line bg-color' :class='currentTab==item.id ? "on":""'></view>
  7. <view class='iconfont' :class='item.icon+" "+(currentTab==item.id ? "on":"")'></view>
  8. <view>{{item.name}}</view>
  9. </view>
  10. </view> -->
  11. <view class='wrapper'>
  12. <view :hidden='currentTab != 0' class='list'>
  13. <form @submit="subCash">
  14. <!-- <view class='item acea-row row-between-wrapper'>
  15. <view class='name'>持卡人</view>
  16. <view class='input'><input placeholder='请输入持卡人姓名' placeholder-class='placeholder'
  17. name="name" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input></view>
  18. </view> -->
  19. <!-- <view class='item acea-row row-between-wrapper'>
  20. <view class='name'>卡号</view>
  21. <view class='input'><input type='number' placeholder='请填写卡号' placeholder-class='placeholder'
  22. name="cardnum"></input></view>
  23. </view> -->
  24. <!-- <view class='item acea-row row-between-wrapper'>
  25. <view class='name'>银行</view>
  26. <view class='input'>
  27. <picker @change="bindPickerChange" :value="index" :range="array">
  28. <text class='Bank'>{{array[index]}}</text>
  29. <text class='iconfont icon-qiepian38'></text>
  30. </picker>
  31. </view>
  32. </view> -->
  33. <view class='item acea-row row-between-wrapper'>
  34. <view class='name'>提现</view>
  35. <view class='input'><input @input='inputNum' :maxlength="moneyMaxLeng"
  36. :placeholder='"最低提现金额:¥"+minPrice' placeholder-class='placeholder' name="money"
  37. type='digit'></input></view>
  38. </view>
  39. <view class='tip'>
  40. 当前可提现金额: <text
  41. class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
  42. </view>
  43. <view class='tip'>
  44. 提现手续费: <text class="price">{{withdraw_fee}}%</text>,实际到账:<text
  45. class="price">¥{{true_money}}</text>
  46. </view>
  47. <view class='tip'>
  48. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  49. </view>
  50. <button formType="submit" class='bnt bg-color'>提现</button>
  51. </form>
  52. </view>
  53. <view :hidden='currentTab != 1' class='list'>
  54. <form @submit="subCash">
  55. <view class='item acea-row row-between-wrapper' v-if="extract_wechat_type == 0">
  56. <view class='name'>账号</view>
  57. <view class='input'><input placeholder='请填写您的微信账号' placeholder-class='placeholder'
  58. name="name"
  59. onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input>
  60. </view>
  61. </view>
  62. <view class='item acea-row row-between-wrapper'>
  63. <view class='name'>提现</view>
  64. <view class='input'><input @input='inputNum' :maxlength="moneyMaxLeng"
  65. :placeholder='"最低提现金额:¥"+minPrice' placeholder-class='placeholder' name="money"
  66. type='digit'></input></view>
  67. </view>
  68. <view class='item acea-row row-top row-between' v-if="extract_wechat_type == 0">
  69. <view class='name'>收款码</view>
  70. <view class="input acea-row">
  71. <view class="picEwm" v-if="qrcodeUrlW">
  72. <image :src="qrcodeUrlW"></image>
  73. <text class='iconfont icon-guanbi1 fontcolor' @click='DelPicW'></text>
  74. </view>
  75. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("W")'
  76. v-else>
  77. <text class='iconfont icon-icon25201'></text>
  78. <view>上传图片</view>
  79. </view>
  80. </view>
  81. </view>
  82. <view class='tip'>
  83. 当前可提现金额: <text
  84. class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
  85. </view>
  86. <view class='tip'>
  87. 提现手续费: <text class="price">{{withdraw_fee}}%</text>,实际到账:<text
  88. class="price">¥{{true_money}}</text>
  89. </view>
  90. <view class='tip'>
  91. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  92. </view>
  93. <button formType="submit" class='bnt bg-color'>提现</button>
  94. </form>
  95. </view>
  96. <view :hidden='currentTab != 2' class='list'>
  97. <form @submit="subCash">
  98. <view class='item acea-row row-between-wrapper'>
  99. <view class='name'>账号</view>
  100. <view class='input'><input placeholder='请填写您的支付宝账号' placeholder-class='placeholder'
  101. name="name"
  102. onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input>
  103. </view>
  104. </view>
  105. <view class='item acea-row row-between-wrapper'>
  106. <view class='name'>提现</view>
  107. <view class='input'><input @input='inputNum' :maxlength="moneyMaxLeng"
  108. :placeholder='"最低提现金额:¥"+minPrice' placeholder-class='placeholder' name="money"
  109. type='digit'></input></view>
  110. </view>
  111. <view class='item acea-row row-top row-between'>
  112. <view class='name'>收款码</view>
  113. <view class="input acea-row">
  114. <view class="picEwm" v-if="qrcodeUrlZ">
  115. <image :src="qrcodeUrlZ"></image>
  116. <text class='iconfont icon-guanbi1 fontcolor' @click='DelPicZ'></text>
  117. </view>
  118. <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("Z")'
  119. v-else>
  120. <text class='iconfont icon-icon25201'></text>
  121. <view>上传图片</view>
  122. </view>
  123. </view>
  124. </view>
  125. <view class='tip'>
  126. 当前可提现金额: <text
  127. class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
  128. </view>
  129. <view class='tip'>
  130. 提现手续费: <text class="price">{{withdraw_fee}}%</text>,实际到账:<text
  131. class="price">¥{{true_money}}</text>
  132. </view>
  133. <view class='tip'>
  134. 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
  135. </view>
  136. <button formType="submit" class='bnt bg-color'>提现</button>
  137. </form>
  138. </view>
  139. </view>
  140. </view>
  141. <!-- #ifdef MP -->
  142. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  143. <!-- #endif -->
  144. </view>
  145. </template>
  146. <script>
  147. import {
  148. bank_info
  149. } from '@/api/new.js';
  150. import {
  151. extractCash,
  152. extractBank,
  153. getUserInfo
  154. } from '@/api/user.js';
  155. import {
  156. toLogin
  157. } from '@/libs/login.js';
  158. import {
  159. mapGetters
  160. } from "vuex";
  161. import colors from '@/mixins/color.js';
  162. export default {
  163. components: {},
  164. mixins: [colors],
  165. data() {
  166. return {
  167. navList: [],
  168. currentTab: '',
  169. index: 0,
  170. array: [], //提现银行
  171. minPrice: 0.00, //最低提现金额
  172. userInfo: [],
  173. isClone: false,
  174. isAuto: false, //没有授权的不会自动授权
  175. isShowAuth: false, //是否隐藏授权
  176. qrcodeUrlW: "",
  177. qrcodeUrlZ: "",
  178. prevent: true, //避免重复提交成功多次
  179. moneyMaxLeng: 8,
  180. withdraw_fee: '0',
  181. true_money: 0,
  182. extract_wechat_type: 0,
  183. isAuth: false, //判断是否认证
  184. };
  185. },
  186. computed: mapGetters(['isLogin']),
  187. watch: {
  188. isLogin: {
  189. handler: function(newV, oldV) {
  190. if (newV) {
  191. this.getUserInfo();
  192. this.getUserExtractBank();
  193. }
  194. },
  195. deep: true
  196. }
  197. },
  198. onLoad() {
  199. if (this.isLogin) {
  200. this.getUserInfo();
  201. this.getUserExtractBank();
  202. } else {
  203. toLogin()
  204. }
  205. },
  206. onShow() {
  207. if (this.isLogin) {
  208. this.bank_info();
  209. }
  210. uni.removeStorageSync('form_type_cart');
  211. },
  212. methods: {
  213. bank_info() {
  214. const that = this;
  215. bank_info().then((res) => {
  216. if (!res.data.bank_code) {
  217. that.isAuth = false;
  218. uni.showModal({
  219. title: '提示',
  220. content: '您还未认证请立即认证',
  221. confirmText: '立即认证',
  222. success: res => {
  223. if (res.confirm) {
  224. uni.navigateTo({
  225. url: './WAuth'
  226. })
  227. }
  228. },
  229. fail: () => {},
  230. complete: () => {}
  231. });
  232. return
  233. } else {
  234. that.isAuth = true;
  235. }
  236. })
  237. },
  238. inputNum: function(e) {
  239. let val = e.detail.value;
  240. let dot = val.indexOf('.');
  241. if (dot > -1) {
  242. this.moneyMaxLeng = dot + 3;
  243. } else {
  244. this.moneyMaxLeng = 8
  245. }
  246. this.true_money = Math.floor((this.$util.$h.Mul(val, this.$util.$h.Div(this.$util.$h.Sub(100, this
  247. .withdraw_fee), 100))) * 100) / 100 || 0;
  248. },
  249. // uploadpicW(){
  250. // this.uploadpic(this.qrcodeUrlW);
  251. // },
  252. // uploadpicZ(){
  253. // this.uploadpic(this.qrcodeUrlZ);
  254. // },
  255. /**
  256. * 上传文件
  257. *
  258. */
  259. uploadpic: function(type) {
  260. let that = this;
  261. that.$util.uploadImageOne('upload/image', function(res) {
  262. if (type === 'W') {
  263. that.qrcodeUrlW = res.data.url;
  264. } else {
  265. that.qrcodeUrlZ = res.data.url;
  266. }
  267. });
  268. },
  269. /**
  270. * 删除图片
  271. *
  272. */
  273. DelPicW: function() {
  274. this.qrcodeUrlW = "";
  275. },
  276. DelPicZ: function() {
  277. this.qrcodeUrlZ = "";
  278. },
  279. onLoadFun: function() {
  280. this.getUserInfo();
  281. this.getUserExtractBank();
  282. this.isShowAuth = false;
  283. },
  284. // 授权关闭
  285. authColse: function(e) {
  286. this.isShowAuth = e
  287. },
  288. getUserExtractBank: function() {
  289. let that = this;
  290. extractBank().then(res => {
  291. let array = res.data.extractBank;
  292. array.unshift("请选择银行");
  293. that.$set(that, 'array', array);
  294. that.minPrice = res.data.minPrice;
  295. that.withdraw_fee = res.data.withdraw_fee;
  296. that.extract_wechat_type = res.data.extract_wechat_type;
  297. });
  298. },
  299. /**
  300. * 获取个人用户信息
  301. */
  302. getUserInfo: function() {
  303. let that = this;
  304. getUserInfo().then(res => {
  305. that.userInfo = res.data;
  306. if (res.data.user_extract_bank_status) {
  307. this.navList.push({
  308. 'name': '银行卡',
  309. 'icon': 'icon-yinhangqia',
  310. 'id': 0
  311. })
  312. }
  313. if (res.data.user_extract_wechat_status) {
  314. this.navList.push({
  315. 'name': '微信',
  316. 'icon': 'icon-weixin2',
  317. 'id': 1
  318. })
  319. }
  320. if (res.data.user_extract_alipay_status) {
  321. this.navList.push({
  322. 'name': '支付宝',
  323. 'icon': 'icon-icon34',
  324. 'id': 2
  325. })
  326. }
  327. this.currentTab = this.navList[0].id;
  328. })
  329. },
  330. swichNav: function(current) {
  331. this.currentTab = current;
  332. },
  333. bindPickerChange: function(e) {
  334. this.index = e.detail.value;
  335. },
  336. subCash: function(e) {
  337. let that = this,
  338. value = e.detail.value;
  339. if (!this.isAuth) {
  340. uni.showModal({
  341. title: '提示',
  342. content: '您还未认证请立即认证',
  343. confirmText: '立即认证',
  344. success: res => {
  345. if (res.confirm) {
  346. uni.navigateTo({
  347. url: './WAuth'
  348. })
  349. }
  350. },
  351. fail: () => {},
  352. complete: () => {}
  353. });
  354. return
  355. }
  356. // if (that.currentTab == 0) { //银行卡
  357. // if (value.name.length == 0) return this.$util.Tips({
  358. // title: '请填写持卡人姓名'
  359. // });
  360. // if (value.cardnum.length == 0) return this.$util.Tips({
  361. // title: '请填写卡号'
  362. // });
  363. // if (that.index == 0) return this.$util.Tips({
  364. // title: "请选择银行"
  365. // });
  366. // value.extract_type = 'bank';
  367. // value.bankname = that.array[that.index];
  368. // } else if (that.currentTab == 1) { //微信
  369. // value.extract_type = 'weixin';
  370. // if (that.extract_wechat_type == 0) {
  371. // if (value.name.length == 0) return this.$util.Tips({
  372. // title: '请填写微信号'
  373. // });
  374. // if (that.qrcodeUrlW == '') return this.$util.Tips({
  375. // title: '请上传图片'
  376. // });
  377. // value.weixin = value.name;
  378. // value.qrcode_url = that.qrcodeUrlW;
  379. // }
  380. // } else if (that.currentTab == 2) { //支付宝
  381. // value.extract_type = 'alipay';
  382. // if (value.name.length == 0) return this.$util.Tips({
  383. // title: '请填写账号'
  384. // });
  385. // if (that.qrcodeUrlZ == '') return this.$util.Tips({
  386. // title: '请上传图片'
  387. // });
  388. // value.alipay_code = value.name;
  389. // value.qrcode_url = that.qrcodeUrlZ;
  390. // }
  391. if (value.money.length == 0) return this.$util.Tips({
  392. title: '请填写提现金额'
  393. });
  394. if (Number(value.money) < Number(that.minPrice)) return this.$util.Tips({
  395. title: '提现金额不能低于:¥' + that.minPrice
  396. });
  397. if (this.prevent) {
  398. this.prevent = false
  399. } else {
  400. return
  401. }
  402. uni.showLoading({
  403. title:'提交中',
  404. mask:true
  405. })
  406. extractCash(value).then(res => {
  407. //that.getUserInfo();
  408. return this.$util.Tips({
  409. title: res.msg,
  410. icon: 'success'
  411. }, {
  412. url: '/pages/users/user_spread_user/index',
  413. tab: 2
  414. });
  415. }).catch(err => {
  416. setTimeout(e => {
  417. this.prevent = true
  418. }, 1500)
  419. return this.$util.Tips({
  420. title: err
  421. });
  422. });
  423. }
  424. }
  425. }
  426. </script>
  427. <style lang="scss">
  428. page {
  429. background-color: #fff !important;
  430. }
  431. .fontcolor {
  432. color: var(--view-theme) !important;
  433. }
  434. .cash-withdrawal .nav {
  435. height: 130rpx;
  436. box-shadow: 0 10rpx 10rpx #f8f8f8;
  437. }
  438. .cash-withdrawal .nav .item {
  439. font-size: 26rpx;
  440. flex: 1;
  441. text-align: center;
  442. }
  443. .cash-withdrawal .nav .item~.item {
  444. border-left: 1px solid #f0f0f0;
  445. }
  446. .cash-withdrawal .nav .item .iconfont {
  447. width: 40rpx;
  448. height: 40rpx;
  449. border-radius: 50%;
  450. border: 2rpx solid var(--view-theme);
  451. text-align: center;
  452. line-height: 37rpx;
  453. margin: 0 auto 6rpx auto;
  454. font-size: 22rpx;
  455. box-sizing: border-box;
  456. }
  457. .cash-withdrawal .nav .item .iconfont.on {
  458. background-color: var(--view-theme);
  459. color: #fff;
  460. border-color: var(--view-theme);
  461. }
  462. .cash-withdrawal .nav .item .line {
  463. width: 2rpx;
  464. height: 20rpx;
  465. margin: 0 auto;
  466. transition: height 0.3s;
  467. }
  468. .cash-withdrawal .nav .item .line.on {
  469. height: 39rpx;
  470. }
  471. .cash-withdrawal .wrapper .list {
  472. padding: 0 30rpx;
  473. }
  474. .cash-withdrawal .wrapper .list .item {
  475. border-bottom: 1rpx solid #eee;
  476. min-height: 28rpx;
  477. font-size: 30rpx;
  478. color: #333;
  479. padding: 39rpx 0;
  480. }
  481. .cash-withdrawal .wrapper .list .item .name {
  482. width: 130rpx;
  483. }
  484. .cash-withdrawal .wrapper .list .item .input {
  485. width: 505rpx;
  486. }
  487. .cash-withdrawal .wrapper .list .item .input .placeholder {
  488. color: #bbb;
  489. }
  490. .cash-withdrawal .wrapper .list .item .picEwm,
  491. .cash-withdrawal .wrapper .list .item .pictrue {
  492. width: 140rpx;
  493. height: 140rpx;
  494. border-radius: 3rpx;
  495. position: relative;
  496. margin-right: 23rpx;
  497. }
  498. .cash-withdrawal .wrapper .list .item .picEwm image {
  499. width: 100%;
  500. height: 100%;
  501. border-radius: 3rpx;
  502. }
  503. .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1 {
  504. position: absolute;
  505. right: -14rpx;
  506. top: -16rpx;
  507. font-size: 40rpx;
  508. }
  509. .cash-withdrawal .wrapper .list .item .pictrue {
  510. border: 1px solid rgba(221, 221, 221, 1);
  511. font-size: 22rpx;
  512. color: #BBBBBB;
  513. }
  514. .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201 {
  515. font-size: 47rpx;
  516. color: #DDDDDD;
  517. margin-bottom: 3px;
  518. }
  519. .cash-withdrawal .wrapper .list .tip {
  520. font-size: 26rpx;
  521. color: #999;
  522. margin-top: 25rpx;
  523. }
  524. .cash-withdrawal .wrapper .list .bnt {
  525. font-size: 32rpx;
  526. color: #fff;
  527. width: 690rpx;
  528. height: 90rpx;
  529. text-align: center;
  530. border-radius: 50rpx;
  531. line-height: 90rpx;
  532. margin: 64rpx auto;
  533. }
  534. .cash-withdrawal .wrapper .list .tip2 {
  535. font-size: 26rpx;
  536. color: #999;
  537. text-align: center;
  538. margin: 44rpx 0 20rpx 0;
  539. }
  540. .cash-withdrawal .wrapper .list .value {
  541. height: 135rpx;
  542. line-height: 135rpx;
  543. border-bottom: 1rpx solid #eee;
  544. width: 690rpx;
  545. margin: 0 auto;
  546. }
  547. .cash-withdrawal .wrapper .list .value input {
  548. font-size: 80rpx;
  549. color: #282828;
  550. height: 135rpx;
  551. text-align: center;
  552. }
  553. .cash-withdrawal .wrapper .list .value .placeholder2 {
  554. color: #bbb;
  555. }
  556. .price {
  557. color: var(--view-priceColor);
  558. }
  559. </style>