mytimes.vue 9.1 KB

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