<template>
	<view>
		<view class="goodsManageList">
			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item.id)">
				<view class="top">
					<view class="title omit">{{ item.shopName }}</view>
					<!-- <view class="state">
						<text style="color: lightskyblue;font-weight: bold;" @click="detail(item.id)">详情></text>
					</view> -->
					<view class="clear"></view>
				</view>
				<view class="con">
					<view style="float: left;margin-right: 10px;">铺主：{{item.ownerName}}</view>
					<view style="">编号：{{item.shopNo}}</view>
					<view class="tradeAreaName">{{ item.tradeAreaName }}</view>
				</view>
				<view class="clear"></view>
			</view>
			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				loadMore: true,
				param: { pageNo: 1, pageSize: 10 },
			}
		},
		onLoad() {
			this.getData();
		},
		methods: {
			getData() {
				this.http.request({
					url: '/level-one-server/app/TbShop/getAppList',
					success: res=> {
						this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
						this.list.push(...res.data.data);
					}
				})
			},
			detail(id) {
				uni.navigateTo({ url: '/pages/shop/detail?id=' + id });
			},
			//刷新数据
			refresh() {
				this.loadMore = true;
				this.param.pageNo = 1;
				this.list = [];
				this.getData();
			}
		},
		//下拉刷新
		onPullDownRefresh() {
			setTimeout(() => {
				this.refresh();
				uni.stopPullDownRefresh();
			}, 1000);
		},
		//上拉加载
		onReachBottom() {
			if (this.loadMore) {
				this.param.pageNo++;
				this.getData();
			}
		}
	}
</script>

<style>

</style>
