<!--packageI/warehouseFarm/warehouseFarmGood/warehouseFarmGood.wxml-->
<view id="warehouse-farm-good">
  <view style="background-color: #ffffff;margin-bottom: 1rem;">
    <view class="ithumb">
      <swiper indicator-dots="{{false}}" autoplay="{{false}}" circular="{{true}}" indicator-active-color="#007aff">
        <swiper-item wx:if="{{goodsInfo.goods_video}}">
          <video style="width: 100%;height:100%;" src="{{goodsInfo.goods_video}}"
            poster="{{goodsInfo.video_image}}"></video>
        </swiper-item>
        <block wx:for="{{goodsInfo.thumb_url}}" wx:key="index" wx:for-item="ithumb" wx:for-index="index">
          <swiper-item>
            <image src="{{ithumb}}" mode='widthFix' />
            <view class="number-box">{{index + 1}} / {{goodsInfo.thumb_url.length}}</view>
          </swiper-item>
        </block>
        <block wx:if="{{!goodsInfo.thumb_url || goodsInfo.thumb_url.length == 0}}">
          <swiper-item>
            <image src="{{goodsInfo.thumb}}" mode='widthFix' />
          </swiper-item>
        </block>
      </swiper>
    </view>
    <view class="good-title">{{ goodsInfo.title }}</view>
    <view class="good-rule">
      <view class="rule-item {{activeRule == item.nums?'active-rule-color':''}}" catchtap="clickRule"
        data-num="{{item.nums}}" wx:for="{{rule}}">
        <!-- 后台有处理，设置的数量不会重复相同 -->
        <view class="price"><em style="font-size: 10px;">￥</em>{{ item.price }}</view>
        <view class="num">{{ item.nums }}{{ info.sku }}</view>
      </view>
    </view>
  </view>

  <view class="content">
    <view class="title">商品详情</view>
    <mp-html content="{{goodsInfo.content}}"></mp-html>
  </view>

  <van-goods-action>
    <van-goods-action-icon icon="chat-o" text="客服" bind:click="showCserviceFun" />
    <van-goods-action-button type="danger" text="立即购买" bind:click="toOrder" />
  </van-goods-action>


  <!-- 客服 -->
  <van-popup custom-style="border-radius: 38rpx;" show="{{showCservice}}" overlay="{{true}}">
    <view class="pop-content">
      <view class="pop-top">
        <view class="left" wx:if="{{cserviceData.customer_open=='1'}}">
          <view class="wrap">
            <view>
              <view class="image" style="postion:relative">
                <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/kf_online_contect@2x.png"></image>
              </view>
              <view>在线联系</view>
              <button wx:if="{{!cserviceData.cservice || cserviceData.cservice == ''}}" open-type="contact" bindcontact="handleContact"
                style="postion:absolute;width:100%;height:80rpx;opacity:0;top:-140rpx;"></button>
              <button wx:if="{{cserviceData.cservice && cserviceData.cservice !=''}}" data-cservice="{{cserviceData.cservice}}" bindtap="gotoChat"
                style="postion:absolute;width:100%;height:80rpx;opacity:0;top:-140rpx;"></button>
            </view>
          </view>
        </view>
        <view style="display:flex;" wx:if="{{cserviceData.customer_open=='1' && !cserviceData.service_mobile==''}}">
          <view class="line"></view>
        </view>
        <view class="right" wx:if="{{!cserviceData.service_mobile==''}}">
          <view class="wrap" bindtap="callPhone">
            <view>
              <view class="image">
                <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/kf_tel_contect@2x.png"></image>
              </view>
              <view>联系电话</view>
              <view style="margin-top:16rpx">{{cserviceData.service_mobile}}</view>
            </view>
          </view>
        </view>
      </view>
      <view class="pop-bottom" wx:if="{{!cserviceData.service_QRcode==''}}">
        <view class="image">
          <image src="{{cserviceData.service_QRcode}}" show-menu-by-longpress></image>
        </view>
      </view>
      <icon class="iconfont icon-close11" catchtap="closePop"></icon>
    </view>
  </van-popup>
  <!-- 客服end -->
</view>