scoreAccumulate.vue 9.0 KB

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