<!-- 骨架屏 -->
<import src="./detail.skeleton.wxml" />
<template is="skeleton" wx:if="{{loading}}" />
<!-- 轮播图 -->
<swiper indicator-dots circular indicator-active-color='#333'>
    <swiper-item wx:for="{{files.images}}" wx:key="attachmentid" data-index="{{index}}" data-type='image' bindtap="viewMedias">
        <van-image width="100vw" height="464rpx" fit="contain" 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.itemname}}
        <text wx:if="{{isShowFavorites}}" class="{{detail.iscollection?'cuIcon-favorfill':'cuIcon-favor'}}" style="color:{{detail.iscollection?'#FADB14':''}};padding: 6rpx;" id='addToFavorites' bind:tap="{{'clickBut'}}" />
        <van-tag size='medium' type="warning">{{detail.delistingstatus}}</van-tag>
    </view>
    <view class="tags">
        <text wx:if="{{detail.iscustomsize==1}}" style="background-color: #EE0A24;color: #fff;">定制</text>
        <text wx:for="{{detail.brand}}" wx:key="sa_brandid">{{item.brandname}}</text>
        <text wx:for="{{detail.tradefield}}" wx:key="index">{{item.tradefield}}</text>
    </view>
    <view class="offer">
        <view>
            <text class="price">{{handleHide.verify(detail.gradeprice,"详情-当前商品价格",privacyFieldC)}}</text>
            <text wx:if="{{isdisplaysaleqty}}" style="color: #999;font-size: 22rpx;margin-left: 10rpx;">已售{{(detail.soldbase-0)+(detail.saleqty-0)||0}}{{detail.unitname}}</text>

        </view>
        <text class="unit">单位/{{detail.unitname}}</text>
    </view>
    <view class="else">
        <text>起订量：{{detail.orderminqty||' --'}}</text>
        <text>增量：{{detail.orderaddqty||' --'}}</text>
        <text>包装数量:{{detail.packageqty||' --'}}</text>
    </view>
</view>
<view class="model">
    <block wx:for="{{customschemeItems}}" wx:key="value" wx:for-item="it">
        <block wx:if="{{row[it.value+'Rows'].length}}">
            <view class="label">
                {{it.description}}
            </view>
            <view class="product-box">
                <block wx:for="{{row[it.value+'Rows']}}" wx:key="index">
                    <block wx:if="{{it.isonlydisplay == 1}}">
                        <navigator wx:if="{{item.flag}}" url="#" class="product {{content[it.value] === item.parm ? 'active' :''}}" bindtap="changeItemno" data-valuename="{{it.value}}" data-value="{{item}}">
                            {{item.parm=='custom'?'自定义':item.parm}}
                            <view wx:if="{{item.delistingstatus}}" class="tag line-1">
                                {{item.delistingstatus}}
                            </view>
                        </navigator>
                    </block>
                    <block wx:else>
                        <navigator url="#" class="product {{content[it.value] === item.parm ? 'active' :''}} {{item.flag ? '' : 'disabled'}}" bindtap="changeItemno" data-valuename="{{it.value}}" data-value="{{item}}">
                            {{item.parm=='custom'?'自定义':item.parm}}
                            <view wx:if="{{item.delistingstatus}}" class="tag line-1">
                                {{item.delistingstatus}}
                            </view>
                        </navigator>
                    </block>
                </block>
            </view>
        </block>
    </block>
    <!-- 定制项 -->
    <view wx:if="{{detail.iscustomsize==1}}" style="padding-bottom: 20rpx;">
        <customMade id="customMade">
            <view slot='head' class="label">
                {{labelList.custom}}
            </view>
        </customMade>
    </view>

    <view class="label">
        数量 <text style="font-size: 24rpx;font-weight: 400;">(起订量:{{detail.orderminqty}}，增减量:{{detail.orderaddqty}}，包装量:{{detail.packageqty}})</text>
    </view>
    <view class="product-box" style="margin-top: 20rpx;">
        <van-stepper value="{{ detail.qty }}" min="{{detail.orderminqty}}" step="{{detail.orderaddqty||1}}" input-class='input-class' data-iscatch="catch" catch:minus='stepperChange' catch:plus='stepperChange' catch:blur='inputBlur' />
    </view>
    <block wx:if="{{detail.canuseactivity.length}}">
        <view class="label" style="border: none;">
            此商品正在促销
        </view>
        <navigator class="activity" wx:for="{{detail.canuseactivity}}" wx:key="sa_promotionid" wx:for-item='it' url="/packageA/activity/detail?id={{it.sa_promotionid}}">
            {{it.promname}}
        </navigator>
        <view style="height: 1rpx;" />
    </block>
    <!-- 定制项 -->
    <customMade id="customMade">
        <view slot='head' class="label">
            {{labelList.custom}}
        </view>
    </customMade>
