goodsItem.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <div class="goods-item">
  3. <el-card class="w-full" shadow="never" :body-style="{ padding: '10px' }">
  4. <p class="text-xl font-bold flex" style="justify-content: space-between;font-size:14px;">{{ props.goodsItem.title }}
  5. <span v-if="props.goodsItem.status==1" class="p-1 rounded ml-2" style="background-color: #e0eee0;font-size: 12px;color:red;height: 20px;padding: 2px;">已出单</span>
  6. </p>
  7. <!-- 添加规格展示区域 -->
  8. <div v-if="props.goodsItem.specsList && props.goodsItem.specsList.length > 0" class="mb-2">
  9. <el-tag
  10. v-for="spec in props.goodsItem.specsList"
  11. :key="spec.id"
  12. size="small"
  13. class="mr-1 mb-1"
  14. >
  15. {{ spec.name }}: {{ spec.value }}
  16. </el-tag>
  17. </div>
  18. <div>
  19. <b style="color: coral">{{ props.goodsItem.summary }}</b>
  20. <span class="p-1 rounded ml-2" style="background-color: #e0eee0">{{
  21. '×' + props.goodsItem.num
  22. }}</span>
  23. <span class="float-right">
  24. <el-button-group size="small">
  25. <el-button @click="reduce()" :disabled="props.goodsItem.status==1"> - </el-button>
  26. <el-button @click="add()" :disabled="props.goodsItem.status==1"> + </el-button>
  27. </el-button-group>
  28. </span>
  29. </div>
  30. </el-card>
  31. </div>
  32. </template>
  33. <script setup lang="ts">
  34. const emit = defineEmits(['add', 'reduce'])
  35. const props = defineProps({
  36. goodsItem: {
  37. type: Object,
  38. default: () => ({})
  39. }
  40. })
  41. const add = () => {
  42. emit('add', props.goodsItem)
  43. }
  44. const reduce = () => {
  45. emit('reduce', props.goodsItem)
  46. }
  47. </script>
  48. <style></style>