award.vue 9.7 KB

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