myteam.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="content">
  3. <view class="user-top">
  4. <!-- <view class="select-time">
  5. <picker mode="date" @change="bindDateChange" fields="month">
  6. <view class="uni-input">{{showdate}}</view>
  7. </picker>
  8. <image src="../../static/img/downjian.png" mode="widthFix"></image>
  9. </view> -->
  10. <view class="top-val">
  11. {{count}}
  12. </view>
  13. <view class="top-tit">
  14. 转介绍人数
  15. </view>
  16. </view>
  17. <!-- <view class="sz-wrap">
  18. <view class="sz-item">
  19. <view class="sz-tit">
  20. 上月收入
  21. </view>
  22. <view class="sz-val">
  23. 200
  24. </view>
  25. </view>
  26. <view class="jg">
  27. </view>
  28. <view class="sz-item">
  29. <view class="sz-tit">
  30. 累计收入
  31. </view>
  32. <view class="sz-val">
  33. 200
  34. </view>
  35. </view>
  36. </view> -->
  37. <!-- <view class="navbar">
  38. <view v-for="(item, index) in navlist" :key="index" class="nav-item"
  39. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  40. </view> -->
  41. <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300" disable-touch>
  42. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navlist" :key="tabIndex">
  43. <scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
  44. <!-- 空白页 -->
  45. <u-empty text="暂无数据" mode="list" v-if="tabItem.loaded && tabItem.list.length == 0"></u-empty>
  46. <!-- 订单列表 -->
  47. <view class="order-item" v-for="(item, index) in tabItem.list" :key="index">
  48. <image :src="item.avatar" mode="" class="logo"></image>
  49. <view class="title-box">
  50. <view class="title">
  51. <!-- <text>{{ item.mark }}</text> -->
  52. {{item.name}}
  53. </view>
  54. <view class="time">
  55. <!-- <text>{{ item.create_time }}</text> -->
  56. {{$utils.formatDate(item.createTime)}}
  57. </view>
  58. </view>
  59. <!-- <view class="money" @click="goPage('/pagesS/yg/fcxq')">
  60. <view>{{ (item.pm == 0 ? '-' : '+') + 1500 }}</view>
  61. <image src="../../static/img/downright.png" mode=""></image>
  62. </view> -->
  63. </view>
  64. <u-loadmore :status="tabItem.loadingType" />
  65. </scroll-view>
  66. </swiper-item>
  67. </swiper>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. count: 0,
  75. showdate: '',
  76. tabCurrentIndex: 0,
  77. height: '',
  78. id: '',
  79. navlist: [{
  80. status: 0,
  81. title: '收入',
  82. list: [],
  83. page: 1,
  84. pageSize: 100,
  85. loaded: false,
  86. loadingType: 'loadmore'
  87. },
  88. {
  89. status: 1,
  90. title: '扣除',
  91. list: [],
  92. page: 1,
  93. pageSize: 100,
  94. loaded: false,
  95. loadingType: 'loadmore'
  96. }
  97. ]
  98. }
  99. },
  100. onLoad(opt) {},
  101. onShow() {
  102. this.loadData()
  103. },
  104. onReachBottom() {
  105. },
  106. onReady() {
  107. var _this = this;
  108. uni.getSystemInfo({
  109. success: resu => {
  110. const query = uni.createSelectorQuery();
  111. query.select('.swiper-box').boundingClientRect();
  112. query.exec(function(res) {
  113. _this.height = resu.windowHeight - res[0].top + 'px';
  114. console.log('打印页面的剩余高度', _this.height);
  115. });
  116. },
  117. fail: res => {}
  118. });
  119. },
  120. methods: {
  121. //顶部tab点击
  122. tabClick(index) {
  123. this.tabCurrentIndex = index;
  124. this.loadData('tab')
  125. },
  126. // 选择年月
  127. bindDateChange(e) {
  128. let time = e.detail.value.split('-')
  129. this.showdate = time[0] + '年' + time[1] + '月'
  130. this.loadData('reload')
  131. },
  132. // 获取当前年月
  133. getTime() {
  134. let date = new Date()
  135. this.showdate = date.getFullYear() + '年' + (date.getMonth() + 1) + '月'
  136. this.loadData()
  137. },
  138. // 获取数据
  139. loadData(type) {
  140. let that = this
  141. let index = that.tabCurrentIndex
  142. let item = that.navlist[index]
  143. if (type == 'reload') {
  144. item.loaded = false
  145. item.loadingType = 'loadmore'
  146. item.page = 1
  147. item.list = []
  148. }
  149. if (type == 'tab' && item.loaded) {
  150. return
  151. }
  152. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  153. return
  154. }
  155. item.loadingType = 'loading'
  156. that.$u.api.referral({
  157. page: item.page,
  158. pageSize: item.pageSize
  159. }).then(res => {
  160. that.count = res.count
  161. if (res.data.length > 0) {
  162. item.list = item.list.concat(res.data)
  163. }
  164. item.page++
  165. item.loaded = true
  166. if (item.pageSize == res.data.length) {
  167. item.loadingType = 'loadmore'
  168. } else {
  169. item.loadingType = 'nomore'
  170. }
  171. that.count = res.count
  172. })
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss">
  178. .user-top {
  179. width: 100%;
  180. height: 400rpx;
  181. background-color: #4075d6;
  182. display: flex;
  183. flex-direction: column;
  184. justify-content: center;
  185. align-items: center;
  186. padding-bottom: 60rpx;
  187. // position: relative;
  188. .top-tit {
  189. font-size: 30rpx;
  190. font-weight: bold;
  191. color: #FFFFFF;
  192. }
  193. .top-val {
  194. font-size: 72rpx;
  195. font-weight: 500;
  196. color: #FFFFFF;
  197. }
  198. .select-time {
  199. position: absolute;
  200. top: 30rpx;
  201. right: 30rpx;
  202. font-size: 26rpx;
  203. font-weight: 500;
  204. color: #fff;
  205. display: flex;
  206. align-items: center;
  207. image {
  208. width: 17rpx;
  209. margin-left: 10rpx;
  210. }
  211. }
  212. }
  213. .sz-wrap {
  214. width: 670rpx;
  215. height: 186rpx;
  216. background: #FFFFFF;
  217. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  218. border-radius: 20rpx;
  219. margin: -90rpx auto 20rpx;
  220. display: flex;
  221. justify-content: center;
  222. align-items: center;
  223. .jg {
  224. width: 2rpx;
  225. height: 74rpx;
  226. background: #DCDFE6;
  227. }
  228. .sz-item {
  229. width: 330rpx;
  230. height: 100%;
  231. display: flex;
  232. flex-direction: column;
  233. align-items: center;
  234. justify-content: center;
  235. font-size: 30rpx;
  236. font-weight: bold;
  237. .sz-tit {
  238. color: #999999;
  239. }
  240. .sz-val {
  241. margin-top: 30rpx;
  242. color: #181818;
  243. }
  244. }
  245. }
  246. .navbar {
  247. margin-top: 20rpx;
  248. display: flex;
  249. height: 88rpx;
  250. padding: 0 5px;
  251. background: #fff;
  252. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  253. position: relative;
  254. z-index: 10;
  255. .nav-item {
  256. flex: 1;
  257. display: flex;
  258. justify-content: center;
  259. align-items: center;
  260. height: 100%;
  261. font-size: 15px;
  262. color: #999999;
  263. position: relative;
  264. &.current {
  265. color: #000;
  266. &:after {
  267. content: '';
  268. position: absolute;
  269. left: 50%;
  270. bottom: 0;
  271. transform: translateX(-50%);
  272. width: 44px;
  273. height: 0;
  274. border-bottom: 2px solid #fe5b38;
  275. }
  276. }
  277. }
  278. }
  279. //列表
  280. .swiper-box {
  281. margin-top: 20rpx;
  282. padding: 0 20rpx;
  283. background-color: #fff;
  284. .order-item:last-child {
  285. margin-bottom: 60rpx;
  286. }
  287. .order-item {
  288. width: 100%;
  289. // background-color: red;
  290. padding: 20rpx 30rpx;
  291. line-height: 1.5;
  292. display: flex;
  293. align-items: center;
  294. border-bottom: 1rpx solid #F0F0F0;
  295. .logo {
  296. flex-shrink: 0;
  297. margin-right: 20rpx;
  298. width: 80rpx;
  299. height: 80rpx;
  300. border-radius: 50%;
  301. background-color: #eee;
  302. }
  303. .title-box {
  304. flex-grow: 1;
  305. padding-right: 50rpx;
  306. .title {
  307. font-size: 30rpx;
  308. color: #333333;
  309. }
  310. .time {
  311. font-size: 26rpx;
  312. color: #AEAEAE;
  313. }
  314. }
  315. .money {
  316. color: #fd5b23;
  317. min-width: 150rpx;
  318. font-size: 26rpx;
  319. text-align: right;
  320. display: flex;
  321. align-items: center;
  322. justify-content: flex-end;
  323. image {
  324. width: 10rpx;
  325. height: 20rpx;
  326. margin-left: 15rpx;
  327. }
  328. .status {
  329. color: #AEAEAE;
  330. }
  331. }
  332. }
  333. }
  334. .list-scroll-content {
  335. background: #ffffff;
  336. height: 100%;
  337. }
  338. </style>