index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input></view>
  18. </view>
  19. <view class='item acea-row row-between-wrapper'>
  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'>
  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. </view>
  132. </template>
  133. <script>
  134. import {
  135. extractCash,
  136. extractBank,
  137. getUserInfo
  138. } from '@/api/user.js';
  139. import {
  140. toLogin
  141. } from '@/libs/login.js';
  142. import {
  143. mapGetters
  144. } from "vuex";
  145. import colors from '@/mixins/color.js';
  146. export default {
  147. components: {},
  148. mixins:[colors],
  149. data() {
  150. return {
  151. navList: [],
  152. currentTab: '',
  153. index: 0,
  154. array: [], //提现银行
  155. minPrice: 0.00, //最低提现金额
  156. userInfo: [],
  157. isClone: false,
  158. isAuto: false, //没有授权的不会自动授权
  159. isShowAuth: false, //是否隐藏授权
  160. qrcodeUrlW: "",
  161. qrcodeUrlZ: "",
  162. prevent: true, //避免重复提交成功多次
  163. moneyMaxLeng: 8,
  164. withdraw_fee: '0',
  165. true_money: 0,
  166. extract_wechat_type:0
  167. };
  168. },
  169. computed: mapGetters(['isLogin']),
  170. watch: {
  171. isLogin: {
  172. handler: function(newV, oldV) {
  173. if (newV) {
  174. this.getUserInfo();
  175. this.getUserExtractBank();
  176. }
  177. },
  178. deep: true
  179. }
  180. },
  181. onLoad() {
  182. if (this.isLogin) {
  183. this.getUserInfo();
  184. this.getUserExtractBank();
  185. } else {
  186. toLogin();
  187. }
  188. },
  189. onShow() {
  190. uni.removeStorageSync('form_type_cart');
  191. },
  192. methods: {
  193. inputNum: function(e) {
  194. let val = e.detail.value;
  195. let dot = val.indexOf('.');
  196. if(dot>-1){
  197. this.moneyMaxLeng = dot+3;
  198. }else{
  199. this.moneyMaxLeng = 8
  200. }
  201. 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;
  202. },
  203. // uploadpicW(){
  204. // this.uploadpic(this.qrcodeUrlW);
  205. // },
  206. // uploadpicZ(){
  207. // this.uploadpic(this.qrcodeUrlZ);
  208. // },
  209. /**
  210. * 上传文件
  211. *
  212. */
  213. uploadpic: function(type) {
  214. let that = this;
  215. that.$util.uploadImageOne('upload/image', function(res) {
  216. if (type === 'W') {
  217. that.qrcodeUrlW = res.data.url;
  218. } else {
  219. that.qrcodeUrlZ = res.data.url;
  220. }
  221. });
  222. },
  223. /**
  224. * 删除图片
  225. *
  226. */
  227. DelPicW: function() {
  228. this.qrcodeUrlW = "";
  229. },
  230. DelPicZ: function() {
  231. this.qrcodeUrlZ = "";
  232. },
  233. onLoadFun: function() {
  234. this.getUserInfo();
  235. this.getUserExtractBank();
  236. },
  237. // 授权关闭
  238. authColse: function(e) {
  239. this.isShowAuth = e
  240. },
  241. getUserExtractBank: function() {
  242. let that = this;
  243. extractBank().then(res => {
  244. let array = res.data.extractBank;
  245. array.unshift("请选择银行");
  246. that.$set(that, 'array', array);
  247. that.minPrice = res.data.minPrice;
  248. that.withdraw_fee = res.data.withdraw_fee;
  249. that.extract_wechat_type = res.data.extract_wechat_type;
  250. });
  251. },
  252. /**
  253. * 获取个人用户信息
  254. */
  255. getUserInfo: function() {
  256. let that = this;
  257. getUserInfo().then(res => {
  258. that.userInfo = res.data;
  259. if(res.data.user_extract_bank_status){
  260. this.navList.push(
  261. {
  262. 'name': '银行卡',
  263. 'icon': 'icon-yinhangqia',
  264. 'id': 0
  265. }
  266. )
  267. }
  268. if(res.data.user_extract_wechat_status){
  269. this.navList.push(
  270. {
  271. 'name': '微信',
  272. 'icon': 'icon-weixin2',
  273. 'id': 1
  274. }
  275. )
  276. }
  277. if(res.data.user_extract_alipay_status){
  278. this.navList.push(
  279. {
  280. 'name': '支付宝',
  281. 'icon': 'icon-icon34',
  282. 'id': 2
  283. }
  284. )
  285. }
  286. this.currentTab = this.navList[0].id;
  287. })
  288. },
  289. swichNav: function(current) {
  290. this.currentTab = current;
  291. },
  292. bindPickerChange: function(e) {
  293. this.index = e.detail.value;
  294. },
  295. subCash: function(e) {
  296. let that = this,
  297. value = e.detail.value;
  298. if (that.currentTab == 0) { //银行卡
  299. if (value.name.length == 0) return this.$util.Tips({
  300. title: '请填写持卡人姓名'
  301. });
  302. if (value.cardnum.length == 0) return this.$util.Tips({
  303. title: '请填写卡号'
  304. });
  305. if (that.index == 0) return this.$util.Tips({
  306. title: "请选择银行"
  307. });
  308. value.extract_type = 'bank';
  309. value.bankname = that.array[that.index];
  310. } else if (that.currentTab == 1) { //微信
  311. value.extract_type = 'weixin';
  312. if(that.extract_wechat_type == 0){
  313. if (value.name.length == 0) return this.$util.Tips({
  314. title: '请填写微信号'
  315. });
  316. if (that.qrcodeUrlW == '') return this.$util.Tips({
  317. title: '请上传图片'
  318. });
  319. value.weixin = value.name;
  320. value.qrcode_url = that.qrcodeUrlW;
  321. }
  322. } else if (that.currentTab == 2) { //支付宝
  323. value.extract_type = 'alipay';
  324. if (value.name.length == 0) return this.$util.Tips({
  325. title: '请填写账号'
  326. });
  327. if (that.qrcodeUrlZ == '') return this.$util.Tips({
  328. title: '请上传图片'
  329. });
  330. value.alipay_code = value.name;
  331. value.qrcode_url = that.qrcodeUrlZ;
  332. }
  333. if (value.money.length == 0) return this.$util.Tips({
  334. title: '请填写提现金额'
  335. });
  336. if (Number(value.money) < Number(that.minPrice)) return this.$util.Tips({
  337. title: '提现金额不能低于:¥' + that.minPrice
  338. });
  339. if (this.prevent) {
  340. this.prevent = false
  341. } else {
  342. return
  343. }
  344. extractCash(value).then(res => {
  345. //that.getUserInfo();
  346. return this.$util.Tips({
  347. title: res.msg,
  348. icon: 'success'
  349. }, {
  350. url: '/pages/users/user_spread_user/index',
  351. tab: 2
  352. });
  353. }).catch(err => {
  354. setTimeout(e => {
  355. this.prevent = true
  356. }, 1500)
  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>