<import src="index.skeleton.wxml" />
<template is="skeleton" wx-if="{{loading}}" />

<block wx:if="{{!loading}}">
	<!-- 定位 -->
	<view class="locationPicker" style="padding-top:{{statusBarHeight}}px;">
		<image class="locationPicker-icon" src="/static/icon/indexSite.png"></image>
		<navigator
			url="/pages/switchcity/switchcity?city_code={{address.city_code}}&area_code={{address.area_code}}&city={{address.city}}&area={{address.area}}"
			hover-class="none" class="cityCont">
			<view class="nowrap">
				<text>{{address.city}}{{address.area}}</text>
			</view>
			<image src="/static/img/arrow.png"></image>
		</navigator>
	</view>


	<!-- 首页 -->
	<view class="indexTab" style="top:{{statusBarHeight + 40}}px;">
		<view class="indexTab-lable {{stateType == 'shaky' ? 'active':''}}" data-state="shaky" bindtap="orderTab">活动中心
		</view>
		<view class="indexTab-lable {{stateType == 'silver' ? 'active':''}}" data-state="silver" bindtap="orderTab">白金会员
		</view>
		<view class="indexTab-lable {{stateType == 'drill' ? 'active':''}}" data-state="drill" bindtap="orderTab">钻石会员
		</view>
	</view>
	<view class="indexTop" style="padding-top:{{statusBarHeight + 80}}px;">
		<!-- 卡片轮播 -->
		<view class="indexBanner">
			<view class="banner">
				<swiper class="banner-swiper" interval="3000" autoplay circular current="{{current}}"
					bindchange="swiperChange">
					<swiper-item wx:for="{{adverts}}" wx:key="adverts" bindtap="navigato" data-url="{{item.url}}">
						<image class="banner-img" src="{{item.cover}}" show-menu-by-longpress="true" mode="aspectFill"
							bindtap="clickImg" data-img="{{item.qrcode}}" data-url="{{item.url}}" data-channel="{{item.channel}}">
						</image>
						<i class="light"></i>
					</swiper-item>
				</swiper>

			</view>
		</view>

		<!-- 自定义轮播图进度点 -->
		<view class="dots">
			<block wx:for="{{adverts}}" wx:key="cardBanner">
				<view class='{{index == swiperCurrent ? "active":""}}'></view>
			</block>
		</view>

		<!-- 公告 -->
		<view class="indexNews">
			<image src="/static/icon/news_icon.png"></image>
			<view class="marquee_container" style="--marqueeWidth--:-30em">
				<view class="marquee_text {{ noticeData.length > 20 ? 'active' : ''}}">{{noticeData}}</view>
			</view>
		</view>

		<!-- 活动中心-权益列表 -->
		<view class="cardArr" wx:if="{{stateType == 'shaky'}}">
			<view class="cardArr-top">
				<block wx:if="{{cardArr.length > 0}}">
					<view bindtap="rightNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard"
						data-id="{{item.right_config_id}}" data-from="{{item.from}}"
						data-rightid="{{item.right_config_id}}">
						<image class="indexCard-img" src="{{item.cover}}"></image>
						<view class="nowrap indexCard-title">{{item.title}}</view>
						<view class="nowrap activity-remark" wx:if="{{item.subtitle != null}}">
							<text class="nowrap">{{item.subtitle}}</text>
						</view>
						<view class="activity-tips" wx:if="{{item.label}}">{{item.label}}</view>
					</view>
				</block>
				<block wx:else>
					<view class="legalTips">
						<image src="/static/img/legal_tips.png"></image>
						<text>抱歉, 此地区暂无权益</text>
					</view>
				</block>
			</view>

			<!-- 福利日 -->
			<view class="WelfareCont" wx:if="{{activities.length > 0}}">
				<view class="WelfareTop">
					<image class="welfare_stra" src="../../static/img/welfare_stra.png"></image>
					<image class="welfare-title" src="../../static/img/welfare_title.png"></image>
				</view>
				<view class="WelfareTitle"><text>{{ activities.length }}</text> 大会员权益，福利全线升级</view>
				<view class="WelfareList" bindtap="Snapup" wx:for="{{activities}}" wx:key="activities"
					data-text="{{item.code_text}}" data-can="{{item.canBuy}}" data-id="{{item.welfare_id}}"
					data-from="{{item.right.from}}" data-rightId="{{item.right.right_config_id}}">
					<image class="WelfareList-img {{item.surplus == 0 ? 'active' : ''}}"
						src="{{item.right.from == 'washcar' ? '../../static/img/welfare_back_00.png' : '../../static/img/welfare_back_01.png'}}">
					</image>
					<view class="WelfareList-back">
						<image class="WelfareList-left {{item.surplus == 0 ? 'active' : ''}}"
							src="{{item.right.from == 'washcar' ? '../../static/img/welfare_icon_00.png' : '../../static/img/welfare_icon_01.png' }}">
						</image>
						<view class="WelfareList-center">
							<view class="nowrap WelfareList-price">{{item.price}}<text> 元</text>（{{item.title}}）</view>
							<view class="WelfareList-center-cont">
								<view class="WelfareList-center-all {{item.surplus == 0 ? 'active' : ''}}">
									<text>[限量{{item.stock}}份]</text> <text>[剩余{{item.surplus}}份]</text>
								</view>
								<view class="WelfareList-center-time {{item.surplus == 0 ? 'active' : ''}}">
									<text>{{item.start_time}} 开抢</text><text>{{item.end_time}} 结束</text>
								</view>
							</view>
						</view>
						<view class="WelfareList-right {{item.surplus == 0 ? 'active' : ''}}">
							<text>抢购</text>
						</view>
					</view>
				</view>
				<view class="subscribe" bindtap="subscribeTap" wx:if="{{!subState}}">
					<view class="subscribe-icon">
						<image class="subscribe-icon-one" src="/static/img/finger_00.png"></image>
						<image class="subscribe-icon-two" src="/static/img/finger_01.png"></image>
					</view>
					<view class="subscribe-cont"><text>点击消息提醒</text></view>
				</view>
			</view>
		</view>

		<!-- 白金会员&钻石会员-权益列表 -->
		<view class="cardArr" wx:else>
			<view class="cardArr-top">
				<block wx:if="{{cardArr.length > 0}}">
					<!-- <view bindtap="userNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard" data-id="{{item.id}}"
					data-type="{{item.get_type}}"> -->
					<view bindtap="userNav" data-id="{{item.category_id}}" wx:for="{{cardArr}}" wx:key="cardArr"
						class="indexCard">
						<image class="indexCard-img" src="{{item.cover}}"></image>
						<view class="nowrap indexCard-title">{{item.title}}</view>
						<view class="nowrap indexCard-remark" wx:if="{{item.description != null}}">{{item.description}}
						</view>
						<view class="activity-tips indexCard-tips" wx:if="{{item.label != ''}}">{{item.label}}</view>
					</view>
				</block>
				<block wx:else>
					<view class="legalTips">
						<image src="/static/img/legal_tips.png"></image>
						<text>抱歉, 此地区暂无权益</text>
					</view>
				</block>
			</view>
		</view>
	</view>
</block>