<import src="/components/local/wxParse/wxParse.wxml" />
<wxs module="tool" src="../../app.wxs" />
<wxs src="./../../utils/wxsUtil.wxs" module="wxsUtil" />

<view wx:if="{{detail.id || detail.project_id}}" class="item margin item-radius current{{current}}">
  <view class="item-top flex-align-center ">
    <text class="flex1 ellipsis">{{detail.name}}</text>
  </view>
  <view>
    <view class="item-content flex">
      <image class="img" src="{{detail.banner_urls.length > 0 ? detail.banner_urls[0] : '' || deviceData.cover_url}}"></image>
      <view class="content flex-column">
        <view class="content-text-box flex1" wx:if="{{source != 'secondaryCard'}}">
          <text style="color:#999;">{{source == 'cardgoods' ? '可用店铺：' : '预约店铺：'}}</text>
          <text class="flex1 ellipsis">{{deviceData.store_name || detail.store_name}}</text>
        </view>
        <view class="content-text-box flex1">
          <text style="color:#999;">{{source == 'cardgoods' ? '可用时间：' : source == 'secondaryCard' ? '有效期：' : '使用时间：'}}</text>
          <text class="flex1 ellipsis" wx:if="{{detail.days}}">{{detail.days}}天</text>
          <text class="flex1 ellipsis" wx:if="{{detail.take_out_time_max}}">{{detail.take_out_time_max}}之前</text>
          <text class="flex1 ellipsis" wx:else>{{tool.replaceStr(timeData.order_day)}} {{tool.replaceStr(timeData.order_time)}}</text>
        </view>
        <view class="content-text-box flex1" wx:if="{{deviceData.device_name}}">
          <text style="color:#999;">使用设备：</text>
          <text class="flex1 ellipsis">{{deviceData.device_name}}</text>
        </view>
        <view class="content-text-box flex1" wx:else></view>
      </view>
    </view>
  </view>
  <view class="item-btn flex-align-center">
    <text style="font-size: 28rpx;color: #999;">{{source == 'cardgoods' ? '购买费用：' : source == 'secondaryCard' ? '价格：' : '预约费用：'}}</text>
    <text style="font-size: 36rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;margin-right:24rpx;" wx:if="{{source == 'secondaryCard'}}">¥{{detail.price}}</text>
    <text style="font-size: 36rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;margin-right:24rpx;" wx:else>¥{{moneyData.projectWithGoodsPrice}}</text>
  </view>
</view>
<!-- 次卡分配详情 -->
<view class="card-details">
  <view class="card-details-title">次卡详情</view>
  <!-- 固定次数次卡分配 -->
  <block wx:for="{{cardDetail}}" wx:key="id">
    <view wx:if="{{cardDetail}}" class="card-details-fixed" wx:if="{{item.time!=0}}">
      <text class="card-details-fixed-text">{{item.project_name}}</text>
      <text>{{item.time}}次</text>
    </view>
  </block>
  <!-- 用户选择分配次数 -->
  <view wx:for="{{Ac_cardDetail}}" class="card-details-Active" wx:key="index">
    <view class="card-details-Active-tittle">{{item.group_name}}</view>
    <block wx:for="{{item.project_list}}"  wx:for-item="detail" wx:key="id">
      <view class="card-details-active {{detail.time>0?'activeSelect':''}}">
        <text>{{detail.project_name}}</text>
        <view class="calculation">
          <view class="lation-content" wx:if="{{item.total>item.project_list.length}}">
            <view class="reduce" data-id='{{item.Idindex}}' data-index='{{index}}' bindtap="onReduce">-</view>
            <view class="lation-num">{{detail.time}}</view>
            <view class="lation-add" data-index='{{index}}' data-id='{{item.Idindex}}' bindtap="onLationAdd">+</view>
          </view>
          <view bindtap="selectCardRadio" data-index='{{index}}' data-id='{{item.Idindex}}'  class="radio" wx:else>
          <image class="radio-image" src="{{detail.time==0?'../../images/icon_12.png':'../../images/icon_13.png'}}"></image>
          </view>
        </view>
      </view>
    </block>
    <view class="card-details-surplus">
      剩余分配次数:<text>{{item.total_time}}</text>
    </view>
  </view>
