snow 1 년 전
부모
커밋
c505927151

+ 15 - 0
src/api/dashboard/accountsReceivableExpired/index.ts

@@ -0,0 +1,15 @@
+import { http } from "/@/utils/http";
+import { loadEnv } from "@build/index";
+const { VITE_PROXY_DOMAIN_REAL, VITE_PROXY_USER_REAL } = loadEnv();
+const userAPi = VITE_PROXY_DOMAIN_REAL;
+const yewuApi = VITE_PROXY_USER_REAL + "/admin/";
+interface ResponseType extends Promise<any> {
+  data?: object;
+  code?: number;
+  msg?: string;
+}
+
+// 列表
+export const httpList = (param: object = {}): ResponseType => {
+  return http.request("post", `${yewuApi}departEveryDay`, param);
+};

+ 26 - 0
src/api/dashboard/grossMargin/index.ts

@@ -0,0 +1,26 @@
+import { http } from "/@/utils/http";
+import { loadEnv } from "@build/index";
+const { VITE_PROXY_DOMAIN_REAL, VITE_PROXY_USER_REAL } = loadEnv();
+const userAPi = VITE_PROXY_DOMAIN_REAL;
+const yewuApi = VITE_PROXY_USER_REAL + "/admin/";
+interface ResponseType extends Promise<any> {
+  data?: object;
+  code?: number;
+  msg?: string;
+}
+
+export const httpDepartDayList = (param: object = {}): ResponseType => {
+  return http.request("post", `${yewuApi}departEveryDay`, param);
+};
+
+export const httpDepartMonthList = (param: object = {}): ResponseType => {
+  return http.request("post", `${yewuApi}departEveryMonth`, param);
+};
+
+export const httpCompanyDayList = (param: object = {}): ResponseType => {
+  return http.request("post", `${yewuApi}companyEveryMonth`, param);
+};
+
+export const httpCompanyMonthList = (param: object = {}): ResponseType => {
+  return http.request("post", `${yewuApi}companyEvery`, param);
+};

+ 1 - 0
src/hooks/core/useAsync.ts

@@ -1,6 +1,7 @@
 import { ref, reactive, unref } from "vue";
 import { ElMessage } from "element-plus";
 import { useNav } from "/@/layout/hooks/nav";
