<template>
  <div :class="theme">
    <div scroll-y="true" :class="['scroll-Y']">
      <van-checkbox-group v-model="checkedList" @change="checkboxChange" checked-color="#064C8A">
        <div class="container" v-if="memberLevelDiscount">
          <div class="item">
            <div class="title">会员等级减免</div>
            <div class="content">{{ memberGrade.memberGradeText || '' }}减免{{ memberGrade.discountTime || 0 }}小时。可优惠{{ memberGrade.discountFee || 0 }}元</div>
          </div>
          <van-checkbox color="#fff" name="member" checked-color="var(--k-color-primary)" :disabled="isMember" @click="memberClick" />
          <!-- :checked="isCheck('member')" -->
          <div class="member-discount-info" v-if="isMemberDiscountDisabled">当日已使用</div>
        </div>
        <div class="container" v-if="enableConsume">
          <div class="item">
            <div class="title">消费减免</div>
            <!-- <uni-view class="content" v-if="parkInfoEntity.parkMallCode === 1 && parkInfoEntity.expirationDate">{{reduceDiscountMessage}}</uni-view> -->
            <div class="content" v-if="orderDetail.parkInfo.parkMallCode !== 1">
              {{ todayReduceDiscountMessage }}
            </div>
            <van-stepper
              v-if="!enableConsumeNonSplit && maxReduceDiscount > 0 || parkMallCode === 1 || parkMallCode === 0" 
              :min="stepperMin"
              name="reduces"
              :disabled="isReduces || !maxReduceDiscount"
              :max="stepperMax"
              :value="reduceHours"
              @plus="onReduceHoursChange('plus')"
              @minus="onReduceHoursChange('minus')" 
              async-change
            />
          </div>
          <van-checkbox name="reduces" color="#fff" checked-color="var(--k-color-primary)" :disabled="isReduces || !maxReduceDiscount" @click="reducesClick" />
        </div>
      </van-checkbox-group>
    </div>
    <div class="flewx">
      <div class="control-box">
        <div class="flewx-content">
          <div class="fee-box">
            <div>合计：</div>
            <div class="actualPayFee">{{ actualPayFee | currency }}</div>
            <div :class="['van-hairline--surround', 'usingTotalDiscount', usingTotalDiscount > 0 && 'usingTotalDiscount-red']">已优惠{{ usingTotalDiscount | currency }}元</div>
            <!-- <van-count-down :time="3 * 60 * 1000" /> -->
          </div>
        </div>
        <div class="btn-box">
          <k-button style="width: 100%; max-width: 240px" title="确定" disabledColor="#D1D2D9" @click="confirm" />
        </div>
      </div>
      <!-- 开启底部安全区适配 -->
      <van-number-keyboard safe-area-inset-bottom />
    </div>
  </div>
</template>

<script>
import parkingFeeDiscountsJs from './mixins/parkingFeeDiscounts';
import baseMixins from './mixins/base';

export default {
  mixins: [baseMixins, parkingFeeDiscountsJs],
};
</script>

<style lang="less" scoped>
.scroll-Y {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f4f7ff;
}

.container {
  background-color: #fafbff;
  width: calc(100% - 100px);
  margin: 30px;
  padding-left: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  line-height: 70px;
  position: relative;
  height: inherit;
  border: 1px solid #d8dae0;

  .item {
    width: 570px;
    padding: 20px 0;

    .title {
      font-size: 34px;
    }

    .content {
      font-size: 28px;
      color: #989898;
    }
  }

  .member-discount-info {
    font-size: 20px;
    position: absolute;
    right: 12px;
    bottom: 0;
    color: #989898;
  }

  .page_img {
    width: 49px;
    height: 49px;
    border: 1px solid #e6e6e6;
    border-radius: 50%;
    overflow: hidden;

    img {
      width: 50px;
      height: 50px;
      margin-left: -1px;
    }
  }
}

/*页面底部操作区*/
.flewx {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background-color: #fff;

  .control-box {
    width: 100%;
    box-sizing: border-box;

    display: flex;
    align-content: flex-start;
    align-items: center;
    //padding-bottom: constant(safe-area-inset-bottom);
    //padding-bottom: env(safe-area-inset-bottom);
    padding: 30px 24px 30px 30px;
    justify-content: space-between;

    .flewx-content {
      font-size: 28px;

      .fee-box {
        display: flex;
        align-items: center;
        justify-content: flex-start;
      }

      .actualPayFee {
        color: #333;
        font-size: 40px;
      }

      .usingTotalDiscount {
        font-family: 'PingFang SC';
        font-style: normal;
        font-weight: 400;
        font-size: 22px;
        //height: 22px;
        //line-height: 22px;
        margin-left: 7px;
        //border: 1px solid var(--k-color-red-01);
        background-color: #f4f7ff;
        border-radius: 2px;

        &::after {
          border-color: #999999;
        }

        color: #999999;
        padding: 1px 3px;

        &.usingTotalDiscount-red {
          color: var(--k-color-red-01);
          background-color: var(--k-color-red-06);

          &::after {
            border-color: var(--k-color-red-01);
          }
        }
      }

      .count-down-box {
        display: flex;
        font-weight: 400;
        align-items: center;
        color: var(--k-color-red-01);
        font-family: 'PingFang SC';
        font-style: normal;
        font-weight: 400;
        font-size: 26px;
        margin-top: 5px;

        .van-count-down {
          font-size: 30px;
          color: var(--k-color-red-01);
        }

        .desc {
          font-size: 30px;
        }
      }
    }

    .btn-box {
      display: flex;
      justify-content: flex-end;
      margin-left: 35px;
      flex: 1;
      max-width: 240px;
    }
  }
}

/deep/ checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background-color: red !important;
  border-radius: 50% !important;
  border: 1px solid red;
}

/deep/ checkbox .wx-checkbox-input {
  border-radius: 50% !important;
}

/deep/ .van-stepper__input {
  background-color: #ffffff;
  font-size: 34px;
  border: 1px solid #e5e5e5;
  border-left: 0;
  border-right: 0;
  margin-left: 0;
  margin-right: 0;
}

/deep/ .van-stepper__minus {
  border: 1px solid #e5e5e5;
  border-right: 0;
}

/deep/ .van-stepper__plus {
  border: 1px solid #e5e5e5;
  border-left: 0;
}
</style>
