<template>
  <div class="border-box border-top-8">
    <div v-if="goodsData.commodityPurchaseInstruction" class="border-box pl-12 pr-12">
      <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-12 pb-12" :class="{
          'border-bottom':
            index <
            goodsData.commodityPurchaseInstruction
              .commodityPurchaseInstructionModuleEntityList.length -
            1,
        }">
          <div class="flex flex-items-center flex-row flex-shrink-0 mr-8">
            <zn-icon :name="moduleItem.moduleIcon" size="20" color="#333"></zn-icon>
            <span class="ml-4 font-size-14 color-171717 line-height-20">
              {{ moduleItem.moduleTitle }}
            </span>
          </div>
          <span class="flex-full font-size-12 color-525866 line-height-20 mt-4">
            {{ 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>
