index.vue 14 KB

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