award.vue 9.5 KB

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