+import { IDataType } from "/@/api/types";
 
 type Params = {
   code: number;

+ 14 - 0
src/utils/calc.ts

@@ -73,3 +73,17 @@ export function unit2TenThousand(value) {
   if ((value < 1000 && value > 0) || (value < 0 && value > -1000)) return value;
   return division(value, 10000).toFixed(2) + "W";
 }
+export function createTotalItem(values) {
+  const fields = Object.keys(values[0]);
+  return values.reduce(
+    (prev, current) =>
+      fields.reduce(
+        (prevObject, currentKey) => ({
+          ...prevObject,
+          [currentKey]: addition(prev[currentKey] || 0, current[currentKey])
+        }),
+        {}
+      ),
+    {}
+  );
+}

+ 0 - 2
src/views/InvoiceSales/invoiceApply/index.vue

@@ -25,9 +25,7 @@ const PageName = "invoiceApply";
 //   { code: "028", name: "批量导入财务开票结果(发票申请)" },
 const { hasPermissionWithCode } = usePermission(PageName);
 const loading = ref(false);
-
 const baseUrl = "/InvoiceSales/invoiceApplyDetail";
-
 const postModalRef = ref<InstanceType<typeof PostModal> | null>(null);
 const execlUploadRef = ref<InstanceType<typeof ExeclUpload> | null>(null);
 const approvalModalRef = ref<InstanceType<typeof ApprovalModal> | null>(null);

+ 5 - 11
src/views/dashboard/accountsReceivable/config/content.config.ts

@@ -48,21 +48,15 @@ const contentConfig: ContentConfig = {
   superUserNoAction: false,
   showTitle: true,
   handleData(data = []) {
-    const total = data.reduce((prev, current) => {
-      const keys = Object.keys(current)
-      return keys.reduce((prev, currentKey) => ({
-        ...prev,
-        [currentKey]: currentKey !== 'depart' ? addition(current[currentKey] || 0, prev[currentKey] || 0) : '总计'
-      }), prev)
-    }, {})
+    const total = data.reduce((prev, current) => Object.keys(current).reduce((prev, currentKey) => ({
+      ...prev,
+      [currentKey]: currentKey !== 'depart' ? addition(current[currentKey] || 0, prev[currentKey] || 0) : '总计'
+    }), prev), {})
     return [...data, total]
   },
   columns: columns.map(column => ({
     align: 'center',
-    ...column,
-    ...(column.prop !== "depart"
-      ? { cellRenderer: ({ row }) => unit2TenThousand(row[column.prop]) }
-      : {})
+    ...column, ...(column.prop !== "depart" ? { cellRenderer: ({ row }) => unit2TenThousand(row[column.prop]) } : {})
   })),
   apis: {
     httpList

+ 104 - 0
src/views/dashboard/accountsReceivableExpired/config/content.config.ts

@@ -0,0 +1,104 @@
+/* eslint-disable prettier/prettier */
+import { ContentConfig } from "/@/components/PageContent";
+
+import { httpList } from "/@/api/dashboard/accountsReceivableExpired";
+// import { addition, unit2TenThousand } from "/@/utils/calc";
+
+const columns = [
+  {
+    label: "确认单编码",
+    prop: "depart",
+    width: '115px'
+  },
+  {
+    label: "销售订单主编号",
+    prop: "wpay_fee",
+    width: '115px'
+  },
+  {
+    label: "确认单下单时间",
+    prop: "wpay_ainv_fee",
+    width: '115px'
+  },
+  {
+    label: "客户名称",
+    prop: "winv_fee"
+  },
+  {
+    label: "业务员部门",
+    prop: "inv_fee"
+  },
+  {
+    label: "业务员",
+    prop: "winv_asend_fee"
+  },
+  {
+    label: "产品名称",
+    prop: "wpay_send_fee"
+  },
+  {
+    label: "下单数量",
+    prop: "winv_two_month"
+  },
+  {
+    label: "销售单价",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "销售总额",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "已回款",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "未回款",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "已开票",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "未开票",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "开票进行中",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "已开票未回款",
+    prop: "wpay_six_month",
+    width: '110px'
+  },
+  {
+    label: "账期",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "回款状态",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "开票状态",
+    prop: "wpay_six_month"
+  },
+  {
+    label: "发货状态",
+    prop: "wpay_six_month"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "超期应收账明细表 (万宇toB)",
+  superUserNoAction: false,
+  showTitle: true,
+  columns,
+  apis: {
+    httpList
+  }
+};
+
+export default contentConfig;

+ 10 - 0
src/views/dashboard/accountsReceivableExpired/index.vue

@@ -0,0 +1,10 @@
+<script setup lang="ts">
+import contentConfig from "./config/content.config";
+const PageName = "accountsReceivable";
+</script>
+
+<template>
+  <PageAuth :pageName="PageName">
+    <PageContainer :contentConfig="contentConfig" />
+  </PageAuth>
+</template>

+ 0 - 0
src/views/dashboard/accountsReceivableExpired/超期应收账明细表.md


+ 209 - 0
src/views/dashboard/grossMargin/config/companyGrossMargin.config.ts

@@ -0,0 +1,209 @@
+/* eslint-disable prettier/prettier */
+import { ContentConfig } from "/@/components/PageContent";
+
+import { httpCompanyDayList } from "/@/api/dashboard/grossMargin";
+import { addition, createTotalItem, division, multiplication, subtraction, unit2TenThousand } from "/@/utils/calc";
+
+const columns = [
+  {
+    label: "百辰&普润&泓源",
+    prop: "field"
+  },
+  {
+    label: "本日销售净额",
+    prop: "pure_day_sale",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_day_sale)
+    }
+  },
+  {
+    label: "本日毛利润",
+    prop: "pure_day_profit",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_day_profit)
+    }
+  },
+  {
+    label: "本日毛利率",
+    prop: "pure_day_interest_rate",
+    cellRenderer({ row }) {
+      return Number(row.pure_day_interest_rate).toFixed(2) + '%'
+    }
+  },
+  {
+    label: "本月销售净额",
+    prop: "pure_month_sale",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_month_sale)
+    }
+  },
+  {
+    label: "本月销售指标",
+    prop: "total_tips",
+    cellRenderer({ row }) {
+      return row.total_tips === '--' ? '--' : unit2TenThousand(row.total_tips)
+    }
+  },
+  {
+    label: "本月指标达成率",
+    prop: "month_completion_rate",
+    cellRenderer({ row }) {
+      return row.month_completion_rate === '--' ? '--' : Number(row.month_completion_rate).toFixed(2) + '%'
+    }
+  },
+  {
+    label: "本月毛利润",
+    prop: "pure_month_profit",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_month_profit)
+    }
+  },
+  {
+    label: "本月毛利率",
+    prop: "pure_month_interest_rate",
+    cellRenderer({ row }) {
+      return row.pure_month_interest_rate === '--' ? '--' : Number(row.pure_month_interest_rate).toFixed(2) + '%'
+    }
+  }
+];
+
+const companies = ['百辰', '普润', '泓源']
+const fields = ['自营', '渠道', '小计', '供应商端', '合计']
+
+const mapFieldToTotalProperties = {
+  '供应商端': {
+    saleDay: 'supplierSaleDay',
+    saleMonth: 'supplierSaleMonth',
+    purchDay: 'supplierPurchDay',
+    purchMonth: 'supplierPurchMonth',
+  },
+  '自营': {
+    saleDay: 'selfOperatedSaleDay',
+    saleMonth: 'selfOperatedSaleMonth',
+    purchDay: 'selfOperatedPurchDay',
+    purchMonth: 'selfOperatedPurchMonth',
+  },
+  '渠道': {
+    saleDay: 'channelSaleDay',
+    saleMonth: 'channelSaleMonth',
+    purchDay: 'channelPurchDay',
+    purchMonth: 'channelPurchMonth'
+  }
+}
+
+const contentConfig: ContentConfig = {
+  title: "",
+  superUserNoAction: false,
+  handleData(data = []) {
+    let tableData = data.filter(({ companyName }) => companies.some(company => companyName.indexOf(company) !== -1))
+
+    //合计三家公司的自营、渠道、供应商端数据
+    const total = tableData.reduce((prev, current) => ({
+      supplierSaleDay: addition(prev.supplierSaleDay, subtraction(current.dayinfo[2].sale_total, current.dayinfo[2].th_total)),
+      supplierSaleMonth: addition(prev.supplierSaleMonth, subtraction(current.monthinfo[2].msale_total, current.monthinfo[2].mth_total)),
+      supplierPurchDay: addition(prev.supplierPurchDay, subtraction(current.dayinfo[2].cgd_total, current.dayinfo[2].cgd_th_total)),
+      supplierPurchMonth: addition(prev.supplierPurchMonth, subtraction(current.monthinfo[2].mcgd_total, current.monthinfo[2].mcgd_th_total)),
+
+      selfOperatedSaleDay: addition(prev.selfOperatedSaleDay, subtraction(current.dayinfo[1].sale_total, current.dayinfo[1].th_total)),
+      selfOperatedSaleMonth: addition(prev.selfOperatedSaleMonth, subtraction(current.monthinfo[1].msale_total, current.monthinfo[1].mth_total)),
+      selfOperatedPurchDay: addition(prev.selfOperatedPurchDay, subtraction(current.dayinfo[1].cgd_total, current.dayinfo[1].cgd_th_total)),
+      selfOperatedPurchMonth: addition(prev.selfOperatedPurchMonth, subtraction(current.monthinfo[1].mcgd_total, current.monthinfo[1].mcgd_th_total)),
+
+      channelSaleDay: addition(prev.channelSaleDay, subtraction(current.dayinfo[0].sale_total, current.dayinfo[0].th_total)),
+      channelSaleMonth: addition(prev.channelSaleMonth, subtraction(current.monthinfo[0].msale_total, current.monthinfo[0].mth_total)),
+      channelPurchDay: addition(prev.channelPurchDay, subtraction(current.dayinfo[0].cgd_total, current.dayinfo[0].cgd_th_total)),
+      channelPurchMonth: addition(prev.channelPurchMonth, subtraction(current.monthinfo[0].mcgd_total, current.monthinfo[0].mcgd_th_total)),
+
+      totalTips: addition(prev.totalTips, current.total_tips)
+    }), {
+      supplierSaleDay: 0,
+      supplierSaleMonth: 0,
+      supplierPurchDay: 0,
+      supplierPurchMonth: 0,
+      selfOperatedSaleDay: 0,
+      selfOperatedSaleMonth: 0,
+      selfOperatedPurchDay: 0,
+      selfOperatedPurchMonth: 0,
+      channelSaleDay: 0,
+      channelSaleMonth: 0,
+      channelPurchDay: 0,
+      channelPurchMonth: 0,
+      totalTips: 0
+    })
+
+
+
+    tableData = fields.map(field => {
+      const properties = mapFieldToTotalProperties[field]
+
+      if (!properties) {
+        return {
+          field,
+          total_tips: '--',
+          pure_day_sale: 0,
+          pure_day_purch: 0,
+          pure_day_profit: 0,
+          pure_day_interest_rate: 0,
+          pure_month_sale: 0,
+          pure_month_purch: 0,
+          month_completion_rate: '--',
+          pure_month_profit: 0,
+          pure_month_interest_rate: 0
+        }
+      }
+
+      const pure_day_sale = total[properties.saleDay]
+      const pure_day_purch = total[properties.purchDay]
+      /* 本日毛利润 = (本日净销售额 - 本日净采购额) **/
+      const pure_day_profit = subtraction(pure_day_sale, pure_day_purch)
+      const pure_month_sale = total[properties.saleMonth]
+      const pure_day_interest_rate = multiplication(division(pure_day_profit, pure_day_sale), 100)
+      const pure_month_purch = total[properties.purchMonth]
+      /* 本月毛利润 = (本月销售净额 - 本月采购净额) **/
+      const pure_month_profit = subtraction(pure_month_sale, pure_month_purch)
+      /* 本月毛利率 = (本月毛利润 / 本月销售净额) * 100**/
+      const pure_month_interest_rate = multiplication(division(pure_month_profit, pure_month_sale), 100)
+
+
+      return {
+        field,
+        total_tips: '--',
+        pure_day_sale,
+        pure_day_purch,
+        pure_day_profit,
+        pure_month_sale,
+        pure_month_purch,
+        pure_day_interest_rate,
+        month_completion_rate: '--',
+        pure_month_profit,
+        pure_month_interest_rate
+      }
+    })
+
+    /* 小计 = 自营 + 渠道 **/
+    const totalItem = createTotalItem([tableData[0], tableData[1]])
+    totalItem.field = "小计"
+    totalItem.total_tips = "--"
+    totalItem.month_completion_rate = "--"
+    totalItem.pure_month_interest_rate = multiplication(division(totalItem.pure_month_profit, totalItem.pure_month_sale), 100)
+    totalItem.pure_day_interest_rate = multiplication(division(totalItem.pure_day_profit, totalItem.pure_day_sale), 100)
+    tableData[2] = totalItem
+
+    /* 合计 = 小计 + 供应商端 **/
+    const lastItem = createTotalItem([tableData[2], tableData[3]])
+    lastItem.field = "合计"
+    lastItem.total_tips = total.totalTips
+    lastItem.pure_month_interest_rate = multiplication(division(lastItem.pure_month_profit, lastItem.pure_month_sale), 100)
+    lastItem.pure_day_interest_rate = multiplication(division(lastItem.pure_day_profit, lastItem.pure_day_sale), 100)
+    /* 本月指标达成率 = (本月销售净额 / 本月销售指标) * 100 **/
+    lastItem.month_completion_rate = multiplication(division(lastItem.pure_month_sale, lastItem.total_tips), 100)
+    tableData[4] = lastItem
+    return tableData
+  },
+  columns,
+  apis: {
+    httpList: httpCompanyDayList
+  }
+};
+
+export default contentConfig;

