index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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. that.minPrice = res.data.minPrice;
  236. that.brokerageType = res.data.brokerageType ? parseInt(res.data.brokerageType) : 0;
  237. });
  238. },
  239. /**
  240. * 获取个人用户信息
  241. */
  242. getUserInfo: function() {
  243. let that = this;
  244. getUserInfo().then(res => {
  245. that.navList = [{
  246. 'name': that.$t(`银行卡`),
  247. 'icon': 'icon-yinhangqia',
  248. 'id': 0
  249. },
  250. {
  251. 'name': that.$t(`微信`),
  252. 'icon': 'icon-weixin2',
  253. 'id': 1
  254. },
  255. {
  256. 'name': that.$t(`支付宝`),
  257. 'icon': 'icon-icon34',
  258. 'id': 2
  259. }
  260. ]
  261. let list = [];
  262. that.userInfo = res.data;
  263. for (var i = 0; i < that.userInfo.extract_type.length; i++) {
  264. if (this.navList[that.userInfo.extract_type[i]].id == that.userInfo.extract_type[i]) {
  265. list.push(this.navList[that.userInfo.extract_type[i]])
  266. }
  267. }
  268. this.navList = list
  269. this.swichNav(this.navList[0].id)
  270. });
  271. },
  272. swichNav: function(current) {
  273. this.currentTab = current;
  274. },
  275. bindPickerChange: function(e) {
  276. this.index = e.detail.value;
  277. },
  278. subCash(e) {
  279. let that = this,
  280. value = e.detail.value;
  281. if (this.prevent) return
  282. if (that.currentTab == 0) { //银行卡
  283. if (!value.name.trim()) return this.$util.Tips({
  284. title: this.$t(`请填写持卡人姓名`)
  285. });
  286. if (!value.cardnum.trim()) return this.$util.Tips({
  287. title: this.$t(`请填写卡号`)
  288. });
  289. if (that.index == 0) return this.$util.Tips({
  290. title: this.$t(`请选择银行`)
  291. });
  292. value.extract_type = 'bank';
  293. value.bankname = that.array[that.index];
  294. } else if (that.currentTab == 1) { //微信
  295. value.extract_type = 'weixin';
  296. // 自动提现隐藏账号
  297. if (!that.brokerageType && !value.name.trim()) return this.$util.Tips({
  298. title: this.$t(`请填写微信号`)
  299. });
  300. value.weixin = value.name;
  301. value.qrcode_url = that.qrcodeUrlW;
  302. } else if (that.currentTab == 2) { //支付宝
  303. value.extract_type = 'alipay';
  304. if (value.name.length == 0) return this.$util.Tips({
  305. title: this.$t(`请填写账号`)
  306. });
  307. value.alipay_code = value.name;
  308. value.qrcode_url = that.qrcodeUrlZ;
  309. }
  310. if (!value.money.trim()) return this.$util.Tips({
  311. title: this.$t(`请填写提现金额`)
  312. });
  313. if (Number(value.money) < Number(that.minPrice)) return this.$util.Tips({
  314. title: this.$t(`提现金额不能低于`) + that.minPrice
  315. });
  316. this.prevent = true
  317. extractCash(value).then(res => {
  318. that.getUserInfo();
  319. return this.$util.Tips({
  320. title: res.msg,
  321. icon: 'success'
  322. }, {
  323. url: '/pages/users/user_spread_user/index',
  324. tab: 2
  325. });
  326. setTimeout(e => {
  327. this.prevent = false
  328. }, 1000)
  329. }).catch(err => {
  330. setTimeout(e => {
  331. this.prevent = false
  332. }, 1000)
  333. return this.$util.Tips({
  334. title: err
  335. });
  336. });
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="scss">
  342. page {
  343. background-color: #fff !important;
  344. }
  345. .fontcolor {
  346. color: var(--view-theme) !important;
  347. }
  348. .cash-withdrawal .nav {
  349. height: 130rpx;
  350. box-shadow: 0 10rpx 10rpx #f8f8f8;
  351. }
  352. .cash-withdrawal .nav .item {
  353. font-size: 26rpx;
  354. flex: 1;
  355. text-align: center;
  356. }
  357. .cash-withdrawal .nav .item~.item {
  358. border-left: 1px solid #f0f0f0;
  359. }
  360. .cash-withdrawal .nav .item .iconfont {
  361. width: 40rpx;
  362. height: 40rpx;
  363. border-radius: 50%;
  364. border: 2rpx solid var(--view-theme);
  365. text-align: center;
  366. line-height: 37rpx;
  367. margin: 0 auto 6rpx auto;
  368. font-size: 22rpx;
  369. box-sizing: border-box;
  370. }
  371. .cash-withdrawal .nav .item .iconfont.on {
  372. background-color: var(--view-theme);
  373. color: #fff;
  374. border-color: var(--view-theme);
  375. }
  376. .cash-withdrawal .nav .item .line {
  377. width: 2rpx;
  378. height: 20rpx;
  379. margin: 0 auto;
  380. transition: height 0.3s;
  381. }
  382. .cash-withdrawal .nav .item .line.on {
  383. height: 39rpx;
  384. }
  385. .cash-withdrawal .wrapper .list {
  386. padding: 0 30rpx;
  387. }
  388. .cash-withdrawal .wrapper .list .item {
  389. border-bottom: 1rpx solid #eee;
  390. min-height: 28rpx;
  391. font-size: 30rpx;
  392. color: #333;
  393. padding: 39rpx 0;
  394. }
  395. .cash-withdrawal .wrapper .list .item .name {
  396. width: 130rpx;
  397. }
  398. .cash-withdrawal .wrapper .list .item .input {
  399. width: 505rpx;
  400. }
  401. .cash-withdrawal .wrapper .list .item .input .placeholder {
  402. color: #bbb;
  403. }
  404. .cash-withdrawal .wrapper .list .item .picEwm,
  405. .cash-withdrawal .wrapper .list .item .pictrue {
  406. width: 140rpx;
  407. height: 140rpx;
  408. border-radius: 3rpx;
  409. position: relative;
  410. margin-right: 23rpx;
  411. }
  412. .cash-withdrawal .wrapper .list .item .picEwm image {
  413. width: 100%;
  414. height: 100%;
  415. border-radius: 3rpx;
  416. }
  417. .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1 {
  418. position: absolute;
  419. right: -14rpx;
  420. top: -16rpx;
  421. font-size: 40rpx;
  422. }
  423. .cash-withdrawal .wrapper .list .item .pictrue {
  424. border: 1px solid rgba(221, 221, 221, 1);
  425. font-size: 22rpx;
  426. color: #BBBBBB;
  427. }
  428. .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201 {
  429. font-size: 47rpx;
  430. color: #DDDDDD;
  431. margin-bottom: 3px;
  432. }
  433. .cash-withdrawal .wrapper .list .tip {
  434. font-size: 26rpx;
  435. color: #999;
  436. margin-top: 25rpx;
  437. }
  438. .cash-withdrawal .wrapper .list .bnt {
  439. font-size: 32rpx;
  440. color: #fff;
  441. width: 690rpx;
  442. height: 90rpx;
  443. text-align: center;
  444. border-radius: 50rpx;
  445. line-height: 90rpx;
  446. margin: 64rpx auto;
  447. }
  448. .cash-withdrawal .wrapper .list .tip2 {
  449. font-size: 26rpx;
  450. color: #999;
  451. text-align: center;
  452. margin: 44rpx 0 20rpx 0;
  453. }
  454. .cash-withdrawal .wrapper .list .value {
  455. height: 135rpx;
  456. line-height: 135rpx;
  457. border-bottom: 1rpx solid #eee;
  458. width: 690rpx;
  459. margin: 0 auto;
  460. }
  461. .cash-withdrawal .wrapper .list .value input {
  462. font-size: 80rpx;
  463. color: #282828;
  464. height: 135rpx;
  465. text-align: center;
  466. }
  467. .cash-withdrawal .wrapper .list .value .placeholder2 {
  468. color: #bbb;
  469. }
  470. .price {
  471. color: var(--view-priceColor);
  472. }
  473. </style>