award.vue 9.9 KB

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