yongjin.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view> -->
  6. <view class="header">
  7. <image src="../../static/user/yongjin.png" mode=""></image>
  8. <view class="integral">
  9. {{ integral || '0.00' }}
  10. </view>
  11. <!-- <navigator url="/pages/money/conversionIntegral"><view class="right">转换USDT</view></navigator> -->
  12. </view>
  13. <view class="navbar">
  14. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  15. </view>
  16. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  17. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  18. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  19. <!-- 空白页 -->
  20. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  21. <!-- 订单列表 -->
  22. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  23. <view class="title-box">
  24. <view class="title">
  25. <text>{{ item.mark }}</text>
  26. </view>
  27. <view class="time">
  28. <text>{{ item.add_time }}</text>
  29. </view>
  30. </view>
  31. <view class="money">
  32. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  33. </view>
  34. </view>
  35. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  36. </scroll-view>
  37. </swiper-item>
  38. </swiper>
  39. <!-- <view class="button">
  40. <navigator url="/pages/user/integralTransforms" class="b-left">积分转账</navigator>
  41. <navigator url="/pages/user/exchangeIntegral" class="b-right">转换购物积分</navigator>
  42. </view> -->
  43. <button type="default" class="button">立即提现</button>
  44. </view>
  45. </template>
  46. <script>
  47. import { integrallist } from '@/api/functionalUnit.js';
  48. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  49. import empty from '@/components/empty';
  50. export default {
  51. components: {
  52. empty,
  53. uniLoadMore
  54. },
  55. onReady() {
  56. },
  57. data() {
  58. return {
  59. tabCurrentIndex: 0,
  60. navList: [
  61. {
  62. state: 0,
  63. text: '收入',
  64. loadingType: 'more',
  65. orderList: [],
  66. page: 1, //当前页数
  67. limit: 10 //每次信息条数
  68. },
  69. {
  70. state: 1,
  71. text: '支出',
  72. loadingType: 'more',
  73. orderList: [],
  74. page: 1, //当前页数
  75. limit: 10 //每次信息条数
  76. },
  77. ],
  78. };
  79. },
  80. onShow() {
  81. // 载入积分数据
  82. this.loadData();
  83. },
  84. methods: {
  85. // 页面跳转
  86. navto(e) {
  87. uni.navigateTo({
  88. url: e
  89. });
  90. },
  91. //获取收入支出信息
  92. async loadData(source) {
  93. //这里是将订单挂载到tab列表下
  94. let index = this.tabCurrentIndex;
  95. let navItem = this.navList[index];
  96. let state = navItem.state;
  97. if (source === 'tabChange' && navItem.loaded === true) {
  98. //tab切换只有第一次需要加载数据
  99. return;
  100. }
  101. if (navItem.loadingType === 'loading') {
  102. //防止重复加载
  103. return;
  104. }
  105. // 修改当前对象状态为加载中
  106. navItem.loadingType = 'loading';
  107. integrallist(
  108. {
  109. page: navItem.page,
  110. limit: navItem.limit
  111. },
  112. state
  113. )
  114. .then(({ data }) => {
  115. if (data.length > 0) {
  116. navItem.orderList = navItem.orderList.concat(data);
  117. navItem.page++;
  118. }
  119. if (navItem.limit == data.length) {
  120. //判断是否还有数据, 有改为 more, 没有改为noMore
  121. navItem.loadingType = 'more';
  122. return;
  123. } else {
  124. //判断是否还有数据, 有改为 more, 没有改为noMore
  125. navItem.loadingType = 'noMore';
  126. }
  127. uni.hideLoading();
  128. this.$set(navItem, 'loaded', true);
  129. })
  130. .catch(e => {
  131. console.log(e);
  132. });
  133. },
  134. //swiper 切换
  135. changeTab(e) {
  136. this.tabCurrentIndex = e.target.current;
  137. this.loadData('tabChange');
  138. },
  139. //顶部tab点击
  140. tabClick(index) {
  141. this.tabCurrentIndex = index;
  142. }
  143. },
  144. computed: {
  145. //积分
  146. integral() {
  147. return this.$store.state.user.userInfo.integral
  148. }
  149. },
  150. };
  151. </script>
  152. <style lang="scss">
  153. page {
  154. background: #ffffff;
  155. height: 100%;
  156. }
  157. .header {
  158. image {
  159. width: 100%;
  160. height: 400rpx;
  161. }
  162. .integral {
  163. width: 100%;
  164. text-align: center;
  165. position: absolute;
  166. top: 160rpx;
  167. color: #fff;
  168. font-size: 80rpx;
  169. font-weight: bold;
  170. }
  171. .right {
  172. position: absolute;
  173. top: 120rpx;
  174. right: 0;
  175. background-color: #fff;
  176. border-radius: 10rpx 0 0 10rpx;
  177. color: #438BED;
  178. padding: 5rpx 15rpx;
  179. font-size: 28rpx;
  180. }
  181. }
  182. .navbar {
  183. display: flex;
  184. height: 40px;
  185. padding: 0 5px;
  186. background: #fff;
  187. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  188. position: relative;
  189. z-index: 10;
  190. .nav-item {
  191. flex: 1;
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. height: 100%;
  196. font-size: 15px;
  197. color: $font-color-dark;
  198. position: relative;
  199. &.current {
  200. color: #438BED;
  201. &:after {
  202. content: '';
  203. position: absolute;
  204. left: 50%;
  205. bottom: 0;
  206. transform: translateX(-50%);
  207. width: 44px;
  208. height: 0;
  209. border-bottom: 2px solid #438BED;
  210. }
  211. }
  212. }
  213. }
  214. // 列表
  215. .swiper-box {
  216. height: calc(100% - 180rpx - 400rpx);
  217. padding-top: 10rpx;
  218. .order-item {
  219. padding: 20rpx 30rpx;
  220. line-height: 1.5;
  221. .title-box {
  222. .title {
  223. font-size: $font-lg;
  224. color: $font-color-base;
  225. }
  226. .time {
  227. font-size: $font-base;
  228. color: $font-color-light;
  229. }
  230. }
  231. .money {
  232. color: #EF3A55;
  233. font-size: $font-lg;
  234. }
  235. }
  236. }
  237. .list-scroll-content {
  238. height: 100%;
  239. }
  240. .content {
  241. height: 100%;
  242. .empty-content {
  243. height: 100%;
  244. background-color: #ffffff;
  245. }
  246. }
  247. .button {
  248. position: relative;
  249. bottom: 0;
  250. bottom: 50rpx;
  251. width: 674rpx;
  252. height: 88rpx;
  253. background: linear-gradient(90deg, #44BFEC, #438BED);
  254. border-radius: 44rpx;
  255. font-size: 36rpx;
  256. font-family: PingFang SC;
  257. font-weight: 500;
  258. color: #FFFFFF;
  259. }
  260. </style>