index.vue 15 KB

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