Forráskód Böngészése

新建业绩提成页面菜单和销售分析页面

cz 1 éve
szülő
commit
3d910be01c

+ 3 - 3
src/views/WDLY/outInBound/abnormal/index.vue

@@ -201,7 +201,7 @@ const config = computed(() => {
       attrs: {
         label: "最近操作人",
         prop: "handleUserName",
-        width: 120,
+        width: 140,
       },
     },
     {
@@ -251,7 +251,7 @@ const config = computed(() => {
             click() {
               formConfig.value = formConfigData[1];
               formData.data = {
-                type: row.type,
+                type: row.type + "",
                 linkCode: row.linkCode,
                 title: row.title,
               };
@@ -468,7 +468,7 @@ const getDtl = (row) => {
   formData.data = {
     status: "0",
     abnormalInfoId: row.id,
-    type: row.type,
+    type: row.type + "",
     linkCode: row.linkCode,
     title: row.title,
     handleTime: proxy.parseTime(new Date()),

+ 345 - 28
src/views/dataBoard/board/salesAnalysis/index.vue

@@ -37,13 +37,17 @@
         </el-form-item>
       </el-form>
     </div>
-    <div class="bck statistics" style="margin-top: 10px">
+    <div
+      class="bck statistics"
+      style="margin-top: 10px"
+      v-loading="statisticsLoading"
+    >
       <div class="item first">
         <div class="left_">
           <div class="money">
-            {{ moneyFormat(0, 2) }}
+            {{ moneyFormat(allData.salesStatisticsData.amount, 2) }}
           </div>
-          <div>销售额({{ 0 }})</div>
+          <div>销售额()</div>
         </div>
         <div class="right_">
           <div class="icon">
@@ -54,7 +58,7 @@
       <div class="item two">
         <div class="left_">
           <div class="money">
-            {{ moneyFormat(0, 2) }}
+            {{ allData.salesStatisticsData.contractCount }}
           </div>
           <div>订单(单)</div>
         </div>
@@ -67,7 +71,7 @@
       <div class="item three">
         <div class="left_">
           <div class="money">
-            {{ 0 }}
+            {{ allData.salesStatisticsData.customerCount }}
           </div>
           <div>下单客户数(人)</div>
         </div>
@@ -79,7 +83,11 @@
       </div>
     </div>
 
-    <div class="bck scatter" style="margin-top: 10px">
+    <div
+      class="bck scatter"
+      style="margin-top: 10px"
+      v-loading="scatterLoading"
+    >
       <el-row>
         <el-col :span="8">
           <TitleInfo :content="titleList[0]"></TitleInfo>
@@ -87,24 +95,107 @@
         </el-col>
         <el-col :span="16">
           <byTable
+            :hideSearch="true"
             :source="sourceList.scatterData"
             :pagination="sourceList.scatterPagination"
             :config="scatterConfig"
             :loading="scatterLoading"
             highlight-current-row
             :selectConfig="[]"
-            @get-list="getList"
           >
           </byTable>
         </el-col>
       </el-row>
     </div>
+
+    <div style="margin-top: 10px">
+      <el-row>
+        <el-col :span="12" class="bck" v-loading="salesLoading">
+          <TitleInfo :content="titleList[1]"></TitleInfo>
+          <div ref="echartDomOne" style="height: 30vh"></div>
+          <div style="margin-top: 10px">
+            <byTable
+              :hideSearch="true"
+              :tableHeight="300"
+              :source="sourceList.salesData"
+              :pagination="sourceList.salesPagination"
+              :config="salesConfig"
+              :loading="salesLoading"
+              highlight-current-row
+              :selectConfig="[]"
+            >
+            </byTable>
+          </div>
+        </el-col>
+        <el-col :span="12" style="padding-left: 10px">
+          <div class="bck" v-loading="salesmanSalesLoading">
+            <TitleInfo :content="titleList[2]"></TitleInfo>
+            <div ref="echartDomTwo" style="height: 30vh"></div>
+            <div style="margin-top: 10px">
+              <byTable
+                :hideSearch="true"
+                :tableHeight="300"
+                :source="sourceList.salesmanSalesData"
+                :pagination="sourceList.salesmanSalesPagination"
+                :config="salesmanSalesConfig"
+                :loading="salesmanSalesLoading"
+                highlight-current-row
+                :selectConfig="[]"
+              >
+              </byTable>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
+
+    <div style="margin-top: 10px">
+      <el-row>
+        <el-col :span="12" class="bck" v-loading="productSalesLoading">
+          <TitleInfo :content="titleList[3]"></TitleInfo>
+          <div ref="echartDomThree" style="height: 30vh"></div>
+          <div style="margin-top: 10px">
+            <byTable
+              :hideSearch="true"
+              :tableHeight="300"
+              :source="sourceList.productSalesVolumeData"
+              :pagination="sourceList.productSalesVolumePagination"
+              :config="productSalesConfig"
+              :loading="productSalesLoading"
+              highlight-current-row
+              :selectConfig="[]"
+            >
+            </byTable>
+          </div>
+        </el-col>
+        <el-col :span="12" style="padding-left: 10px">
+          <div class="bck" v-loading="productSalesOneLoading">
+            <TitleInfo :content="titleList[4]"></TitleInfo>
+            <div ref="echartDomFour" style="height: 30vh"></div>
+            <div style="margin-top: 10px">
+              <byTable
+                :hideSearch="true"
+                :tableHeight="300"
+                :source="sourceList.productSalesVolumeOneData"
+                :pagination="sourceList.productSalesVolumeOnePagination"
+                :config="productSalesOneConfig"
+                :loading="productSalesOneLoading"
+                highlight-current-row
+                :selectConfig="[]"
+              >
+              </byTable>
+            </div>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
   </div>
 </template>
 
 <script setup>
 import * as echarts from "echarts";
 
+import byTable from "@/components/byTable/index";
 import TitleInfo from "@/components/TitleInfo/index.vue";
 const titleList = [
   "销售分布",
@@ -114,9 +205,14 @@ const titleList = [
   "商品销量",
 ];
 const { proxy } = getCurrentInstance();
+
+const statisticsLoading = ref(false);
 const scatterLoading = ref(false);
-const loadingOne = ref(false);
-const loadingTwo = ref(false);
+const salesLoading = ref(false);
+const salesmanSalesLoading = ref(false);
+const productSalesLoading = ref(false);
+const productSalesOneLoading = ref(false);
+
 const queryForm = reactive({
   beginTime: "",
   endTime: "",
@@ -125,15 +221,51 @@ const queryForm = reactive({
 const sourceList = ref({
   scatterData: [],
   scatterPagination: {
-    total: 3,
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+  },
+  salesData: [],
+  salesPagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+  },
+  salesmanSalesData: [],
+  salesmanSalesPagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+  },
+  productSalesVolumeData: [],
+  productSalesVolumePagination: {
+    total: 0,
+    pageNum: 1,
+    pageSize: 10,
+  },
+  productSalesVolumeOneData: [],
+  productSalesVolumeOnePagination: {
+    total: 0,
     pageNum: 1,
     pageSize: 10,
   },
 });
+
+const allData = reactive({
+  salesStatisticsData: {},
+});
 //图表
 const echartDom = ref(null);
+const echartDomOne = ref(null);
+const echartDomTwo = ref(null);
+const echartDomThree = ref(null);
+const echartDomFour = ref(null);
 let myChart = null;
-const option = reactive({
+let myChartOne = null;
+let myChartTwo = null;
+let myChartThree = null;
+let myChartFour = null;
+const optionOne = reactive({
   data: {
     tooltip: {
       trigger: "item",
@@ -172,6 +304,48 @@ const option = reactive({
     ],
   },
 });
+const optionTwo = reactive({
+  data: {
+    tooltip: {
+      trigger: "axis",
+      axisPointer: {
+        type: "shadow",
+      },
+    },
+    grid: {
+      left: "1%",
+      right: "1%",
+      bottom: "1%",
+      top: "10%",
+      containLabel: true,
+    },
+    xAxis: [
+      {
+        type: "category",
+        data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
+        axisTick: {
+          alignWithLabel: true,
+        },
+      },
+    ],
+    yAxis: [
+      {
+        type: "value",
+      },
+    ],
+    series: [
+      {
+        name: "Direct",
+        type: "bar",
+        barWidth: "25%",
+        data: [10, 52, 200, 334, 390, 330, 220],
+        itemStyle: {
+          color: "#0084FF",
+        },
+      },
+    ],
+  },
+});
 const scatterConfig = computed(() => {
   return [
     {
@@ -203,25 +377,141 @@ const scatterConfig = computed(() => {
     },
   ];
 });
+const salesConfig = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "序列",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "客户",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "销售额(¥)",
+        prop: "amount",
+      },
+      render(amount) {
+        return proxy.moneyFormat(amount, 2);
+      },
+    },
+  ];
+});
+const salesmanSalesConfig = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "序列",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "业务员",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "销售额(¥)",
+        prop: "amount",
+      },
+      render(amount) {
+        return proxy.moneyFormat(amount, 2);
+      },
+    },
+  ];
+});
+const productSalesConfig = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "序列",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "商品名称",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "销售额(¥)",
+        prop: "amount",
+      },
+      render(amount) {
+        return proxy.moneyFormat(amount, 2);
+      },
+    },
+  ];
+});
 
+const productSalesOneConfig = computed(() => {
+  return [
+    {
+      attrs: {
+        label: "序列",
+        prop: "receiptWarehouseName",
+      },
+    },
+    {
+      attrs: {
+        label: "商品名称",
+        prop: "productName",
+      },
+    },
+    {
+      attrs: {
+        label: "销售量(个)",
+        prop: "amount",
+      },
+      render(amount) {
+        return proxy.moneyFormat(amount, 2);
+      },
+    },
+  ];
+});
 const getData = () => {
-  // loading.value = true;
-  loadingOne.value = true;
-  loadingTwo.value = true;
-  // proxy.post("/saleQuotation/sourceStatistics", queryForm).then((res) => {
-  //   allData.sourceData = res;
-  //   setTimeout(() => {
-  //     loading.value = false;
-  //   }, 200);
-  // });
-  // proxy.post("/saleQuotation/typeStatistics", queryForm).then((res) => {
-  //   allData.typeData = res;
-  //   setTimeout(() => {
-  //     loadingOne.value = false;
-  //   }, 200);
-  // });
+  statisticsLoading.value = true;
+  scatterLoading.value = true;
+  salesLoading.value = true;
+  salesmanSalesLoading.value = true;
+  productSalesLoading.value = true;
+  productSalesOneLoading.value = true;
+
   proxy.post("/contract/salesStatistics", queryForm).then((res) => {
-    console.log(res, "aa");
+    allData.salesStatisticsData = res;
+    setTimeout(() => {
+      statisticsLoading.value = false;
+    }, 200);
+  });
+
+  proxy.post("/contract/customSalesStatistics", queryForm).then((res) => {
+    sourceList.value.salesData = res;
+    setTimeout(() => {
+      salesLoading.value = false;
+    }, 200);
+  });
+
+  proxy.post("/contract/salesmanSalesStatistics", queryForm).then((res) => {
+    sourceList.value.productSalesVolumeData = res;
+    setTimeout(() => {
+      productSalesLoading.value = false;
+    }, 200);
+  });
+
+  proxy.post("/contract/salesmanSalesStatistics", queryForm).then((res) => {
+    sourceList.value.productSalesVolumeOneData = res;
+    setTimeout(() => {
+      productSalesOneLoading.value = false;
+    }, 200);
   });
 };
 
@@ -237,7 +527,31 @@ onMounted(() => {
   window.addEventListener("resize", () => {
     myChart.resize();
   });
-  myChart.setOption(option.data);
+  myChart.setOption(optionOne.data);
+  // 客户分类柱状图
+  myChartOne = echarts.init(echartDomOne.value);
+  window.addEventListener("resize", () => {
+    myChartOne.resize();
+  });
+  myChartOne.setOption(optionTwo.data);
+  // 业务员销售趋势柱状图
+  myChartTwo = echarts.init(echartDomTwo.value);
+  window.addEventListener("resize", () => {
+    myChartTwo.resize();
+  });
+  myChartTwo.setOption(optionTwo.data);
+  //商品销售额柱状图
+  myChartThree = echarts.init(echartDomThree.value);
+  window.addEventListener("resize", () => {
+    myChartThree.resize();
+  });
+  myChartThree.setOption(optionTwo.data);
+  // 商品销量柱状图
+  myChartFour = echarts.init(echartDomFour.value);
+  window.addEventListener("resize", () => {
+    myChartFour.resize();
+  });
+  myChartFour.setOption(optionTwo.data);
   getData();
 });
 </script>
@@ -311,4 +625,7 @@ onMounted(() => {
 .scatter {
   // display: flex;
 }
+.public {
+  display: flex;
+}
 </style>

+ 189 - 270
src/views/salesMange/salesMange/performance/index.vue

@@ -5,14 +5,15 @@
         <el-form :inline="true" :model="queryForm">
           <el-form-item label="年份">
             <el-date-picker
-              v-model="queryForm.aa"
+              v-model="queryForm.time"
               type="year"
               placeholder="请选择"
+              @change="onQuery"
             />
           </el-form-item>
           <el-form-item label="业务员">
             <el-select
-              v-model="queryForm.countryId"
+              v-model="queryForm.userId"
               placeholder="请选择"
               @change="onQuery"
             >
@@ -97,44 +98,34 @@
             />
           </el-table-column>
           <el-table-column label="提成">
-            <el-table-column label="售后" prop="totalIncome" width="120" />
-            <el-table-column label="公共" prop="totalExpenses" width="120" />
-            <el-table-column label="总办" prop="grossProfit" width="120" />
+            <el-table-column label="售后" prop="afterSalesAmount" width="120" />
+            <el-table-column label="公共" prop="publicAmount" width="120" />
+            <el-table-column
+              label="总办"
+              prop="haveOverallAmount"
+              width="120"
+            />
             <el-table-column
               label="部门提成"
-              prop="grossProfitMargin"
+              prop="departmentalCommission"
               width="120"
             />
             <el-table-column
               label="个人提成"
-              prop="grossProfitMargin"
+              prop="personalCommission"
               width="120"
             />
           </el-table-column>
           <el-table-column
             label="操作"
             align="center"
-            width="170"
+            width="100"
             fixed="right"
           >
             <template #default="{ row }">
               <div>
                 <el-button type="primary" @click="changeExchangeRate(row)" link
-                  >调整汇率</el-button
-                >
-                <el-button
-                  type="primary"
-                  @click="clickSettlement(row)"
-                  v-if="row.settlementStatus === 0"
-                  link
-                  >结算</el-button
-                >
-                <el-button
-                  type="primary"
-                  @click="clickCancelSettlement(row)"
-                  v-else
-                  link
-                  >取消结算</el-button
+                  >调整</el-button
                 >
               </div>
             </template>
@@ -154,65 +145,7 @@
       </el-row>
     </div>
 
-    <el-dialog
-      title="默认汇率"
-      v-if="dialogVisible"
-      v-model="dialogVisible"
-      width="600"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="submit"
-      >
-        <template #currencyList>
-          <el-table
-            :data="formData.data.list"
-            style="width: 100%"
-            v-loading="loadingDialog"
-          >
-            <el-table-column label="币种">
-              <template #default="{ row }">
-                <div>{{ dictValueLabel(row.type, accountCurrency) }}</div>
-              </template>
-            </el-table-column>
-            <el-table-column label="兑 CHY 汇率">
-              <template #default="{ row, $index }">
-                <el-form-item
-                  :prop="'list.' + $index + '.rate'"
-                  :rules="rules.rate"
-                  :inline-message="true"
-                >
-                  <el-input-number
-                    v-model="row.rate"
-                    placeholder="请输入兑 CHY 汇率"
-                    style="width: 100%"
-                    :precision="6"
-                    :controls="false"
-                    :min="0"
-                  />
-                </el-form-item>
-              </template>
-            </el-table-column>
-          </el-table>
-        </template>
-      </byForm>
-      <template #footer>
-        <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" @click="submitForm()" size="large"
-          >确 定</el-button
-        >
-      </template>
-    </el-dialog>
-
-    <el-dialog
-      title="调整汇率"
-      v-if="openChange"
-      v-model="openChange"
-      width="600"
-    >
+    <el-dialog title="调整" v-if="openChange" v-model="openChange" width="700">
       <byForm
         :formConfig="formChangeConfig"
         :formOption="formOption"
@@ -220,36 +153,106 @@
         :rules="rules"
         ref="change"
       >
-        <template #currencyList>
-          <el-table
-            :data="formChangeData.data.list"
-            style="width: 100%"
-            v-loading="loadingDialog"
-          >
-            <el-table-column label="币种">
-              <template #default="{ row }">
-                <div>{{ dictValueLabel(row.type, accountCurrency) }}</div>
-              </template>
-            </el-table-column>
-            <el-table-column label="兑 CHY 汇率">
-              <template #default="{ row, $index }">
-                <el-form-item
-                  :prop="'list.' + $index + '.rate'"
-                  :rules="rules.rate"
-                  :inline-message="true"
+        <template #afterSalesRatioSlot>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="4">
+                <el-input
+                  v-model="formChangeData.data.afterSalesRatio"
+                  placeholder="请输入"
+                  :formatter="(val) => val.replace(/[^\d]/g, '')"
+                  :parser="(val) => val.replace(/[^\d]/g, '')"
+                >
+                  <template #suffix>
+                    <span> % </span>
+                  </template></el-input
                 >
-                  <el-input-number
-                    v-model="row.rate"
-                    placeholder="请输入兑 CHY 汇率"
-                    style="width: 100%"
-                    :precision="6"
-                    :controls="false"
-                    :min="0"
-                  />
-                </el-form-item>
-              </template>
-            </el-table-column>
-          </el-table>
+              </el-col>
+              <el-co :span="20" style="padding-left: 10px"> 默认 4% </el-co>
+            </el-row>
+          </div>
+        </template>
+        <template #publicRatioSlot>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="4">
+                <el-input
+                  v-model="formChangeData.data.publicRatio"
+                  placeholder="请输入"
+                  :formatter="(val) => val.replace(/[^\d]/g, '')"
+                  :parser="(val) => val.replace(/[^\d]/g, '')"
+                >
+                  <template #suffix>
+                    <span> % </span>
+                  </template></el-input
+                >
+              </el-col>
+              <el-co :span="20" style="padding-left: 10px"> 默认 6% </el-co>
+            </el-row>
+          </div>
+        </template>
+        <template #haveOverallRatioSlot>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="4">
+                <el-input
+                  v-model="formChangeData.data.haveOverallRatio"
+                  placeholder="请输入"
+                  :formatter="(val) => val.replace(/[^\d]/g, '')"
+                  :parser="(val) => val.replace(/[^\d]/g, '')"
+                >
+                  <template #suffix>
+                    <span> % </span>
+                  </template></el-input
+                >
+              </el-col>
+              <el-co :span="20" style="padding-left: 10px"> 默认 5% </el-co>
+            </el-row>
+          </div>
+        </template>
+        <template #departmentalRatioSlot>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="4">
+                <el-input
+                  v-model="formChangeData.data.departmentalRatio"
+                  placeholder="请输入"
+                  :formatter="(val) => val.replace(/[^\d]/g, '')"
+                  :parser="(val) => val.replace(/[^\d]/g, '')"
+                >
+                  <template #suffix>
+                    <span> % </span>
+                  </template></el-input
+                >
+              </el-col>
+              <el-co :span="20" style="padding-left: 10px">
+                默认 33%。即:部门提成 = (总收入 - 总支出 - 售后 - 公共 -
+                总办) * 部门占比
+              </el-co>
+            </el-row>
+          </div>
+        </template>
+        <template #personalRatioSlot>
+          <div style="width: 100%">
+            <el-row>
+              <el-col :span="4">
+                <el-input
+                  v-model="formChangeData.data.personalRatio"
+                  placeholder="请输入"
+                  :formatter="(val) => val.replace(/[^\d]/g, '')"
+                  :parser="(val) => val.replace(/[^\d]/g, '')"
+                >
+                  <template #suffix>
+                    <span> % </span>
+                  </template></el-input
+                >
+              </el-col>
+              <el-co :span="20" style="padding-left: 10px">
+                默认 17%。即:个人提成 = (总收入 - 总支出 - 售后 - 公共 -
+                总办)* 个人占比
+              </el-co>
+            </el-row>
+          </div>
         </template>
       </byForm>
       <template #footer>
@@ -273,10 +276,8 @@ const { proxy } = getCurrentInstance();
 const accountCurrency = ref([]);
 const userList = ref([]);
 const queryForm = reactive({
-  countryId: "",
-  beginTime: "",
-  endTime: "",
-  timeArr: "",
+  userId: "",
+  time: "",
 });
 const settlementStatus = ref([
   {
@@ -364,6 +365,11 @@ const getList = async (req) => {
     }, 200);
   });
 };
+
+const onQuery = () => {
+  getList();
+};
+
 const rateStatus = ref(false);
 const judgeRate = () => {
   proxy.post("/currencyRate/list", {}).then(
@@ -412,66 +418,10 @@ const formOption = reactive({
   itemWidth: 100,
   rules: [],
 });
-const formData = reactive({
-  data: {
-    list: [],
-  },
-});
-const formConfig = computed(() => {
-  return [
-    {
-      type: "slot",
-      prop: "currencyList",
-      slotName: "currencyList",
-      label: "",
-    },
-  ];
-});
 const rules = ref({
   rate: [{ required: true, message: "请输入兑 CHY 汇率", trigger: "blur" }],
 });
-const openModal = () => {
-  if (accountCurrency.value && accountCurrency.value.length > 0) {
-    formData.data = {
-      list: accountCurrency.value.map((item) => {
-        return {
-          id: "",
-          type: item.value,
-          rate: 1,
-        };
-      }),
-    };
-  } else {
-    formData.data = {
-      list: [],
-    };
-  }
-  loadingDialog.value = true;
-  dialogVisible.value = true;
-  proxy.post("/currencyRate/list", {}).then(
-    (res) => {
-      if (res && res.length > 0 && formData.data.list.length > 0) {
-        formData.data.list = formData.data.list.map((item) => {
-          for (let i = 0; i < res.length; i++) {
-            if (item.type === res[i].type) {
-              item.id = res[i].id;
-              item.rate = res[i].rate;
-              break;
-            }
-          }
-          return {
-            ...item,
-          };
-        });
-      }
-      loadingDialog.value = false;
-    },
-    (err) => {
-      console.log(err);
-      loadingDialog.value = false;
-    }
-  );
-};
+
 const submitForm = () => {
   submit.value.handleSubmit(() => {
     loadingDialog.value = true;
@@ -495,118 +445,87 @@ const submitForm = () => {
 const openChange = ref(false);
 const change = ref(null);
 const formChangeData = reactive({
-  data: {
-    list: [],
-  },
+  data: {},
 });
 const formChangeConfig = computed(() => {
   return [
     {
       type: "slot",
-      prop: "currencyList",
-      slotName: "currencyList",
-      label: "",
+      prop: "afterSalesRatio",
+      slotName: "afterSalesRatioSlot",
+      label: "售后占比",
+    },
+    {
+      type: "slot",
+      prop: "publicRatio",
+      slotName: "publicRatioSlot",
+      label: "公共占比",
+    },
+    {
+      type: "slot",
+      prop: "haveOverallRatio",
+      slotName: "haveOverallRatioSlot",
+      label: "总办占比",
+    },
+    {
+      type: "slot",
+      prop: "departmentalRatio",
+      slotName: "departmentalRatioSlot",
+      label: "部门占比",
+    },
+    {
+      type: "slot",
+      prop: "personalRatio",
+      slotName: "personalRatioSlot",
+      label: "个人占比",
     },
   ];
 });
+const rowData = ref({});
 const changeExchangeRate = (row) => {
-  formChangeData.data = {
-    id: row.contractId,
-    list: [],
-  };
-  if (accountCurrency.value && accountCurrency.value.length > 0) {
-    formChangeData.data.list = accountCurrency.value.map((item) => {
-      return {
-        type: item.value,
-        rate: 1,
-      };
-    });
-  }
-  loadingDialog.value = true;
-  openChange.value = true;
-  if (row.currencyRateJson) {
-    let currencyRateJson = JSON.parse(row.currencyRateJson);
-    formChangeData.data.list = formChangeData.data.list.map((item) => {
-      for (let i = 0; i < currencyRateJson.length; i++) {
-        if (item.type === currencyRateJson[i].type) {
-          item.rate = currencyRateJson[i].rate;
-          break;
-        }
-      }
-      return {
-        ...item,
-      };
-    });
-    loadingDialog.value = false;
-  } else {
-    proxy.post("/currencyRate/list", {}).then(
-      (res) => {
-        if (res && res.length > 0 && formChangeData.data.list.length > 0) {
-          formChangeData.data.list = formChangeData.data.list.map((item) => {
-            for (let i = 0; i < res.length; i++) {
-              if (item.type === res[i].type) {
-                item.rate = res[i].rate;
-                break;
-              }
-            }
-            return {
-              ...item,
-            };
-          });
-        }
-        loadingDialog.value = false;
-      },
-      (err) => {
-        console.log(err);
-        loadingDialog.value = false;
-      }
-    );
-  }
+  rowData.value = row;
+  proxy.post("/commissionRule/detail", { id: row.id }).then((res) => {
+    openChange.value = true;
+    formChangeData.data = res;
+  });
 };
+
 const submitChangeForm = () => {
   change.value.handleSubmit(() => {
-    loadingDialog.value = true;
-    let data = {};
-    data.id = formChangeData.data.id;
-    data.currencyRateJson = JSON.stringify(formChangeData.data.list);
-    proxy.post("/saleStatement/update", data).then(
-      () => {
-        ElMessage({
-          message: "保存成功",
-          type: "success",
-        });
-        openChange.value = false;
-        getList();
-      },
-      (err) => {
-        console.log(err);
-        loadingDialog.value = false;
-      }
-    );
+    const {
+      afterSalesRatio,
+      publicRatio,
+      haveOverallRatio,
+      departmentalRatio,
+      personalRatio,
+    } = formChangeData.data;
+    let sum =
+      Number(afterSalesRatio) +
+      Number(publicRatio) +
+      Number(haveOverallRatio) +
+      Number(departmentalRatio) +
+      Number(personalRatio);
+    if (sum > 100) return this.msgInfo("全部占比不可大于100%");
+    proxy
+      .post("/commission/add", {
+        commissionRule: formChangeData.data,
+        ...rowData.value,
+      })
+      .then(
+        () => {
+          ElMessage({
+            message: "操作成功",
+            type: "success",
+          });
+          openChange.value = false;
+          getList();
+        },
+        (err) => {
+          console.log(err);
+        }
+      );
   });
 };
-const clickSettlement = (row) => {
-  proxy
-    .post("/saleStatement/update", { id: row.contractId, settlementStatus: 1 })
-    .then(() => {
-      ElMessage({
-        message: "保存成功",
-        type: "success",
-      });
-      getList();
-    });
-};
-const clickCancelSettlement = (row) => {
-  proxy
-    .post("/saleStatement/update", { id: row.contractId, settlementStatus: 0 })
-    .then(() => {
-      ElMessage({
-        message: "保存成功",
-        type: "success",
-      });
-      getList();
-    });
-};
 </script>
 
 <style lang="scss" scoped>