contribution.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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('/pages/user/user')"><image class="goback" src="../../static/img/fanhui.png" mode=""></image></view>
  7. <view class="header">我的贡献值</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/user/gxzbg.png" mode=""></image></view>
  10. <view class="money-box">
  11. <view class="money">{{userInfo.gx | getMoneyStyle}}</view>
  12. <view>贡献值余额</view>
  13. </view>
  14. <view class="money-btn" @click="navto('/pages/money/conversion')">
  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 ,gxlist} 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. gxlist(
  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(e) {
  197. uni.switchTab({
  198. url:e
  199. })
  200. }
  201. }
  202. };
  203. </script>
  204. <style lang="scss">
  205. page {
  206. background: #f1f1f1;
  207. height: 100%;
  208. }
  209. .status_bar {
  210. height: var(--status-bar-height);
  211. width: 100%;
  212. }
  213. .content-money {
  214. position: relative;
  215. height: 480rpx;
  216. .content-bg {
  217. position: absolute;
  218. top: 0;
  219. left: 0;
  220. right: 0;
  221. width: 750rpx;
  222. height: 480rpx;
  223. image {
  224. width: 100%;
  225. height: 100%;
  226. }
  227. }
  228. .body-title {
  229. height: 80rpx;
  230. text-align: center;
  231. font-size: 35rpx;
  232. position: relative;
  233. .header {
  234. position: absolute;
  235. left: 0;
  236. top: 0;
  237. width: 100%;
  238. font-size: 36rpx;
  239. font-family: PingFang SC;
  240. font-weight: bold;
  241. color: #fffeff;
  242. height: 80rpx;
  243. font-size: 36rpx;
  244. font-weight: 700;
  245. z-index: 9;
  246. display: flex;
  247. justify-content: center;
  248. align-items: center;
  249. }
  250. .goback-box {
  251. position: absolute;
  252. left: 18rpx;
  253. top: 0;
  254. height: 80rpx;
  255. display: flex;
  256. align-items: center;
  257. }
  258. .goback {
  259. z-index: 100;
  260. width: 20rpx;
  261. height: 37rpx;
  262. }
  263. }
  264. }
  265. .info-box {
  266. width: 670rpx;
  267. height: 186rpx;
  268. background: #ffffff;
  269. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  270. border-radius: 20rpx;
  271. margin: -100rpx auto 0;
  272. position: relative;
  273. z-index: 2;
  274. .info-item {
  275. width: 50%;
  276. display: flex;
  277. flex-direction: column;
  278. align-items: center;
  279. line-height: 1;
  280. .info-font {
  281. font-size: 30rpx;
  282. font-family: PingFang SC;
  283. font-weight: bold;
  284. color: #999999;
  285. }
  286. .info-num {
  287. margin-top: 30rpx;
  288. font-size: 30rpx;
  289. font-family: PingFang SC;
  290. font-weight: bold;
  291. color: #181818;
  292. }
  293. }
  294. .shu {
  295. width: 2rpx;
  296. height: 74rpx;
  297. background: #dcdfe6;
  298. }
  299. }
  300. .money-box {
  301. position: relative;
  302. z-index: 2;
  303. padding-top: 90rpx;
  304. color: #ffffff;
  305. text-align: center;
  306. .money {
  307. font-size: 72rpx;
  308. font-family: PingFang SC;
  309. font-weight: bold;
  310. color: #ffffff;
  311. }
  312. .text {
  313. font-size: 30rpx;
  314. }
  315. }
  316. .money-btn {
  317. position: relative;
  318. z-index: 2;
  319. color: #ffffff;
  320. padding-right: 50rpx;
  321. text-align: right;
  322. font-size: 30rpx;
  323. font-family: PingFang SC;
  324. font-weight: bold;
  325. color: #FFFFFF;
  326. margin-top: 70rpx;
  327. text {
  328. display: inline-block;
  329. padding-left: 10rpx;
  330. }
  331. }
  332. .navbar {
  333. margin-top: 20rpx;
  334. display: flex;
  335. height: 88rpx;
  336. padding: 0 5px;
  337. background: #fff;
  338. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  339. position: relative;
  340. z-index: 10;
  341. .nav-item {
  342. flex: 1;
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. height: 100%;
  347. font-size: 15px;
  348. color: #999999;
  349. position: relative;
  350. &.current {
  351. color: #000;
  352. &:after {
  353. content: '';
  354. position: absolute;
  355. left: 50%;
  356. bottom: 0;
  357. transform: translateX(-50%);
  358. width: 44px;
  359. height: 0;
  360. border-bottom: 2px solid #fe5b38;
  361. }
  362. }
  363. }
  364. }
  365. //列表
  366. .swiper-box {
  367. .order-item:last-child {
  368. margin-bottom: 60rpx;
  369. }
  370. .order-item {
  371. padding: 20rpx 30rpx;
  372. line-height: 1.5;
  373. .title-box {
  374. .title {
  375. font-size: $font-lg;
  376. color: $font-color-base;
  377. }
  378. .time {
  379. font-size: $font-base;
  380. color: $font-color-light;
  381. }
  382. }
  383. .money {
  384. color: #fd5b23;
  385. font-size: $font-lg;
  386. text-align: right;
  387. .status {
  388. color: $font-color-light;
  389. }
  390. }
  391. }
  392. }
  393. .list-scroll-content {
  394. background: #ffffff;
  395. height: 100%;
  396. }
  397. .content {
  398. height: 100%;
  399. .empty-content {
  400. background-color: #ffffff;
  401. }
  402. }
  403. .btn-box {
  404. width: 674rpx;
  405. height: 88rpx;
  406. background: linear-gradient(0deg, #2e58ff, #32c6ff);
  407. border-radius: 44rpx;
  408. font-size: 36rpx;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. color: #ffffff;
  412. text-align: center;
  413. line-height: 88rpx;
  414. position: fixed;
  415. bottom: 48rpx;
  416. left: 0;
  417. right: 0;
  418. margin: 0 auto;
  419. }
  420. </style>