index.vue 14 KB

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