<template>
	<view class="content" :style="[theme]">
		<view class="onecontentone">
			我的会员卡<text v-if="list.length!=0">({{list.length}})</text>
		</view>
		<view class="flex-colum">
			<view class="towcontentitem" v-if="list.length>0" v-for="(item,index) in list" :key="index"
				@click="eeInfo(item)">
				<image class="towcontentitemimage"
					src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/my/recharge.png" mode="aspectFill"></image>
				<view class="towcontentitemone flex-start">
					<image class="towcontentitemoneimage" :src="item.store_avatar" mode="aspectFill"></image>
					<text class="towcontentitemonetext" style="color: #333333;">{{item.store_title}}</text>
				</view>
				<view class="towcontentitemtow flex-between">
					<text class="towcontentitemtowetext" style="color:#333333;">{{item.vip_number}}</text>
					<text>{{item.end_time}}</text>
				</view>
			</view>
		</view>
		<view v-if="list.length==0 && is_end == true" class="flex-colum">
			<image :src="bgnothave" mode="aspectFill">
			</image>
		</view>
		<u-loadmore :status="form.status" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bgnothave:uni.getStorageSync('bgnothave'),
				list: [],
				is_end: false,
				nickname: uni.cache.get('loginuser').userinfo.nickname,
				form: {
					page: 1,
					status: 'loadmore',
				},
			}
		},
		onShow() {
			this.userusercarlist()
		},
		onReachBottom() {
			this.userusercarlist()
		},
		computed: {
			theme() {
				return this.$store.getters.theme
			},
		},
		methods: {
			async userusercarlist() {
				let res = await this.api.userusercarlist({
					page: this.form.page,
					store_id:uni.cache.get('store_id')
				})
				if (res.length == 0) {
					this.is_end = true
					this.form.status = 'nomore'
					return false;
				} else {
					this.form.status = 'loading';
					this.form.page = ++this.form.page;
					setTimeout(() => {
						this.list = [...this.list, ...res];
						if (res.length == 10) {
							this.form.status = 'loading';
						} else {
							this.is_end = true;
							this.form.status = 'nomore';
						}
					}, 500)

				}
			},
			eeInfo(e) {
				uni.pro.navigateTo('my/member/memberinfo',{
					id: e.vip_id,
					lang:1
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #FFFFFF;
	}

	.content {
		border-top: 16rpx solid #f7f7f7;
		padding: 28rpx;
		padding-bottom: 40rpx;

		.flex-colum_image {
			display: flex;
			align-items: center;
			justify-content: center;
			height: 100%;

			text {
				margin-top: 30rpx;
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #666666;
			}
		}

		.onecontentone {
			font-size: 32rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.flex-colum {
			.towcontentitem {
				margin-top: 22rpx;
				width: 96%;
				position: relative;
				height: 224rpx;
				padding: 32rpx;
				border-radius: 12rpx;

				.towcontentitemimage {
					top: 0;
					left: 0;
					position: absolute;
					width: 100%;
					height: 100%;
					border-radius: 12rpx;
					z-index: 9;
				}

				.towcontentitemone {
					position: relative;
					z-index: 10;
					.towcontentitemoneimage {
						width: 76rpx;
						height: 76rpx;
						border-radius: 50%;
					}

					.towcontentitemonetext {
						width: 60%;
						margin-left: 16rpx;
						font-size: 32rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						font-family: Source Han Sans CN-Medium, Source Han Sans CN;
						font-weight: 500;
						color: #422A07;
					}
				}

				.towcontentitemtow {
					z-index: 10;
					position: absolute;
					width: 100%;
					left: 0;
					bottom: 18rpx;
					padding:0 32rpx;
					// margin-top: 52rpx;
					font-size: 24rpx;
					font-family: Source Han Sans CN-Regular, Source Han Sans CN;
					font-weight: 400;
					color: #422A07;
				}
			}
		}

	}
</style>