<!-- 骨架屏 -->
<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}}
  </view>
  <view class="tags">
    <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">{{detail.gradeprice}}</text>
      <text class="old-price">{{detail.marketprice}}</text>
    </view>
    <text class="unit">单位/{{detail.unitname}}</text>
  </view>
  <view class="else">
    <text>起订量：{{detail.orderminqty}}({{detail.unitname}})</text>
    <text>库存：{{userrole=='经销商'?detail.stockstatus:detail.cansaleqty}}</text>
  </view>
</view>
<!-- 选择型号 -->
<view class="model" wx:if="{{rows.length}}">
  <view class="label">
    选择商品
  </view>
  <view class="product-box">
    <navigator url="#" class="product {{itemno===item.itemno?'active':''}}" wx:for="{{rows}}" wx:key="itemno" bindtap="changeItemno" data-item="{{item}}">{{item.spec}}</navigator>
  </view>
</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 wx:if="{{detail.spec}}" class="row">
        规格：{{detail.spec || ' --'}}
      </view>
      <view wx:if="{{detail.model}}" class="row">
        型号：{{detail.model || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].material}}" class="row">
        材质：{{detail.itemextend[0].material || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].device}}" class="row">
        装置：{{detail.itemextend[0].device || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].pressure}}" class="row">
        压力等级：{{detail.itemextend[0].pressure || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].prodline}}" class="row">
        产线：{{detail.itemextend[0].prodline || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].connection}}" class="row">
        连接形式：{{detail.itemextend[0].connection || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].valveplatematerial}}" class="row">
        阀板材质：{{detail.itemextend[0].valveplatematerial || ' --'}}
      </view>
      <view wx:if="{{detail.itemextend[0].specalnote}}" class="row">
        特殊说明：{{detail.itemextend[0].specalnote || ' --'}}
      </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>

<block wx:if="{{userrole!='业务员'}}">
  <!-- 底部 -->
  <view style="height: 150rpx;" />
  <view class="footer">
    <picker wx:if="{{detail.tradefield.length>=2}}" range='{{detail.tradefield}}' range-key='tradefield' bindchange='storage'>
      <van-button custom-class='but' bindtap="clickBut">加入购物车</van-button>
    </picker>
    <van-button wx:else custom-class='but' bindtap="clickBut">加入购物车
    </van-button>
  </view>
  <!-- 购物车按钮 -->
  <Float id="Float" />
</block>