ProductInfo.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <script lang="ts" setup>/**
  2. * @Name: ProductInfo.vue
  3. * @Description: 商品列表-商品信息插槽
  4. * @Author: Cheney
  5. */
  6. import { DocumentCopy } from '@element-plus/icons-vue';
  7. import { handleCopy } from '/@/utils/useCopyText';
  8. const props = defineProps({
  9. item: {
  10. type: Object,
  11. required: true
  12. },
  13. imgWidth: {
  14. type: Number,
  15. default: 30
  16. },
  17. showTitleTooltip: {
  18. type: Boolean,
  19. default: false
  20. },
  21. displaySKU: {
  22. type: Boolean,
  23. default: false
  24. },
  25. displayCompetitor: {
  26. type: Boolean,
  27. default: false
  28. }
  29. });
  30. </script>
  31. <template>
  32. <div class="flex justify-start items-center font-medium">
  33. <div v-if="item.img" :style="`width: ${imgWidth}px; height: ${imgWidth}px; margin-right: 5px;`">
  34. <el-tooltip effect="light" placement="right-start">
  35. <el-image
  36. :src="`https://d1ge0kk1l5kms0.cloudfront.net/images/I/${item.img}.jpg`"
  37. :style="`width: ${imgWidth}px; height: ${imgWidth}px; margin-right: 5px;`"
  38. fit="scale-down"
  39. lazy
  40. />
  41. <template #content>
  42. <el-image
  43. :src="`https://d1ge0kk1l5kms0.cloudfront.net/images/I/${item.img}.jpg`"
  44. style="width: 250px"
  45. />
  46. </template>
  47. </el-tooltip>
  48. </div>
  49. <el-image v-else :style="`width: ${imgWidth}px; margin-right: 5px;`" lazy>
  50. <div slot="error" class="image-slot">
  51. <i class="el-icon-picture-outline"></i>
  52. </div>
  53. </el-image>
  54. <div class="text-left">
  55. <el-tooltip :content="item.title" :disabled="showTitleTooltip || !item.title" effect="dark" placement="top-start"
  56. show-after="350">
  57. <el-link :disabled="!item.title" :href="item.url" :underline="false" target="_blank" type="primary">
  58. <span :class="item.is_competitors && displayCompetitor ? 'line-clamp-1' : 'line-clamp-2' +
  59. ' text-ellipsis whitespace-normal'">
  60. {{ item.title || '--' }}
  61. </span>
  62. </el-link>
  63. </el-tooltip>
  64. <div>
  65. <div class="flex">
  66. ASIN:
  67. <span class="font-semibold italic ml-1" style="color: #1d2129;">
  68. {{ item.asin || '--' }}
  69. </span>
  70. <el-button :disabled="!item.asin" :icon="DocumentCopy" class="ml-1 cursor-pointer" link
  71. @click="handleCopy(item.asin || '')">
  72. </el-button>
  73. </div>
  74. <!--<el-tooltip :content="item.sku" :disabled="!item.sku" effect="light" show-after="300">-->
  75. <div v-if="item.is_competitors && displayCompetitor">
  76. <p class="m-0 p-0 line-clamp-1 text-ellipsis">
  77. <!--竞品:-->
  78. <span :style="item.is_competitors ? 'color: #F77D7C;' : ''">
  79. <el-tag effect="plain" size="small" type="danger">
  80. {{ item.is_competitors ? '竞品' : '否' }}
  81. </el-tag>
  82. </span>
  83. </p>
  84. </div>
  85. <!--</el-tooltip>-->
  86. </div>
  87. </div>
  88. </div>
  89. </template>
  90. <style scoped>
  91. </style>