award.vue 9.7 KB

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