myggz.vue 8.5 KB

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