</view>

<!-- 低价换购 -->
<view class="exchange-details" wx:if="{{cardExchangeList.length!=0}}">
  <view class="exchange-details-title">低价换购</view>
  <view class="exchange-box" wx:for="{{cardExchangeList}}" wx:key="index">
    <view class="exchange-box-image">
      <image src="{{item.cover_url}}"></image>
    </view>
    <view class="exchange-info">
      <view class="exchange-info-title">
        {{item.project_name}}
      </view>
      <view class="exchange-info-bottom">
        <view class="exchange-info-price">
          ￥{{item.price}}
        </view>
        <image style="margin: 0;" class="select-activity" data-index="{{index}}" bindtap="selectExchange" src="{{selectExchange==0?'/images/icon_12.png':'/images/icon_13.png'}}"></image>
      </view>
    </view>
  </view>
</view>

<!-- 项目耗材下单时，传入的产品信息 -->
<view wx:if="{{productDetail}}" class="item margin item-radius">
  <view class="item-top flex-align-center ">
    <text class="flex1 ellipsis">{{productDetail.name}}</text>
  </view>
  <view>
    <view class="item-content flex">
      <image class="img" src="{{productDetail.banner_urls.length > 0 ? productDetail.banner_urls[0] : ''}}"></image>
      <view class="content flex-column">
        <view class="content-text-box flex">
          <text style="color:#999;">预约店铺：</text>
          <text class="flex1 ellipsis">{{productDetail.store_name || deviceData.store_name}}</text>
        </view>
        <view class="content-text-box flex">
          <text style="color:#999;">使用时间：</text>
          <text wx:if="{{projectOrderData.order_time}}" class="flex1 ellipsis">{{projectOrderData.order_time}}</text>
          <text wx:else class="flex1 ellipsis">{{tool.replaceStr(timeData.order_day)}} {{tool.replaceStr(timeData.order_time)}}</text>
        </view>
        <view class="content-text-box flex" wx:if="{{detail.name}}">
          <text style="color:#999;">使用项目：</text>
          <text class="flex1 ellipsis">{{detail.name}}</text>
        </view>
      </view>
    </view>
  </view>
  <view class="item-btn flex-align-center">
    <text style="font-size: 28rpx;">预约费用：</text>
    <text style="font-size: 36rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;margin-right:24rpx;">¥{{moneyData.productPrice}}</text>
  </view>
</view>

<view class="list_Content_show" hidden="{{inFirstIn?false:true}}">
  <view class="timeSelect">
    <view class="timeShow">未选优惠券</view>
  </view>
  <image class="list_Content_img" src="/images/white_on.png"></image>
  <view class="list_top_contents">
    <view class="first_and_title"><text>第二步：</text>选择您的优惠卷/卡</view>
  </view>
</view>

