<template>
  <div v-show="shopCarCount" class="shopCar" @click="shoppingCart">
    <div class="shopCar-container">
      <span class="shopCar-count">{{ shopCarCount }}</span>
    </div>
  </div>
</template>
<script>
export default {
  computed: {
    shopCarCount() {
      return this.$store.getters['shopCart/cartCount'];
    }
  },
  methods: {
    shoppingCart() {
      console.log(123123);
      this.$track.registeredEvents(
        'APP_ShoppingCartBuoyClick',
        {
          page_name: '浏览记录页'
        },
        () => {
          if (this.$bridge.isApp) {
            this.$bridge.openNewUrl({
              data: {
                newUrl: `xyqb://shoppingCart?needLogin=1`
              }
            });
          } else {
            this.$router.push('/shopCart');
          }
        }
      );
    }
  }
};
</script>
<style lang="less" scoped>
.shopCar {
  width: 38px;
  height: 38px;
  background-color: @white;
  align-items: center;
  justify-content: center;
  border: solid 0.5px #c8c9cc;
  border-radius: 50%;
  box-shadow: 0 0.053333rem 0.32rem 0 rgb(100 101 102 / 12%);
  box-sizing: border-box;
  position: fixed;
  bottom: calc(15% + 56px + @padding-md);
  right: 6%;
  z-index: 9;

  &-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: url(~@/assets/images/browse/shop2.png) no-repeat center center;
    background-size: 18px 18px;
  }
  &-count {
    // .text-size(14);
    font-size: 12px;
    color: @white;
    text-align: center;
    position: absolute;
    width: 20px;
    height: 20px;
    line-height: 20px;
    background-color: #ff1616;
    border-radius: 50%;
    right: -6px;
    top: -8px;
  }
}
</style>
