snow 1 年間 前
コミット
157ea75700

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/index.html


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.188593da.css


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.d9aeea69.css


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/app.03b8ed94.js


BIN
dist/static/js/app.03b8ed94.js.gz


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/app.c41af068.js


BIN
dist/static/js/app.c41af068.js.gz


+ 10 - 0
src/api/newResults/index.js

@@ -0,0 +1,10 @@
+// 物业管理员
+import http from "@/api/axios";
+
+const onlineReportApi = "http://rep.report.caixiao365.com/admin/Everyday/"
+
+export default {
+  departmentEveryDay: (data, params) => http(onlineReportApi + "departEveryDay", data, "post", params),
+  departmentEveryMonth: (data, params) => http(onlineReportApi + "departEveryMonth", data, "post", params),
+  companyEveryMonth: (data, params) => http(onlineReportApi + "companyEveryMonth", data, "post", params),
+};

+ 156 - 0
src/components/newResults/company-month.vue

@@ -0,0 +1,156 @@
+<template>
+  <div v-loading="loading">
+    <div class="search clear">
+      <el-select size="small" style="margin-right:10px" v-model="depart_id" @change="requestData">
+        <el-option v-for="depart in departItems" :key="depart.id" :value="depart.value" :label="depart.label" />
+      </el-select>
+
+      <el-date-picker class="fr picker" v-model="daytime" style=";width:100px" value-format="yyyy" :editable="false"
+        :clearable="false" :size="'small'" type="year" format="yyyy" align="right" placeholder="选择日期"
+        :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }" @change="requestData" />
+    </div>
+
+    <el-row style="margin-top:10px">
+      <el-table border size="mini" :data="tableData" :cell-class-name="setCellClassName">
+        <el-table-column fixed="left" label="月度" prop="month" align="center" width="60px" />
+        <el-table-column label="当月营收目标" align="center" min-width="140px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.total_tips)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月营业收入(净)" align="center" min-width="140px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.pure_sale)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月营收完成%" align="center" min-width="140px">
+          <template slot-scope="scope">
+            {{Number(scope.row.completion_rate).toFixed(2) + "%"}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月毛利完成%" align="center" min-width="140px">
+          <template slot-scope="scope">
+            {{Number(scope.row.cost_rate).toFixed(2) + "%"}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月毛利指标" align="center" min-width="140px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.cost_tips)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月毛利完成" align="center" min-width="140px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.pure_profit)}}
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-row>
+  </div>
+</template>
+
+
+<script>
+import asyncRequest from "@/api/newResults";
+import { unit2TenThousand, subtraction, multiplication, division } from "../newReport/src/_utils";
+export default {
+  data(){
+    return {
+      loading: false,
+      daytime: "",
+      tableData: [],
+      depart_id: "",
+      departItems:[
+        {value:'',label:'所有平台'},
+        {value:'52',label:'百辰荣达'},
+        {value:'53',label:'普润心堂&锦兴弘昌'},
+        {value:'56',label:'泓源广诚'},
+        {value:'57',label:'万宇恒通'}
+      ]
+    }
+  },
+  mounted() {
+    this.daytime = this.transformTime();
+    this.requestData();
+  },
+  methods: {
+    unit2TenThousand,
+    transformTime() {
+      let time = new Date();
+      let y = time.getFullYear();
+      let M = time.getMonth() + 1;
+      let d = time.getDate();
+      return y + "-" + (M < 10 ? "0" + M : M) + "-" + (d < 10 ? "0" + d : d);
+    },
+    async requestData() {
+      this.loading = true;
+      
+      const result = await asyncRequest.departmentEveryMonth({
+        year: (this.daytime.split('-'))[0], 
+        depart_id: this.depart_id
+      })
+      
+      switch(Number(result.code)){
+        case 0:
+          this.tableData = (result.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,
+              cost_tips:tableItem.cost_tips,
+              total_tips:tableItem.total_tips,
+              cost_rate: Number(tableItem.cost_tips) === 0 ? 0 : multiplication(division(pure_profit, tableItem.cost_tips) || 0, 100).toFixed(2)
+            }
+          })
+
+          console.log(this.tableData);
+
+          // 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)
+          // this.tableData = [...tableData,totalItem]
+          break
+        default:
+          break
+      }
+      // this.getHeight();
+      this.loading = false;
+    }
+  }
+}
+</script>
+
+
+
+<style lang="scss" scoped>
+
+.new-results{
+  .search {
+    height:36px;
+    display: flex;
+    justify-content: end;
+    padding:0px 10px;
+    margin-top:10px
+  }
+}
+</style>
+

