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

<!-- 轮播图 -->
<swiper indicator-dots circular indicator-active-color='#333' wx:if="{{files.images.length!=0}}">
	<swiper-item wx:for="{{files.images}}" wx:key="attachmentid" data-index="{{index}}" data-type='image' bindtap="viewMedias">
		<van-image width="100vw" height="464rpx" fit="cover" src="{{item.cover}}" use-loading-slot use-error-slot lazy-load>
			<van-loading slot="loading" type="spinner" size="20" vertical />
			<text slot="error">加载失败</text>
		</van-image>
	</swiper-item>
</swiper>

<!-- 介绍 -->
<view class="intr">
	<view class="title">
		{{detail.promname}}
	</view>
	<view class="tags">
		<text wx:if="{{detail.type}}">{{detail.type}}</text>
		<text wx:if="{{detail.brandname}}">{{detail.brandname}}</text>
		<text wx:if="{{detail.tradefield.length}}">{{detail.tradefield}}</text>
	</view>
	<view class="exp">活动周期：{{detail.begdate || ' --'}}</view>
	<view class="exp">结束时间：{{detail.enddate || ' --'}}</view>
	<view class="exp">活动说明：{{detail.remarks || ' --'}}</view>
</view>

<view class="product-list">
	<view class="label" wx:if="{{groupList.length<=1}}">
		商品列表
	</view>
	<van-tabs wx:else active="{{ active }}" title-active-color='var(--assist)' color='var(--assist)' bind:change='tabChange'>
		<van-tab wx:for="{{groupList}}" wx:key="sa_promotion_itemgroupid" name='{{item.sa_promotion_itemgroupid}}' title="{{item.groupname}}" />
	</van-tabs>
	<navigator class="setclient-list-item" url="#" wx:for="{{list}}" data-file="{{item.attinfos}}" catchtap="viewImage" wx:key="itemno">
		<view class="mian">
			<view class="img">
				<van-image width="100%" height="100%" wx:if="{{item.cover}}" src="{{item.cover}}" use-loading-slot use-error-slot lazy-load>
					<van-loading slot="loading" type="spinner" size="20" vertical />
					<text slot="error" style="font-size: 24rpx;">暂无图片</text>
				</van-image>
				<text wx:else class="err">暂无图片</text>
			</view>
			<view class="dec">
				<view class="title line-1">
					{{item.itemname}}
				</view>
				<view class="subfield line-1">
					品号:{{item.itemno||' --'}}
				</view>
				<view class="subfield line-1">
					<text style="margin-right: 15rpx;">型号:{{item.model||' --'}}</text>
					<text>规格:{{item.spec||' --'}}</text>
				</view>
				<view class="price line-1">
					价格：<text class="num">￥{{handleHide.query(item.gradeprice || item.price,hidePrice)}}元</text><text wx:if="{{item.gradeprice<item.oldprice ||item.price<item.oldprice}}" style="text-decoration:line-through; color:#999;">/{{handleHide.query(item.oldprice,hidePrice)}}元</text>
				</view>
				<view class="subfield line-1">
					限购数量：{{item.groupqty==0?'不限购':(item.groupqty-item.saledqty)<=0?'已售罄':item.groupqty}}
				</view>
			</view>
		</view>
	</navigator>

	<view wx:if="{{list.length==0}}" style="margin-left: -30rpx; padding-bottom: 150rpx;">
		<Yl_Empty />
	</view>
</view>

<view style="height: 150rpx;" />
<view class="footer">
	<van-button custom-class='but' bindtap="clickBut">去下单</van-button>
</view>

<wxs src="/utils/hidePrice.wxs" module="handleHide" />