index.vue 15 KB

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