<view class="margin order-sum  item-radius">
  <view class="top">
    <view class="text flex" wx:if="{{source != 'secondaryCard'}}">
      <text class="flex1">预约费用</text>
      <view class="right-500">
        <text wx:if="{{source == 'product_with_project_order'}}">¥{{productDetail.price}}</text>
        <text wx:else>¥{{wxsUtil.calculateMoney([moneyData.projectWithGoodsPrice, moneyData.productPrice])}}</text>
      </view>
    </view>
    <!-- 折扣 -->
    <!-- <view class="text flex" style="margin-bottom: 0;">
      <view class="coupon flex flex1 flex-align-center">
        <image class="order-coupon-icon" src="/images/display.png" />
        <text>折扣优惠</text>
      </view>
    </view> -->
    <!-- <view wx:if="{{level!=0}}" class="coup-box">
      <view class="coup-box-title">权益折扣</view>
      <view class="spc-in">
      </view> -->
      <!-- <view class="color-price">-¥{{priceSet}}</view> -->
      <!-- <view class="coup-box-title">余额支付享受{{tolevel}}折优惠</view>
    </view> -->
    <view class="text flex" bindtap="onCouponOpen">
      <view class="coupon flex flex1 flex-align-center">
        <image class="order-coupon-icon" src="/images/icon_order_coupon.png" />
        <text>优惠券</text>
      </view>
      <view class="flex-align-center right-500">
        <text class="coupon-guide-tips" wx:if="{{couponList.length > 0 && currentChangeCoupon == null && memberCardCurrentDiscount != 0}}">未选优惠券</text>
        <text style="color: #FF3007;" wx:elif="{{ couponList.length > 0 && currentChangeCoupon != null && memberCardCurrentDiscount != 0}}">-¥{{moneyData.couponMoney}}</text>
        <text wx:else style="color: #bbb;">无可用</text>
        <image src="/images/my/right.png" style="width: 24rpx;height: 24rpx;"></image>
      </view>
    </view>
    <view class="text flex-center" hidden="{{true}}">
      <image class="order-coupon-icon" src="/images/icon_order_vip.png" />
      <text class="flex1">会员抵扣</text>
      <view class="flex-center right-500">
        <text style="color: #bbb;" wx:if="{{memberDiscountStatus < 1 || currentCoupon != -1}}">无可用</text>
        <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}" wx:else>
          <text class="flex-center" style="color: #FF3007;" wx:if="{{memberCardCurrentDiscount == 0}}">{{'-¥'+moneyData.memberDiscountMoney}}</text>
          <text class="flex-center" wx:else>{{memberCardCurrentDiscount < 0 ? '去选择' : array[memberCardCurrentDiscount] }}</text>
        </picker>
      </view>
      <image src="/images/my/right.png" style="width: 24rpx;height: 24rpx;"></image>
    </view>
  </view>
  <view class="bottom flex-align-center" wx:if="{{source != 'secondaryCard'}}">
    <text style="font-size: 28rpx;color: #999;">合计：</text>
    <text class="total-price">¥{{ wxsUtil.calculateMoney([moneyData.projectWithGoodsPrice, moneyData.productPrice, moneyData.couponMoney * -1, moneyData.memberDiscountMoney * -1]) }}</text>
  </view>
  <view class="bottom flex-align-center" wx:else>
    <text style="font-size: 28rpx;color: #999;">合计：</text>
    <text class="total-price">¥{{selectExchange==1?exchangePrice:detail.price}}</text>
  </view>
</view>
<!-- <view class="item-radius" wx:if="{{recommendMemberCard.id}}"> -->
<view class="item-radius" hidden="{{true}}">
  <view class="item-top flex-align-center ">
    <text class="ellipsis" style="font-size: 28rpx;font-family: PingFangSC-Regular, PingFang SC;font-weight: 400;">开通会员本单立省</text>
    <text style="font-size: 36rpx;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;color: #FF3007;">¥{{moneyData.memberDiscountMoney}}</text>
  </view>
  <view class="item-vip flex-align-center" bindtap="selectMemberCard" data-id="{{recommendMemberCard.id}}">
    <image class="change-img" src="{{selectCardId ? '/images/icon_17.png' : '/images/icon_16.png'}}"></image>
    <view class="flex1 flex item-vip-card">
      <image class="card-img" src="{{recommendMemberCard.cover_url}}"></image>
      <view class="flex1 flex-column flex-justify-space-between" style="padding:20rpx;">
        <view class="flex-align-center flex-justify-space-between">
          <text>{{recommendMemberCard.card_name}}</text>
          <image src="/images/icon_19.png" style="width:56rpx;height:56rpx;" catchtap="onOpenLandscape"></image>
        </view>
        <text style="font-size: 36rpx;">¥{{recommendMemberCard.price}}</text>
      </view>
    </view>
  </view>
