award.vue 10 KB

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