<template>
  <div class="customer-event" @click="onClickCustomEvent">
    <CardTitle :data="data" />
    <div class="content" v-if="remark">
      <div class="content-html" v-html="remark" />
      <p class="more-container">
        <WlPic :src="require('@RecordCard/assets/images/arrow.png')" />
      </p>
    </div>
    <CardFooter :data="data" />
  </div>
</template>

<script>
import WlPic from "weiling-mobile-ui/lib/WlPic";
import CardTitle from "@RecordCard/components/Common/CardTitle/index.vue";
import CardFooter from "@RecordCard/components/Common/CardFooter/index.vue";
export default {
  name: "CustomEvent",
  components: { WlPic, CardFooter, CardTitle },
  props: {
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      remark: "",
    };
  },
  methods: {
    onClickCustomEvent() {
      this.$emit("onClickCustomEvent", this.data);
    },
  },
  watch: {
    data: {
      handler(val) {
        const { materials = [] } = val;
        this.remark = materials[0]?.material_name;
      },
      immediate: true,
    },
  },
};
</script>

<style lang="scss" scoped>
.customer-event {
  width: 100%;
  .content {
    @include cardContent();
    @extend %flex-middle;
    &-html {
      flex: 1;
      text-align: justify;
      @include textEllipsis(4);
    }
    .more-container {
      width: j(20px);
      height: j(20px);
      border-radius: 50%;
      background-color: white;
      border: 1px solid #e3e3e3;
      margin-left: j(10);
    }
  }
}
</style>
