bill.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar">
  5. </view>
  6. <view class="content-bg">
  7. <image src="/static/img/tg-bg.png" mode=""></image>
  8. </view>
  9. <view class="money-box">
  10. <view class="money">{{ userInfo.score|| '0' }}</view>
  11. <view>我的积分</view>
  12. </view>
  13. <view class="money-box flex" style="padding:20rpx;" >
  14. <view style="flex-grow: 1;text-align: left;" @click="navto('/pages/user/jf/store')">积分商城</view>
  15. <view style="flex-grow: 1;text-align: right;" @click="navto('/pages/user/jf/jfcz')">充值积分</view>
  16. </view>
  17. </view>
  18. <view class="nav flex">
  19. <view class="nav-item" v-for="(item,index) in navList" @click="navClick(index)"
  20. :class="{'action': index == current}">
  21. {{item.tit}}
  22. </view>
  23. </view>
  24. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y @scrolltolower="loadData">
  25. <!-- <empty v-if="loaded === true && list.length === 0" :style="{ height: maxheight }"></empty> -->
  26. <view v-for="(item, index) in navList[current].list" :key="index" class="order-item flex">
  27. <view class="title-box flex_item">
  28. <view class="list_tpl">
  29. <view class="title">
  30. {{item.content || item.title }}
  31. </view>
  32. <view class="time">
  33. <text>{{ item.time }}</text>
  34. </view>
  35. </view>
  36. <view class="" style="color: #ff4173;">
  37. {{item.type == 1 ? '+': '-'}}{{item.v}}
  38. </view>
  39. </view>
  40. </view>
  41. <uni-load-more :status="loadingType"></uni-load-more>
  42. </scroll-view>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. mapState,
  48. mapMutations
  49. } from 'vuex';
  50. import {
  51. getChildList,
  52. getJfBill,
  53. getUserInfo
  54. } from '@/api/user.js'
  55. export default {
  56. onReady(res) {
  57. var _this = this;
  58. uni.getSystemInfo({
  59. success: resu => {
  60. const query = uni.createSelectorQuery();
  61. query.select('.list-scroll-content').boundingClientRect();
  62. query.exec(function(res) {
  63. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  64. });
  65. },
  66. fail: res => {}
  67. });
  68. },
  69. data() {
  70. return {
  71. current: 0,
  72. navList: [
  73. {
  74. tit: '收入',
  75. pm: 1,
  76. list: [],
  77. page: 1,
  78. loaded: false,
  79. loadingType: 'more',
  80. },
  81. {
  82. tit: '支出',
  83. pm: 0,
  84. list: [],
  85. page: 1,
  86. loaded: false,
  87. loadingType: 'more',
  88. },
  89. ],
  90. // 头部图高度
  91. maxheight: '',
  92. pageSize: 10,
  93. };
  94. },
  95. computed: {
  96. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  97. ...mapState(['baseURL'])
  98. },
  99. onLoad(options) {},
  100. onShow() {
  101. this.loadData();
  102. this.getUserInfo()
  103. },
  104. methods: {
  105. ...mapMutations('user',['setUserInfo']),
  106. getUserInfo() {
  107. getUserInfo().then(res => {
  108. this.setUserInfo(res.data)
  109. })
  110. },
  111. navClick(index) {
  112. this.current = index
  113. this.loadData('tab')
  114. },
  115. // 页面跳转
  116. navto(e) {
  117. uni.navigateTo({
  118. url: e
  119. });
  120. },
  121. //获取收入支出信息
  122. async loadData(source) {
  123. //这里是将订单挂载到tab列表下
  124. let that = this
  125. let items = that.navList[that.current]
  126. if(items.loadingType == 'loading' || items.loadingType == 'noMore') return;
  127. if( source == 'tab' && items.loaded) return;
  128. // 修改当前对象状态为加载中
  129. that.loadingType = 'loading';
  130. getJfBill({
  131. page: items.page,
  132. pageSize: that.pageSize,
  133. type: items.pm,
  134. uid: that.userInfo.uid
  135. })
  136. .then(({
  137. data
  138. }) => {
  139. // that.all = data.totalCount
  140. items.list = items.list.concat(data.list)
  141. items.page++
  142. if (that.pageSize == data.list.length) {
  143. //判断是否还有数据, 有改为 more, 没有改为noMore
  144. items.loadingType = 'more';
  145. } else {
  146. //判断是否还有数据, 有改为 more, 没有改为noMore
  147. items.loadingType = 'noMore';
  148. }
  149. that.$set(items, 'loaded', true);
  150. })
  151. .catch(e => {
  152. console.log(e);
  153. });
  154. },
  155. //swiper 切换
  156. changeTab(e) {
  157. this.tabCurrentIndex = e.target.current;
  158. this.loadData('tabChange');
  159. },
  160. //顶部tab点击
  161. tabClick(index) {
  162. this.tabCurrentIndex = index;
  163. },
  164. // 点击返回 我的页面
  165. toBack() {
  166. uni.switchTab({
  167. url: '/pages/user/user'
  168. });
  169. }
  170. }
  171. };
  172. </script>
  173. <style lang="scss">
  174. page {
  175. background: #f8f8f8;
  176. height: 100%;
  177. }
  178. .status_bar {
  179. height: var(--status-bar-height);
  180. width: 100%;
  181. background: #5dbc7c;
  182. }
  183. .content-money {
  184. position: relative;
  185. height: 480rpx;
  186. .content-bg {
  187. position: absolute;
  188. top: 0;
  189. left: 0;
  190. right: 0;
  191. width: 750rpx;
  192. height: 480rpx;
  193. image {
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. .body-title {
  199. height: 80rpx;
  200. text-align: center;
  201. font-size: 35rpx;
  202. position: relative;
  203. .header {
  204. position: absolute;
  205. left: 0;
  206. top: 0;
  207. width: 100%;
  208. font-size: 36rpx;
  209. font-family: PingFang SC;
  210. font-weight: bold;
  211. color: #fffeff;
  212. height: 80rpx;
  213. font-size: 36rpx;
  214. font-weight: 700;
  215. z-index: 9;
  216. display: flex;
  217. justify-content: center;
  218. align-items: center;
  219. }
  220. .goback-box {
  221. position: absolute;
  222. left: 18rpx;
  223. top: 0;
  224. height: 80rpx;
  225. display: flex;
  226. align-items: center;
  227. }
  228. .goback {
  229. z-index: 100;
  230. width: 34rpx;
  231. height: 34rpx;
  232. }
  233. }
  234. }
  235. .money-box {
  236. position: relative;
  237. z-index: 2;
  238. padding-top: 90rpx;
  239. color: #ffffff;
  240. text-align: center;
  241. .money {
  242. font-size: 72rpx;
  243. font-family: PingFang SC;
  244. font-weight: bold;
  245. color: #ffffff;
  246. }
  247. .text {
  248. font-size: 30rpx;
  249. }
  250. }
  251. .order-item {
  252. padding: 20rpx 30rpx;
  253. line-height: 1.5;
  254. background-color: #fff;
  255. .title-box {
  256. width: 100%;
  257. .title-avatar {
  258. flex-shrink: 0;
  259. width: 100rpx;
  260. height: 100rpx;
  261. margin-right: 25rpx;
  262. border-radius: 100%;
  263. image {
  264. width: 100%;
  265. height: 100%;
  266. border-radius: 100%;
  267. }
  268. }
  269. .list_tpl {
  270. width: 85%;
  271. .title {
  272. display: flex;
  273. justify-content: flex-start;
  274. font-size: $font-lg;
  275. color: $font-color-base;
  276. // overflow: hidden; //超出的文本隐藏
  277. // text-overflow: ellipsis; //溢出用省略号显示
  278. // white-space: nowrap;
  279. line-height: 1;
  280. // text-align: center;
  281. padding: 10rpx 20rpx 10rpx 0rpx;
  282. // font-size: b;
  283. font-weight: bold;
  284. // width: 60rpx;
  285. .title-name {
  286. max-width: 40%;
  287. }
  288. .dl {
  289. margin-left: 10rpx;
  290. width: 93rpx;
  291. height: 32rpx;
  292. border-radius: 16rpx;
  293. image {
  294. width: 93rpx;
  295. height: 32rpx;
  296. border-radius: 16rpx;
  297. }
  298. }
  299. .class {
  300. display: inline-block;
  301. margin-left: 10rpx;
  302. padding: 6rpx;
  303. text-align: center;
  304. border: 1px solid #2e58ff;
  305. border-radius: 16rpx;
  306. font-size: 20rpx;
  307. font-family: PingFang SC;
  308. font-weight: 500;
  309. color: #2e58ff;
  310. }
  311. }
  312. .time {
  313. font-size: $font-lg;
  314. color: $font-color-light;
  315. }
  316. }
  317. }
  318. .money {
  319. width: 50%;
  320. text-align: right;
  321. color: #db1935;
  322. font-size: $font-lg;
  323. }
  324. }
  325. .yeji {
  326. position: relative;
  327. margin: -72rpx auto 0;
  328. width: 690rpx;
  329. height: 143rpx;
  330. background: #ffffff;
  331. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  332. border-radius: 10rpx;
  333. display: flex;
  334. align-items: center;
  335. .yeji-a {
  336. width: 50%;
  337. display: flex;
  338. flex-direction: column;
  339. justify-content: center;
  340. align-items: center;
  341. .yeji-top {
  342. font-size: 28rpx;
  343. font-family: PingFang SC;
  344. font-weight: bold;
  345. color: #333333;
  346. }
  347. .yeji-buttom {
  348. font-size: 42rpx;
  349. font-family: PingFang SC;
  350. font-weight: bold;
  351. color: #333333;
  352. }
  353. }
  354. .border {
  355. width: 1rpx;
  356. height: 51rpx;
  357. background: #dddddd;
  358. }
  359. }
  360. .navbar {
  361. margin-top: 20rpx;
  362. display: flex;
  363. height: 88rpx;
  364. padding: 0 5px;
  365. background: #fff;
  366. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  367. position: relative;
  368. z-index: 10;
  369. .nav-item {
  370. flex: 1;
  371. display: flex;
  372. justify-content: center;
  373. align-items: center;
  374. height: 100%;
  375. font-size: 15px;
  376. color: #999999;
  377. position: relative;
  378. &.current {
  379. color: #000;
  380. &:after {
  381. content: '';
  382. position: absolute;
  383. left: 50%;
  384. bottom: 0;
  385. transform: translateX(-50%);
  386. width: 44px;
  387. height: 0;
  388. border-bottom: 2px solid #fe5b38;
  389. }
  390. }
  391. }
  392. }
  393. .buttom-box {
  394. position: relative;
  395. background-color: #ffffff;
  396. text-align: center;
  397. padding: 30rpx 0;
  398. .buttom {
  399. flex-grow: 1;
  400. }
  401. .money {
  402. font-size: 32rpx;
  403. font-weight: bold;
  404. color: #ff4173;
  405. }
  406. .text {
  407. padding-bottom: 26rpx;
  408. font-size: 28rpx;
  409. font-weight: 500;
  410. color: #666666;
  411. &.current {
  412. border-bottom: 2px solid #ff4173;
  413. }
  414. }
  415. .icon {
  416. height: 50rpx;
  417. width: 48rpx;
  418. margin: 0 auto;
  419. .icon-img {
  420. width: 100%;
  421. height: 100%;
  422. }
  423. }
  424. }
  425. .nav {
  426. width: 750rpx;
  427. height: 88rpx;
  428. .nav-item {
  429. line-height: 88rpx;
  430. width: 50%;
  431. text-align: center;
  432. font-size: 30rpx;
  433. font-weight: 500;
  434. color: #333333;
  435. height: 100%;
  436. }
  437. .action {
  438. font-weight: bold;
  439. position: relative;
  440. &::after {
  441. content: '';
  442. width: 50rpx;
  443. height: 6rpx;
  444. background: #ff4173;
  445. border-radius: 3rpx;
  446. position: absolute;
  447. left: 0;
  448. right: 0;
  449. bottom: 6rpx;
  450. margin: auto;
  451. }
  452. }
  453. background-color: #fff;
  454. }
  455. </style>