<template>
  <div class="addCarAlert">
    <div class="backdrop" v-if="isShowAlert" @click="closeAlert">
      <div class="pop-tip">
        <div class="window-img">
          <div class="title">
            <i class="iconfont icon-guanbi close"></i>
          </div>
          <dl class="box-img">
            <dt>
              <i class="icon iconfont icon-xuanzhong"></i>
            </dt>
            <dd>{{tipText}}</dd>
            <dd>
              <a href="/v3/joincart" class="qu-car">去购物车结算 &gt;&gt;</a>
            </dd>
          </dl>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState({
      isShowAlert: state => state.gooddetail.isShowAlert,
      tipText: state => state.gooddetail.tipText
    })
  },
  methods: {
    closeAlert() {
      this.$store.commit("closeAlert");
    }
  }
};
</script>

<style lang="scss">
.addCarAlert {
  .backdrop {
    position: fixed;
    z-index: 12;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.3);
    &.zIndex {
      z-index: 1;
    }
    .pop-tip {
      .window-img {
        background: #fff;
        position: fixed;
        top: 25%;
        left: 50%;
        z-index: 101;
        border-radius: 3px;
        width: 80%;
        transform: translateX(-50%);
      }
      .title {
        position: relative;
        width: 100%;
        i {
          right: 0;
          top: -22px;
          position: absolute;
          color: #fff;
        }
      }
      .box-img {
        text-align: center;
        padding: 20px 10px 30px 10px;
        dt {
          width: 35px;
          height: 35px;
          line-height: 42px;
          margin: 0 auto;
          border-radius: 50%;
          margin-bottom: 5px;
          .iconfont {
            font-size: 27px;
            font-weight: bold;
            color: #1080d0;
          }
        }
        dd {
          font-size: 14px;
          color: #333;
          padding-top: 10px;
          line-height: 20px;
          a {
            color: #1080d0;
          }
        }
      }
    }
  }
}
</style>