jf.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="content-money">
  5. <view class="status_bar"><!-- 这里是状态栏 --></view>
  6. <view class="body-title">
  7. <view class="goback-box" @click="toBack"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  8. <view class="header">我的贡献值</view>
  9. </view>
  10. <view class="content-bg"><image src="../../static/img/tg-bg.png" mode=""></image></view>
  11. <view class="money-box">
  12. <view class="money">{{ userInfo.point | getMoneyStyle }}</view>
  13. <view>贡献值</view>
  14. </view>
  15. <view class="moneybtn-box">
  16. <view class="money-btn" style="text-decoration: underline;"></view>
  17. <view class="money-btn" ></view>
  18. </view>
  19. </view>
  20. </view>
  21. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300" @change="changeTab" disable-touch>
  22. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  23. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  24. <!-- 空白页 -->
  25. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  26. <!-- 订单列表 -->
  27. <view class="order-item flex" v-for="(item, index) in tabItem.orderList" :key="index">
  28. <view class="title-box">
  29. <view class="title">
  30. <text>{{ item.title }}</text>
  31. </view>
  32. <view class="time">
  33. <text>{{ item.add_time }}</text>
  34. </view>
  35. </view>
  36. <view class="money">
  37. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  38. </view>
  39. </view>
  40. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  41. </scroll-view>
  42. </swiper-item>
  43. </swiper>
  44. </view>
  45. </template>
  46. <script>
  47. import { pointList } from '@/api/wallet.js';
  48. import { mapState, mapMutations } from 'vuex';
  49. import { getMoneyStyle } from '@/utils/rocessor.js';
  50. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  51. import empty from '@/components/empty';
  52. import { getUserInfo } from '@/api/user.js';
  53. export default {
  54. filters: {
  55. getMoneyStyle
  56. },
  57. computed: {
  58. ...mapState('user', ['userInfo'])
  59. },
  60. components: {
  61. empty,
  62. uniLoadMore
  63. },
  64. onReady(res) {
  65. var _this = this;
  66. uni.getSystemInfo({
  67. success: resu => {
  68. const query = uni.createSelectorQuery();
  69. query.select('.swiper-box').boundingClientRect();
  70. query.exec(function(res) {
  71. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  72. console.log('打印页面的剩余高度', _this.maxheight);
  73. });
  74. },
  75. fail: res => {}
  76. });
  77. },
  78. data() {
  79. return {
  80. // 头部图高度
  81. maxheight: '',
  82. tabCurrentIndex: 0,
  83. sr: '',
  84. zc: '',
  85. navList: [
  86. {
  87. state: 1,
  88. text: '收入',
  89. loadingType: 'more',
  90. orderList: [],
  91. page: 1, //当前页面
  92. limit: 10 //每次信息条数
  93. },
  94. {
  95. state: 0,
  96. text: '支出',
  97. loadingType: 'more',
  98. orderList: [],
  99. page: 1, //当前页面
  100. limit: 10 //每次信息条数
  101. }
  102. ],
  103. money: ''
  104. };
  105. },
  106. onLoad(options) {},
  107. onShow() {
  108. this.getUserInfo();
  109. this.loadData();
  110. //获取用户余额
  111. // userBalance({}).then(({ data }) => {
  112. // this.money = data.commissionCount;
  113. // });
  114. },
  115. methods: {
  116. ...mapMutations('user', ['setUserInfo']),
  117. navto(e) {
  118. uni.navigateTo({
  119. url: e
  120. });
  121. },
  122. getUserInfo() {
  123. getUserInfo({}).then(({ data }) => {
  124. this.setUserInfo(data);
  125. });
  126. },
  127. async loadData(source) {
  128. const obj = this;
  129. //这里时将订单挂载到tab列表下
  130. let index = this.tabCurrentIndex;
  131. let navItem = this.navList[index];
  132. let state = navItem.state ;
  133. if (source === 'tabChange' && navItem.loaded === true) {
  134. //tab切换只有第一次需要加载数据
  135. return;
  136. }
  137. if (navItem.loadingType === 'loading') {
  138. //防止重复加载
  139. return;
  140. }
  141. //修改当前对象状态为加载中
  142. navItem.loadingType = 'loading';
  143. pointList(
  144. {
  145. page: navItem.page,
  146. limit: navItem.limit,
  147. status: -1
  148. }
  149. )
  150. .then(({ data }) => {
  151. if (data.length > 0) {
  152. let arr = []
  153. data.forEach(item => {
  154. arr = arr.concat(item.list)
  155. console.log(arr);
  156. })
  157. navItem.orderList = navItem.orderList.concat(arr);
  158. // navItem.orderList = navItem.orderList.concat(data);
  159. // console.log(navItem.orderList);
  160. // navItem.page++;
  161. }
  162. //判断是否还有数据, 有改为more, 没有改为noMore
  163. if (navItem.limit == data.length) {
  164. navItem.loadingType = 'more';
  165. } else {
  166. navItem.loadingType = 'noMore';
  167. }
  168. uni.hideLoading();
  169. this.$set(navItem, 'loaded', true);
  170. })
  171. .catch(e => {
  172. console.log(e);
  173. });
  174. },
  175. toBack() {
  176. uni.navigateBack();
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss">
  182. page {
  183. background: #f2f5f4;
  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: $base-color;
  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. .money-box {
  243. position: relative;
  244. z-index: 2;
  245. padding-top: 100rpx;
  246. color: $base-color;
  247. text-align: center;
  248. .money {
  249. font-size: 72rpx;
  250. font-family: PingFang SC;
  251. font-weight: bold;
  252. color: $base-color;
  253. }
  254. .text {
  255. font-size: 30rpx;
  256. }
  257. }
  258. .moneybtn-box {
  259. display: flex;
  260. justify-content: space-between;
  261. position: relative;
  262. z-index: 2;
  263. color: #ffffff;
  264. padding: 20rpx 50rpx;
  265. font-size: 30rpx;
  266. font-family: PingFang SC;
  267. font-weight: bold;
  268. color: #ffffff;
  269. }
  270. .navbar {
  271. margin-top: 25rpx;
  272. display: flex;
  273. height: 40px;
  274. padding: 0 5px;
  275. background: #fff;
  276. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  277. position: relative;
  278. z-index: 10;
  279. .nav-item {
  280. flex: 1;
  281. display: flex;
  282. justify-content: center;
  283. align-items: center;
  284. height: 100%;
  285. font-size: 15px;
  286. color: $font-color-dark;
  287. position: relative;
  288. &.current {
  289. color: #000;
  290. font-weight: bold;
  291. &:after {
  292. content: '';
  293. position: absolute;
  294. left: 50%;
  295. bottom: 0;
  296. transform: translateX(-50%);
  297. width: 44px;
  298. height: 0;
  299. border-bottom: 2px solid rgba(154, 94, 25, 1);
  300. }
  301. }
  302. }
  303. }
  304. //列表
  305. .swiper-box {
  306. .order-item {
  307. padding: 20rpx 30rpx;
  308. line-height: 1.5;
  309. .title-box {
  310. .title {
  311. font-size: $font-lg;
  312. color: $font-color-base;
  313. }
  314. .time {
  315. font-size: $font-base;
  316. color: $font-color-light;
  317. }
  318. }
  319. .money {
  320. color: rgba(239, 58, 85, 1);
  321. font-size: $font-lg;
  322. }
  323. }
  324. }
  325. .info-box {
  326. width: 670rpx;
  327. height: 186rpx;
  328. background: #ffffff;
  329. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  330. border-radius: 20rpx;
  331. margin: -100rpx auto 0;
  332. position: relative;
  333. z-index: 2;
  334. .info-item {
  335. width: 50%;
  336. display: flex;
  337. flex-direction: column;
  338. align-items: center;
  339. line-height: 1;
  340. .info-font {
  341. font-size: 30rpx;
  342. font-family: PingFang SC;
  343. font-weight: bold;
  344. color: #999999;
  345. }
  346. .info-num {
  347. margin-top: 30rpx;
  348. font-size: 30rpx;
  349. font-family: PingFang SC;
  350. font-weight: bold;
  351. color: #181818;
  352. }
  353. }
  354. .shu {
  355. width: 2rpx;
  356. height: 74rpx;
  357. background: #dcdfe6;
  358. }
  359. }
  360. .list-scroll-content {
  361. background-color: #ffffff;
  362. height: 100%;
  363. }
  364. .content {
  365. height: 100%;
  366. .empty-content {
  367. background-color: #ffffff;
  368. }
  369. }
  370. .btm-wrap {
  371. height: 140rpx;
  372. width: 750rpx;
  373. position: fixed;
  374. bottom: 0;
  375. left: 0;
  376. background-color: #fff;
  377. .btn {
  378. width: 674rpx;
  379. height: 88rpx;
  380. line-height: 88rpx;
  381. margin: auto;
  382. background: linear-gradient(-22deg, #9a5e19, #9a5e19);
  383. border-radius: 44rpx;
  384. text-align: center;
  385. font-size: 36rpx;
  386. font-family: PingFang SC;
  387. font-weight: 500;
  388. color: #ffffff;
  389. }
  390. }
  391. </style>