<template>
  <div class="flex shop-item" @click="toUrl(item)">
    <svg-icon class="shop" icon-class="shop"></svg-icon>
    <p>{{ item.productName }}</p>
    <button>去购买</button>
  </div>
</template>

<script setup>
import { cartClickSave } from "@/api/shortVideo";
import { defineProps } from "vue";
defineProps({
  item: {
    type: Object,
    default: () => {},
  },
});

const toUrl = (item) => {
  cartClickSave({
    productId: item.productId,
    productName: item.productName,
    productType: item.productType,
    videoId: item.videoId,
  });
  window.location.href = item.url;
};
</script>
<style scoped lang="scss">
.flex {
  display: flex;
}
.shop-item {
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 20px 10px;
  margin-bottom: 20px;
  .shop {
    width: 64px;
    height: 64px;
  }
  p {
    font-weight: 400;
    font-size: 24px;
    color: #ffffff;
    letter-spacing: 0;
    line-height: 32px;
    text-align: left;
    flex: 1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: 2;
    margin: 0 10px;
  }
  button {
    height: 46px;
    background-image: linear-gradient(90deg, #ff7066 0%, #ff3d36 100%);
    border-radius: 24px;
    font-weight: 500;
    font-size: 26px;
    color: #ffffff;
    padding: 0 18px;
  }
}
</style>
