<template>
  <scroll-view scroll-y="true" class="scroll-Y">
    <!--    <wx-points-commit ref="wxPointsCommit"></wx-points-commit>-->

    <van-checkbox-group :value="checkedCouponList" checked-color="#EA3323">
      <div class="card-list" v-if="couponList.length">
        <div class="item" v-for="(item, index) in couponList" :key="index" :class="index === couponList.length - 1 ? 'mgb-110' : ''">
          <div class="item-image cro">
            <div class="cro_right_top"></div>
            <div class="cro_right_bottom"></div>
            <div class="img">
              <div>
                <span style="font-weight: bold; color: #ed1c24">￥</span>
                <span style="font-weight: bold; color: #ed1c24; font-size: 50px">{{ item.discountFee }}</span>
              </div>
              <span style="color: #989898; font-size: 30px">停车劵</span>
            </div>
          </div>
          <div class="item-content cro_">
            <div class="cro_left_top"></div>
            <div class="cro_left_bottom"></div>
            <div class="content">
              <span class="h3">{{ item.name }}</span>
              <span class="span">有效期至 {{ item.expirationDate }}</span>
            </div>
            <div class="erwm_box">
              <van-checkbox :name="`coupon${index}`" color="#fff" :disabled="item.disabled" @click="checkboxItemChange(`coupon${index}`, index)" />
            </div>
          </div>
        </div>
      </div>
    </van-checkbox-group>
    <div class="flewx">
      <div class="flewx-content">
        应付<span style="color: red; font-size: 32px; padding-left: 20px">{{ actualPayFee | currency }}</span>
        元
        <span style="color: #8d8d8d; padding-left: 30px; font-size: 28px">已优惠{{ remainPrice | currency }}元</span>
      </div>
      <div
        :class="{
          flewx_index3: true,
          blue_flewx_index3: custTypeId === 1,
          green_flewx_index3: custTypeId === 2,
          'btn-disabled': !checkedCouponList.servicefee,
        }"
        @click="confirm"
      >
        确定
      </div>
    </div>
  </scroll-view>
</template>

<script>
import parkingFeeCouponJs from '../../mixins/parkingFeeCoupon';

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

<style lang="less" scoped>
//@import '../../styles/common.less';
.scroll-Y {
  width: 100%;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #f1f1f1;
}

.card-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 10px 20px;
  box-sizing: border-box;
  flex: 1;
  position: relative;

  .item {
    display: flex;
    margin-bottom: 16px;

    .item-image {
      border: 2px solid #f2f2f2;
      border-right: 2px dashed #f2f2f2;
      padding: 16px;
      border-radius: 16px 0 0 16px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #fff;

      &.cro {
        position: relative;
      }

      .img {
        width: 130px;
        height: 130px;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        image {
          width: 100%;
          height: 100%;
        }
      }
    }

    .item-content {
      flex: 1;
      border: 2px solid #f2f2f2;
      border-radius: 0 8px 8px 0;
      padding: 16px;
      box-sizing: border-box;
      background: #fff;
      display: flex;

      &.cro_ {
        position: relative;
      }

      .content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        flex: 1;

        .h3 {
          font-size: 28px;
          line-height: 48px;
          font-weight: 500;
        }

        .span {
          font-size: 24px;
          color: #838181;
          line-height: 40px;
        }
      }

      .erwm_box {
        display: flex;
        align-items: center;
        position: relative;

        image {
          width: 52px;
          height: 52px;
        }

        .tag {
          position: absolute;
          bottom: 0;
          right: 0;
          border-radius: 16px;
          padding: 5px 10px;
          box-sizing: border-box;
          background: #f7931e;
          text-align: center;
          color: #fff;
          width: 122px;
          font-size: 24px;
        }
      }
    }
  }
}

// 凹圆角
.cro_left_top,
.cro_left_bottom,
.cro_right_top,
.cro_right_bottom {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid #eee;
  z-index: 1;
  background: #f2f2f2;
}

.cro_left_top {
  top: -1px;
  left: -1px;
  border-radius: 0px 0px 8px 0px;
  border-bottom: 1px solid #f2f2f2;
  border-top: 1px solid #f2f2f2;
  border-right: 1px solid #f2f2f2;
  border-left: 1px solid #f2f2f2;
}

.cro_left_bottom {
  left: -1px;
  bottom: -1px;
  border-radius: 0px 8px 0px 0px;
  border-top: 1px solid #f2f2f2;
  border-bottom: 1px solid #f2f2f2;
  border-right: 1px solid #f2f2f2;
  border-left: 1px solid #f2f2f2;
}

.cro_right_top {
  top: -1px;
  right: -1px;
  border-radius: 0px 0px 0px 8px;
  border-top: 1px solid #f2f2f2;
  border-bottom: 1px solid #f2f2f2;
  border-left: 1px solid #f2f2f2;
  border-right: 1px solid #f2f2f2;
}

.cro_right_bottom {
  right: -1px;
  bottom: -1px;
  border-radius: 8px 0px 0px 0px;
  border-top: 1px solid #f2f2f2;
  border-bottom: 1px solid #f2f2f2;
  border-left: 1px solid #f2f2f2;
  border-right: 1px solid #f2f2f2;
}

.mgb-110 {
  margin-bottom: 110px !important;
}

.flewx {
  width: 100%;
  height: 100px;
  background-color: #fff;
  position: fixed;
  bottom: 0;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  // padding-bottom: constant(safe-area-inset-bottom);
  // padding-bottom: env(safe-area-inset-bottom);
  padding-bottom: 20px;

  .flewx-content {
    position: absolute;
    left: 16px;
  }

  .flewx_index3 {
    width: 150px;
    height: 70px;
    border-radius: 50px;
    text-align: center;
    font-size: 28px;
    line-height: 70px;
    color: #fff;
    background-image: linear-gradient(to right, #7e4fa1, #433c7f);
    box-shadow: 2px 3px 5px #888888;
    position: absolute;
    right: 16px;
  }

  .blue_flewx_index3 {
    .color-background-color('blue');
  }

  .green_flewx_index3 {
    .color-background-color('green');
  }
}

/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;
}
</style>
