|  | @@ -1,44 +1,27 @@
 | 
	
		
			
				|  |  |  <template>
 | 
	
		
			
				|  |  |    <div>
 | 
	
		
			
				|  |  |      <basic-container class="page-crad">
 | 
	
		
			
				|  |  | -      <avue-crud
 | 
	
		
			
				|  |  | -        ref="crud"
 | 
	
		
			
				|  |  | -        :option="option"
 | 
	
		
			
				|  |  | -        :data="dataList"
 | 
	
		
			
				|  |  | -        :page.sync="page"
 | 
	
		
			
				|  |  | -        :search.sync="search"
 | 
	
		
			
				|  |  | -        :cell-style="cellStyle"
 | 
	
		
			
				|  |  | -        @search-change="searchChange"
 | 
	
		
			
				|  |  | -        @current-change="currentChange"
 | 
	
		
			
				|  |  | -        @size-change="sizeChange"
 | 
	
		
			
				|  |  | -        @refresh-change="refreshChange"
 | 
	
		
			
				|  |  | -        @on-load="onLoad"
 | 
	
		
			
				|  |  | -        :table-loading="loading"
 | 
	
		
			
				|  |  | -        :summary-method="summaryMethod"
 | 
	
		
			
				|  |  | -        @saveColumn="saveColumn"
 | 
	
		
			
				|  |  | -        @resetColumn="resetColumn"
 | 
	
		
			
				|  |  | -        @search-criteria-switch="searchCriteriaSwitch"
 | 
	
		
			
				|  |  | -      >
 | 
	
		
			
				|  |  | +      <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
 | 
	
		
			
				|  |  | +        :cell-style="cellStyle" @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
 | 
	
		
			
				|  |  | +        @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
 | 
	
		
			
				|  |  | +        @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
 | 
	
		
			
				|  |  |          <template slot="menuLeft">
 | 
	
		
			
				|  |  | -          <el-button type="info" size="small" @click="outExport"
 | 
	
		
			
				|  |  | -            >导出</el-button
 | 
	
		
			
				|  |  | -          >
 | 
	
		
			
				|  |  | +          <el-button type="info" size="small" @click="outExport">导出</el-button>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  | -        <template slot="corpIdSearch">
 | 
	
		
			
				|  |  | -          <crop-select v-model="search.corpId" corpType="KH"></crop-select>
 | 
	
		
			
				|  |  | +        <template slot="corpNameSearch">
 | 
	
		
			
				|  |  | +          <crop-select v-model="search.corpName" corpType="KH" :zhKey="true"></crop-select>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  | -        <template slot="businesDateSearch">
 | 
	
		
			
				|  |  | -          <el-date-picker
 | 
	
		
			
				|  |  | -            v-model="search.businesDate"
 | 
	
		
			
				|  |  | -            type="daterange"
 | 
	
		
			
				|  |  | -            start-placeholder="开始日期"
 | 
	
		
			
				|  |  | -            end-placeholder="结束日期"
 | 
	
		
			
				|  |  | -            format="yyyy-MM-dd"
 | 
	
		
			
				|  |  | -            value-format="yyyy-MM-dd HH:mm:ss"
 | 
	
		
			
				|  |  | -            :default-time="['00:00:00', '23:59:59']"
 | 
	
		
			
				|  |  | -          >
 | 
	
		
			
				|  |  | +        <template slot="careteTimeSearch">
 | 
	
		
			
				|  |  | +          <el-date-picker v-model="search.careteTime" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
 | 
	
		
			
				|  |  | +            format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
 | 
	
		
			
				|  |  |            </el-date-picker>
 | 
	
		
			
				|  |  |          </template>
 | 
	
		
			
				|  |  | +        <template slot="brandSearch">
 | 
	
		
			
				|  |  | +          <el-select v-model="search.brand" filterable clearable>
 | 
	
		
			
				|  |  | +            <el-option v-for="(item, index) in brandOption" :key="index" :label="item.dictValue"
 | 
	
		
			
				|  |  | +              :value="item.dictValue" />
 | 
	
		
			
				|  |  | +          </el-select>
 | 
	
		
			
				|  |  | +        </template>
 | 
	
		
			
				|  |  |        </avue-crud>
 | 
	
		
			
				|  |  |      </basic-container>
 | 
	
		
			
				|  |  |    </div>
 | 
	
	
		
			
				|  | @@ -46,6 +29,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  <script>
 | 
	
		
			
				|  |  |  import { getToken } from "@/util/auth";
 | 
	
		
			
				|  |  | +import { getList } from "@/api/statisticAnalysis/salesProfitN"
 | 
	
		
			
				|  |  |  import _ from "lodash";
 | 
	
		
			
				|  |  |  export default {
 | 
	
		
			
				|  |  |    name: "index",
 | 
	
	
		
			
				|  | @@ -80,32 +64,28 @@ export default {
 | 
	
		
			
				|  |  |          column: [
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "客户名称",
 | 
	
		
			
				|  |  | -            prop: "corpId",
 | 
	
		
			
				|  |  | +            prop: "corpName",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100,
 | 
	
		
			
				|  |  | -            search: true,
 | 
	
		
			
				|  |  | -            formatter: row => {
 | 
	
		
			
				|  |  | -              return row.corpsName;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +            search: true
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "品牌",
 | 
	
		
			
				|  |  | -            prop: "billType",
 | 
	
		
			
				|  |  | +            prop: "brand",
 | 
	
		
			
				|  |  |              type: "select",
 | 
	
		
			
				|  |  | -            hide: true,
 | 
	
		
			
				|  |  |              showColumn: false,
 | 
	
		
			
				|  |  |              search: true
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "省份",
 | 
	
		
			
				|  |  | -            prop: "orderNo",
 | 
	
		
			
				|  |  | +            prop: "province",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100,
 | 
	
		
			
				|  |  |              search: true
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "日期",
 | 
	
		
			
				|  |  | -            prop: "businesDate",
 | 
	
		
			
				|  |  | +            prop: "careteTime",
 | 
	
		
			
				|  |  |              type: "date",
 | 
	
		
			
				|  |  |              format: "yyyy-MM-dd",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
	
		
			
				|  | @@ -114,97 +94,99 @@ export default {
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "业务员",
 | 
	
		
			
				|  |  | -            prop: "portOfLoad",
 | 
	
		
			
				|  |  | +            prop: "salesName",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              search: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "发货数量",
 | 
	
		
			
				|  |  | -            prop: "portOfDestination",
 | 
	
		
			
				|  |  | +            prop: "quantity",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "销售金额",
 | 
	
		
			
				|  |  | -            prop: "transport",
 | 
	
		
			
				|  |  | +            prop: "amount",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "特价条数",
 | 
	
		
			
				|  |  | -            prop: "procurementCost",
 | 
	
		
			
				|  |  | +            prop: "specialOfferQuantity",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "特价总金额",
 | 
	
		
			
				|  |  | -            prop: "partsCost",
 | 
	
		
			
				|  |  | +            prop: "specialOfferAmounts",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "非特价条数",
 | 
	
		
			
				|  |  | -            prop: "purchasePrice",
 | 
	
		
			
				|  |  | +            prop: "nonSpecialOfferQuantity",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "非特价总金额",
 | 
	
		
			
				|  |  | -            prop: "amount",
 | 
	
		
			
				|  |  | +            prop: "nonSpecialOfferAmount",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "17寸以上数量",
 | 
	
		
			
				|  |  | -            prop: "grossProfit",
 | 
	
		
			
				|  |  | +            prop: "seventeenQuantity",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "17寸以上金额",
 | 
	
		
			
				|  |  | -            prop: "grossProfitRate",
 | 
	
		
			
				|  |  | +            prop: "seventeenAmount",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "采购金额",
 | 
	
		
			
				|  |  | -            prop: "fd",
 | 
	
		
			
				|  |  | +            prop: "purchaseAmount",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "返利使用额",
 | 
	
		
			
				|  |  | -            prop: "fc",
 | 
	
		
			
				|  |  | +            prop: "thisUsedProfit",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "费用总金额",
 | 
	
		
			
				|  |  | -            prop: "singleTicketMargin",
 | 
	
		
			
				|  |  | +            prop: "totalAmount",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "销售毛利",
 | 
	
		
			
				|  |  | -            prop: "singleTicketMargin",
 | 
	
		
			
				|  |  | +            prop: "grossProfit",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            },
 | 
	
		
			
				|  |  |            {
 | 
	
		
			
				|  |  |              label: "销售毛利率",
 | 
	
		
			
				|  |  | -            prop: "singleTicketMargin",
 | 
	
		
			
				|  |  | +            prop: "grossProfitRate",
 | 
	
		
			
				|  |  |              overHidden: true,
 | 
	
		
			
				|  |  |              width: 100
 | 
	
		
			
				|  |  |            }
 | 
	
		
			
				|  |  |          ]
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      brandOption: []
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  | -  filters: {
 | 
	
		
			
				|  |  | -    decimalFormat(num) {
 | 
	
		
			
				|  |  | -      return num ? Number(num).toFixed(2) : "0.00";
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +  async created() {
 | 
	
		
			
				|  |  | +    this.option = await this.getColumnData(this.getColumnName(185), this.option);
 | 
	
		
			
				|  |  | +    this.getWorkDicts('brand').then(res => {
 | 
	
		
			
				|  |  | +      this.brandOption = res.data.data;
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  |    },
 | 
	
		
			
				|  |  |    methods: {
 | 
	
		
			
				|  |  |      cellStyle() {
 | 
	
	
		
			
				|  | @@ -235,66 +217,71 @@ export default {
 | 
	
		
			
				|  |  |        this.page.pageSize = val;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      onLoad(page, params = {}) {
 | 
	
		
			
				|  |  | -      // this.loading = true;
 | 
	
		
			
				|  |  | -      // getList(
 | 
	
		
			
				|  |  | -      //   page.currentPage,
 | 
	
		
			
				|  |  | -      //   page.pageSize,
 | 
	
		
			
				|  |  | -      //   Object.assign(params, this.search)
 | 
	
		
			
				|  |  | -      // )
 | 
	
		
			
				|  |  | -      //   .then(res => {
 | 
	
		
			
				|  |  | -      //     if (res.data.data.records) {
 | 
	
		
			
				|  |  | -      //       res.data.data.records.forEach(e => {
 | 
	
		
			
				|  |  | -      //         e.itemLoading = true;
 | 
	
		
			
				|  |  | -      //       });
 | 
	
		
			
				|  |  | -      //     }
 | 
	
		
			
				|  |  | -      //     this.dataList = res.data.data.records ? res.data.data.records : [];
 | 
	
		
			
				|  |  | -      //     this.page.total = res.data.data.total;
 | 
	
		
			
				|  |  | -      //     if (this.page.total) {
 | 
	
		
			
				|  |  | -      //       this.option.height = window.innerHeight - 210;
 | 
	
		
			
				|  |  | -      //     }
 | 
	
		
			
				|  |  | -      //   })
 | 
	
		
			
				|  |  | -      //   .finally(() => {
 | 
	
		
			
				|  |  | -      //     this.loading = false;
 | 
	
		
			
				|  |  | -      //   });
 | 
	
		
			
				|  |  | +      let data = this.deepClone(Object.assign({}, params, this.search));
 | 
	
		
			
				|  |  | +      if (data.careteTime) {
 | 
	
		
			
				|  |  | +        data.beginCreateTime = data.careteTime[0]
 | 
	
		
			
				|  |  | +        data.endCreateTime = data.careteTime[1]
 | 
	
		
			
				|  |  | +        delete data.careteTime
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      this.loading = true;
 | 
	
		
			
				|  |  | +      getList(
 | 
	
		
			
				|  |  | +        page.currentPage,
 | 
	
		
			
				|  |  | +        page.pageSize,
 | 
	
		
			
				|  |  | +        data
 | 
	
		
			
				|  |  | +      )
 | 
	
		
			
				|  |  | +        .then(res => {
 | 
	
		
			
				|  |  | +          if (res.data.data.records) {
 | 
	
		
			
				|  |  | +            res.data.data.records.forEach(e => {
 | 
	
		
			
				|  |  | +              e.itemLoading = true;
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +          this.dataList = res.data.data.records ? res.data.data.records : [];
 | 
	
		
			
				|  |  | +          this.page.total = res.data.data.total;
 | 
	
		
			
				|  |  | +          if (this.page.total) {
 | 
	
		
			
				|  |  | +            this.option.height = window.innerHeight - 210;
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        .finally(() => {
 | 
	
		
			
				|  |  | +          this.loading = false;
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //列保存触发
 | 
	
		
			
				|  |  | +    async saveColumn() {
 | 
	
		
			
				|  |  | +      const inSave = await this.saveColumnData(this.getColumnName(185), this.option);
 | 
	
		
			
				|  |  | +      if (inSave) {
 | 
	
		
			
				|  |  | +        this.$message.success("保存成功");
 | 
	
		
			
				|  |  | +        //关闭窗口
 | 
	
		
			
				|  |  | +        this.$refs.crud.$refs.dialogColumn.columnBox = false;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    async resetColumn() {
 | 
	
		
			
				|  |  | +      this.option = this.option;
 | 
	
		
			
				|  |  | +      const inSave = await this.delColumnData(this.getColumnName(185), this.option);
 | 
	
		
			
				|  |  | +      if (inSave) {
 | 
	
		
			
				|  |  | +        this.$message.success("重置成功");
 | 
	
		
			
				|  |  | +        this.$refs.crud.$refs.dialogColumn.columnBox = false;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    editOpen(row) {},
 | 
	
		
			
				|  |  |      outExport() {
 | 
	
		
			
				|  |  | -      // if (!this.search.billType) {
 | 
	
		
			
				|  |  | -      //   return this.$message.error("请选择类别");
 | 
	
		
			
				|  |  | -      // }
 | 
	
		
			
				|  |  | -      // window.open(
 | 
	
		
			
				|  |  | -      //   `/api/blade-purchase-sales/exportOrder/exportProfit?${
 | 
	
		
			
				|  |  | -      //     this.website.tokenHeader
 | 
	
		
			
				|  |  | -      //   }=${getToken()}&billType=${this.search.billType}`
 | 
	
		
			
				|  |  | -      // );
 | 
	
		
			
				|  |  | +      let params = { ...this.search }
 | 
	
		
			
				|  |  | +      if (params.careteTime && params.careteTime.length > 0) {
 | 
	
		
			
				|  |  | +        params = {
 | 
	
		
			
				|  |  | +          ...params,
 | 
	
		
			
				|  |  | +          beginCreateTime: params.careteTime[0] + ' 00:00:00',
 | 
	
		
			
				|  |  | +          endCreateTime: params.careteTime[1] + ' 23:59:59',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        params = {
 | 
	
		
			
				|  |  | +          ...params,
 | 
	
		
			
				|  |  | +          beginCreateTime: '',
 | 
	
		
			
				|  |  | +          endCreateTime: '',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      window.open(
 | 
	
		
			
				|  |  | +        `/api/blade-purchase-sales/exportOrder/selSalesProfitExport?${this.website.tokenHeader
 | 
	
		
			
				|  |  | +        }=${getToken()}&corpName=${this.search.corpName}&brand=${params.brand}&beginCreateTime=${params.beginCreateTime}&endCreateTime=${params.endCreateTime}&salesName=${params.salesName}&province=${params.province}`
 | 
	
		
			
				|  |  | +      );
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -    summaryMethod({ columns, data }) {
 | 
	
		
			
				|  |  | -      const sums = [];
 | 
	
		
			
				|  |  | -      // if (columns.length > 0) {
 | 
	
		
			
				|  |  | -      //   columns.forEach((item, index) => {
 | 
	
		
			
				|  |  | -      //     sums[0] = "合计";
 | 
	
		
			
				|  |  | -      //     if (item.property == "purchasePrice" || item.property == "amount") {
 | 
	
		
			
				|  |  | -      //       let amountSum = 0;
 | 
	
		
			
				|  |  | -      //       let purchaseAmountSum = 0;
 | 
	
		
			
				|  |  | -      //       data.forEach(e => {
 | 
	
		
			
				|  |  | -      //         amountSum = _.add(amountSum, Number(e.amount));
 | 
	
		
			
				|  |  | -      //         purchaseAmountSum = _.add(
 | 
	
		
			
				|  |  | -      //           purchaseAmountSum,
 | 
	
		
			
				|  |  | -      //           Number(e.purchasePrice)
 | 
	
		
			
				|  |  | -      //         );
 | 
	
		
			
				|  |  | -      //       });
 | 
	
		
			
				|  |  | -      //       //入库金额总计
 | 
	
		
			
				|  |  | -      //       if (item.property == "purchasePrice") {
 | 
	
		
			
				|  |  | -      //         sums[index] = micrometerFormat(purchaseAmountSum);
 | 
	
		
			
				|  |  | -      //       }
 | 
	
		
			
				|  |  | -      //       if (item.property == "amount") {
 | 
	
		
			
				|  |  | -      //         sums[index] = micrometerFormat(amountSum);
 | 
	
		
			
				|  |  | -      //       }
 | 
	
		
			
				|  |  | -      //     }
 | 
	
		
			
				|  |  | -      //   });
 | 
	
		
			
				|  |  | -      // }
 | 
	
		
			
				|  |  | -      return sums;
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  };
 | 
	
		
			
				|  |  |  </script>
 | 
	
	
		
			
				|  | @@ -303,9 +290,11 @@ export default {
 | 
	
		
			
				|  |  |  .page-crad ::v-deep .basic-container__card {
 | 
	
		
			
				|  |  |    height: 94.2vh;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  ::v-deep .el-table__expanded-cell[class*="cell"] {
 | 
	
		
			
				|  |  |    padding: 0px;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  .itemTable ::v-deep .el-table {
 | 
	
		
			
				|  |  |    width: 100%;
 | 
	
		
			
				|  |  |  }
 |