award.vue 11 KB

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