index.vue 13 KB

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