<wxs module="filters" src="../../utils/toFixed.wxs"></wxs>
<popup show="{{show}}" height="{{height}}" FixHeight="{{FixHeight}}" bind:close="close" class="popupHeight">
  <view class="sku-container">
    <!-- 好友邀请提示 -->
    <view class="friend-share-tip" wx:if="{{shareInfo.sharer && shareInfo.sessionName && shareInfo.mealsName}}">{{shareInfo.sharer}} 已成功报名 {{shareInfo.sessionName}} / {{shareInfo.mealsName}}</view>
    <checkbox-group bindchange="checkboxChange" class="check-box" wx:if="{{maxUserCoin>0}}">
      <checkbox checked="{{checkeduseCoin}}" color="#ee3a43" />仅显示可用宝贝币的场次
    </checkbox-group>
    <!-- 补缴费用说明 -->
    <!-- wx:if="{{orderInfo.dayBeforeStart}}" -->
    <view wx:if="{{orderInfo}}">
      <view class="modular modular-pad" wx:if="{{orderInfo.refundRule!=5}}">
      <view class="modal-title">补缴费用</view>
      <view class="modal-label">
        <view style="font-weight: 700;margin-bottom: 10rpx;">补缴规则</view>
        <!-- <view class="subtitleColor">·当前日期时触发前{{orderInfo.dayBeforeStart}}天，换场次需补交{{orderInfo.deductRate*100}}%费用</view> -->
        <view class="subtitleColor spacing" wx:if="{{orderInfo.refundRule!=5&&orderInfo.deductRate==0}}">当前日期可免费申请换场次</view>
        <!-- <view class="subtitleColor spacing" wx:if="{{orderInfo.refundRule==6&&orderInfo.dayBeforeStart>=60}}">当前日期可免费申请换场次</view> -->
        <!-- <view class="subtitleColor spacing" wx:elif="{{orderInfo.refundRule==1&&orderInfo.dayBeforeStart>=2}}">当前日期是出发前2天，换场次需要补缴30%费用</view>
        <view class="subtitleColor spacing" wx:elif="{{orderInfo.refundRule==1&&orderInfo.dayBeforeStart>=1}}">当前日期是出发前1天，换场次需要补缴50%费用</view>
        <view class="subtitleColor spacing" wx:elif="{{orderInfo.refundRule==2&&orderInfo.dayBeforeStart>=7}}">当前日期可免费申请换场次</view> -->
        <!-- wx:elif="{{orderInfo.refundRule==2&&orderInfo.dayBeforeStart>=3&&orderInfo.dayBeforeStart<=6}}" -->
        <view wx:if="{{orderInfo.refundRule!=5&&orderInfo.deductRate!=0}}" class="subtitleColor spacing" >当前日期是出发前{{orderInfo.dayBeforeStart}}天，换场次需要补缴{{orderInfo.deductRate*100}}%费用</view>
        <!-- <view class="subtitleColor spacing" wx:elif="{{orderInfo.refundRule==2&&orderInfo.dayBeforeStart<3}}">当前日期是出发前{{orderInfo.dayBeforeStart}}天，换场次需要补缴70%费用</view>
        <view class="subtitleColor spacing" wx:if="{{orderInfo.refundRule==3&&orderInfo.dayBeforeStart>=7}}">当前日期可免费申请换场次</view>
        <view class="subtitleColor spacing" wx:elif="{{orderInfo.refundRule==3&&orderInfo.dayBeforeStart<7}}">当日期是出发前{{orderInfo.dayBeforeStart}}天，换场次需补缴10%费用</view>
        <view class="subtitleColor spacing" wx:if="{{orderInfo.refundRule==4&&orderInfo.dayBeforeStart>=7}}">当前日期可免费申请换场次</view>
        <view class="subtitleColor spacing" wx:if="{{orderInfo.refundRule==4&&orderInfo.dayBeforeStart<7}}">当日期是出发前{{orderInfo.dayBeforeStart}}天，换场次需补缴25%费用</view> -->
        <!-- <view wx:elif="{{orderInfo.refundRule==1&&orderInfo.dayBeforeStart<=1}}">当前日期是出发前2天,换场次需要补缴50%费用</view> -->
        <view class="spacing" wx:if="{{orderInfo.resultIncome*orderInfo.deductRate*100*0.5>0}}">·总支付金额：{{orderInfo.resultIncome}}元</view>
        <view class="spacing" wx:if="{{orderInfo.resultIncome*orderInfo.deductRate*100*0.5>0}}">·需补缴费用：{{filters.toFix(orderInfo.sumDeduct)}}元（{{orderInfo.deductRate*100}}%）*50%（专属优惠）={{ filters.toFix(orderInfo.resultIncome*0.5*orderInfo.deductRate) }}元</view>
        <view>
          <view class="warning">注：</view>
          <view class="spacing">·换场次当前享有专属优惠，仅需支付50%的补缴费用。</view>
          <view class="spacing">·若因孩子生病、疫情等特殊原因无法参与活动而产生扣费，需提交证明给宝大大进行处理。</view>
          <view class="spacing">·若换场次成功后申请退款，则需根据换场次条例补回优惠的补缴费用金额。<text bindtap="showFund" class="subtitleColor">点击查看换场次条例></text> </view>
        </view>
      </view>
    </view>
    </view>
    <!-- 换场次说明 -->
    <view class="modular modular-pad" wx:if="{{changeSku}}">
      <view class="modal-title">规则说明</view>
      <view class="modal-label">
        <view class="spacing">1、只可申请更换至同一活动下的场次；</view>
        <view class="spacing">2、提交申请后，宝大大们会进行审核处理，若需缴纳手续费则宝大大会进行联系。审核结果将会通过服务号发送消息通知；<text class="subtitleColor" bindtap="confirm">前往关注服务号></text></view>
      </view>
    </view>
    <!-- 头部 -->
    <view class="sku-box-top {{(shareInfo.sharer && shareInfo.sessionName && shareInfo.mealsName)?'m-top40':''}}">
      <view class="sku-column">
        <view class="column-title">选择日期：</view>
        <eventCalendar sid="{{initialSku.s1}}" calendarInfo="{{calendarInfo}}" presellOpen="{{presellOpen}}" bind:change="changeDate"></eventCalendar>
      </view>
      <view class="sku-column" wx:if="{{sessionInfo.length>0}}">
        <view class="column-title">选择场次：</view>
        <view class="sku-column-body">
          <view class="sku-sessions" wx:for="{{sessionInfo}}" wx:key="sid">
            <view class="sku-sessions-box {{(item.status==0 || item.status==1)?(item.actnum>0?(item.actnum>(item.beignNum*item.proportion)?'sale':'few-quota'):(item.status==1 && presellOpen==0 && item.actnum<=0 && item.waitActNum && item.waitActNum>0?'alternate':'full')):'full'}} {{checkSession==index?'sku-row__item--active':''}}" data-item="{{item}}" data-i="{{index}}" bindtap="selectSession">
              <view class="sessions-title">{{item.name}}</view>
              <text class="sessions-status">{{(item.status==0 || item.status==1)?(item.actnum>0?(item.actnum>(item.beignNum*item.proportion)?'火热报名中':'少量名额'):(item.status==1 && presellOpen==0 && item.actnum<=0 && item.waitActNum && item.waitActNum>0?'售罄候补':'已满额')):(item.status==1?'已满额':'已结束')}}</text>
            </view>
          </view>
        </view>
      </view>
      <view class="sku-column" wx:if="{{mealsInfo.length>0 && sessionInfo.length>0 && checkSession !=-1}}">
        <view class="column-title">选择{{military==1?'排':'套餐'}}：</view>
        <view class="sku-column-body">
          <view class="sku-package" wx:for="{{mealsInfo}}" wx:key="pid">
            <view class="sku-sessions-box flex-box {{checkMeals==index?'sku-row__item--active':''}} {{military==1?((item.status==0 || item.status==1)?(item.actnum>0?(item.actnum>10?'sale':'few-quota'):(presellOpen==0 && item.actnum<=0 && item.waitActNum && item.waitActNum>0?'alternate':'full')):'full'):''}}" data-item="{{item}}" data-i="{{index}}" bindtap="selectMeals">
              <view class="sessions-title">{{item.policyName}}</view>
              <view class="meals-status" wx:if="{{military==1}}">(
                <text wx:if="{{item.minAge && item.maxAge}}">{{item.minAge+'~'+item.maxAge+'岁,'}}</text>
                {{item.campSex==1?'男':(item.campSex==0?'女':'不限')}}
                )
              </view>
              <view class="identify attr-r" wx:if="{{military==1 && item.actnum<=0 && item.waitActNum>0&&presellOpen==0}}">售罄候补</view>
              <view class="identify attr-l" wx:if="{{item.userCoin>0}}">
                <text class='icon icon-coin font12'></text>
              </view>
            </view>
          </view>
        </view>
        <view class="militaryTip" wx:if="{{mealsInfo[checkMeals].userCoin>0}}">每个参与者最多可用{{mealsInfo[checkMeals].userCoin}}枚宝贝币</view>
        <view class="militaryTip" wx:if="{{military==1}}">注：年龄根据儿童上学时的年龄进行计算</view>
      </view>
      <view class="sku-column" wx:if="{{checkSession != -1 && checkMeals != -1 && mealsInfo.length>0 && sessionInfo.length>0}}" style="border: 0;">
        <view class="sku-column-quota">
          <view>参与人数</view>
          <view class="stepper sku__stepper sku-tep">
            <view class="stepper__minus {{initialSku.selectedNum <= sku.minT?'stepper__minus__diabled':''}}" data-type="minus" bindtap="quantity"></view>
            <input type="number" value="{{initialSku.selectedNum || ''}}" class="stepper__input" data-type="modfiy" bindblur="quantity" />{{sku.stock_num}}
            <view class="stepper__plus {{initialSku.selectedNum>=sku.stock_num?'stepper__plus__diabled':(initialSku.selectedNum >= sku.maxT?'stepper__plus__diabled':'')}}" data-type="plus" bindtap="quantity"></view>
          </view>
        </view>
        <view class="sku-column-quota" style="margin:0;font-size:26rpx">
          <text class="van-sku__quota" wx:if="{{presellOpen==0}}">￥{{mealsInfo[checkMeals].price}}/人</text>
          <view class="presell-price-view" wx:if="{{presellOpen!=0}}">
            <text class="">活动价：<text class="van-sku__quota">￥{{mealsInfo[checkMeals].price}}</text></text>
            <text class="">预付金：<text class="van-sku__quota">￥{{mealsInfo[checkMeals].presellPrice}}</text></text>
          </view>
          <text wx:if="{{mealsInfo[checkMeals].maxT <= sku.quota}}" class="van-sku__quota">每次限报{{mealsInfo[checkMeals].maxT}}人</text>
        </view>
      </view>
    </view>
  </view>
  <view class="bottom-btns-box">
    <button class="button button-subtitle" bindtap="confirmChange" style="line-height: 3;" wx:if="{{changeSku}}">提交更换申请</button>
    <button class="button button-subtitle" data-type="{{(saleType && presellOpen==0)?1:0}}" bindtap="sumbit" style="line-height: 3;" wx:else>{{presellOpen==0 &&saleType?'售罄候补':'立即购买'}}</button>
  </view>
</popup>