+ 94 - 0
src/views/dashboard/grossMargin/config/companyMonthGrossMargin.config.ts

@@ -0,0 +1,94 @@
+/* eslint-disable prettier/prettier */
+import { ContentConfig } from "/@/components/PageContent";
+
+import { httpCompanyMonthList } from "/@/api/dashboard/grossMargin";
+import { addition, createTotalItem, division, multiplication, subtraction, unit2TenThousand } from "/@/utils/calc";
+
+const columns = [
+  {
+    label: "月份",
+    prop: "month"
+  },
+  {
+    label: "销售净额",
+    prop: "pure_sale",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_sale)
+    },
+  },
+  {
+    label: "销售指标",
+    prop: "total_tips",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.total_tips)
+    },
+  },
+  {
+    label: "指标达成率",
+    prop: "completion_rate",
+    cellRenderer({ row }) {
+      return Number(row.completion_rate).toFixed(2) + '%'
+    }
+  },
+  {
+    label: "毛利润",
+    prop: "pure_profit",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_profit)
+    },
+  },
+  {
+    label: "毛利率",
+    prop: "pure_interest_rate",
+    cellRenderer({ row }) {
+      return Number(row.pure_interest_rate).toFixed(2) + '%'
+    },
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "",
+  superUserNoAction: false,
+  handleData(data = []) {
+    const tableData = data.map(tableItem => {
+      /* 销售净额 = 销售额 - 退货额 **/
+      const pure_sale = subtraction(tableItem.sale_total, tableItem.th_total)
+      /* 指标达成率 = 销售净额 / 销售指标 **/
+      const completion_rate = multiplication(division(pure_sale, tableItem.total_tips), 100)
+
+      /* 采购净额 = 采购额 - 采购退货额 **/
+      const pure_purch = subtraction(tableItem.cgd_total, tableItem.cgd_th_total)
+      /* 毛利润 = (本月销售净额 - 本月采购净额) **/
+      const pure_profit = subtraction(pure_sale, pure_purch)
+      /*  毛利率 = (本月毛利润 / 本月销售净额) * 100 **/
+      const pure_interest_rate = multiplication(division(pure_profit, pure_sale) || 0, 100)
+
+      return {
+        month: tableItem.month,
+        completion_rate,
+        pure_interest_rate,
+        pure_profit,
+        pure_sale,
+        pure_purch,
+        total_tips: tableItem.total_tips
+      }
+    })
+
+    const totalItem = createTotalItem(tableData)
+    totalItem.month = "年度合计"
+    /* 年度指标达成率 = (年度销售净额 / 年度销售指标) **/
+    totalItem.completion_rate = multiplication(division(totalItem.pure_sale, totalItem.total_tips), 100)
+    /* 年度毛利润 = 年度销售额 - 年度采购额 **/
+    totalItem.pure_profit = subtraction(totalItem.pure_sale, totalItem.pure_purch)
+    /* 年度毛利率 = (年度毛利润 / 年度销售额) **/
+    totalItem.pure_interest_rate = multiplication(division(totalItem.pure_profit, totalItem.pure_sale), 100)
+
+    return [...tableData, totalItem]
+  },
+  columns,
+  apis: {
+    httpList: httpCompanyMonthList
+  }
+};
+
+export default contentConfig;

