index.vue 15 KB

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