hwq 4 years ago
parent
commit
52b97b61fd
4 changed files with 73 additions and 14 deletions
  1. 9 0
      api/user.js
  2. 28 6
      pages/index/index.vue
  3. 36 8
      pages/user/promotion.vue
  4. BIN
      static/img/index/index1.png

+ 9 - 0
api/user.js

@@ -36,3 +36,12 @@ export function children(data,id) {
 		data
 	});
 }
+
+//查看推荐下级
+export function spread_children(data,id) {
+	return request({
+		url:'/api/user/spread_children/' + id,
+		method:'get',
+		data
+	});
+}

+ 28 - 6
pages/index/index.vue

@@ -22,6 +22,13 @@
 				</view>
 			</view>
 		</view>
+		<view class="index1">
+			<image src="../../static/img/index/index1.png" mode=""></image>
+			<view class="bottom">
+				
+			</view>
+		</view>
+		
 	</view>
 </template>
 <script>
@@ -88,18 +95,15 @@ page {
 }
 
 .content {
-	display: flex;
 	position: relative;
+	display: flex;
 	flex-direction: column;
 	.bg {
-		position: absolute;
 		width: 100%;
-		height: 6000rpx;
+		height: 1480rpx ;
 	}
 	.box {
-		margin-top: 1480rpx;
-	}
-
+z-index: 100;
 	.discounts {
 		margin: 0 30rpx;
 		display: flex;
@@ -185,5 +189,23 @@ page {
 			}
 		}
 	}
+	}
+
+.index1{
+	position: absolute;
+	bottom: -400rpx;
+	width: 100%;
+	height: 713rpx;
+	image{
+		width: 100%;
+		height: 100%;
+	}
+	.bottom{
+		width: 100%;
+		height: 100rpx;
+		position: absolute;
+	}
+}
+
 }
 </style>

+ 36 - 8
pages/user/promotion.vue

@@ -10,7 +10,7 @@
 				<view class="text">我的推广人数</view>
 			</view>
 		</view>
-		<view class="navbar flex">
+		<!-- <view class="navbar flex">
 			<view class="nav-item">
 				<view class="num">5</view>
 				<view class="font">奖励层数</view>
@@ -20,11 +20,11 @@
 				<view class="num">120</view>
 				<view class="font">成交人数</view>
 			</view>
-		</view>
+		</view> -->
 		<view class="swiper-box" :style="{ height: maxheight + 'px' }">
 			<scroll-view scroll-y="true" class="list-scroll-content" @scrolltolower="loadData">
 				<!-- 空白页 -->
-				<empty v-if="loaded === true && list.length === 0"></empty>
+				<!-- <empty v-if="list.length === 0"></empty> -->
 
 				<!-- 订单列表 -->
 				<view class="order-item flex" v-for="(item, index) in list" :key="index">
@@ -47,9 +47,9 @@
 </template>
 
 <script>
-import { spreadCommission, userBalance } from '@/api/wallet.js';
+import { spread_children } from '@/api/user.js';
 import { mapState, mapMutations } from 'vuex';
-import { getMoneyStyle } from '@/utils/rocessor.js';
+import { getMoneyStyle, getTime } from '@/utils/rocessor.js';
 import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 import empty from '@/components/empty';
 export default {
@@ -82,14 +82,42 @@ export default {
 			tabCurrentIndex: 0,
 			all: '100',
 			list: '',
-			loadingType: 'more'
+			loadingType: 'more',
+			limit: 10,
+			page: 1,
+			id: ''
 		};
 	},
 	onLoad(options) {},
 	onShow() {
-		// this.loadData();
+		this.id = this.userInfo.id;
+		this.loadData();
+	},
+	computed: {
+		...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
 	},
 	methods: {
+		loadData() {
+			const obj = this;
+			if (obj.loadingType == 'nomore' || obj.loadingType == 'loading') {
+				return;
+			}
+			obj.loadingType == 'loading';
+			spread_children({ limit: obj.limit, page: obj.page }, obj.id).then(({ data }) => {
+				console.log(data);
+				data.forEach(e => {
+					e.time = getTime(e.createtime);
+				});
+				obj.list = obj.list.concat(data);
+				obj.page++;
+				if (data.length == obj.limit) {
+					console.log(data.length, obj.limit, obj.loadingType);
+					obj.loadingType == 'more';
+				} else {
+					obj.loadingType == 'nomore';
+				}
+			});
+		},
 		navto(e) {
 			uni.navigateTo({
 				url: e
@@ -215,7 +243,7 @@ page {
 //列表
 
 .swiper-box {
-	padding-top: 10rpx;
+	padding-top: 80rpx;
 	.order-item {
 		padding: 20rpx 30rpx;
 		line-height: 1.5;

BIN
static/img/index/index1.png