integral.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="container">
  3. <!-- 头部 -->
  4. <view class="header">
  5. <image src="../../static/img/img38.png" mode="scaleToFill"></image>
  6. <view class="money">3852</view>
  7. </view>
  8. <!-- 收入和支出 -->
  9. <view class="navbar">
  10. <view class="nav-item" v-for="(item, index) in navList" :key="index"
  11. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  12. </view>
  13. <swiper class="swiper-box" :current="tabCurrentIndex" duration="300" @change="changeTab">
  14. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  15. <!-- 空白页 -->
  16. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  17. <!-- 推广奖励 -->
  18. <scroll-view class="scorll" scroll-y="true">
  19. <view class="cost">
  20. <view class="award" v-for="item in tabItem ">
  21. <view class="award-left">
  22. <view class="text">消费赠送</view>
  23. <view class="time">2021-8-26 09:30</view>
  24. </view>
  25. <view class="award-right">+200</view>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </swiper-item>
  30. </swiper>
  31. </view>
  32. </template>
  33. <script>
  34. // 组件
  35. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  36. import empty from '@/components/empty';
  37. //接口
  38. import { integral } from '@/api/wallet.js';
  39. export default {
  40. components: {
  41. empty,
  42. uniLoadMore
  43. },
  44. data() {
  45. return {
  46. height: '',
  47. tabCurrentIndex: 0,
  48. navList: [
  49. {
  50. state: 0,
  51. text: '收入',
  52. loadingType: 'more',
  53. orderList: [],
  54. page: 1, //当前页数
  55. limit: 10 //每次信息条数
  56. },
  57. {
  58. state: 1,
  59. text: '支出',
  60. loadingType: 'more',
  61. orderList: [],
  62. page: 1, //当前页数
  63. limit: 10 //每次信息条数
  64. }
  65. ],
  66. list: [],
  67. money: ''
  68. }
  69. },
  70. methods: {
  71. //swiper 切换
  72. changeTab(e) {
  73. this.tabCurrentIndex = e.target.current;
  74. this.loadData('tabChange')
  75. },
  76. //顶部tab点击
  77. tabClick(index) {
  78. this.tabCurrentIndex = index;
  79. },
  80. loadData(type) {
  81. let obj = this
  82. let index = obj.tabCurrentIndex
  83. let navItem = obj.navList[index]
  84. if(navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
  85. return
  86. }
  87. if(type == 'tabChange' && navItem.loaded == 'loaded') {
  88. return
  89. }
  90. navItem.loadingType == 'loading';
  91. integral({
  92. page: navItem.page,
  93. limit: navItem.limit
  94. },navItem.state).then( res => {
  95. console.log(res)
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .container {
  103. width: 750rpx;
  104. height: 1334rpx;
  105. background-color: #f1f1f1;
  106. .header {
  107. position: relative;
  108. image {
  109. width: 750rpx;
  110. height: 400rpx;
  111. }
  112. .money {
  113. font-size: 72rpx;
  114. font-family: PingFang SC;
  115. font-weight: 500;
  116. color: #3F7C1F;
  117. position: absolute;
  118. top: 50%;
  119. left: 50%;
  120. transform: translate(-50% ,-50%);
  121. }
  122. }
  123. .swiper-box {
  124. height: calc(100% - 500rpx);
  125. background-color: #FFFFFF;
  126. }
  127. .scorll {
  128. height: 90%;
  129. }
  130. .navbar {
  131. display: flex;
  132. height: 100rpx;
  133. padding: 0 5rpx;
  134. background: #fff;
  135. box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.06);
  136. position: relative;
  137. z-index: 10;
  138. margin-top: 25rpx;
  139. .nav-item {
  140. flex: 1;
  141. display: flex;
  142. justify-content: center;
  143. align-items: center;
  144. height: 100%;
  145. font-size: 15px;
  146. color: #999999;
  147. position: relative;
  148. &.current {
  149. color: #333333;
  150. &:after {
  151. content: '';
  152. position: absolute;
  153. left: 50%;
  154. bottom: 0;
  155. transform: translateX(-50%);
  156. width: 44px;
  157. height: 0;
  158. border-bottom: 2px solid #3F7C1F;
  159. }
  160. }
  161. }
  162. }
  163. .cost {
  164. width: 750rpx;
  165. height: auto;
  166. background-color: #fff;
  167. .award {
  168. width: 701rpx;
  169. height: 132rpx;
  170. border-bottom: 1px solid #F0F4F8;
  171. margin-left: 25rpx;
  172. display: flex;
  173. justify-content: space-between;
  174. align-items: center;
  175. .award-left {
  176. width: 221rpx;
  177. height: 40rpx;
  178. margin-left: 30rpx;
  179. margin-bottom: 35rpx;
  180. .text {
  181. width: 182rpx;
  182. height: 30rpx;
  183. font-size: 30rpx;
  184. font-family: PingFang SC;
  185. font-weight: bold;
  186. color: #666666;
  187. margin-bottom: 16rpx;
  188. }
  189. .time {
  190. width: 221rpx;
  191. height: 20rpx;
  192. font-size: 26rpx;
  193. font-family: PingFang SC;
  194. font-weight: 500;
  195. color: #AEAEAE;
  196. }
  197. }
  198. .award-right {
  199. font-size: 36rpx;
  200. font-family: PingFang SC;
  201. font-weight: bold;
  202. color: #FF0000;
  203. margin-right: 30rpx;
  204. }
  205. }
  206. }
  207. }
  208. </style>