<template>
  <div class="cart-con" :style="{maxHeight:active?'100%':'0'}">
    <component :is="cp.type" :sku="cp.sku" @backList="cp.type='list'" :fromList='cp.fromList' @toPay="handlePay"></component>
  </div>
</template>

<script>
import list from './ctemp/list'
import detail from './ctemp/detail'

export default {
  props: ['active', 'cp'],
  data () {
    return {
      sku: ''
    }
  },
  methods: {
    handlePay (data) {
      this.cp.fromList = true
      this.cp.sku = data
      this.cp.type = 'detail'
    }
  },
  mounted () {
  },
  components: {
    list,
    detail
  }
}
</script>

<style lang="scss" scoped>

.c-button {
  height: 50px;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
  margin-top: 10px;
  display: inline-block;
  background-color: #1fe4dc;
  text-align: center;
  cursor: pointer;
  &:first-child {
    width: 50px;
    box-sizing: border-box;
  }

  &:last-child {
    width: 150px;
    line-height: 50px;
    color: #000;
    font-size: 14px;
  }
}
.cart-con {
  $animateType: cubic-bezier(0.77, 0, 0.175, 1);
  width: 730px;
  position: fixed;
  right: 0;
  height: 100%;
  transition: max-height 0.7s $animateType;
  max-height: 100%;
  background: #fff;
  z-index: 99999;
  top: 0;
  overflow: hidden;
  .cart {
    color: #000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    font-size: 16px;
    .c-title {
      height: 70px;
      line-height: 70px;
    }
    i {
      color: #999;
      cursor: pointer;
    }
  }
  .items {
    max-height:600px;
    overflow: auto;
    .item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-top: 1px solid #e7e7e7;
      padding: 20px 60px;
      &:last-of-type {
        border-bottom: 1px solid #e7e7e7;
      }
      img {
        width: 80px;
        vertical-align: middle;
        &:last-of-type {
          width: 100px;
          margin-top: 40px;
        }
      }
      .iconfont {
        font-size: 36px;
        vertical-align: middle;
        margin: 0 20px;
      }
      .taocan {
        text-align: center;
        .numAP {
          margin-top: 30px;
          span {
            font-size: 16px;
            margin: 0 10px;
          }
          i {
            cursor: pointer;
            display: inline-block;
            width: 20px;
            height: 20px;
            line-height: 10px;
            padding: 5px;
            border: 1px solid #e7e7e7;
          }
        }
      }
      .jiage{
        .oper{
          margin-top: 30px;
          text-align: right;
          span{
            cursor: pointer;
            color: #a0a0a0;
            border-bottom: 1px solid #e7e7e7;
          }
        }
      }
    }
  }
  .jiesuan{
    text-align: right;
    margin-top: 40px;
    margin-right: 60px;
    p{
      color: #a0a0a0;
      line-height: 36px;
    }
    .price{
      line-height: 40px;
      font-size: 24px;
    }
  }
}
</style>