+ 303 - 0
src/components/newResults/company.vue

@@ -0,0 +1,303 @@
+<template>
+  <div v-loading="loading">
+    <div class="search clear">
+      <el-select size="small" style="margin-right:10px" v-model="companyName" @change="requestData">
+        <el-option label="所有公司" v-for="company in companies" :key="company.value" :value="company.value" :label="company.label" />
+      </el-select>
+
+      <el-date-picker class="fr picker" v-model="daytime" style=";width:150px" value-format="yyyy-MM-dd" :editable="false"
+        :clearable="false" :size="'small'" format="yyyy-MM-dd" type="date" align="right" placeholder="选择日期"
+        :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }" @change="requestData" />
+    </div>
+
+    <el-row style="margin-top:10px">
+      <el-table border size="mini" :data="tableData" :cell-class-name="setCellClassName">
+        <el-table-column fixed="left" label="业务公司" prop="companyName" align="center" width="190px" />
+        <el-table-column label="当日营业收入" align="center" width="120px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.sale_total)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月营收目标" align="center" width="120px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.total_tips)}}
+          </template>
+        </el-table-column>
+
+        <el-table-column label="当月营业收入(净)" align="center" width="400px">
+          <template slot-scope="scope">
+            <div style="display:flex;flex-direction: column;">
+              <p style="text-align: center;">{{unit2TenThousand(scope.row.msale_total)}}</p>
+              <el-table border size="mini" :data="scope.row.info">
+                <el-table-column align="center" label="直营/自营">
+                  <template slot-scope="scope">
+                    {{unit2TenThousand(scope.row[0].monthinfo.msale_total)}}
+                  </template>
+                </el-table-column>
+                
+                <el-table-column align="center" label="渠道">
+                  <template slot-scope="scope">
+                    {{ unit2TenThousand(scope.row[1].monthinfo.msale_total)}}
+                  </template>
+                </el-table-column>
+                <el-table-column align="center" label="供应商端">
+                  <template slot-scope="scope">
+                    {{ unit2TenThousand(scope.row[2].monthinfo.msale_total)}}
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="当月营收完成%" align="center" width="120px">
+          <template slot-scope="scope">
+            {{scope.row.completion_rate + "%"}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月毛利完成%" align="center" width="120px">
+          <template slot-scope="scope">
+            {{scope.row.gross_completion_rate + '%'}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月毛利指标" align="center" width="120px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.cost_tips)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月毛利完成" align="center" width="120px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.gross_completion)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月实际毛利率" align="center" width="120px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.gross_sale_completion_rate) + "%"}}
+          </template>
+        </el-table-column>
+        <el-table-column label="当月成本合计" align="center" width="120px">
+          <template slot-scope="scope">
+            {{unit2TenThousand(scope.row.mcost_total)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="直营/自营成本" align="center" width="120px">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.info[0][0].monthinfo.mcost_total)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="渠道成本" align="center" width="120px">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.info[0][1].monthinfo.mcost_total)}}
+          </template>
+        </el-table-column>
+        <el-table-column label="供应商端成本" align="center" width="120px">
+          <template slot-scope="scope">
+            {{ unit2TenThousand(scope.row.info[0][2].monthinfo.mcost_total)}}
+          </template>
+        </el-table-column>
+      </el-table>
+    </el-row>
+  </div>
+</template>
+
+
+<script>
+import asyncRequest from "@/api/newResults";
+import { addition, unit2TenThousand, subtraction, multiplication, division } from "../newReport/src/_utils";
+export default {
+  data() {
+    return {
+      daytime: "",
+      loading: false,
+      tableData: [],
+      companyName: "",
+      companies:[
+        { value:"",label: "所有公司"},
+        { value:"北京百辰荣达国际科贸有限公司",label: "北京百辰荣达国际科贸有限公司"},
+        { value:"北京泓源广诚国际商贸有限公司",label: "北京泓源广诚国际商贸有限公司"},
+        { value:"北京锦兴弘昌科技有限公司&\n北京普润心堂商贸有限公司&\n北京知事文化产业发展有限公司",label: "普润&锦兴&知事"},
+        { value:"北京万宇恒通国际科贸有限公司",label: "北京万宇恒通国际科贸有限公司"},
+      ]
+    }
+  },
+  mounted() {
+    this.daytime = this.transformTime();
+    this.requestData();
+  },
+  methods: {
+    unit2TenThousand,
+    setCellClassName({ column }) {
+      const { label } = column;
+      return label === "当月营业收入(净)" ? "pure__cell" : "";
+    },
+    transformTime() {
+      let time = new Date();
+      let y = time.getFullYear();
+      let M = time.getMonth() + 1;
+      let d = time.getDate();
+      return y + "-" + (M < 10 ? "0" + M : M) + "-" + (d < 10 ? "0" + d : d);
+    },
+    addDataToCompany(c1,c2){
+     return {
+        companyName:'北京锦兴弘昌科技有限公司&\n北京普润心堂商贸有限公司&\n北京知事文化产业发展有限公司',
+        cost_tips:Number(addition(c1.cost_tips,c2.cost_tips)).toFixed(2),
+        total_tips:Number(addition(c1.total_tips,c2.total_tips)).toFixed(2),
+        monthinfo:c1.monthinfo.map((item,index) => ({
+          mcgd_th_total:Number(addition(item.mcgd_th_total,c2.monthinfo[index].mcgd_th_total)).toFixed(2),
+          mcgd_total:Number(addition(item.mcgd_total,c2.monthinfo[index].mcgd_total)).toFixed(2),
+          msale_total:Number(addition(item.msale_total,c2.monthinfo[index].msale_total)).toFixed(2),
+          mth_total:Number(addition(item.mth_total,c2.monthinfo[index].mth_total)).toFixed(2),
+          type:item.type
+        })),
+        dayinfo:c1.monthinfo.map((item,index) => ({
+          cgd_th_total:Number(addition(item.cgd_th_total,c2.monthinfo[index].cgd_th_total)).toFixed(2),
+          cgd_total:Number(addition(item.cgd_total,c2.monthinfo[index].cgd_total)).toFixed(2),
+          sale_total:Number(addition(item.sale_total,c2.monthinfo[index].sale_total)).toFixed(2),
+          th_total:Number(addition(item.th_total,c2.monthinfo[index].th_total)).toFixed(2),
+          type:item.type
+        })),
+      }
+    },
+    async requestData() {
+      this.loading = true;
+      this.tableData = [];
+
+      const res = await asyncRequest.companyEveryMonth({ daytime: this.daytime });
+      // 锦兴下标
+      const jx_index = res.data.findIndex(({companyName}) => companyName === "北京锦兴弘昌科技有限公司");
+      // 普润下标
+      const pr_index = res.data.findIndex(({companyName}) => companyName === "北京普润心堂商贸有限公司");
+      // 知事下标
+      const zs_index = res.data.findIndex(({companyName}) => companyName === "北京知事文化产业发展有限公司");
+
+
+      if(pr_index >= 0 && jx_index >= 0){
+        const pr_item = res.data.splice(pr_index, 1);
+        res.data[jx_index] = this.addDataToCompany(res.data[jx_index],pr_item[0])
+      }
+
+      if(zs_index >= 0 && jx_index >= 0){
+        const zs_item = res.data.splice(zs_index, 1);
+        res.data[jx_index] = this.addDataToCompany(res.data[jx_index],zs_item[0])
+      }
+
+
+      if(this.companyNo && companyNo === "1"){
+          res.data = res.data.filter(({companyName}) => companyName === "北京百辰荣达国际科贸有限公司")
+      }
+
+
+      if(this.companyName){
+          res.data = res.data.filter(({companyName}) => companyName === this.companyName)
+      }
+
+
+      // const isBeforeDate = this.getDiffDay() < 0 && this.companyNo === "GS2302231323386950"
+
+      if (res.code === 0 && res.data && res.data.length > 0) {
+        res.data.forEach(({ companyName, monthinfo, dayinfo, total_tips ,cost_tips }) => {
+          // monthinfo[1] = {
+          //   ...(isBeforeDate ? {
+          //     msale_total:addition(monthinfo[1].msale_total,monthinfo[2].msale_total),
+          //     mth_total:addition(monthinfo[1].mth_total,monthinfo[2].mth_total),
+          //     type:'2'
+          //   } : monthinfo[1])
+          // }
+
+          // monthinfo[0] = {
+          //   ...(isBeforeDate ? {
+          //     msale_total:0,
+          //     mth_total:0,
+          //     type:'1'
+          //   } : monthinfo[0])
+          // }
+
+          // monthinfo[2] = {
+          //   ...(isBeforeDate ? {
+          //     msale_total:0,
+          //     mth_total:0,
+          //     type:'3'
+          //   } : monthinfo[2])
+          // }
+
+
+          // this.companyName = companyName
+
+
+          const mapResponseType = { '1': '自营', '2': '渠道', '3': '供应商端' }
+
+          const types = Object.keys(mapResponseType)
+
+          let prev_sale_total = 0;
+          let prev_msale_total = 0;
+          let prev_cost_total = 0;
+          let prev_mcost_total = 0;
+              
+          const item = types.map(type => {
+             const _monthinfo = monthinfo.find(month => String(month.type) === type) || {}
+             const _dayinfo = dayinfo.find(day => String(day.type) === type) || {}
+
+             /** 月营业收入 = 月销售额 - 月退货额  */ 
+             const msale_total = subtraction(_monthinfo.msale_total, _monthinfo.mth_total) || 0
+             /** 日营业收入 = 日销售额 - 日退货额 */
+             const sale_total = subtraction(_dayinfo.sale_total, _dayinfo.th_total) || 0;
+             /** 日成本 = 日采购额 - 日退货额 */
+             const cost_total = subtraction(_dayinfo.cgd_total, _dayinfo.cgd_th_total) || 0;
+             /** 月成本 = 月采购额 - 月退货额 */
+             const mcost_total = subtraction(_monthinfo.mcgd_total, _monthinfo.mcgd_th_total) || 0;
+
+             prev_sale_total = Number(addition(prev_sale_total,sale_total)).toFixed(2);
+             prev_msale_total = Number(addition(prev_msale_total,msale_total)).toFixed(2);
+             prev_cost_total = Number(addition(prev_cost_total,cost_total)).toFixed(2);
+             prev_mcost_total = Number(addition(prev_mcost_total,mcost_total)).toFixed(2);
+
+             return {
+               type:mapResponseType[type],
+               dayinfo: { ..._dayinfo,  sale_total  },
+               monthinfo: { ...monthinfo,  msale_total, mcost_total }
+           }
+          })
+
+
+          const gross_completion = Number(subtraction(prev_msale_total, prev_mcost_total)).toFixed(2) //当月毛利完成 = 月营收 - 月成本
+          this.tableData = [
+            ...this.tableData,
+            { 
+              companyName,  // 公司名称
+              cost_tips, // 当月成本指标
+              total_tips, // 当月营收目标
+              info: [{...item}], // 直营.. 渠道 销售
+              sale_total:prev_sale_total, // 当日营业收入
+              cost_total: prev_cost_total, // 当日成本总额
+              msale_total:prev_msale_total, // 当月营业收入
+              mcost_total: prev_mcost_total,// 当月成本总额
+              gross_completion, //当月毛利完成 = 月营收 - 月成本
+
+              completion_rate:multiplication(division(prev_msale_total,total_tips), 100).toFixed(2), // 当月应收完成率
+              gross_completion_rate: Number(cost_tips) === 0 ? 0 : multiplication(division(gross_completion,cost_tips) || 0, 100).toFixed(2), // 当月毛利完成率
+              gross_sale_completion_rate:Number(multiplication(division(gross_completion,prev_msale_total) || 0, 100)).toFixed(2), // 本月毛利率 =  当月毛利完成 / 当月营业收入
+            }
+          ]
+        })
+      } else {
+        this.tableData = [];
+      }
+      // this.getHeight();
+      this.loading = false;
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.new-results {
+  .search {
+    height: 36px;
+    display: flex;
+    justify-content: end;
+    padding: 0px 10px;
+    margin-top: 10px
+  }
+}
+</style>
+

+ 249 - 0
src/components/newResults/department.vue

@@ -0,0 +1,249 @@
+<template>
+  <div v-loading="loading">
+    <div class="search clear">
+      <el-select size="small" style="margin-right:10px" v-model="depart_id" @change="requestData">
+        <el-option 
+          v-for="depart in departItems" 
+          :key="depart.value" 
+          :label="depart.label" 
+          :value="depart.value" 
+         />
+      </el-select>
+
+      <el-date-picker 
+        class="fr picker" 
+        v-model="daytime" 
+        :picker-options="{ disabledDate(time) { return time.getTime() > Date.now(); } }" 
+        placeholder="选择日期"
+        style=";width:150px" 
+        value-format="yyyy-MM-dd" 
+        format="yyyy-MM-dd" 
+        :editable="false"
+        :clearable="false" 
+        :size="'small'" 
+        align="right" 
+        type="date" 
+        />
+    </div>
+
+    <el-row style="margin-top: 10px; display: flex;">
+      <el-table border size="mini" :data="list" :span-method="spanMethod" :cell-class-name="setCellClassName">
+        <el-table-column fixed="left" label="公司" prop="company" align="center" width="140px" />
+        <el-table-column fixed="left" label="部门" prop="depart" align="center" width="140px" />
+        <el-table-column label="当日营业收入"  align="center" width="120px">
+          <template slot-scope="scope">{{ unit2TenThousand(scope.row.dayinfo.sale_total) }}</template>
+        </el-table-column>
+        
+        <el-table-column label="当月营收目标" align="center" width="120px">
+          <template slot-scope="scope">{{ unit2TenThousand(scope.row.total_tips) }}</template>
+        </el-table-column>
+
+        <el-table-column label="当月营业收入(净)" align="center" width="400px">
+          <template slot-scope="scope">
+            <div style="display:flex;flex-direction: column;">
+              <p style="text-align: center;">{{ unit2TenThousand(scope.row.monthinfo.monthNetSales)}}</p>
+              <el-table border size="mini" :data="scope.row.currentMonthPure">
+                <el-table-column align="center" label="直营/自营">
+                  <template slot-scope="scope">{{ unit2TenThousand(scope.row.zy) }}</template>
+                </el-table-column>
+                <el-table-column align="center" label="渠道">
+                  <template slot-scope="scope">{{unit2TenThousand(scope.row.qd)}}</template>
+                </el-table-column>
+              </el-table>
+            </div>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="成本" align="center" min-width="400px">
+          <el-table-column align="center" label="直营/自营">
+            <template slot-scope="scope">{{unit2TenThousand(scope.row.zy_cost)}}</template>
+          </el-table-column>
+
+          <el-table-column align="center" label="渠道">
+            <template slot-scope="scope">{{unit2TenThousand(scope.row.qd_cost)}}</template>
+          </el-table-column>
+        </el-table-column>
+
+        <el-table-column align="center" label="毛利" min-width="400px">
+          <el-table-column align="center" label="直营/自营">
+            <template slot-scope="scope">{{unit2TenThousand(scope.row.zy_gross)}}</template>
+          </el-table-column>
+
+          <el-table-column align="center" label="渠道">
+            <template slot-scope="scope">{{unit2TenThousand(scope.row.qd_gross)}}</template>
+          </el-table-column>
+        </el-table-column>
+      </el-table>
+    </el-row>
+  </div>
+</template>
+
+
+<script>
+import asyncRequest from "@/api/newResults";
+import setHeight from "@/mixins/index";
+
+import { 
+  addition, 
+  division, 
+  subtraction, 
+  multiplication, 
+  unit2TenThousand 
+} from "../newReport/src/_utils";
+
+export default {
+  mixins: [ setHeight ],
+  data(){
+    return {
+      list: [],
+      daytime: "",
+      depart_id: "",
+      loading: false,
+      departItems:[
+        {value:'',label:'所有平台'},
+        {value:'52',label:'百辰荣达'},
+        {value:'53',label:'普润心堂&锦兴弘昌'},
+        {value:'56',label:'泓源广诚'},
+        {value:'57',label:'万宇恒通'}
+      ]
+    }
+  },
+  mounted() {
+    this.daytime = this.transformTime();
+    this.requestData();
+  },
+  watch:{ daytime:{ handler(){ this.requestData() }}},
+  methods: {
+    unit2TenThousand,
+    transformTime() {
+      let time = new Date();
+      let y = time.getFullYear();
+      let M = time.getMonth() + 1;
+      let d = time.getDate();
+      return y + "-" + (M < 10 ? "0" + M : M) + "-" + (d < 10 ? "0" + d : d);
+    },
+      /* 表格合并列和行 */
+    spanMethod({ rowIndex, columnIndex }) {
+		  if (columnIndex === 0) {
+		   const _row = this.flitterData(this.list).one[rowIndex];
+		   const _col = _row > 0 ? 1 : 0;
+		   return { rowspan: _row, colspan: _col };
+		  }
+	  },
+	  /**合并表格的第一列,处理表格数据 */
+	  flitterData(arr) {
+      let spanOneArr = [];
+      let concatOne = 0;
+	     arr.forEach((item, index) => {
+	     if (index === 0) {
+	       spanOneArr.push(1);
+	     } else {
+	      //注意这里的quarterly是表格绑定的字段,根据自己的需求来改
+	       if (item.company === arr[index - 1].company) {
+	         //第一列需合并相同内容的判断条件
+	         spanOneArr[concatOne] += 1;
+	         spanOneArr.push(0);
+	       } else {
+	         spanOneArr.push(1);
+           concatOne = index;
+	       }
+	     }
+	    });
+
+	    return { one: spanOneArr };
+	  },
+    setCellClassName({ column }) {
+      const { label } = column; return label === "当月营业收入(净)" ? "pure__cell" : "";
+    },
+    async requestData() {
+      this.loading = true;
+      this.list = [];
+
+      const res = await asyncRequest.departmentEveryDay({ daytime: this.daytime });
+
+      if (res.code === 0 && res.data && res.data.length > 0) {
+        let list = (res.data || [])
+        .map(({depart, msale_total, mth_total, sale_total, th_total, total_tips ,mzy_sale_total, mchannel_sale_total,channel_cost_total,zy_cost_total}) => {
+          return {
+            depart, total_tips,mzy_sale_total, mchannel_sale_total, channel_cost_total, zy_cost_total,
+            dayinfo: { sale_total, th_total }, monthinfo:{ msale_total, mth_total }
+          }
+        });
+
+        this.total = list.reduce((prev,current) => {
+            const { total_tips = 0, day = 0, month = 0 } = current;
+            return {  total_tips: addition(total_tips,prev.total_tips), month: addition(month,prev.month), day: addition(day, prev.day) }
+          },
+          { total_tips: 0, month: 0, day: 0}
+        )
+
+
+        let mapDepart = ["百辰","泓源","普润","平台"]
+        if(this.depart_id === "52"){
+          list = list.filter(({ depart }) => depart === "百辰")
+          mapDepart = mapDepart.filter(depart  => depart === "百辰")
+        }
+
+        if(this.depart_id === "53"){
+          list = list.filter(({ depart }) => depart === "普润")
+          mapDepart = mapDepart.filter(depart  => depart === "普润")
+        }
+
+        if(this.depart_id === "56"){
+          list = list.filter(({ depart }) => depart === "泓源")
+          mapDepart = mapDepart.filter(depart  => depart === "泓源")
+        }
+
+        if(this.depart_id === "57"){
+          list = list.filter(({ depart }) => depart === "平台")
+          mapDepart = mapDepart.filter(depart  => depart === "平台")
+        }
+
+
+        list = mapDepart.map(d => list.find(({ depart }) => depart === d))
+
+        console.log(list)
+        const mapToDepartment = { 百辰:"百辰荣达", 泓源:"泓源广诚", 普润:"普润心堂&锦兴弘昌", 平台:"万宇恒通" }
+        this.list = list.map(({depart,total_tips,dayinfo,monthinfo,mchannel_sale_total,mzy_sale_total,zy_cost_total,channel_cost_total}) => {
+          /* 月净销售 = 月销售 - 月退货 **/
+          const monthNetSales = subtraction(monthinfo.msale_total, monthinfo.mth_total)
+          /* 月经销售完成率 = 月净销售 / 销售指标 **/
+          const monthProportion = multiplication(division(monthNetSales,total_tips),100).toFixed(2)
+          return {
+            total_tips, // 营收目标
+            zy_cost: zy_cost_total, // 自营成本
+            qd_cost: channel_cost_total, // 渠道成本
+            depart: mapToDepartment[depart],
+            company: "北京万宇恒通国际科贸有限公司",
+            currentMonthPure:[ { zy : mzy_sale_total, qd: mchannel_sale_total } ], // 当月营业收入(净)
+            zy_gross:Number(subtraction(mzy_sale_total,zy_cost_total)).toFixed(2), // 自营毛利  = 自营营收 - 自营成本
+            qd_gross:Number(subtraction(mchannel_sale_total,channel_cost_total)).toFixed(2), // 渠道毛利 = 渠道营收 - 渠道成本
+            dayinfo:{ ...dayinfo, /** 日销售额 = 日销售额 - 日退货额 */  sale_total:subtraction(dayinfo.sale_total,dayinfo.th_total) },
+            /* 占比 =  (当前部门销售额 / 各部门总销售额) / 100 **/
+            proportion:multiplication( division(monthinfo.msale_total,this.total.month) || 0 ,100) || 0,
+            monthinfo:{ monthNetSales,monthProportion: monthProportion }
+          }
+        })
+      } else {
+        this.list = [];
+      }
+      this.getHeight();
+      this.loading = false;
+    },
+  },
+}
+
+</script>
+
+<style lang="scss" scoped>
+.new-results{
+  .search {
+    height:36px;
+    display: flex;
+    justify-content: end;
+    padding:0px 10px;
+    margin-top:10px
+  }
+}
+</style>
+

+ 3 - 3
src/components/reports/src/CompanyMonthGrossMargin.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="SalesReportRejectedNew" style="margin-top:10px">
     <el-table
+      border
       :data="tableData"
       v-loading="loading"
-      border
       :size="'mini'"
       style="width: 100%"
     >
@@ -32,6 +32,7 @@
 <script>
 import asyncRequest from "@/api/report";
 import setHeight from "@/mixins/index";
+
 import { 
   unit2TenThousand,
   getCompanyLabel,
@@ -78,8 +79,7 @@ export default {
     division,
     async searchList() {
       this.loading = true;
-      console.log(this.daytime)
-      const result = await asyncRequest.companyEvery({year:(this.daytime.split('-'))[0], companyNo:this.companyNo})
+      const result = await asyncRequest.companyEvery({year: (this.daytime.split('-'))[0], companyNo:this.companyNo})
       switch(Number(result.code)){
         case 0:
           const tableData = (result.data || []).map(tableItem => {

+ 2 - 0
src/main.js

@@ -2,6 +2,8 @@ import App from "./App.vue";
 import * as filters from './filters' // global filters
 import router from "./router"
 
+import "./styles/index.scss"
+
 import {
   Table,
   Select,

+ 1 - 0
src/pages/index.vue

@@ -20,6 +20,7 @@ export default {
         {label:'3.应收账款', link:'/?path=accountsReceivable'},
         {label:'4.订单情况', link:'/?path=newReport'},
         {label:'5.发货情况', link:'/?path=stock'}
+        // {label:'6.业绩报表(新)',link:'/?path=newResults'}
       ]
     }
   },

+ 132 - 0
src/pages/newResults.vue

@@ -0,0 +1,132 @@
+<template>
+  <div class="new-results" v-loading="state.loading" style="min-height:300px">
+    <div v-if="!state.error && isShow">
+      <result-company />
+      <result-company-month />
+      <result-department />
+    </div>
+
+    <template v-else-if="!state.loading">
+      <unusual-state :hasPermission="isShow" :message="state.message" path="newReport" />
+    </template>
+  </div>
+</template>
+
+<script>
+import PeriodDatePicker from "../components/period-date-picker";
+import UnusualState from "@/components/unusual/index.vue";
+import ResultCompany from "@/components/newResults/company.vue"
+import ResultDepartment from "@/components/newResults/department.vue"
+import ResultCompanyMonth from "@/components/newResults/company-month.vue"
+import { getOpenid, getParameterByName, removeOpenid, setOpenid } from "../utils/auth";
+
+export default {
+  name: "newReport",
+  components: {
+    UnusualState,
+    ResultCompany,
+    ResultDepartment,
+    PeriodDatePicker,
+    ResultCompanyMonth
+  },
+  data() {
+    return {
+      zxTotal: 0,
+      daytime: "",
+      isDisplay: false,
+      state:{ message: '', error: false, loading: false }
+    };
+  },
+  mounted() {    
+    if(!getParameterByName('code')){ 
+      this.login() 
+    }else{
+      this.requestUserinfo()
+    }
+  },
+  methods: {
+    async time(e) {
+      const { startTime, endTime } = e;
+      this.start = startTime || "";
+      this.end = endTime || "";
+
+      const { start, end } = this;
+      if ((start !== "" && end === "") || (start === "" && end !== "")) {
+        this.$message.warning("时间区间不完整!");
+        this.date = []
+        return;
+      }
+
+      if(this.start && this.end){
+        this.date = [this.start + " 00:00:00", this.end + " 23:59:59"]
+      }else{
+        this.date = [this.start, this.end]
+      }
+
+    },
+    async requestUserinfo(){
+       this.state.loading = true
+       const openid = getOpenid()
+       const code = getParameterByName('code')
+       //  const result = await userRequest.userinfo({  ...( openid ? { openid } :  { code }) })
+
+       const result ={
+        "code": 0,
+        "message": "获取成功",
+        "data": {
+		      "openid": "oOpc26KiZFBKIm7SB8knFGvov1qg",
+		      "subscribe_time": "2022-12-21 15:52:14",
+		      "updatetime": "2023-05-09 16:22:33",
+          "addtime": "2023-04-10 18:11:17",
+		      "is_show": ["1", "2", "4"],
+          "nickname": "雪寒",
+		      "addr": "\/\/",
+		      "gender": "0",
+          "mobile": "",
+		      "avatar": "",
+		      "status": "1",
+		      "id": "1",
+		      "companyArr": [
+            {"companyNo": "GS2302231125079621", "companyName": "北京百辰荣达国际科贸有限公司", "info": [1, 2]}, 
+            {"companyNo": "GS2302231323386950","companyName": "北京泓源广诚国际商贸有限公司", "info": [1, 2]}, 
+            {"companyNo": "GS2203161855277894","companyName": "北京万宇恒通国际科贸有限公司", "info": [1, 2]},
+            {"companyNo": "GS2304031312553746","companyName": "北京锦兴弘昌科技有限公司",  "info": [1, 2]}, 
+            {"companyNo": "GS2302231124114965","companyName": "北京普润心堂商贸有限公司", "info": [1, 2]}
+          ]
+      	}
+      }
+      
+        this.state.loading = false
+        switch(Number(result.code)){
+          case 0:
+           this.isShow =  (result.data.is_show || []).includes(4) || (result.data.is_show || []).includes('4')
+           setOpenid(result.data.openid)
+           break
+          default:
+           this.state.error = true;
+           this.state.message = result.message;
+           openid && removeOpenid();
+           break;
+        }
+      },
+    login(){
+      const redirect_url = encodeURIComponent('http://stat.caixiao365.com/accountsReceivable')
+      var state = 'wx_' + Math.random().toString(36).substr(2, 15)
+      const scope = 'snsapi_userinfo'
+      const baseUrl = "https://open.weixin.qq.com/connect/oauth2/authorize";
+      const url = `${baseUrl}?appid=${config.appId}&redirect_uri=${redirect_url}&response_type=code&scope=${scope}&state=${state}#wechat_redirect`
+      window.location.href = url;
+    },
+  }
+}
+</script>
+
+
+<style lang="scss" scoped>
+.new-results {
+  width: 100vw;
+  height: 100vh;
+  position: fixed;
+  overflow: auto;
+}
+</style>

+ 15 - 16
src/router/index.js

@@ -1,36 +1,35 @@
-import Report from "./../pages/report.vue"
-import Login from "./../pages/login.vue"
 import AccountsReceivable from "./../pages/accountsReceivable.vue"
-import Results from "./../pages/results.vue"
 import NewReport from "./../pages/newReport.vue"
+import NewResult from "../pages/newResults.vue"
+import Results from "./../pages/results.vue"
+import Report from "./../pages/report.vue"
 import Stock from "./../pages/stock.vue"
+import Login from "./../pages/login.vue"
 import Index from "../pages/index.vue"
 
-import { getParameterByName } from "../utils/auth"
 
+import { getParameterByName } from "../utils/auth"
 const routes = [
   { path:"/", component: Index },
-  { path: '/report', component: Report},
-  { path:'/login', component: Login},
-  { path:'/newReport', component: NewReport},
-  { path:'/results', component: Results},
-  { path:'/accountsReceivable', component: AccountsReceivable},
-  { path:'/stock', component: Stock},
+  { path:'/report', component: Report },
+  { path:'/login', component: Login} ,
+  { path:'/newReport', component: NewReport },
+  { path:'/results', component: Results },
+  { path:'/accountsReceivable', component: AccountsReceivable },
+  { path:'/stock', component: Stock },
+  { path:'/U2FsdGVkX18CBclMtv5NilX83zsPwHBktj7mWEchdUQ', component: NewResult }
 ]
 
-const router = new VueRouter({routes ,mode:'hash'})
+const router = new VueRouter({routes, mode:'hash'})
 
 router.beforeEach((to, _, next) => {
   const path = getParameterByName('path')
   if(to.path === "/" && !path){
     next()
   }else if (to.path !== '/login' && !getParameterByName('code')) {
-    next({
-      path:'login',
-      query:{ path }
-    })
+    next({ path:'login', query: { path } })
   } else {
-    next()
+    next();
   }
 })
 

+ 16 - 1
src/styles/index.scss

@@ -1,3 +1,18 @@
-.el-table_14_column_58{
+.pure__cell{
+  padding: 0px !important;
 
+  .cell {
+    padding: 0px !important;
+    margin-right: -1px;
+    margin-bottom: -1px;
+
+    .el-table{
+      border-left: none !important;
+      // border-right: none !important;
+
+      .el-table--border::after{
+        display: none !important;
+      }
+    }
+  }
 }

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません