<template>
	<div class="app-content">
		<view class="list-box">
			<view v-if="!$util.isEmpty(list.data)">
				<view class="flex list" v-for="(item, index) in list.data" :key="index">
						<image :src="item.avatar"></image>
					<view class="list-msg">
							<view>{{item.name}}</view>
							<text>已采购 {{item.expendAmount}}</text>
					</view>
				</view>
			</view>
			<block v-else>
				<app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
			</block>
		</view>
    <kd-entrance></kd-entrance>
	</div>
</template>
<script>
	import { getList } from "@/api/ghs"
	import AppWrapperEmpty from '@/components/app-wrapper-empty'
	import { list } from '@/mixins'
	export default {
		components: {AppWrapperEmpty,},
		name: 'ghs-shop',
		mixins: [list],
		data() {
			return {
			}
		},
		onLoad() {
		},
		onShow() {

		},
		onPullDownRefresh() {
			this.resetList()
			this._list().then(res => {
				uni.stopPullDownRefresh()
			})
		},
		onReachBottom() {
			if (!this.list.finished) {
				this._list().then(res => {
					uni.stopPullDownRefresh()
				})
			} else {
				uni.stopPullDownRefresh()
			}
		},
		methods: {
			async init() {
				this._list()
			},
			_list(){
				return getList({ type: 0 }).then(res => {
					this.completes(res)
				});
			}
		}
	}
</script>
<style lang="scss" scoped>
	.app-content{
		.flex{display: flex;align-items: center;}
		.flex-center{display: flex;align-items: center;justify-content: center}
		.flex-space{display: flex;align-items: center;justify-content: space-between}
		.flex-end{display: flex;align-items: center;justify-content: flex-end}
		.list-box{
			padding: 20rpx;
			.list{
				background: #ffffff;
				padding: 20rpx;
				margin-bottom: 20rpx;
				border-radius: 20rpx;
				image{
					width: 100rpx;
					height: 100rpx;
					margin-right: 20rpx;
					border-radius: 50%;
				}
				.list-msg{
					line-height: 1;
					font-size: 32rpx;
					font-weight: 700;
					view{
						margin-bottom: 20rpx;
					}
					text{
						font-size: 24rpx;
						font-weight: 500;
						color: #949494;
					}
				}
			}
		}
	}
</style>
