consumption.vue 8.6 KB

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