spread.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <view class="content">
  3. <view class="wrap">
  4. <view class="top-wrap flex">
  5. <view class="">
  6. <view class="">
  7. {{all|| '0'}}
  8. </view>
  9. <view class="tit">
  10. 累计邀请
  11. </view>
  12. </view>
  13. <image src="../../static/img/yq.png" mode=""></image>
  14. </view>
  15. <view class="yq">
  16. <view class="ht"></view>
  17. <view class="info flex">
  18. <view class="">
  19. <view class="">
  20. 邀请好友
  21. </view>
  22. <view class="tit">
  23. 邀请更多好友获得更多奖励
  24. </view>
  25. </view>
  26. <view class="btn" @click="goYq">
  27. 去邀请
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="p-tit flex">
  33. <view class="line"></view>
  34. <view class="">推广列表</view>
  35. <view class="line"></view>
  36. </view>
  37. <swiper :current="tabCurrentIndex" :style="{ height: maxheight }" class="swiper-box" duration="300"
  38. @change="changeTab">
  39. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  40. <scroll-view class="list-scroll-content" :style="{ height: maxheight }" scroll-y
  41. @scrolltolower="loadData">
  42. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0" :style="{ height: maxheight }"></empty>
  43. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  44. <view class="title-box flex_item">
  45. <view class="title-avatar">
  46. <image :src="item.avatar"></image>
  47. </view>
  48. <view class="list_tpl">
  49. <view class="title">
  50. <view class="title-name clamp">{{ item.nickname }}</view>
  51. </view>
  52. <view class="time">
  53. <text>{{ item.vip ? item.vip_name : '' }}</text>
  54. </view>
  55. <view class="time">
  56. <text>{{ item.time }}</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  62. </scroll-view>
  63. </swiper-item>
  64. </swiper>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. mapState,
  70. mapMutations
  71. } from 'vuex';
  72. import empty from '@/components/empty';
  73. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  74. import {
  75. myspread,
  76. getLevelList,
  77. getUser
  78. } from '@/api/user.js';
  79. export default {
  80. components: {
  81. empty,
  82. uniLoadMore
  83. },
  84. onReady(res) {
  85. var _this = this;
  86. uni.getSystemInfo({
  87. success: resu => {
  88. const query = uni.createSelectorQuery();
  89. query.select('.swiper-box').boundingClientRect();
  90. query.exec(function(res) {
  91. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  92. console.log('打印页面的剩余高度', _this.height);
  93. });
  94. },
  95. fail: res => {}
  96. });
  97. },
  98. data() {
  99. return {
  100. all: 0,
  101. tabCurrentIndex: 0,
  102. maxheight: '',
  103. navList: [{
  104. state: 0,
  105. text: '直接推荐',
  106. loadingType: 'more',
  107. orderList: [],
  108. page: 1, //当前页数
  109. limit: 10 //每次信息条数
  110. },
  111. {
  112. state: 1,
  113. text: '间接推荐',
  114. loadingType: 'more',
  115. orderList: [],
  116. page: 1, //当前页数
  117. limit: 10 //每次信息条数
  118. }
  119. ],
  120. }
  121. },
  122. computed: {
  123. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  124. ...mapState(['baseURL'])
  125. },
  126. onLoad() {
  127. },
  128. onShow() {
  129. this.loadData();
  130. },
  131. onReachBottom() {
  132. },
  133. methods: {
  134. goYq() {
  135. uni.navigateTo({
  136. url: '/pages/user/shareQrCode'
  137. })
  138. },
  139. //获取收入支出信息
  140. async loadData(source) {
  141. //这里是将订单挂载到tab列表下
  142. let index = this.tabCurrentIndex;
  143. let navItem = this.navList[index];
  144. let state = navItem.state;
  145. if (source === 'tabChange' && navItem.loaded === true) {
  146. //tab切换只有第一次需要加载数据
  147. return;
  148. }
  149. if (navItem.loadingType === 'loading' || navItem.loadingType === 'noMore') {
  150. //防止重复加载
  151. return;
  152. }
  153. // 修改当前对象状态为加载中
  154. navItem.loadingType = 'loading';
  155. myspread({
  156. page: navItem.page,
  157. limit: navItem.limit,
  158. grade:state,
  159. uid: this.userInfo.uid
  160. })
  161. .then(({
  162. data
  163. }) => {
  164. console.log(data,'的');
  165. this.order = data.order
  166. this.zt_order = data.zt_order
  167. this.jt_order = data.jt_order
  168. this.all = data.total;
  169. // this.totalLevel = data.totalLevel
  170. if (data.list.length > 0) {
  171. this.list = data.list;
  172. navItem.orderList = navItem.orderList.concat(data.list);
  173. navItem.page++;
  174. }
  175. this.$nextTick(function() {
  176. if (navItem.limit == data.list.length) {
  177. //判断是否还有数据, 有改为 more, 没有改为noMore
  178. navItem.loadingType = 'more';
  179. return;
  180. } else {
  181. //判断是否还有数据, 有改为 more, 没有改为noMore
  182. navItem.loadingType = 'noMore';
  183. }
  184. });
  185. this.$set(navItem, 'loaded', true);
  186. })
  187. .catch(e => {
  188. navItem.loadingType = 'noMore'
  189. navItem.loaded = true
  190. console.log(e);
  191. });
  192. },
  193. }
  194. }
  195. </script>
  196. <style lang="scss" scoped>
  197. .wrap {
  198. width: 750rpx;
  199. background: linear-gradient(180deg, #3A79F6, #f8f8f8);
  200. padding-top: 60rpx;
  201. }
  202. .top-wrap {
  203. width: 674rpx;
  204. height: 186rpx;
  205. background-color: #fff;
  206. margin: auto;
  207. position: relative;
  208. border-radius: 20rpx 20rpx 0 0;
  209. font-weight: bold;
  210. font-size: 70rpx;
  211. color: #242424;
  212. padding: 0 50rpx 0 40rpx;
  213. .tit {
  214. font-weight: 500;
  215. font-size: 28rpx;
  216. color: #727272;
  217. }
  218. image {
  219. width: 217rpx;
  220. height: 192rpx;
  221. }
  222. }
  223. .ht {
  224. width: 702rpx;
  225. height: 46rpx;
  226. background:#B7C7E8;
  227. border-radius: 25rpx;
  228. }
  229. .yq {
  230. width: 702rpx;
  231. height: 202rpx;
  232. background: #f2f6ff;
  233. border-radius: 25rpx;
  234. margin: -46rpx auto 0;
  235. .info {
  236. height: 155rpx;
  237. padding: 0 50rpx 0 47rpx;
  238. font-weight: bold;
  239. font-size: 34rpx;
  240. color: #242424;
  241. .btn {
  242. width: 139rpx;
  243. line-height: 63rpx;
  244. border-radius: 10rpx;
  245. border: 1px solid #D9D7CA;
  246. font-weight: bold;
  247. font-size: 29rpx;
  248. color: #242424;
  249. text-align: center;
  250. }
  251. .tit {
  252. font-weight: 500;
  253. font-size: 24rpx;
  254. color: #81827D;
  255. padding-top: 15rpx;
  256. }
  257. }
  258. }
  259. .p-tit {
  260. justify-content: center;
  261. font-weight: 500;
  262. font-size: 30rpx;
  263. color: #333333;
  264. padding: 20rpx 0;
  265. .line {
  266. width: 43rpx;
  267. height: 1rpx;
  268. background: #D4D4D4;
  269. margin: 0 15rpx;
  270. }
  271. }
  272. .swiper-box {
  273. background-color: #fff;
  274. border-radius: 20rpx 20rpx 0 0;
  275. width: 702rpx;
  276. margin: auto;
  277. }
  278. .order-item {
  279. padding: 20rpx 30rpx;
  280. line-height: 1.5;
  281. // background-color: #fff;
  282. .title-box {
  283. width: 100%;
  284. .title-avatar {
  285. flex-shrink: 0;
  286. width: 100rpx;
  287. height: 100rpx;
  288. margin-right: 25rpx;
  289. border-radius: 100%;
  290. image {
  291. width: 100%;
  292. height: 100%;
  293. border-radius: 100%;
  294. }
  295. }
  296. .list_tpl {
  297. width: 85%;
  298. .title {
  299. display: flex;
  300. justify-content: flex-start;
  301. font-size: $font-lg;
  302. color: $font-color-base;
  303. overflow: hidden; //超出的文本隐藏
  304. text-overflow: ellipsis; //溢出用省略号显示
  305. white-space: nowrap;
  306. line-height: 1;
  307. text-align: center;
  308. .title-name {
  309. max-width: 40%;
  310. }
  311. .dl {
  312. margin-left: 10rpx;
  313. width: 93rpx;
  314. height: 32rpx;
  315. border-radius: 16rpx;
  316. image {
  317. width: 93rpx;
  318. height: 32rpx;
  319. border-radius: 16rpx;
  320. }
  321. }
  322. .class {
  323. display: inline-block;
  324. margin-left: 10rpx;
  325. padding: 6rpx;
  326. text-align: center;
  327. border: 1px solid #2e58ff;
  328. border-radius: 16rpx;
  329. font-size: 20rpx;
  330. font-family: PingFang SC;
  331. font-weight: 500;
  332. color: #2e58ff;
  333. }
  334. }
  335. .time {
  336. font-size: $font-lg;
  337. color: $font-color-light;
  338. }
  339. .star {
  340. justify-content: flex-start;
  341. image {
  342. width: 36rpx;
  343. height: 36rpx;
  344. }
  345. }
  346. }
  347. }
  348. .money {
  349. width: 50%;
  350. text-align: right;
  351. color: #db1935;
  352. font-size: $font-lg;
  353. }
  354. }
  355. </style>