<template>
	<view  style="height: 100vh">
		<view class="content">
			<view class="dyquan-wrap" v-for="(item,index) in list" :key="index">
				<view class="showtime">
					<text class="float_left order-no-text">{{ item.card_name|| '' }}</text>
				</view>
				<view class="item-info" v-for="good in item.card" @click="goGoods(good)">
					<image :src="good.product.image" mode=""></image>
					<view class="info-info">
						<view class="clamp2">
							{{good.product.store_name || ''}}
						</view>
						<view class="info-cs">
							剩余使用次数：{{good.repertory || ''}}
						</view>
					</view>
				</view>
			</view>
			
			<view v-if="list.length == 0 && loadingType=='nomore'">
				<emptyPage title="暂无订单信息~"></emptyPage>
			</view>
		</view>
	</view>
</template>

<script>
	import { getMyServeList} from "@/api/user.js";
	import emptyPage from '@/components/emptyPage.vue';
	export default {
		components: {
			emptyPage
		},
		data() {
			return {
				page: 1,
				pageSize: 10,
				loaded: false,
				loadingType: 'more',
				list: []
			}
		},
		onLoad(opt) {

		},
		onShow() {
			// this.getList()
		},
		onReachBottom() {
			// this.getList()
		},
		onReady() {

		},
		methods: {
			goGoods(item) {
				console.log(item)
				uni.navigateTo({
					url:'/pages/goods_details/index?id=' + item.product_id
				})
			},
			tabClick(item, index) {
				this.tabCurrentIndex = index;
			},
			getList(type) {
				let that = this
				if (type == 'reload') {
					// item.list
					return
				}
				if (type == 'tab' && that.loaded) {
					return
				}
				if (that.loadingType == 'loading' || that.loadingType == 'nomore') {
					return
				}
				that.loadingType = 'loading'

				getMyServeList({
					page: that.page,
					limit: that.pageSize,
					name: ''
				}).then(({
					data
				}) => {
					that.list = that.list.concat(data.list)
					that.page++
					if (data.length == that.pageSize) {
						that.loadingType = 'more'
					} else {
						that.loadingType = 'nomore'
					}
				})

			}
		}
	}
</script>

<style lang="scss">
	.content {
		background-color:#f8f6f6 ;
		height: auto;
		min-height: 100%;
		
	}
	.dyquan-wrap {
		padding: 20rpx;
		background-color: #fff;
		margin-bottom: 15rpx;
		.showtime {
			height: 50rpx;
		}
		.item-info {
			width: 750rpx;
			height: 205rpx;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			
			image {
				width: 160rpx;
				height: 160rpx;
				margin-right: 30rpx;
			}

			.info-info {
				height: 160rpx;
				padding: 15rpx 0;
				padding-right: 50rpx;
				font-size: 30rpx;
				font-weight: 500;
				color: #666666;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: flex-start;
				.info-cs {
					font-size: 26rpx;
					font-weight: 500;
					color: #999999;
				}
			}
		}

		.btm {
			width: 100%;
			height: 95rpx;
			background-color: #fff;
			display: flex;
			justify-content: flex-end;
			align-items: center;

			.btn {
				width: 144rpx;
				height: 55rpx;
				border-radius: 28rpx;
				font-size: 26rpx;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 55rpx;
				text-align: center;
			}
		}
	}
</style>
