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