<template>
  <div class=" border-t-[8px] border-t-[#f5f5f5]">
    <div v-if="goodsData.commodityPurchaseInstruction" class=" pl-[12px] pr-[12px]">
      <ModuleTitle v-if="showTitle" :title="goodsData.commodityPurchaseInstruction.templateTitle" />
      <div v-for="(moduleItem, index) in goodsData.commodityPurchaseInstruction
        .commodityPurchaseInstructionModuleEntityList" :key="index">
        <div class="flex flex-items-start flex-col pt-[12px] pb-[12px]" :class="{
          'border-b border-ink-200':
            index <
            goodsData.commodityPurchaseInstruction
              .commodityPurchaseInstructionModuleEntityList.length -
            1,
        }">
          <div class="flex items-center flex-row shrink-0 mr-[8px]">
            <zn-icon :name="moduleItem.moduleIcon" size="20" color="#333"></zn-icon>
            <span class="ml-[4px] text-[14px] text-[#171717] leading-[20px]">
              {{ moduleItem.moduleTitle }}
            </span>
          </div>
          <span class="flex-1 text-[12px] text-ink-600 leading-[20px] mt-[4px]">
            {{ moduleItem.moduleContent }}
          </span>
        </div>
      </div>
    </div>
    <vue3-markdown-it v-else :source="goodsData.commodityTip" :html="true" />
  </div>
</template>

<script setup>
import { defineProps } from "vue";
import Vue3MarkdownIt from 'vue3-markdown-it';
import ModuleTitle from "@/components/ModuleTitle/index.vue";
import ZnIcon from "@/components/ZnIcon/index.vue";

// Props定义
const props = defineProps({
  goodsData: {
    type: Object,
    default: () => ({}),
  },
  showTitle: {
    type: Boolean,
    default: true,
  },
});
</script>
