<import src="/components/local/wxParse/wxParse.wxml" />
<wxs src="./../../utils/wxsUtil.wxs" module="wxsUtil" />
<view class="swiper-box">
  <swiper autoplay circular current="{{topBannerCurrentSwiper}}" bindchange="swiperChange">
    <swiper-item wx:for="{{projectData.banner_urls}}" wx:key="index">
      <image src="{{item}}"></image>
    </swiper-item>
  </swiper>
  <view class="swiper-dots flex-align-center flex-column">
    <block wx:for="{{projectData.banner_urls}}" wx:key="index">
      <view class="swiper-dot{{index == topBannerCurrentSwiper ? ' swiper-dot-active' : ''}}"></view>
    </block>
  </view>
</view>
<view class="project-bgc" style="margin: 20rpx 20rpx 0;">
  <view class="project-desc">
    <view class="price flex-align-center" style="align-items: baseline;">
      <text style="font-family: PingFangSC-Semibold;font-size: 56rpx;color: #FF3007; font-weight: 500;"><text style="font-size: 24rpx;color: #FF3007;">¥</text>{{projectData.is_member ? projectData.member_price : projectData.price}}</text>
      <view class="newPeoplePrice" wx:if="{{source=='project'&&isNewUser==1&&projectData.new_price!=0}}"><text>新人价</text><text>￥</text>{{projectData.new_price}}</view>
      <text class="vip-origin-price">¥{{projectData.original_price}}</text>
      <image wx:if="{{projectData.is_member}}" src="/images/icon_11.png" style="width: 88rpx;height: 30rpx;margin-left: 20rpx;"></image>
      <text wx:if="{{projectData.is_member}}" class="flex1" style="margin-left:24rpx;font-size: 32rpx;color: #999999;text-decoration:line-through;">¥{{projectData.price}}</text>
      <text class="flex1" style="text-align: right;font-size: 24rpx;color: #999999;">{{projectData.buy_num}}人已买</text>
    </view>
    <text class="desc ellipsis2" style="font-family: PingFangSC-Semibold;">{{projectData.name}}</text>
    <view class="tags ellipsis2" wx:if="{{projectData.tags}}">
      <text class="tags tags-item" wx:for="{{ wxsUtil.split(projectData.tags, ' ') }}" wx:key="index">{{item}}</text>
    </view>
  </view>
  <view class="project-change" wx:if="{{source != 'cardgoods'}}">
    <!-- <view class="item flex-align-center" bindtap="onPopupState" data-key="visible" data-value="{{true}}" id="selectTime">
      <text>预约时间段选择</text>
      <image src="/images/icon_nav_01.png"></image>
      <text class="flex1" style="text-align:right;" wx:if="{{currentChangeDevice}}">{{currentChangeTime.order_day}} {{currentChangeTime.order_time}}</text>
    </view> -->
    <!-- <view class="item flex-align-center" wx:if="{{currentChangeDevice}}">
      <text>预约设备选择</text>
      <image src="/images/icon_nav_01.png"></image>
      <text class="flex1 ellipsis" style="text-align:right;margin-left: 40rpx;" wx:if="{{currentChangeDevice}}">{{currentChangeDevice.device_name}}/{{currentChangeDevice.store_name}}</text>
    </view> -->
  </view>
  <view class="project-change" style="margin-top: 20rpx;" wx:if="{{source=='goods'}}">
    <view class="item flex-align-center location">
      <text class="text">仅支持到店自取（10:00-22:00）</text>
    </view>
  </view>
</view>
<view class="flex-center" style="height: 74rpx;">
  <view style="height: 2rpx;width:130rpx;background: #E9E9E9;"></view>
  <text style="font-size: 24rpx;color: #666;margin: 0 20rpx;">{{navBarTitles[source]||'项目详情'}}</text>
  <view style="height: 2rpx;width:130rpx;background: #E9E9E9;"></view>
</view>
<view class="project-detail">
  <!-- <view class="title flex-center">
    <view class="line"></view>
    <text style="font-size:28rpx;margin:0 40rpx;">项目详情</text>
    <view class="line"></view>
  </view> -->
  <!-- <view class="title flex-align-center">
    <view class="line"></view>
    <text style="margin:0 12rpx;">项目详情</text>
  </view> -->
  <view class="detail flex-column">
    <template is="wxParse" data="{{wxParseData:article.nodes}}" />
  </view>
