gfz.vue 6.2 KB

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