SubidyColumn(old).tsx 6.03 KB
import moment from 'moment';
import React from 'react';
import { useStore } from '../index';

export default function SubidyColumn() {
  const { setDetailVisible, setOrderId, currentItem } = useStore();
  const FactoryColumn = [
    {
      title: "VIN",
      dataIndex: "vin",
      key: "vin",
      width: "10%",
      render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>)
    },
    {
      title: "车辆",
      dataIndex: "materialName",
      key: "materialName",
    },
    {
      title: "补贴类型",
      dataIndex: "subsidyName",
      key: "subsidyName"
    },
    {
      title: "应折让金额(元)",
      dataIndex: "rebateAmount",
      key: "rebateAmount",
    },
    {
      title: "实际折让金额(元)",
      dataIndex: "actualRebateAmount",
      key: "actualRebateAmount",
    },
    {
      title: "往来单位",
      dataIndex: "factoryName",
      key: "factoryName",
    },
    {
      title: "下零售门店",
      dataIndex: "retailShopName",
      key: "retailShopName",
    },
    {
      title: "下零售日期",
      dataIndex: "retailTime",
      key: "retailTime",
      render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss')
    },
    {
      title: "操作",
      width: "10%",
      key: "options",
      render: (text: any, record: FvmAllowance.OrderItemVo) => (
        <>
          <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a>
        </>
      )
    }
  ];
  /**厂家代收 */
  const CollectionColumn = [
    {
      title: "VIN",
      dataIndex: "vin",
      key: "vin",
      width: "10%",
      render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>)
    },
    {
      title: "车辆",
      dataIndex: "materialName",
      key: "materialName",
    },
    {
      title: currentItem.rebateFundsType == 2 ? "厂家代收款名称" : "厂家直营车折让名称",
      dataIndex: "subsidyName",
      width: "10%"
    },
    {
      title: "应折让金额(元)",
      dataIndex: "rebateAmount",
      key: "rebateAmount",
    },
    {
      title: "实际折让金额(元)",
      dataIndex: "actualRebateAmount",
      key: "actualRebateAmount",
    },
    {
      title: "往来单位",
      dataIndex: "factoryName",
      key: "factoryName",
    },
    {
      title: "下零售门店",
      dataIndex: "retailShopName",
      key: "retailShopName",
    },
    {
      title: "下零售日期",
      dataIndex: "retailTime",
      key: "retailTime",
      render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss')
    },
    {
      title: "操作",
      width: "10%",
      key: "options",
      render: (text: any, record: FvmAllowance.OrderItemVo) => (
        <>
          <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a>
        </>
      )
    }
  ];
  const CashColumn = [
    {
      title: "VIN",
      dataIndex: "vin",
      key: "vin",
      width: "10%",
      render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>)
    },
    {
      title: "车辆",
      dataIndex: "materialName",
      key: "materialName",
    },
    {
      title: "启票金额(元)",
      dataIndex: "rebateAmount",
      key: "rebateAmount",
    },
    {
      title: "现金启票奖励折让金额(元)",
      dataIndex: "actualRebateAmount",
      key: "actualRebateAmount",
    },
    {
      title: "往来单位",
      dataIndex: "factoryName",
      key: "factoryName",
    },
    {
      title: "下零售门店",
      dataIndex: "retailShopName",
      key: "retailShopName",
    },
    {
      title: "启票日期",
      dataIndex: "ticketTime",
      key: "ticketTime",
      render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss')
    },
    {
      title: "操作",
      width: "10%",
      key: "options",
      render: (text: any, record: FvmAllowance.OrderItemVo) => (
        <>
          <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a>
        </>
      )
    }
  ];
  /**厂家促销确认清单 */
  const PromotionColumn = [
    {
      title: "VIN",
      dataIndex: "vin",
      key: "vin",
      width: "10%",
      render: (text: string) => (<div style={{ wordWrap: 'break-word', wordBreak: 'break-word' }}> {text}</div>)
    },
    {
      title: "车辆",
      dataIndex: "materialName",
      key: "materialName",
    },
    // {
    //   title: "折让类型",
    //   dataIndex: "subsidyName",
    //   key: "subsidyName"
    // },
    // {
    //   title: "应折让金额(元)",
    //   dataIndex: "rebateAmount",
    //   key: "rebateAmount",
    // },
    // {
    //   title: "实际折让金额(元)",
    //   dataIndex: "actualRebateAmount",
    //   key: "actualRebateAmount",
    // },
    {
      title: "往来单位",
      dataIndex: "factoryName",
      key: "factoryName",
    },
    {
      title: "下零售门店",
      dataIndex: "retailShopName",
      key: "retailShopName",
    },
    {
      title: "下零售时间",
      dataIndex: "retailTime",
      key: "retailTime",
      render: (text: number) => moment(text).format("YYYY-MM-DD")
    },
    {
      title: "启票日期",
      dataIndex: "ticketTime",
      key: "ticketTime",
      render: (text: number) => moment(text).format('YYYY-MM-DD HH:mm:ss')
    },
    // {
    //   title: "操作",
    //   width: "10%",
    //   key: "options",
    //   render: (text: any, record: FvmAllowance.OrderItemVo) => (
    //     <>
    //       <a onClick={() => { setDetailVisible(true); setOrderId(record.id); }}>确认折让差异</a>
    //     </>
    //   )
    // }
  ];
  if (currentItem.rebateFundsType == 1) {
    return FactoryColumn;
  }
  if (currentItem.rebateFundsType == 2) {
    return CollectionColumn;
  }
  if (currentItem.rebateFundsType == 3) {
    return CashColumn;
  }
  if (currentItem.rebateFundsType == 4) {
    return PromotionColumn;
  }
  if (currentItem.rebateFundsType == 6) {
    return CollectionColumn;
  }
  return [];
}