</view>
<van-tabs custom-class='tabs' title-active-color='var(--assist)' color='var(--assist)'>
    <van-tab title="商品简介">
        <view class="tab-box">
            <view class="row">
                品号：{{detail.itemno}}
            </view>
            <view class="row">
                型号：{{detail.model || ' --'}}
            </view>
            <view class="row">
                规格：{{detail.standards || ' --'}}
            </view>
            <view class="row">
                别名：{{detail.byname || ' --'}}
            </view>
            <view class="row">
                特殊说明：<text wx:if="{{detail.specalnote}}" style="color: red;">{{detail.specalnote}}</text><text wx:else> --</text>
            </view>
        </view>
    </van-tab>
    <van-tab title="产品资料">
        <Yl_Empty wx:if="{{detail.technicalinfo.length==0}}" />
        <view wx:else class="document-box">
            <navigator class="document" url="#" wx:for="{{detail.technicalinfo}}" wx:key="index" bindtap="openDocument" data-item="{{item}}">{{item.document}}</navigator>
        </view>
    </van-tab>
</van-tabs>
<view style="height: 200rpx;" />
<view class="cu-bar bg-white tabbar border shop footer" style="display: flex;">
    <navigator url="#" class="action " style="height: 100%;display: flex; flex-direction: column; align-items: center;" bindtap="toCollect">
        <view class="cuIcon-cart" style="color: #F37B1D;">
            <view class="cu-tag badge">{{badge}}</view>
        </view>
        购物车
    </navigator>
    <navigator wx:if="{{isShowFavorites}}" url="/packageA/favorites/index" class="action" style="height: 100%;display: flex; flex-direction: column; align-items: center;">
        <view class="{{detail.iscollection?'cuIcon-favorfill':'cuIcon-favor'}}" style="color:{{detail.iscollection?'#FADB14':''}}">
            <view class="cu-tag badge">{{favoriteCount}}</view>
        </view>
        收藏夹
    </navigator>

    <picker wx:if="{{detail.tradefield.length>=2}}" range='{{detail.tradefield}}' disabled='{{itemCount!=selectCount}}' range-key='tradefield' bindchange='storage'>
        <van-button custom-class="bg-orange submit {{isShowFavorites?'w240':'w610'}}" id='addToShoppingCart' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">加入购物车</van-button>
    </picker>
    <van-button wx:else custom-class="bg-orange submit {{isShowFavorites?'w240':'w610'}}" id='addToShoppingCart' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">加入购物车</van-button>

    <picker wx:if="{{detail.tradefield.length>=2}}" range='{{detail.tradefield}}' disabled='{{itemCount!=selectCount}}' range-key='tradefield' bindchange='storage'>
        <van-button custom-class="bg-blue submit {{isShowFavorites?'w240':'w610'}}" id='addToShoppingCart' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">立即下单</van-button>
    </picker>
    <van-button wx:else custom-class="bg-blue submit {{isShowFavorites?'w240':'w610'}}" id='placeAnOrder' disabled='{{itemCount!=selectCount}}' bind:click="clickBut">立即下单</van-button>
</view>
<wxs src="/utils/hidePrice.wxs" module="handleHide" />