index.vue 16 KB

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