award.vue 10 KB

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