index.vue 16 KB

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