gfz.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="content">
  3. <view class="" style="height: 20rpx;"></view>
  4. <view class="top-wrap">
  5. <view class="top-top flex">
  6. <view class="item ">
  7. <view class="val">
  8. {{pUser.holding_value}}
  9. </view>
  10. <view class="name">
  11. 个人共富值
  12. </view>
  13. </view>
  14. <view class="item">
  15. <view class="val">
  16. {{pUser.trem_holding_value}}
  17. </view>
  18. <view class="">
  19. 联盟共富值
  20. </view>
  21. </view>
  22. </view>
  23. <view class="flex top-btm">
  24. <view class="">
  25. 当前等级:{{ pUser.zero_level ? pUser.zero_level.name:'暂无' }}
  26. </view>
  27. <view class="">
  28. </view>
  29. </view>
  30. </view>
  31. <view class="navbar">
  32. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  33. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  34. </view>
  35. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300"
  36. @change="changeTab">
  37. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex" >
  38. <scroll-view scroll-y="true" class="good-content" @scrolltolower="loadData" :style="{ height: height }">
  39. <empty v-if="tabItem.loaded === true && tabItem.list.length === 0"></empty>
  40. <view>
  41. <view class="order-item flex" v-for="(item, index) in tabItem.list" :key="index">
  42. <view class="title-box">
  43. <view class="title">
  44. <text>{{ item.name }}</text>
  45. </view>
  46. <view class="time">
  47. <text>{{getTime(item.add_time) }}</text>
  48. </view>
  49. </view>
  50. <view class="money">
  51. <view>{{ item.holding_value }}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <uni-load-more :status="tabItem.loadingType" v-if="!(tabItem.list.length == 0 && tabItem.loaded)"></uni-load-more>
  56. </scroll-view>
  57. </swiper-item>
  58. </swiper>
  59. </view>
  60. </template>
  61. <script>
  62. import empty from '@/components/empty.vue'
  63. import {
  64. mapState,
  65. mapMutations
  66. } from 'vuex';
  67. import {
  68. getCardList,
  69. createPass,
  70. getGsList,
  71. passUser,
  72. passLst
  73. } from '@/api/zero.js'
  74. export default {
  75. components: {
  76. empty
  77. },
  78. data() {
  79. return {
  80. height: '',
  81. tabCurrentIndex: 0,
  82. pUser: {
  83. holding_value: 0,
  84. trem_holding_value: 0,
  85. zero_level: {
  86. name: ''
  87. }
  88. },
  89. navList: [{
  90. text: '个人',
  91. state: 1,
  92. loaded: false,
  93. list: [],
  94. page: 1,
  95. limit: 10,
  96. loadingType: 'more'
  97. },
  98. {
  99. text: '团队',
  100. state: 2,
  101. loaded: false,
  102. list: [],
  103. page: 1,
  104. limit: 10,
  105. loadingType: 'more'
  106. }
  107. ]
  108. }
  109. },
  110. onLoad() {
  111. },
  112. computed: {
  113. ...mapState('user', ['userInfo'])
  114. },
  115. onShow() {
  116. this.passUser()
  117. this.loadData()
  118. },
  119. onReachBottom() {
  120. },
  121. onReady() {
  122. var that = this;
  123. uni.getSystemInfo({
  124. success: resu => {
  125. const query = uni.createSelectorQuery();
  126. query.select('.swiper-box').boundingClientRect();
  127. query.exec(function(res) {
  128. that.height = resu.windowHeight - res[0].top + 'px';
  129. });
  130. },
  131. fail: res => {}
  132. });
  133. },
  134. methods: {
  135. getTime(time) {
  136. const num =13 - (time+'').length;
  137. let l = 1;//倍数
  138. for (let i = 0; i < num; i++) {
  139. l+='0';
  140. }
  141. // 重新解析为数字
  142. l = parseInt(l)
  143. const date = new Date(parseInt(time) * l);
  144. const year = date.getFullYear();
  145. const mon = date.getMonth() + 1;
  146. const day = date.getDate();
  147. const hours = date.getHours();
  148. const minu = date.getMinutes();
  149. const sec = date.getSeconds();
  150. return year + '-' + mon + '-' + day + ' ' + hours + ':' + minu + ':' + sec;
  151. },
  152. //swiper 切换
  153. changeTab(e) {
  154. this.tabCurrentIndex = e.target.current;
  155. this.loadData('tabChange');
  156. },
  157. //顶部tab点击
  158. tabClick(index) {
  159. this.tabCurrentIndex = index;
  160. },
  161. passUser() {
  162. passUser().then(res => {
  163. // console.log()
  164. this.pUser = res.data
  165. })
  166. },
  167. loadData() {
  168. let that = this;
  169. let item = that.navList[that.tabCurrentIndex]
  170. let qdata = {
  171. page: item.page,
  172. limit: item.limit
  173. }
  174. if (item.state == 1) {
  175. qdata.uid = that.userInfo.uid
  176. } else {
  177. qdata.sp_uid = that.userInfo.uid
  178. }
  179. if(item.loadingType == 'loading' || item.loadingType == 'noMore') {
  180. return
  181. }
  182. item.loadingType = 'loading'
  183. passLst(qdata).then(res => {
  184. console.log(res)
  185. let arr = res.data.result.list
  186. item.list = item.list.concat(arr)
  187. if(item.limit == arr.length) {
  188. item.page++
  189. item.loadingType = 'more'
  190. }else {
  191. item.loadingType = 'noMore'
  192. }
  193. item.loaded = true
  194. })
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .top-wrap {
  201. width: 690rpx;
  202. height: 320rpx;
  203. padding: 43rpx;
  204. padding-bottom: 0;
  205. background-color: #ebd4be;
  206. margin: auto;
  207. border-radius: 20rpx;
  208. text-align: center;
  209. font-size: 29rpx;
  210. font-weight: 400;
  211. color: #6E4019;
  212. .top-top {
  213. height: 200rpx;
  214. .item {
  215. flex-grow: 1;
  216. .val {
  217. font-size: 63rpx;
  218. font-weight: bold;
  219. }
  220. }
  221. }
  222. .top-btm {
  223. border-top: 1px solid #E3C5A8;
  224. view {
  225. flex-grow: 1;
  226. line-height: 80rpx;
  227. }
  228. }
  229. }
  230. .order-item {
  231. padding: 20rpx 30rpx;
  232. line-height: 1.5;
  233. .title-box {
  234. .title {
  235. font-size: $font-lg;
  236. color: $font-color-base;
  237. }
  238. .time {
  239. font-size: $font-base;
  240. color: $font-color-light;
  241. }
  242. }
  243. .money {
  244. color: #fd5b23;
  245. font-size: $font-lg;
  246. text-align: right;
  247. .status {
  248. color: $font-color-light;
  249. }
  250. }
  251. }
  252. .navbar {
  253. margin-top: 20rpx;
  254. display: flex;
  255. height: 88rpx;
  256. padding: 0 5px;
  257. background: #fff;
  258. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  259. position: relative;
  260. z-index: 10;
  261. .nav-item {
  262. flex: 1;
  263. display: flex;
  264. justify-content: center;
  265. align-items: center;
  266. height: 100%;
  267. font-size: 15px;
  268. color: #999999;
  269. position: relative;
  270. &.current {
  271. color: #000;
  272. &:after {
  273. content: '';
  274. position: absolute;
  275. left: 50%;
  276. bottom: 0;
  277. transform: translateX(-50%);
  278. width: 44px;
  279. height: 0;
  280. border-bottom: 2px solid $base-color;
  281. }
  282. }
  283. }
  284. }
  285. .swiper-box {
  286. background-color: #fff;
  287. }
  288. </style>