+ 122 - 0
src/views/dashboard/grossMargin/config/grossMargin.config.ts

@@ -0,0 +1,122 @@
+/* eslint-disable prettier/prettier */
+import { ContentConfig } from "/@/components/PageContent";
+
+import { httpDepartDayList } from "/@/api/dashboard/grossMargin";
+import { createTotalItem, division, multiplication, subtraction, unit2TenThousand } from "/@/utils/calc";
+
+const columns = [
+  {
+    label: "部门",
+    prop: "depart"
+  },
+  {
+    label: "本日销售净额",
+    prop: "pure_day_sale",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_day_sale)
+    }
+  },
+  {
+    label: "本日毛利润",
+    prop: "pure_day_profit",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_day_profit)
+    }
+  },
+  {
+    label: "本日毛利率",
+    prop: "pure_day_interest_rate",
+    cellRenderer({ row }) {
+      return Number(row.pure_day_interest_rate).toFixed(2) + '%'
+    }
+  },
+  {
+    label: "本月销售净额",
+    prop: "pure_month_sale",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_month_sale)
+    }
+  },
+  {
+    label: "本月销售指标",
+    prop: "total_tips",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.total_tips)
+    }
+  },
+  {
+    label: "本月指标达成率",
+    prop: "month_completion_rate",
+    cellRenderer({ row }) {
+      return Number(row.month_completion_rate).toFixed(2) + '%'
+    }
+  },
+  {
+    label: "本月毛利润",
+    prop: "pure_month_profit",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_month_profit)
+    }
+  },
+  {
+    label: "本月毛利率",
+    prop: "pure_month_interest_rate",
+    cellRenderer({ row }) {
+      return Number(row.pure_month_interest_rate).toFixed(2) + '%'
+    }
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "",
+  superUserNoAction: false,
+  handleData(data = []) {
+    const tableData = data.map(tableItem => {
+      /* 本日净销售额 = 日销售额 - 日销售退货 **/
+      const pure_day_sale = subtraction(tableItem.sale_total, tableItem.th_total)
+      /* 本日净采购额 = 日采购额 - 日采购退货 **/
+      const pure_day_purch = subtraction(tableItem.cgd_total, tableItem.cgd_th_total)
+      /* 本日毛利润 = (本日净销售额 - 本日净采购额) **/
+      const pure_day_profit = subtraction(pure_day_sale, pure_day_purch)
+      /* 本日毛利率 = (本月毛利润 / 本月销售净额) * 100**/
+      const pure_day_interest_rate = multiplication(division(pure_day_profit, pure_day_sale), 100)
+
+      /* 本月净销售额 = 月销售额 - 月销售退货额 **/
+      const pure_month_sale = subtraction(tableItem.msale_total, tableItem.mth_total)
+      /* 本月净采购额 = 月采购额 - 月采购退货额 **/
+      const pure_month_purch = subtraction(tableItem.mcgd_total, tableItem.mcgd_th_total)
+      /* 本月指标达成率 = (本月销售净额 / 本月销售指标) * 100 **/
+      const month_completion_rate = multiplication(division(pure_month_sale, tableItem.total_tips), 100)
+      /* 本月毛利润 = (本月销售净额 - 本月采购净额) **/
+      const pure_month_profit = subtraction(pure_month_sale, pure_month_purch)
+      /* 本月毛利率 = (本月毛利润 / 本月销售净额) * 100**/
+      const pure_month_interest_rate = multiplication(division(pure_month_profit, pure_month_sale), 100)
+
+      return {
+        total_tips: tableItem.total_tips,
+        pure_day_interest_rate,
+        depart: tableItem.depart,
+        pure_day_sale,
+        pure_day_profit,
+        pure_month_sale,
+        month_completion_rate,
+        pure_month_profit,
+        pure_month_interest_rate
+      }
+    })
+
+    const totalItem = createTotalItem(tableData)
+    totalItem.depart = "合计"
+    totalItem.month_completion_rate = multiplication(division(totalItem.pure_day_sale, totalItem.total_tips), 100)
+    totalItem.pure_month_interest_rate = multiplication(division(totalItem.pure_month_profit, totalItem.pure_month_sale), 100)
+    this.tableData = [...tableData, totalItem]
+
+    return [...tableData, totalItem]
+  },
+  columns,
+  apis: {
+    httpList: httpDepartDayList
+  }
+};
+
+export default contentConfig;

