index.vue 16 KB

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