</view>
<view class="item-radius" style="background-color: #fff;" wx:if="{{projectProducts.length > 0}}">
  <view class="item-top flex-align-center ">
    <text class="flex1 ellipsis">升级产品</text>
  </view>
  <view class="item-products-content flex">
    <view class="item-product flex" wx:for="{{ projectProducts }}" wx:key="index" bindtap="selectProjectProduct" data-id="{{item.id}}" data-index="{{index}}">
      <image src="{{item.cover_url}}"></image>
      <view class="flex1 flex-column flex-justify-space-between ellipsis" style="padding: 20rpx;">
        <text class="ellipsis" style="font-size: 28rpx;font-family: PingFangSC-Medium, PingFang SC;font-weight: 500;">{{item.product_name}}</text>
        <view class="flex-justify-space-between">
          <text style="font-size: 36rpx;font-family: PingFangSC-Semibold, PingFang SC;font-weight: 600;">¥{{selectCardId || memberStatus == 1 || detail.is_member == 1 ? item.member_price : item.price}}</text>
          <image src="{{selectProductIndex == index ? '/images/icon_17.png' : '/images/icon_16.png'}}" style="width:48rpx;height:48rpx;"></image>
        </view>
      </view>
    </view>
  </view>
</view>
<view style="height:170rpx;"></view>
<view class="buy flex-align-center flex-justify-space-between" style="padding: 0 20rpx;">
  <view class="flex-align-center" wx:if="{{source != 'secondaryCard'}}">
    <text style="font-size: 28rpx;">合计：</text>
    <text class="total-pay-price">¥{{ moneyData.payMoney }}</text>
  </view>
  <view class="flex-align-center" wx:else>
    <text style="font-size: 28rpx;">合计：</text>
    <text class="total-pay-price">¥{{ selectExchange==1?exchangePrice:detail.price }}</text>
  </view>
  <view wx:if="{{source == 'product_with_project_order'}}" class="btn use-btn flex-center" bindtap="onProductPay">
    提交订单
  </view>
  <view wx:elif="{{source == 'goods'}}" class="btn use-btn flex-center" bindtap="onGoodsPay">
    提交订单
  </view>
  <view wx:elif="{{source == 'cardgoods'}}" class="btn use-btn flex-center" bindtap="onCardgoodsPay">
    提交订单
  </view>
  <view wx:elif="{{source == 'secondaryCard'}}" class="btn use-btn flex-center" bindtap="onSecondaryCardPay">
    提交订单
  </view>
  <view wx:else class="btn use-btn flex-center" bindtap="onPay" id="payProject">提交订单</view>
</view>
<wux-landscape visible="{{ visibleLandscape }}" maskClosable="{{ true }}" closable="{{ false }}" bind:close="onCloseLandscape" class="skin-popup" catchtouchmove="true">
  <view class="use-popup flex-column">
    <view class="text-cotent">
      <template is="wxParse" data="{{wxParseData:article.nodes}}" />
    </view>
    <image src="/images/icon_20.png" class="close-img" bindtap="onCloseLandscape"></image>
  </view>
</wux-landscape>
<wux-popup class="popup-radius" position="bottom" catchtouchmove="true" visible="{{ visible }}" bind:close="onClose">
  <view class="coupon-popup">
    <view class="top flex-align-center need-show-line">
      <text style="text-align: center;">我的优惠券</text>
      <image src="/images/icon_20.png" class="close-img" bindtap="onCancelCoupon" />
    </view>
    <scroll-view scroll-y>
      <view class="list">
        <coupon-item class="coupon-item" wx:for="{{ couponList }}" item="{{item}}" wx:key="index" data-index="{{index}}" source="checkbox" couponStatus="{{item.status}}" checkStatus="{{currentCoupon == index}}" bind:check="onCouponChange"></coupon-item>
        <view class="btm-text">--已经到底了--</view>
      </view>
    </scroll-view>
    <view class="coupon-popup-btm flex-center">
      <view class="coupon-popup-btm-btn flex-center" bindtap="onConfirmCoupon">确认</view>
    </view>
  </view>
</wux-popup>

