<template>
  <div class="win-order">
    <div class="header">
      <CardTitle :data="data" :need_ellipsis="true" />
      <p class="win-icon">
        <WlPic src="https://wlmvp-cos.weiling.cn/frontend/win-icon.png" />
      </p>
    </div>
    <div class="content">
      <p>签单公司：{{ company_name }}</p>
      <p>金额：{{ amount }}</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: "WinOrder",
  components: { WlPic, CardFooter, CardTitle },
  props: {
    data: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      company_name: "",
      amount: "",
    };
  },
  watch: {
    data: {
      handler(val) {
        const { materials = [] } = val;
        const { material_name: company_name = "" } = materials[0];
        const { material_name: amount = "" } = materials[1];
        this.company_name = company_name;
        this.amount = amount;
      },
      immediate: true,
    },
  },
};
</script>

<style lang="scss" scoped>
.win-order {
  width: 100%;
  .header {
    height: j(42);
    @extend %flex-between;
    .win-icon {
      flex-shrink: 0;
      width: j(87);
      height: j(73);
      margin-left: j(5);
    }
  }
  .content {
    background-color: #f9f9f9;
    border-radius: j(10);
    padding: j(10);
    color: var(--wl-business-doing-color, #6236ff);
    p {
      line-height: j(24);
      @include textEllipsis(1);
    }
  }
}
</style>
