qudou.vue 9.6 KB

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