<wux-popup class="popup-radius" position="bottom" catchtouchmove="true" visible="{{ payNow }}" bind:close="onClosePay">
  <view class="coupon-popup payType">
    <view class="top flex-align-center">
      <text style="text-align: center;"></text>
      <image src="/images/icon_20.png" class="close-img" bindtap="onClosePay" />
    </view>

    <view class="moneyShow" wx:if="{{source != 'secondaryCard'}}"><text>¥</text>{{ moneyData.payMoney }}</view>
    <view class="moneyShow" wx:else><text>¥</text>{{selectExchange==1?exchangePrice:detail.price }}</view>
    <!-- <view class="moneyShow" wx:else><text>¥</text>{{ level?pay_methon==2?levelPrice:selectExchange==1?exchangePrice:detail.price:selectExchange==1?exchangePrice:detail.price }}</view> -->

    <view class="select-pay-methon" catchtap="pay_methonw">
      <image class="pay-img" src="/images/wx_pay.png"></image>
      <view class="pay-title">微信支付</view>
      <image class="select-activity" src="{{pay_methon==1?'/images/icon_13.png':'/images/icon_12.png'}}"></image>
    </view>

    <view class="select-pay-methon" catchtap="pay_methonc" style="margin-bottom: 15rpx;">
      <image class="pay-img" src="/images/joli_pay.png"></image>
      <view class="pay-title">储值支付</view>
      <view class="pay-money"><text>￥</text>{{inserllAmount}}</view>
      <image class="select-activity" src="{{pay_methon==2?'/images/icon_13.png':'/images/icon_12.png'}}"></image>
    </view>
    <!-- <view wx:if="{{level!=0}}" class="coup-box-title" style="text-align: left; margin-left: 90rpx;">权益优惠减¥{{toLevelPrice}}</view> -->
    <view class="coupon-popup-btm flex-center">
      <view class="coupon-popup-btm-btn flex-center" bindtap="payNow">支付</view>
    </view>
  </view>
</wux-popup>

<view class="list_first_to" catchtouchmove="noneEnoughPeople" hidden="{{inFirstIn?false:true}}">

  <view wx:if="{{detail.id || detail.project_id}}" class="item itemInNeeds current{{current}}">
    <view class="item-top flex-align-center onIndex111 opc">
      <text class="flex1 ellipsis"></text>
    </view>
    <view>
      <view class="item-content flex opcBack">
        <image class="img" src="{{detail.banner_urls.length > 0 ? detail.banner_urls[0] : '' || deviceData.cover_url}}"></image>
        <view class="content flex-column">
          <view class="content-text-box flex1">
            <text style="color:#999;">{{source == 'cardgoods' ? '可用店铺：' : '预约店铺：'}}</text>
            <text class="flex1 ellipsis">{{deviceData.store_name || detail.store_name}}</text>
          </view>
          <view class="content-text-box flex1">
            <text style="color:#999;">{{source == 'cardgoods' ? '可用时间：' : '使用时间：'}}</text>
            <text class="flex1 ellipsis" wx:if="{{detail.take_out_time_max}}">{{detail.take_out_time_max}}之前</text>
            <text class="flex1 ellipsis" wx:else>{{tool.replaceStr(timeData.order_day)}} {{tool.replaceStr(timeData.order_time)}}</text>
          </view>
          <view class="content-text-box flex1" wx:if="{{deviceData.device_name}}">
            <text style="color:#999;">使用设备：</text>
            <text class="flex1 ellipsis">{{deviceData.device_name}}</text>
          </view>
          <view class="content-text-box flex1" wx:else></view>
        </view>
      </view>
    </view>
    <view class="item-btn flex-align-center onIndex111 opc">
      <text style="font-size: 28rpx;color: #999;">{{source == 'cardgoods' ? '购买费用：' : '预约费用：'}}</text>
      <text style="font-size: 36rpx;font-family: PingFang-SC-Medium, PingFang-SC;font-weight: 500;margin-right:24rpx;">¥{{moneyData.projectWithGoodsPrice}}</text>
    </view>
  </view>

  <view class="list_top_show">
    <image class="list_top_img" src="/images/white_on.png"></image>
    <view class="list_top_content">
      <view class="first_and_title"><text>第一步：</text>核对您预约的项目和店铺</view>
    </view>
  </view>


  <view class="KnowBtn" catchtap="knowSubmit">我知道了</view>

</view>