<template>
  <div class="pay-detail">
    <div class="order-status">
      <p>待支付</p>
      <p>取消订单</p>
    </div>
    <ul class="goods-list">
      <li>
        <div class="goods-cover">
          <img alt="" height="60" src="" width="60">
        </div>
        <div class="info">
          <p class="top">
            <span>曼哈顿</span>
            <span>￥1000</span>
          </p>
          <p class="bottom">
            <span>标准+茉莉初雪+标准糖</span>
            <span>*2</span>
          </p>
        </div>
      </li>
      <li>
        <p class="more">展开（共8件）</p>
      </li>
    </ul>
    <ul class="amount-detail">
      <li>
        <p class="label">订座预约款</p>
        <p class="value">-¥200</p>
      </li>
      <li>
        <p class="label">优惠券</p>
        <p class="value">-¥500</p>
      </li>
      <li>
        <p class="label">小计</p>
        <p class="label">¥2700</p>
      </li>
    </ul>
    <payment class="margin-top-20"
             @onChange="handlePayment"/>
    <div class="footer">
      <p class="price">￥2700</p>
      <van-button class="btn" type="warning">去结算</van-button>
    </div>
    <!--选择优惠券-->
    <van-popup
      v-model="couponPopup"
      class="af-van-popup"
      position="bottom"
      style="border-radius: 16px 16px 0 0;">
      <h1 class="title">选择优惠券</h1>
      <div class="af-popup-main">
        <div v-for="i in 1" :key="i" class="coupon">
          <div class="money">
            <p>50</p>
            <p>元</p>
          </div>
          <div class="des">
            <p class="name">50元点单代金券</p>
            <p class="expire">有效期：2021-04-27至2021-05-26</p>
          </div>
        </div>
      </div>
    </van-popup>
    <!--选择预约款-->
    <van-popup
      v-model="downPaymentPopup"
      class="af-van-popup"
      position="bottom"
      style="border-radius: 16px 16px 0 0;">
      <h1 class="title">选择预约款</h1>
      <div class="af-popup-main">
        <div v-for="i in 3" :key="i" class="down-payment">
          <div class="money">
            <p>预约款</p>
            <p>￥1000</p>
            <p>订单满1000可使用</p>
          </div>
          <div class="des">
            <p>星桥店</p>
            <p>12人卡座 (舞台中间)</p>
            <p>04月27日 今日</p>
          </div>
        </div>
      </div>
    </van-popup>
  </div>
</template>

<script>
import payment from '../../common/payment'
import { Button, Popup } from 'vant'

export default {
  name: 'index',
  components: {
    payment,
    'van-button': Button,
    'van-popup': Popup
  },
  data () {
    return {
      order_pay_type: 2,
      couponPopup: false, // 优惠券选择弹窗
      downPaymentPopup: false // 选择预约款弹窗
    }
  },
  methods: {
    handlePayment (val) {
      this.order_pay_type = val
    }
  }
}
</script>

<style lang="scss" scoped>
.pay-detail {
  padding-bottom: 68px;
}

.margin-top-20 {
  margin-top: 20px;
}

.order-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;

  p:nth-of-type(1) {
    font-size: 21px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #D32323;
    line-height: 29px;
  }

  p:nth-of-type(2) {
    font-size: 14px;
    color: #736F6F;
    line-height: 20px;
  }
}

.goods-list {
  padding: 0 20px;

  li {
    display: flex;
    margin-top: 12px;

    &:nth-of-type(1) {
      margin-top: 0;
    }
  }

  .info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: calc(100% - 60px);
  }

  .top,
  .bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 10px;
  }

  .top {

    span {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #1F1E1E;
      line-height: 22px;
      letter-spacing: 1px;
    }
  }

  .bottom {
    span {
      font-size: 14px;
      color: #736F6F;
      line-height: 20px;
    }
  }

  .more {
    width: 100%;
    font-size: 14px;
    color: #CCC6C6;
    line-height: 20px;
    text-align: center;
  }
}

.goods-cover {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
}

.amount-detail {
  margin-top: 14px;
  background: #fff;

  li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #F2F2F2;

    &:nth-last-child(1) {
      border-bottom: none;
    }
  }

  p {
    font-size: 18px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    line-height: 25px;
  }

  .label {
    color: #1F1E1E;
  }

  .value {
    color: #D32323;
  }
}

.footer {
  position: fixed;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 68px;
  padding: 0 20px;
  background: #FFFFFF;
  box-shadow: 0 -2px 4px 0 rgba(13, 13, 13, 0.03);

  .price {
    font-size: 21px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #D32323;
    line-height: 29px;
  }
}

.btn {
  width: 124px;
  height: 40px;
  background: #D32323;
  border-radius: 25px;
  border: none;

  ::v-deep .van-button__text {
    font-size: 16px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 40px;
  }
}

.af-van-popup {
  .title {
    padding: 20px 0 12px 20px;
    font-size: 18px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #1F1E1E;
    line-height: 25px;
  }
}

.af-popup-main {
  height: 335px;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
}

.coupon {
  display: flex;
  align-items: center;
  width: 365px;
  height: 90px;
  margin: 0 auto;
  background: url("./image/bg_coupon@2x.png") center center/100% 100% no-repeat;

  .money {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    width: 32%;
    padding-right: 10px;

    p {
      &:nth-of-type(1) {
        font-size: 36px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #1F1E1E;
        line-height: 50px;
      }

      &:nth-of-type(2) {
        padding-bottom: 10px;
        margin-left: 6px;
        font-size: 10px;
        color: #736F6F;
        line-height: 14px;
      }
    }
  }

  .des {
    padding-left: 20px;

    .name {
      font-size: 16px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #1F1E1E;
      line-height: 22px;
      letter-spacing: 1px;
    }

    .expire {
      margin-top: 8px;
      font-size: 10px;
      color: #736F6F;
      line-height: 14px;
    }
  }
}

.down-payment {
  display: flex;
  align-items: center;
  width: 335px;
  height: 110px;
  margin: 10px auto 0;
  background: url("./image/bg_money@2x.png") center center/100% 100% no-repeat;

  &:nth-of-type(1) {
    margin: 0 auto;
  }

  .money {
    width: 40%;

    p {
      padding-left: 16px;

      &:nth-of-type(1) {
        font-size: 12px;
        color: #1F1E1E;
        line-height: 17px;
      }

      &:nth-of-type(2) {
        font-size: 24px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #D32323;
        line-height: 33px;
      }

      &:nth-of-type(3) {
        font-size: 12px;
        color: #CCC6C6;
        line-height: 17px;
      }
    }
  }

  .des {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 16px;
    width: 60%;

    p {
      &:nth-of-type(1) {
        font-size: 16px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #1F1E1E;
        line-height: 22px;
      }

      &:nth-of-type(2) {
        margin: 10px 0 4px;
        font-size: 12px;
        color: #736F6F;
        line-height: 17px;
      }

      &:nth-of-type(3) {
        font-size: 12px;
        color: #D32323;
        line-height: 17px;
      }
    }
  }
}
</style>