+ 94 - 0
src/views/dashboard/grossMargin/config/monthGrossMargin.config.ts

@@ -0,0 +1,94 @@
+/* eslint-disable prettier/prettier */
+import { ContentConfig } from "/@/components/PageContent";
+
+import { httpDepartMonthList } from "/@/api/dashboard/grossMargin";
+import { addition, createTotalItem, division, multiplication, subtraction, unit2TenThousand } from "/@/utils/calc";
+
+const columns = [
+  {
+    label: "月份",
+    prop: "month"
+  },
+  {
+    label: "销售净额",
+    prop: "pure_sale",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_sale)
+    },
+  },
+  {
+    label: "销售指标",
+    prop: "total_tips",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.total_tips)
+    },
+  },
+  {
+    label: "指标达成率",
+    prop: "completion_rate",
+    cellRenderer({ row }) {
+      return Number(row.completion_rate).toFixed(2) + '%'
+    }
+  },
+  {
+    label: "毛利润",
+    prop: "pure_profit",
+    cellRenderer({ row }) {
+      return unit2TenThousand(row.pure_profit)
+    },
+  },
+  {
+    label: "毛利率",
+    prop: "pure_interest_rate",
+    cellRenderer({ row }) {
+      return Number(row.pure_interest_rate).toFixed(2) + '%'
+    },
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "",
+  superUserNoAction: false,
+  handleData(data = []) {
+    const tableData = data.map(tableItem => {
+      /* 销售净额 = 销售额 - 退货额 **/
+      const pure_sale = subtraction(tableItem.sale_total, tableItem.th_total)
+      /* 指标达成率 = 销售净额 / 销售指标 **/
+      const completion_rate = multiplication(division(pure_sale, tableItem.total_tips), 100)
+
+      /* 采购净额 = 采购额 - 采购退货额 **/
+      const pure_purch = subtraction(tableItem.cgd_total, tableItem.cgd_th_total)
+      /* 毛利润 = (本月销售净额 - 本月采购净额) **/
+      const pure_profit = subtraction(pure_sale, pure_purch)
+      /*  毛利率 = (本月毛利润 / 本月销售净额) * 100 **/
+      const pure_interest_rate = multiplication(division(pure_profit, pure_sale) || 0, 100)
+
+      return {
+        month: tableItem.month,
+        completion_rate,
+        pure_interest_rate,
+        pure_profit,
+        pure_sale,
+        pure_purch,
+        total_tips: tableItem.total_tips
+      }
+    })
+
+    const totalItem = createTotalItem(tableData)
+    totalItem.month = "年度合计"
+    /* 年度指标达成率 = (年度销售净额 / 年度销售指标) **/
+    totalItem.completion_rate = multiplication(division(totalItem.pure_sale, totalItem.total_tips), 100)
+    /* 年度毛利润 = 年度销售额 - 年度采购额 **/
+    totalItem.pure_profit = subtraction(totalItem.pure_sale, totalItem.pure_purch)
+    /* 年度毛利率 = (年度毛利润 / 年度销售额) **/
+    totalItem.pure_interest_rate = multiplication(division(totalItem.pure_profit, totalItem.pure_sale), 100)
+
+    return [...tableData, totalItem]
+  },
+  columns,
+  apis: {
+    httpList: httpDepartMonthList
+  }
+};
+
+export default contentConfig;

+ 25 - 0
src/views/dashboard/grossMargin/index.vue

@@ -0,0 +1,25 @@
+<script setup lang="ts">
+import companyGrossMarginConfig from "./config/companyGrossMargin.config";
+import companyMonthGressMarginConfig from "./config/companyMonthGrossMargin.config";
+import grossMarginConfig from "./config/grossMargin.config";
+import motnhGrossMarginConfig from "./config/monthGrossMargin.config";
+const PageName = "accountsReceivable";
+</script>
+
+<template>
+  <PageAuth :pageName="PageName">
+    <div class="bg-white">
+      <h2 class="font-bold ml-[15px] pt-[10px]" style="font-size: 16px">
+        平台维度
+      </h2>
+      <PageContainer :contentConfig="grossMarginConfig" />
+      <PageContainer :contentConfig="motnhGrossMarginConfig" />
+
+      <h2 class="font-bold ml-[15px] pt-[10px]" style="font-size: 16px">
+        公司维度
+      </h2>
+      <PageContainer :contentConfig="companyGrossMarginConfig" />
+      <PageContainer :contentConfig="companyMonthGressMarginConfig" />
+    </div>
+  </PageAuth>
+</template>

+ 0 - 0
src/views/dashboard/grossMargin/毛利报表看板.md