index.vue 15 KB

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