|  | @@ -0,0 +1,342 @@
 | 
	
		
			
				|  |  | +<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"
 | 
	
		
			
				|  |  | +        @saveColumn="saveColumn"
 | 
	
		
			
				|  |  | +        @resetColumn="resetColumn"
 | 
	
		
			
				|  |  | +        @search-criteria-switch="searchCriteriaSwitch"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +        <template slot="menuLeft">
 | 
	
		
			
				|  |  | +          <el-button type="info" size="small" @click="outExport" icon="el-icon-download">导出</el-button>
 | 
	
		
			
				|  |  | +        </template>
 | 
	
		
			
				|  |  | +        <template slot="corpNameSearch">
 | 
	
		
			
				|  |  | +          <crop-select v-model="search.corpId" corpType="KH"></crop-select>
 | 
	
		
			
				|  |  | +        </template>
 | 
	
		
			
				|  |  | +        <template slot="storageNameSearch">
 | 
	
		
			
				|  |  | +          <warehouse-select
 | 
	
		
			
				|  |  | +            v-model="search.storageId"
 | 
	
		
			
				|  |  | +            :configuration="configurationWarehouse"/>
 | 
	
		
			
				|  |  | +        </template>
 | 
	
		
			
				|  |  | +      </avue-crud>
 | 
	
		
			
				|  |  | +    </basic-container>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +import { getToken } from "@/util/auth";
 | 
	
		
			
				|  |  | +import { getList, exportExcel } from "@/api/statisticAnalysis/salesReconciliation";
 | 
	
		
			
				|  |  | +import { micrometerFormat } from "@/util/validate";
 | 
	
		
			
				|  |  | +import _ from "lodash";
 | 
	
		
			
				|  |  | +import option from "../../businessManagement/salesOrder/configuration/mainList.json";
 | 
	
		
			
				|  |  | +export default {
 | 
	
		
			
				|  |  | +  name: "index",
 | 
	
		
			
				|  |  | +  data() {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      form: {},
 | 
	
		
			
				|  |  | +      search: {},
 | 
	
		
			
				|  |  | +      dataList: [],
 | 
	
		
			
				|  |  | +      loading: false,
 | 
	
		
			
				|  |  | +      detailData: {},
 | 
	
		
			
				|  |  | +      page: {
 | 
	
		
			
				|  |  | +        pageSize: 20,
 | 
	
		
			
				|  |  | +        currentPage: 1,
 | 
	
		
			
				|  |  | +        total: 0,
 | 
	
		
			
				|  |  | +        pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      option: {
 | 
	
		
			
				|  |  | +        searchShow: true,
 | 
	
		
			
				|  |  | +        align: "center",
 | 
	
		
			
				|  |  | +        searchSpan: 8,
 | 
	
		
			
				|  |  | +        border: true,
 | 
	
		
			
				|  |  | +        index: true,
 | 
	
		
			
				|  |  | +        addBtn: false,
 | 
	
		
			
				|  |  | +        viewBtn: false,
 | 
	
		
			
				|  |  | +        editBtn: false,
 | 
	
		
			
				|  |  | +        delBtn: false,
 | 
	
		
			
				|  |  | +        showSummary: true,
 | 
	
		
			
				|  |  | +        searchIcon: true,
 | 
	
		
			
				|  |  | +        searchIndex: 2,
 | 
	
		
			
				|  |  | +        menu: false,
 | 
	
		
			
				|  |  | +        column: [
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "客户名称",
 | 
	
		
			
				|  |  | +            prop: "corpName",
 | 
	
		
			
				|  |  | +            search: true,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "制单日期",
 | 
	
		
			
				|  |  | +            prop: "businesDate",
 | 
	
		
			
				|  |  | +            search: true,
 | 
	
		
			
				|  |  | +            type: 'date',
 | 
	
		
			
				|  |  | +            format: "yyyy-MM-dd",
 | 
	
		
			
				|  |  | +            valueFormat: "yyyy-MM-dd",
 | 
	
		
			
				|  |  | +            unlinkPanels: true,
 | 
	
		
			
				|  |  | +            searchRange: true,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "商品名称",
 | 
	
		
			
				|  |  | +            prop: "goodName",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "规格",
 | 
	
		
			
				|  |  | +            prop: "typeno",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "级别",
 | 
	
		
			
				|  |  | +            prop: "level",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "花纹",
 | 
	
		
			
				|  |  | +            prop: "brandItem",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "批号",
 | 
	
		
			
				|  |  | +            prop: "lotNo",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "销售数量",
 | 
	
		
			
				|  |  | +            prop: "orderQuantity",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "单价",
 | 
	
		
			
				|  |  | +            prop: "price",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "应收金额",
 | 
	
		
			
				|  |  | +            prop: "debitAmount",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "仓库名称",
 | 
	
		
			
				|  |  | +            prop: "storageName", //storageId
 | 
	
		
			
				|  |  | +            search: true,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            label: "备注",
 | 
	
		
			
				|  |  | +            prop: "remarks",
 | 
	
		
			
				|  |  | +            search: false,
 | 
	
		
			
				|  |  | +            overHidden: true,
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +        ],
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 仓库配置
 | 
	
		
			
				|  |  | +      configurationWarehouse: {
 | 
	
		
			
				|  |  | +        multipleChoices: false,
 | 
	
		
			
				|  |  | +        multiple: false,
 | 
	
		
			
				|  |  | +        collapseTags: false,
 | 
	
		
			
				|  |  | +        placeholder: "请点击右边按钮选择",
 | 
	
		
			
				|  |  | +        dicData: [],
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  filters: {
 | 
	
		
			
				|  |  | +    decimalFormat(num) {
 | 
	
		
			
				|  |  | +      return num ? Number(num).toFixed(2) : "0.00";
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  async created() {
 | 
	
		
			
				|  |  | +    // this.option = await this.getColumnData(this.getColumnName(126), option);
 | 
	
		
			
				|  |  | +    let i = 0;
 | 
	
		
			
				|  |  | +    this.option.column.forEach(item => {
 | 
	
		
			
				|  |  | +      if (item.search) i++
 | 
	
		
			
				|  |  | +    })
 | 
	
		
			
				|  |  | +    if (i % 3 !== 0){
 | 
	
		
			
				|  |  | +      const num = 3 - Number(i % 3)
 | 
	
		
			
				|  |  | +      this.option.searchMenuSpan = num * 8;
 | 
	
		
			
				|  |  | +      this.option.searchMenuPosition = "right";
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  methods: {
 | 
	
		
			
				|  |  | +    cellStyle() {
 | 
	
		
			
				|  |  | +      return "padding:0;height:40px;";
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    searchCriteriaSwitch(type) {
 | 
	
		
			
				|  |  | +      if (type) {
 | 
	
		
			
				|  |  | +        this.option.height = this.option.height - 46;
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        this.option.height = this.option.height + 46;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      this.$refs.crud.getTableHeight();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //点击搜索按钮触发
 | 
	
		
			
				|  |  | +    searchChange(params, done) {
 | 
	
		
			
				|  |  | +      this.page.currentPage = 1;
 | 
	
		
			
				|  |  | +      this.onLoad(this.page, params);
 | 
	
		
			
				|  |  | +      done();
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    refreshChange() {
 | 
	
		
			
				|  |  | +      delete this.search.corpName;
 | 
	
		
			
				|  |  | +      delete this.search.storageName
 | 
	
		
			
				|  |  | +      this.onLoad(this.page, this.search);
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    currentChange(val) {
 | 
	
		
			
				|  |  | +      this.page.currentPage = val;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    sizeChange(val) {
 | 
	
		
			
				|  |  | +      this.page.currentPage = 1;
 | 
	
		
			
				|  |  | +      this.page.pageSize = val;
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    onLoad(page, params) {
 | 
	
		
			
				|  |  | +      this.loading = true;
 | 
	
		
			
				|  |  | +      this.dataList.forEach(item => {
 | 
	
		
			
				|  |  | +        this.$refs.crud.toggleRowExpansion(item, false);
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +      let queryParams = Object.assign({}, params);
 | 
	
		
			
				|  |  | +      if (queryParams.businesDate && queryParams.businesDate.length > 0) {
 | 
	
		
			
				|  |  | +        queryParams = {
 | 
	
		
			
				|  |  | +          ...queryParams,
 | 
	
		
			
				|  |  | +          orderStartDate: queryParams.businesDate[0] + ' 00:00:00',
 | 
	
		
			
				|  |  | +          orderEndDate: queryParams.businesDate[1] + ' 23:59:59',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        delete queryParams.businesDate;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      getList(
 | 
	
		
			
				|  |  | +        page.currentPage,
 | 
	
		
			
				|  |  | +        page.pageSize,
 | 
	
		
			
				|  |  | +        queryParams
 | 
	
		
			
				|  |  | +      )
 | 
	
		
			
				|  |  | +        .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;
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    editOpen(row) {
 | 
	
		
			
				|  |  | +      if (row.billType == "BJ") {
 | 
	
		
			
				|  |  | +        this.$router.push({
 | 
	
		
			
				|  |  | +          path: "/exportTrade/customerInquiry/index",
 | 
	
		
			
				|  |  | +          query: {
 | 
	
		
			
				|  |  | +            id: row.id
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        this.$router.push({
 | 
	
		
			
				|  |  | +          path: "/exportTrade/salesContract/index",
 | 
	
		
			
				|  |  | +          query: {
 | 
	
		
			
				|  |  | +            id: row.id
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    outExport() {
 | 
	
		
			
				|  |  | +      if (!this.search.corpId) this.$set(this.search, 'corpId', '');
 | 
	
		
			
				|  |  | +      if (!this.search.storageId) this.$set(this.search, 'storageId', '');
 | 
	
		
			
				|  |  | +      if (this.search.businesDate && this.search.businesDate.length > 0) {
 | 
	
		
			
				|  |  | +        this.search = {
 | 
	
		
			
				|  |  | +          ...this.search,
 | 
	
		
			
				|  |  | +          orderStartDate: this.search.businesDate[0] + ' 00:00:00',
 | 
	
		
			
				|  |  | +          orderEndDate: this.search.businesDate[1] + ' 23:59:59',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      } else {
 | 
	
		
			
				|  |  | +        this.search = {
 | 
	
		
			
				|  |  | +          ...this.search,
 | 
	
		
			
				|  |  | +          orderStartDate: '',
 | 
	
		
			
				|  |  | +          orderEndDate: '',
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      // return console.log(this.search)
 | 
	
		
			
				|  |  | +      this.$confirm('是否导出销售对账信息?', '提示', {
 | 
	
		
			
				|  |  | +        confirmButtonText: '确定',
 | 
	
		
			
				|  |  | +        cancelButtonText: '取消',
 | 
	
		
			
				|  |  | +        type: 'warning'
 | 
	
		
			
				|  |  | +      }).then(() => {
 | 
	
		
			
				|  |  | +        window.open(
 | 
	
		
			
				|  |  | +          `/api/blade-purchase-sales/dealerOrder/orderItemStat/export?${
 | 
	
		
			
				|  |  | +            this.website.tokenHeader
 | 
	
		
			
				|  |  | +          }=${getToken()}&corpId=${this.search.corpId}&storageId=${this.search.storageId}&orderStartDate=${this.search.orderStartDate}&orderEndDate=${this.search.orderEndDate}`
 | 
	
		
			
				|  |  | +        );
 | 
	
		
			
				|  |  | +      }).catch(() => {
 | 
	
		
			
				|  |  | +        this.$message({
 | 
	
		
			
				|  |  | +          type: 'info',
 | 
	
		
			
				|  |  | +          message: '已取消' //
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    //列保存触发
 | 
	
		
			
				|  |  | +    async saveColumn() {
 | 
	
		
			
				|  |  | +      /**
 | 
	
		
			
				|  |  | +       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
 | 
	
		
			
				|  |  | +       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
 | 
	
		
			
				|  |  | +       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
 | 
	
		
			
				|  |  | +       */
 | 
	
		
			
				|  |  | +      const inSave = await this.saveColumnData(
 | 
	
		
			
				|  |  | +        this.getColumnName(126),
 | 
	
		
			
				|  |  | +        this.option
 | 
	
		
			
				|  |  | +      );
 | 
	
		
			
				|  |  | +      if (inSave) {
 | 
	
		
			
				|  |  | +        this.$message.success("保存成功");
 | 
	
		
			
				|  |  | +        //关闭窗口
 | 
	
		
			
				|  |  | +        this.$refs.crud.$refs.dialogColumn.columnBox = false;
 | 
	
		
			
				|  |  | +        this.$nextTick(() => {
 | 
	
		
			
				|  |  | +          this.$refs.crud.doLayout()
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    async resetColumn() {
 | 
	
		
			
				|  |  | +      this.option = option;
 | 
	
		
			
				|  |  | +      const inSave = await this.delColumnData(this.getColumnName(126),option);
 | 
	
		
			
				|  |  | +      if (inSave) {
 | 
	
		
			
				|  |  | +        this.$nextTick(() => {
 | 
	
		
			
				|  |  | +          this.$refs.crud.doLayout()
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +        this.$message.success("重置成功");
 | 
	
		
			
				|  |  | +        //关闭窗口
 | 
	
		
			
				|  |  | +        this.$refs.crud.$refs.dialogColumn.columnBox = false;
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +};
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style scoped>
 | 
	
		
			
				|  |  | +.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%;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 |