award.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack">
  7. <image class="goback" src="../../static/icon/fanhui.png" mode=""></image>
  8. </view>
  9. <view class="header">我的佣金</view>
  10. </view>
  11. <view class="content-bg">
  12. <image src="../../static/img/tg-bg.png" mode=""></image>
  13. </view>
  14. <view class="money-box">
  15. <view class="money">{{ yj || 0 }}</view>
  16. <view>我的佣金</view>
  17. </view>
  18. <view class="moneybtn-box">
  19. <view class="money-btn"></view>
  20. <view class="money-btn" @click="navto('/pages/user/withdrawal')">佣金提现</view>
  21. </view>
  22. </view>
  23. <!-- <view class="info-box flex">
  24. <view class="info-item">
  25. <view class="info-font">累计收入</view>
  26. <view class="info-num">{{userInfo.brokerage || '0'}}</view>
  27. </view>
  28. <view class="shu"></view>
  29. <view class="info-item">
  30. <view class="info-font">累计支出</view>
  31. <view class="info-num">{{userInfo.extractTotalPrice || '0'}}</view>
  32. </view>
  33. </view> -->
  34. <view class="navbar">
  35. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  36. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  37. </view>
  38. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300"
  39. @change="changeTab">
  40. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  41. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  42. <!-- 空白页 -->
  43. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  44. <!-- 订单列表 -->
  45. <view>
  46. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  47. <view class="title-box">
  48. <view class="title">
  49. <text>{{ item.title }}</text>
  50. </view>
  51. <view class="time">
  52. <text>{{ item.add_time }}</text>
  53. </view>
  54. </view>
  55. <view class="money">
  56. <view>{{ (item.pm == 0 ? '-' : '+') + item.number }}</view>
  57. </view>
  58. </view>
  59. </view>
  60. <uni-load-more :status="tabItem.loadingType"
  61. v-if="!(tabItem.orderList.length == 0 && tabItem.loaded)"></uni-load-more>
  62. </scroll-view>
  63. </swiper-item>
  64. </swiper>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapState,
  70. mapMutations
  71. } from 'vuex';
  72. import {
  73. getCommissionInfo,
  74. getUserInfo
  75. } from '@/api/user.js';
  76. import {
  77. getMoneyStyle
  78. } from '@/utils/rocessor.js';
  79. import {
  80. mapGetters
  81. } from 'vuex';
  82. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  83. import empty from '@/components/empty';
  84. import {
  85. spreadCommission,
  86. userBalance,
  87. extractBank
  88. } from '@/api/wallet.js';
  89. export default {
  90. filters: {
  91. getMoneyStyle
  92. },
  93. components: {
  94. empty,
  95. uniLoadMore
  96. },
  97. onReady(res) {
  98. var _this = this;
  99. uni.getSystemInfo({
  100. success: resu => {
  101. const query = uni.createSelectorQuery();
  102. query.select('.swiper-box').boundingClientRect();
  103. query.exec(function(res) {
  104. _this.height = resu.windowHeight - res[0].top + 'px';
  105. console.log('打印页面的剩余高度', _this.height);
  106. });
  107. },
  108. fail: res => {}
  109. });
  110. },
  111. data() {
  112. return {
  113. userInfo: {},
  114. yj: '',
  115. height: '',
  116. // 头部图高度
  117. maxheight: '',
  118. tabCurrentIndex: 0,
  119. orderStatusSum: 0,
  120. recharge: 0,
  121. navList: [
  122. // {
  123. // state: 0,
  124. // text: '全部',
  125. // loadingType: 'more',
  126. // orderList: [],
  127. // page: 1, //当前页数
  128. // limit: 10 //每次信息条数
  129. // },
  130. {
  131. state: 4,
  132. text: '支出',
  133. loadingType: 'more',
  134. orderList: [],
  135. page: 1, //当前页数
  136. limit: 10 //每次信息条数
  137. },
  138. {
  139. state: 3,
  140. text: '收入',
  141. loadingType: 'more',
  142. orderList: [],
  143. page: 1, //当前页数
  144. limit: 10 //每次信息条数
  145. }
  146. ],
  147. money: ''
  148. };
  149. },
  150. onLoad(options) {},
  151. onShow() {
  152. this.extractBank()
  153. this.getUserInfo()
  154. this.loadData();
  155. },
  156. methods: {
  157. getUserInfo() {
  158. getUserInfo({}).then(({
  159. data
  160. }) => {
  161. this.userInfo = data
  162. });
  163. },
  164. extractBank() {
  165. extractBank().then(res => {
  166. console.log(res)
  167. this.yj = res.data.brokerage_price
  168. })
  169. },
  170. toBack() {
  171. uni.switchTab({
  172. url: '/pages/user/user'
  173. });
  174. },
  175. // 页面跳转
  176. navto(e) {
  177. uni.navigateTo({
  178. url: e
  179. });
  180. },
  181. //获取收入支出信息
  182. async loadData(source) {
  183. let obj = this;
  184. //这里是将订单挂载到tab列表下
  185. let index = this.tabCurrentIndex;
  186. let navItem = this.navList[index];
  187. let state = navItem.state;
  188. if (source === 'tabChange' && navItem.loaded === true) {
  189. //tab切换只有第一次需要加载数据
  190. return;
  191. }
  192. if (navItem.loadingType === 'loading') {
  193. //防止重复加载
  194. return;
  195. }
  196. // 修改当前对象状态为加载中
  197. navItem.loadingType = 'loading';
  198. spreadCommission({
  199. page: navItem.page,
  200. limit: navItem.limit,
  201. }, state)
  202. .then(({
  203. data
  204. }) => {
  205. if (data.length > 0) {
  206. data.forEach(e => {
  207. navItem.orderList = navItem.orderList.concat(e.list);
  208. })
  209. console.log(navItem.orderList);
  210. navItem.page++;
  211. }
  212. //判断是否还有数据, 有改为more, 没有改为noMore
  213. if (navItem.limit == data.length) {
  214. navItem.loadingType = 'more';
  215. return;
  216. } else {
  217. navItem.loadingType = 'noMore';
  218. }
  219. uni.hideLoading();
  220. this.$set(navItem, 'loaded', true);
  221. })
  222. .catch(e => {
  223. console.log(e);
  224. });
  225. },
  226. //swiper 切换
  227. changeTab(e) {
  228. this.tabCurrentIndex = e.target.current;
  229. this.loadData('tabChange');
  230. },
  231. //顶部tab点击
  232. tabClick(index) {
  233. this.tabCurrentIndex = index;
  234. }
  235. }
  236. };
  237. </script>
  238. <style lang="scss">
  239. page {
  240. background: #f1f1f1;
  241. height: 100%;
  242. }
  243. .status_bar {
  244. height: var(--status-bar-height);
  245. width: 100%;
  246. }
  247. .content-money {
  248. position: relative;
  249. height: 480rpx;
  250. .content-bg {
  251. position: absolute;
  252. top: 0;
  253. left: 0;
  254. right: 0;
  255. width: 750rpx;
  256. height: 480rpx;
  257. image {
  258. width: 100%;
  259. height: 100%;
  260. }
  261. }
  262. .body-title {
  263. height: 80rpx;
  264. text-align: center;
  265. font-size: 35rpx;
  266. position: relative;
  267. .header {
  268. position: absolute;
  269. left: 0;
  270. top: 0;
  271. width: 100%;
  272. font-size: 36rpx;
  273. font-family: PingFang SC;
  274. font-weight: bold;
  275. color: #fffeff;
  276. height: 80rpx;
  277. font-size: 36rpx;
  278. font-weight: 700;
  279. z-index: 9;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. }
  284. .goback-box {
  285. position: absolute;
  286. left: 18rpx;
  287. top: 0;
  288. height: 80rpx;
  289. display: flex;
  290. align-items: center;
  291. }
  292. .goback {
  293. z-index: 100;
  294. width: 34rpx;
  295. height: 34rpx;
  296. }
  297. }
  298. }
  299. .info-box {
  300. width: 670rpx;
  301. height: 186rpx;
  302. background: #ffffff;
  303. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  304. border-radius: 20rpx;
  305. margin: -100rpx auto 0;
  306. position: relative;
  307. z-index: 2;
  308. .info-item {
  309. width: 50%;
  310. display: flex;
  311. flex-direction: column;
  312. align-items: center;
  313. line-height: 1;
  314. .info-font {
  315. font-size: 30rpx;
  316. font-family: PingFang SC;
  317. font-weight: bold;
  318. color: #999999;
  319. }
  320. .info-num {
  321. margin-top: 30rpx;
  322. font-size: 30rpx;
  323. font-family: PingFang SC;
  324. font-weight: bold;
  325. color: #181818;
  326. }
  327. }
  328. .shu {
  329. width: 2rpx;
  330. height: 74rpx;
  331. background: #dcdfe6;
  332. }
  333. }
  334. .money-box {
  335. position: relative;
  336. z-index: 2;
  337. /* #ifdef H5 */
  338. padding-top: 90rpx;
  339. /* #endif */
  340. color: #ffffff;
  341. text-align: center;
  342. /* #ifdef APP-PLUS */
  343. height: 200rpx;
  344. display: flex;
  345. flex-direction: column;
  346. justify-content: center;
  347. /* #endif */
  348. /* #ifdef MP-WEIXIN */
  349. padding-top: 40rpx;
  350. /* #endif */
  351. .money {
  352. font-size: 72rpx;
  353. font-family: PingFang SC;
  354. font-weight: bold;
  355. color: #ffffff;
  356. }
  357. .text {
  358. font-size: 30rpx;
  359. }
  360. }
  361. .moneybtn-box {
  362. display: flex;
  363. justify-content: space-between;
  364. position: relative;
  365. z-index: 2;
  366. color: #ffffff;
  367. padding: 0rpx 50rpx;
  368. font-size: 30rpx;
  369. font-family: PingFang SC;
  370. font-weight: bold;
  371. color: #ffffff;
  372. }
  373. .navbar {
  374. margin-top: 20rpx;
  375. display: flex;
  376. height: 88rpx;
  377. padding: 0 5px;
  378. background: #fff;
  379. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  380. position: relative;
  381. z-index: 10;
  382. .nav-item {
  383. flex: 1;
  384. display: flex;
  385. justify-content: center;
  386. align-items: center;
  387. height: 100%;
  388. font-size: 15px;
  389. color: #999999;
  390. position: relative;
  391. &.current {
  392. color: #000;
  393. &:after {
  394. content: '';
  395. position: absolute;
  396. left: 50%;
  397. bottom: 0;
  398. transform: translateX(-50%);
  399. width: 44px;
  400. height: 0;
  401. border-bottom: 2px solid #fe5b38;
  402. }
  403. }
  404. }
  405. }
  406. //列表
  407. .swiper-box {
  408. .order-item:last-child {
  409. margin-bottom: 60rpx;
  410. }
  411. .order-item {
  412. padding: 20rpx 30rpx;
  413. line-height: 1.5;
  414. .title-box {
  415. .title {
  416. font-size: $font-lg;
  417. color: $font-color-base;
  418. }
  419. .time {
  420. font-size: $font-base;
  421. color: $font-color-light;
  422. }
  423. }
  424. .money {
  425. color: #fd5b23;
  426. font-size: $font-lg;
  427. text-align: right;
  428. .status {
  429. color: $font-color-light;
  430. }
  431. }
  432. }
  433. }
  434. .list-scroll-content {
  435. background: #ffffff;
  436. height: 100%;
  437. }
  438. .content {
  439. height: 100%;
  440. .empty-content {
  441. background-color: #ffffff;
  442. }
  443. }
  444. .btn-box {
  445. width: 674rpx;
  446. height: 88rpx;
  447. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  448. border-radius: 44rpx;
  449. font-size: 36rpx;
  450. font-family: PingFang SC;
  451. font-weight: 500;
  452. color: #ffffff;
  453. text-align: center;
  454. line-height: 88rpx;
  455. position: fixed;
  456. bottom: 48rpx;
  457. left: 0;
  458. right: 0;
  459. margin: 0 auto;
  460. }
  461. </style>