withdrawal.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. <template>
  2. <view class="content">
  3. <view class="bg-img">
  4. <image src="https://zhibo.liuniu946.com/img/anchor11.png" mode=""></image>
  5. </view>
  6. <view class="awardBox">
  7. <view class="header">
  8. 我的佣金
  9. <view class="toback" @click="toIndex">
  10. <image src="../../static/img/left4.png" mode=""></image>
  11. </view>
  12. </view>
  13. <!-- <view class="withdraw">
  14. <view class="withdraw-btn" @click="navto('/pages/wallet/record')">
  15. 提现记录
  16. </view>
  17. </view> -->
  18. <view class="balance">
  19. <text class="spe">¥</text>
  20. <!-- {{money}} -->
  21. {{count}}
  22. </view>
  23. </view>
  24. <view class="freeze-box">
  25. <view class="freeze">
  26. <view class="freeze-item" @click="navto('/pages/wallet/myWalletDongjie')">
  27. <view class="price">{{ lockCommissionCount || 0}}</view>
  28. <view class="title">冻结中(元)</view>
  29. </view>
  30. <view class="line"></view>
  31. <view class="freeze-item" @click="navto('/pages/wallet/myWalletJ')">
  32. <view class="price">{{ commissionCount || 0}}</view>
  33. <view class="title">已解冻(元)</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="navbar">
  38. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  39. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  40. </view>
  41. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab"
  42. :style="{ height: maxheight + 'px' }">
  43. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  44. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  45. <!-- 空白页 -->
  46. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  47. <!-- 订单列表 -->
  48. <view v-for="(ls, index) in tabItem.orderList">
  49. <view class="order-item flex" v-if="tabCurrentIndex == 0">
  50. <view class="title-box">
  51. <view class="title">
  52. <text>{{ ls.title }}</text>
  53. </view>
  54. <view class="time">
  55. <text>{{ ls.add_time }}</text>
  56. </view>
  57. </view>
  58. <view class="money">
  59. <text>{{ '+' + ls.number }}</text>
  60. </view>
  61. </view>
  62. <view class="order-item flex" v-if="tabCurrentIndex == 1">
  63. <view class="title-box">
  64. <view class="title">
  65. <text>{{ ls.title }}</text>
  66. </view>
  67. <view class="time">
  68. <text>{{ ls.time }}</text>
  69. </view>
  70. </view>
  71. <view class="money">
  72. <text>{{ '-' + ls.number }}</text>
  73. </view>
  74. </view>
  75. </view>
  76. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  77. <view class="immAdd" @click="toAccount">
  78. 立即提现
  79. </view>
  80. </scroll-view>
  81. </swiper-item>
  82. </swiper>
  83. </view>
  84. </template>
  85. <script>
  86. // import { getCommissionInfo, userinfos } from '@/api/user.js';
  87. import {
  88. spreadCount,
  89. getCommissionInfo,
  90. commission
  91. } from '@/api/user.js';
  92. import {
  93. userinfos
  94. } from '@/api/user.js';
  95. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  96. import empty from '@/components/empty';
  97. export default {
  98. components: {
  99. empty,
  100. uniLoadMore
  101. },
  102. onReady() {
  103. // 初始化获取页面宽度
  104. uni.createSelectorQuery()
  105. .select('.content')
  106. .fields({
  107. size: true
  108. },
  109. data => {
  110. // 保存头部高度
  111. // this.maxheight = data.height - Math.floor((data.width / 750) * 570);
  112. this.maxheight = data.height - Math.floor((data.width / 750) * 330) - 40 - 40;
  113. }
  114. )
  115. .exec();
  116. },
  117. data() {
  118. return {
  119. // 头部图高度
  120. maxheight: '',
  121. tabCurrentIndex: 0,
  122. count: 0, //佣金总金额
  123. money: '', // 现用佣金
  124. navList: [{
  125. state: 3,
  126. text: '返佣',
  127. loadingType: 'more',
  128. orderList: [],
  129. page: 1, //当前页数
  130. limit: 10 //每次信息条数
  131. },
  132. {
  133. state: 4,
  134. text: '支出',
  135. loadingType: 'more',
  136. orderList: [],
  137. page: 1, //当前页数
  138. limit: 10 //每次信息条数
  139. },
  140. ],
  141. money: '', // 总余额
  142. recharge: '', // 累计充值
  143. orderStatusSum: '', // 累计消费
  144. lockCommissionCount: '', //冻结金额
  145. commissionCount: '', //解冻金额
  146. };
  147. },
  148. onLoad(options) {},
  149. onShow() {
  150. this.loadData();
  151. },
  152. methods: {
  153. // 页面跳转
  154. toIndex() {
  155. uni.switchTab({
  156. url: '/pages/user/user'
  157. })
  158. },
  159. navto(e) {
  160. console.log('=======', e)
  161. uni.navigateTo({
  162. url: e
  163. });
  164. },
  165. //获取佣金总金额
  166. async loadData(source = 'add') {
  167. console.log(source)
  168. let type = 3;
  169. spreadCount({}, type).then(({
  170. data
  171. }) => {
  172. console.log(data, 'data')
  173. this.count = data.count;
  174. });
  175. // let that = this;
  176. // userinfos().then(({data}) => {
  177. // console.log(data,'res')
  178. // this.money = data.extractPrice;
  179. // this.extractTotalPrice = data.extractTotalPrice;
  180. // });
  181. //这里是将订单挂载到tab列表下
  182. let index = this.tabCurrentIndex;
  183. let navItem = this.navList[index];
  184. let state = navItem.state;
  185. if (source === 'tabChange' && navItem.loaded === true) {
  186. //tab切换只有第一次需要加载数据
  187. return;
  188. }
  189. if (navItem.loadingType === 'loading') {
  190. //防止重复加载
  191. return;
  192. }
  193. // 判断是否重新加载数据
  194. if (source == 'refresh') {
  195. navItem.orderList = [];
  196. }
  197. // 修改当前对象状态为加载中
  198. navItem.loadingType = 'loading';
  199. commission({
  200. page: navItem.page,
  201. limit: navItem.limit
  202. },
  203. state)
  204. .then(({
  205. data
  206. }) => {
  207. console.log('获取佣金明细', data);
  208. this.lockCommissionCount = data.lockCommissionCount;
  209. this.commissionCount = data.commissionCount;
  210. getCommissionInfo({
  211. page: navItem.page,
  212. limit: navItem.page
  213. }, state)
  214. .then(({
  215. data
  216. }) => {
  217. if (data.length > 0) {
  218. navItem.orderList = navItem.orderList.concat(data[0].list);
  219. console.log(navItem.orderList, "orderList");
  220. navItem.page++;
  221. }
  222. })
  223. if (navItem.limit == data.length) {
  224. //判断是否还有数据, 有改为 more, 没有改为noMore
  225. navItem.loadingType = 'more';
  226. return;
  227. } else {
  228. //判断是否还有数据, 有改为 more, 没有改为noMore
  229. navItem.loadingType = 'noMore';
  230. }
  231. uni.hideLoading();
  232. this.$set(navItem, 'loaded', true);
  233. })
  234. },
  235. //获取信息
  236. // 提现
  237. toAccount() {
  238. if (this.count <= 0) {
  239. uni.showToast({
  240. title: '佣金不足',
  241. duration: 2000,
  242. icon: 'none',
  243. });
  244. } else {
  245. uni.navigateTo({
  246. url: '/pages/wallet/account'
  247. });
  248. }
  249. },
  250. //swiper 切换
  251. changeTab(e) {
  252. this.tabCurrentIndex = e.target.current;
  253. this.loadData('tabChange');
  254. },
  255. //顶部tab点击
  256. tabClick(index) {
  257. this.tabCurrentIndex = index;
  258. }
  259. }
  260. };
  261. </script>
  262. <style lang="scss">
  263. page {
  264. background: #f8f8f8;
  265. height: 100%;
  266. }
  267. .content-money {
  268. padding-bottom: 30rpx;
  269. background: $page-color-base;
  270. // border: 2px solid #ffffff;
  271. .moneyTx {
  272. position: absolute;
  273. top: 150rpx;
  274. right: 0rpx;
  275. width: 150rpx;
  276. padding: 10rpx 30rpx;
  277. border: 2px solid #ffffff;
  278. border-top-left-radius: 99rpx;
  279. border-bottom-left-radius: 99rpx;
  280. color: #ffffff;
  281. line-height: 1;
  282. font-size: $font-base;
  283. }
  284. .buttom-box {
  285. background-color: #ffffff;
  286. text-align: center;
  287. margin: 0 30rpx;
  288. padding: 20rpx 0;
  289. border-radius: $border-radius-sm;
  290. margin-top: -60rpx;
  291. .buttom {
  292. font-size: $font-lg;
  293. flex-grow: 1;
  294. }
  295. .interval {
  296. width: 2px;
  297. height: 60rpx;
  298. background-color: #eeeeee;
  299. }
  300. .icon {
  301. height: 50rpx;
  302. width: 48rpx;
  303. margin: 0 auto;
  304. .icon-img {
  305. width: 100%;
  306. height: 100%;
  307. }
  308. }
  309. }
  310. }
  311. .money-box {
  312. background: $base-color;
  313. padding-top: var(--status-bar-height);
  314. height: 410rpx;
  315. color: #ffffff;
  316. text-align: center;
  317. position: relative;
  318. .text {
  319. // padding-top: 80rpx;
  320. font-size: $font-lg;
  321. }
  322. .money {
  323. padding-top: 120rpx;
  324. font-size: 45rpx;
  325. font-weight: 500;
  326. }
  327. .money-accum {
  328. display: flex;
  329. align-items: center;
  330. justify-content: space-around;
  331. margin-top: 44rpx;
  332. .money-frame {
  333. .money-num {
  334. font-size: 45rpx;
  335. font-weight: 500;
  336. color: rgba(255, 255, 255, 1);
  337. }
  338. .mon-text {
  339. font-size: 30rpx;
  340. font-weight: 500;
  341. color: rgba(255, 255, 255, 1);
  342. }
  343. }
  344. }
  345. .money-loca {
  346. width: 140rpx;
  347. height: 50rpx;
  348. background: #FFFFFF;
  349. color: #FA2740;
  350. font-size: $font-base;
  351. line-height: 50rpx;
  352. border-radius: 10rpx 0 0 10rpx;
  353. }
  354. // 立即提现
  355. .draw {
  356. position: absolute;
  357. right: 0;
  358. top: 64rpx;
  359. }
  360. // 余额支付
  361. .rech {
  362. position: absolute;
  363. right: 0;
  364. top: 134rpx;
  365. }
  366. }
  367. .immAdd {
  368. margin: 0 auto;
  369. width: 674rpx;
  370. height: 88rpx;
  371. background: linear-gradient(180deg, #FD4646, #FF3535);
  372. border-radius: 44rpx;
  373. display: flex;
  374. justify-content: center;
  375. align-items: center;
  376. color: #FFFFFF;
  377. font-size: 36rpx;
  378. // margin-top: 63rpx;
  379. // margin-bottom: 133rpx;
  380. position: fixed;
  381. left: 38rpx;
  382. bottom: 50rpx;
  383. }
  384. .bg-img {
  385. width: 100%;
  386. height: 400rpx;
  387. image {
  388. width: 100%;
  389. height: 100%;
  390. }
  391. }
  392. .awardBox {
  393. width: 100%;
  394. height: 400rpx;
  395. // background-color: pink;
  396. position: absolute;
  397. left: 0;
  398. top: 0;
  399. .header {
  400. margin-top: var(--status-bar-height);
  401. // background-color: pink;
  402. width: 100%;
  403. height: 68rpx;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. font-size: 26rpx;
  408. // font-family: PingFang SC;
  409. font-weight: 400;
  410. color: #FFFFFF;
  411. position: relative;
  412. .toback {
  413. // background-color: red;
  414. display: flex;
  415. align-items: center;
  416. width: 44rpx;
  417. height: 68rpx;
  418. margin-left: 16rpx;
  419. position: absolute;
  420. left: 0rpx;
  421. top: 0rpx;
  422. image {
  423. width: 34rpx;
  424. height: 38rpx;
  425. }
  426. }
  427. }
  428. .withdraw {
  429. margin-top: 16rpx;
  430. width: 100%;
  431. display: flex;
  432. justify-content: flex-end;
  433. .withdraw-btn {
  434. width: 174rpx;
  435. height: 60rpx;
  436. background-color: #ffffff;
  437. display: flex;
  438. justify-content: center;
  439. align-items: center;
  440. font-size: 30rpx;
  441. color: #FF0000;
  442. }
  443. }
  444. .balance {
  445. width: 100%;
  446. // height: 150rpx;
  447. display: flex;
  448. justify-content: center;
  449. align-items: center;
  450. font-size: 72rpx;
  451. color: #FFFFFF;
  452. margin-top: 42rpx;
  453. .spe {
  454. font-size: 48rpx;
  455. color: #FFFFFF;
  456. }
  457. }
  458. }
  459. .freeze-box {
  460. // margin-top: -44rpx;
  461. position: absolute;
  462. left: 0;
  463. top: 320rpx;
  464. width: 100%;
  465. display: flex;
  466. justify-content: space-between;
  467. padding: 0 24rpx;
  468. // z-index: 99;
  469. .freeze {
  470. width: 100%;
  471. display: flex;
  472. align-items: center;
  473. background-color: #FFFFFF;
  474. border-radius: 10rpx;
  475. }
  476. .line {
  477. width: 2rpx;
  478. height: 54rpx;
  479. background-color: #EEEEEE;
  480. }
  481. .freeze-item {
  482. padding: 78rpx 0;
  483. width: 50%;
  484. height: 124rpx;
  485. display: flex;
  486. flex-direction: column;
  487. justify-content: center;
  488. align-items: center;
  489. .title {
  490. font-size: 32rpx;
  491. color: #333;
  492. }
  493. .price {
  494. margin-top: 6rpx;
  495. font-size: 28rpx;
  496. color: #666;
  497. }
  498. }
  499. }
  500. .navbar {
  501. margin-top: 94rpx;
  502. display: flex;
  503. height: 40px;
  504. padding: 0 5px;
  505. background: #fff;
  506. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  507. position: relative;
  508. z-index: 10;
  509. .nav-item {
  510. flex: 1;
  511. display: flex;
  512. justify-content: center;
  513. align-items: center;
  514. height: 100%;
  515. font-size: 15px;
  516. color: $font-color-dark;
  517. position: relative;
  518. &.current {
  519. color: $font-color-spec;
  520. &:after {
  521. content: '';
  522. position: absolute;
  523. left: 50%;
  524. bottom: 0;
  525. transform: translateX(-50%);
  526. width: 44px;
  527. height: 0;
  528. border-bottom: 2px solid $font-color-spec;
  529. }
  530. }
  531. }
  532. }
  533. // 列表
  534. .swiper-box {
  535. height: calc(100% - 360px);
  536. padding-top: 10rpx;
  537. .order-item {
  538. padding: 20rpx 30rpx;
  539. line-height: 1.5;
  540. .title-box {
  541. .title {
  542. font-size: $font-lg;
  543. color: $font-color-base;
  544. }
  545. .time {
  546. font-size: $font-base;
  547. color: $font-color-light;
  548. }
  549. }
  550. .money {
  551. color: #fd5b23;
  552. font-size: $font-lg;
  553. }
  554. }
  555. }
  556. .list-scroll-content {
  557. height: calc(100% - 100px);
  558. }
  559. .content {
  560. height: 100%;
  561. .empty-content {
  562. background-color: #ffffff;
  563. }
  564. }
  565. .sy {
  566. height: 44rpx;
  567. width: 100%;
  568. background-color: #FE4040;
  569. }
  570. </style>