</view>
<view style="height:170rpx;"></view>
<view class="buy flex-center" hidden="{{source=='one'?true:false}}">
  <!-- <navigator url="/pages/reserveProject/reserveProject?projectData={{projectData}}" hover-class="none">
    <view class="buy-btn flex-center">立即预约</view>
  </navigator> -->
  <view class="goods-btn" wx:if="{{source=='goods'}}">
    <view class="goods-shop" bindtap="addGoods">添加购物车</view>
    <view class="goods-buy {{source=='goods'&&projectData.num==0?'disabled':''}}" bindtap="addOrder">立即购买</view>
  </view>
  <view wx:else class="buy-btn flex-center" bindtap="addOrder" id="addOrder">
    {{source=='project' ? '加入购物车' : '立即购买'}}
  </view>
  <!-- <navigator url="/pages/orderConfirm/orderConfirm" hover-class="none">
    <view class="buy-btn flex-center" bindtap="addOrder">立即购买</view>
  </navigator> -->
</view>
<wux-popup class="popup-radius" position="bottom" catchtouchmove="isShow" visible="{{ visible }}" bind:close="onPopupState" data-key="visible" data-value="{{false}}" wx:if="{{false}}">
  <view class="device-popup popup">
    <view class="top flex-align-center">
      <text bindtap="onPopupState" style="font-size: 36rpx;" data-key="visible" data-value="{{false}}">取消</text>
      <text bindtap="onConfirmDate" style="font-size: 36rpx;font-family: PingFangSC-Medium;color: #FA7D22;">确定</text>
    </view>
    <picker-time projectData="{{projectData}}" bind:change="onVisibleChange" wx:if="{{ projectData }}"></picker-time>
  </view>
</wux-popup>
<wux-popup class="popup-radius" position="bottom" catchtouchmove="isShow" visible="{{ visible2 }}" bind:close="onPopupState" data-key="visible2" data-value="{{false}}" wx:if="{{false}}">
  <view class="device-popup popup">
    <view class="top flex-align-center">
      <text bindtap="onPopupState" style="font-size: 36rpx;" data-key="visible2" data-value="{{false}}">取消</text>
      <text bindtap="onConfirmDevice" style="font-size: 36rpx;font-family: PingFangSC-Medium;color: #FA7D22;">确定</text>
    </view>
    <scroll-view scroll-y>
      <view class="list">
        <view class="item flex flex-align-center {{item.status== 0 ? 'no-change' : ''}}" wx:for="{{deviceList}}" wx:key="index" bindtap="onDeviceChange" data-index="{{index}}" data-status="{{item.status}}">
          <image class="device-img" src="{{item.cover_url}}"></image>
          <view class="device-info flex-column flex1 flex-start">
            <text style="font-family: PingFangSC-Semibold;">{{item.device_name}}\n{{item.store_name}}</text>
          </view>
          <view class="radio flex-align-center">
            <text wx:if="{{item.status == 0}}">不可预约</text>
            <text wx:else style="color:#FA7D22">可预约</text>
            <image wx:if="{{currentDevice != index && item.status == 1}}" src="/images/icon_radio_01.png"></image>
            <image wx:if="{{currentDevice == index && item.status == 1}}" src="/images/my/select_ok.png"></image>
            <image wx:if="{{item.status == 0}}" src="/images/icon_radio_03.png"></image>
          </view>
        </view>
      </view>
    </scroll-view>
  </view>
</wux-popup>

<!-- 下面是选择项目的弹出框 -->
<wux-popup class="popup-radius" position="bottom" catchtouchmove="true" visible="{{ showProducePup }}" bind:close="onClosePay">
  <scroll-view scroll-y="true" class="coupon-popup">
    <view class="showline"></view>
    <view class="select-product">
      <image class="v2-select-image" src="{{toSelectProduct.cover_url}}"></image>
      <view class="v2-select-content">
        <view class="v2-select-content-name">
          <view class="v2-select-content-names">{{toSelectProduct.name}}</view>
          <image src="/images/icon_20.png" class="close-img" bindtap="onClosePay" />
        </view>

        <view class="v2-desc" wx:if="{{toSelectProduct.desc}}">
          <view class="desc-item" wx:for="{{ wxsUtil.split(toSelectProduct.desc, ' ') }}" wx:key="t_index" wx:for-item="t_item">{{t_item}}</view>
        </view>

        <view class="flex1In"></view>

        <view class="v2-select-ontent-money"><text>¥</text>{{toSelectProduct.price}}</view>
      </view>
    </view>

    <view class="v2-select-title" hidden="{{selectProductData.upgrade.length==0?true:false}}">精选耗材</view>

    <view class="v2-material">

      <view class="{{selectProductIndex==index?'onSelectProduct':'material-item'}}" catchtap="selectProduct" data-index="{{index}}" wx:for="{{selectProductData.upgrade}}" wx:key="index">
        <image class="material-images" src="{{item.cover_url}}"></image>
        <view class="material-content">
          <view class="material-name {{selectProductIndex==index?'onSelectName':''}}">{{item.name}}</view>
        </view>
        <view class="material-price"><text>￥</text>{{item.price}}</view>

      </view>

    </view>

    <view class="bottom-select"></view>

    <view class="submit_bottom" catchtap="submit_bottom">加入购物车</view>

  </scroll-view>
</wux-popup>