Przeglądaj źródła

差价明细报表

chenrui 3 lat temu
rodzic
commit
68a4bef19a

+ 28 - 0
src/api/reportData.js

@@ -123,3 +123,31 @@ export const headRebateDetailReportCount = (params) => {
     method: 'post'
   })
 }
+//  差价明细报表
+export const reportRebateReportList = (params) => {
+  const url = `/report/reportRebate/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  差价明细报表  合计
+export const reportRebateCount = (params) => {
+  return axios({
+    url: '/report/reportRebate/queryCount',
+    data: params,
+    method: 'post'
+  })
+}
+//  差价明细报表 导出
+export const reportRebateExport = (params) => {
+  return axios({
+    url: '/report/reportRebate/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 327 - 0
src/views/reportData/hPriceDifferenceDetailReport/list.vue

@@ -0,0 +1,327 @@
+<template>
+  <a-card size="small" :bordered="false" class="hPriceDifferenceDetailList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="hPriceDifferenceDetailList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="单号">
+                <a-input id="hPriceDifferenceDetailList-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入单号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <custList id="hPriceDifferenceDetailList-custList" ref="custList" @change="custChange"></custList>
+              </a-form-model-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="7" :sm="24">
+                <a-form-model-item label="客户级别">
+                  <v-select
+                    v-model="queryParam.dealer.dealerLevel"
+                    ref="dealerLevel"
+                    id="hPriceDifferenceDetailList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择客户级别"
+                    allowClear></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="品牌分类">
+                  <v-select code="BRAND_TYPE" id="hPriceDifferenceDetailList-brandType" v-model="queryParam.product.brandType" allowClear placeholder="请选择品牌分类"></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品品牌">
+                  <ProductBrand id="hPriceDifferenceDetailList-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="产品分类">
+                  <ProductType id="hPriceDifferenceDetailList-productType" v-model="productType" @change="changeProductType"></ProductType>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <subarea id="hPriceDifferenceDetailList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="省级区域">
+                  <a-select id="hPriceDifferenceDetailList-provinceSn" allowClear v-model="queryParam.dealer.provinceSn" placeholder="请选择省">
+                    <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="类型" prop="bizType">
+                  <a-select id="hPriceDifferenceDetailList-bizType" allowClear v-model="queryParam.bizType" placeholder="请选择类型">
+                    <a-select-option v-for="item in bizTypeList" :value="item.value" :key="item.value">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+            </template>
+            <a-col :md="7" :sm="24" style="margin-bottom: 10px;">
+              <a-button
+                type="primary"
+                class="button-warning"
+                size="small"
+                @click="handleStock"
+                id="hPriceDifferenceDetailList-stockDate">盘点区间日期</a-button>
+              <a-button style="margin-left: 5px" type="primary" @click="handleSearch" :disabled="disabled" id="hPriceDifferenceDetailList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="hPriceDifferenceDetailList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 2800 }"
+        bordered>
+        <template slot="footer">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              分公司金额:{{ (totalData && (totalData.wholesalePrice1 || totalData.wholesalePrice1==0)) ? totalData.wholesalePrice1 : '--' }}
+            </a-col>
+            <a-col :md="6" :sm="24">
+              加盟商金额:{{ (totalData && (totalData.wholesalePrice2 || totalData.wholesalePrice2==0)) ? totalData.wholesalePrice2 : '--' }}
+            </a-col>
+            <a-col :md="6" :sm="24">
+              特约加盟店金额:{{ (totalData && (totalData.wholesalePrice3 || totalData.wholesalePrice3==0)) ? totalData.wholesalePrice3 : '--' }}
+            </a-col>
+            <a-col :md="6" :sm="24">
+              直接差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? totalData.directRebateAmount : '--' }}
+            </a-col>
+            <a-col :md="6" :sm="24">
+              间接差价金额:{{ (totalData && (totalData.indirectRebateAmount || totalData.indirectRebateAmount==0)) ? totalData.indirectRebateAmount : '--' }}
+            </a-col>
+          </a-row>
+        </template>
+      </s-table>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import getDate from '@/libs/getDate.js'
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import custList from '@/views/common/custList.vue'
+import subarea from '@/views/common/subarea.js'
+import { getArea } from '@/api/data'
+import ProductBrand from '@/views/common/productBrand.js'
+import ProductType from '@/views/common/productType.js'
+import { headRebateDetailReportList, headRebateDetailReportCount } from '@/api/reportData'
+export default {
+  components: { STable, VSelect, custList, subarea, rangeDate, ProductBrand, ProductType },
+  data () {
+    return {
+      spinning: false,
+      advanced: false, // 高级搜索 展开/关闭
+      queryParam: { //  查询条件
+        time: [
+          getDate.getCurrMonthDays().starttime,
+          getDate.getCurrMonthDays().endtime
+        ],
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        bizNo: '',
+        dealer: {
+          dealerSn: undefined,
+          dealerLevel: undefined,
+          subareaSn: undefined, //  区域
+          provinceSn: undefined
+        },
+        product: {
+          brandType: undefined,
+          productBrandSn: undefined, //  产品品牌
+          productTypeSn1: '', //  产品一级分类
+          productTypeSn2: '', //  产品二级分类
+          productTypeSn3: '' //  产品三级分类
+        },
+        bizType: undefined
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      addrProvinceList: [], //  省下拉
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
+        { title: '订单号', dataIndex: 'bizNo', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '日期', dataIndex: 'bizCreateDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户名称', dataIndex: 'dealer.dealerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌', dataIndex: 'productBrandName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '二级分类', dataIndex: 'productTypeName2', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '分公司金额', dataIndex: 'wholesalePrice1', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '加盟商金额', dataIndex: 'wholesalePrice2', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '特约加盟店金额', dataIndex: 'wholesalePrice3', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '直接差价', dataIndex: 'directRebateAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '类型', dataIndex: 'bizTypeValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        const params = Object.assign(parameter, this.queryParam)
+        delete params.time
+        this.spinning = true
+        return headRebateDetailReportList(params).then(res => {
+          // 总计
+          this.getCount(params)
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+            if (data.list[i].bizType) {
+              data.list[i].bizTypeValue = data.list[i].bizType == 'SALES' ? '采购差价' : data.list[i].bizType == 'SALES_RETURN' ? '退货差价' : ''
+            }
+          }
+          this.disabled = false
+          this.spinning = false
+          return data
+        })
+      },
+      productType: [],
+      bizTypeList: [
+        { value: 'SALES', name: '采购差价' },
+        { value: 'SALES_RETURN', name: '退货差价' }
+      ],
+      totalData: null
+    }
+  },
+  methods: {
+    // 盘点库存日期
+    handleStock () {
+      this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
+    },
+    //  创建时间  change
+    dateChange (date) {
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    // 合计
+    getCount (params) {
+      headRebateDetailReportCount(params).then(res => {
+        if (res.status == 200) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  查询
+    handleSearch () {
+      const _this = this
+      // this.$refs.ruleForm.validate(valid => {
+      //   if (valid) {
+      _this.$refs.table.refresh(true)
+      //   } else {
+      //     console.log('error submit!!')
+      //     return false
+      //   }
+      // })
+    },
+    custChange (val) {
+      this.queryParam.dealer.dealerSn = val.key
+    },
+    //  产品分类  change
+    changeProductType (val, opt) {
+      this.queryParam.product.productTypeSn1 = val[0] ? val[0] : ''
+      this.queryParam.product.productTypeSn2 = val[1] ? val[1] : ''
+      this.queryParam.product.productTypeSn3 = val[2] ? val[2] : ''
+    },
+    //  省/市/区
+    getArea (leve, sn) {
+      let params
+      if (leve == 'province') {
+        params = { type: '2' }
+      } else {
+        params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
+      }
+      getArea(params).then(res => {
+        if (res.status == 200) {
+          if (leve == 'province') {
+            this.addrProvinceList = res.data || []
+          } else if (leve == 'city') {
+            this.addrCityList = res.data || []
+          } else if (leve == 'district') {
+            this.addrDistrictList = res.data || []
+          }
+        } else {
+          if (leve == 'province') {
+            this.addrProvinceList = []
+          } else if (leve == 'city') {
+            this.addrCityList = []
+          } else if (leve == 'district') {
+            this.addrDistrictList = []
+          }
+        }
+      })
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.time = [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ]
+      this.$refs.rangeDate.resetDate(this.queryParam.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.bizNo = ''
+      this.queryParam.dealer.dealerSn = undefined
+      this.queryParam.dealer.dealerLevel = undefined
+      this.queryParam.dealer.subareaSn = undefined
+      this.queryParam.dealer.provinceSn = undefined
+      this.queryParam.product.brandType = ''
+      this.queryParam.product.productBrandSn = ''
+      this.queryParam.product.productTypeSn1 = ''
+      this.queryParam.product.productTypeSn2 = ''
+      this.queryParam.product.productTypeSn3 = ''
+      this.queryParam.bizType = undefined
+      this.productType = []
+      this.totalData = null
+      if (this.advanced) {
+        this.$refs.custList.resetForm()
+      }
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.getArea('province')
+    })
+  }
+}
+</script>

+ 81 - 121
src/views/reportData/priceDifferenceDetailReport/list.vue

@@ -13,76 +13,40 @@
           @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="日期" prop="time">
-                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              <a-form-model-item label="日期" prop="month">
+                <a-date-picker v-model="queryParam.month" format="YYYY-MM" @change="onChange" />
               </a-form-model-item>
             </a-col>
             <a-col :md="5" :sm="24">
-              <a-form-model-item label="单号">
-                <a-input id="priceDifferenceDetailList-bizNo" v-model.trim="queryParam.bizNo" allowClear placeholder="请输入单号"/>
+              <a-form-model-item label="省份" prop="provinceSn">
+                <a-select v-model="queryParam.provinceSn" allowClear placeholder="请选择省">
+                  <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                </a-select>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-model-item label="客户名称">
-                <custList id="priceDifferenceDetailList-custList" ref="custList" @change="custChange"></custList>
+              <a-form-model-item label="记账门店">
+                <custList id="priceDifferenceDetailList-rebateDealer" ref="rebateDealerList" @change="rebateDealerChange"></custList>
               </a-form-model-item>
             </a-col>
             <template v-if="advanced">
-              <a-col :md="7" :sm="24">
-                <a-form-model-item label="客户级别">
-                  <v-select
-                    v-model="queryParam.dealer.dealerLevel"
-                    ref="dealerLevel"
-                    id="priceDifferenceDetailList-dealerLevel"
-                    code="DEALER_LEVEL"
-                    placeholder="请选择客户级别"
-                    allowClear></v-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="品牌分类">
-                  <v-select code="BRAND_TYPE" id="priceDifferenceDetailList-brandType" v-model="queryParam.product.brandType" allowClear placeholder="请选择品牌分类"></v-select>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="产品品牌">
-                  <ProductBrand id="priceDifferenceDetailList-productBrandSn" v-model="queryParam.product.productBrandSn"></ProductBrand>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="产品分类">
-                  <ProductType id="priceDifferenceDetailList-productType" v-model="productType" @change="changeProductType"></ProductType>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="所在区域">
-                  <subarea id="priceDifferenceDetailList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
-                </a-form-model-item>
-              </a-col>
-              <a-col :md="6" :sm="24">
-                <a-form-model-item label="省级区域">
-                  <a-select id="priceDifferenceDetailList-provinceSn" allowClear v-model="queryParam.dealer.provinceSn" placeholder="请选择省">
-                    <a-select-option v-for="item in addrProvinceList" :value="item.areaSn" :key="item.areaSn + 'a'">{{ item.name }}</a-select-option>
-                  </a-select>
-                </a-form-model-item>
-              </a-col>
               <a-col :md="6" :sm="24">
-                <a-form-model-item label="类型" prop="bizType">
-                  <a-select id="priceDifferenceDetailList-bizType" allowClear v-model="queryParam.bizType" placeholder="请选择类型">
-                    <a-select-option v-for="item in bizTypeList" :value="item.value" :key="item.value">{{ item.name }}</a-select-option>
-                  </a-select>
+                <a-form-model-item label="客户名称">
+                  <custList id="priceDifferenceDetailList-custList" ref="custList" @change="custChange"></custList>
                 </a-form-model-item>
               </a-col>
             </template>
             <a-col :md="7" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="priceDifferenceDetailList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="priceDifferenceDetailList-reset">重置</a-button>
               <a-button
+                style="margin-left: 5px"
                 type="primary"
                 class="button-warning"
-                size="small"
-                @click="handleStock"
-                id="priceDifferenceDetailList-stockDate">盘点区间日期</a-button>
-              <a-button style="margin-left: 5px" type="primary" @click="handleSearch" :disabled="disabled" id="priceDifferenceDetailList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="priceDifferenceDetailList-reset">重置</a-button>
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                id="allocationDetailsList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}
                 <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -104,19 +68,13 @@
         <template slot="footer">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              分公司金额:{{ (totalData && (totalData.wholesalePrice1 || totalData.wholesalePrice1==0)) ? totalData.wholesalePrice1 : '--' }}
-            </a-col>
-            <a-col :md="6" :sm="24">
-              加盟商金额:{{ (totalData && (totalData.wholesalePrice2 || totalData.wholesalePrice2==0)) ? totalData.wholesalePrice2 : '--' }}
-            </a-col>
-            <a-col :md="6" :sm="24">
-              特约加盟店金额:{{ (totalData && (totalData.wholesalePrice3 || totalData.wholesalePrice3==0)) ? totalData.wholesalePrice3 : '--' }}
+              实售金额:{{ (totalData && (totalData.wholesalePrice1 || totalData.wholesalePrice1==0)) ? totalData.wholesalePrice1 : '--' }}
             </a-col>
             <a-col :md="6" :sm="24">
-              直接差价金额:{{ (totalData && (totalData.directRebateAmount || totalData.directRebateAmount==0)) ? totalData.directRebateAmount : '--' }}
+              开单金额:{{ (totalData && (totalData.wholesalePrice2 || totalData.wholesalePrice2==0)) ? totalData.wholesalePrice2 : '--' }}
             </a-col>
             <a-col :md="6" :sm="24">
-              间接差价金额:{{ (totalData && (totalData.indirectRebateAmount || totalData.indirectRebateAmount==0)) ? totalData.indirectRebateAmount : '--' }}
+              直接差额:{{ (totalData && (totalData.wholesalePrice3 || totalData.wholesalePrice3==0)) ? totalData.wholesalePrice3 : '--' }}
             </a-col>
           </a-row>
         </template>
@@ -126,68 +84,42 @@
 </template>
 
 <script>
+import moment from 'moment'
 import getDate from '@/libs/getDate.js'
 import { STable, VSelect } from '@/components'
-import rangeDate from '@/views/common/rangeDate.vue'
 import custList from '@/views/common/custList.vue'
-import subarea from '@/views/common/subarea.js'
 import { getArea } from '@/api/data'
-import ProductBrand from '@/views/common/productBrand.js'
-import ProductType from '@/views/common/productType.js'
-import { headRebateDetailReportList, headRebateDetailReportCount } from '@/api/reportData'
+import { reportRebateReportList, reportRebateCount, reportRebateExport } from '@/api/reportData'
 export default {
-  components: { STable, VSelect, custList, subarea, rangeDate, ProductBrand, ProductType },
+  components: { STable, VSelect, custList },
   data () {
     return {
       spinning: false,
       advanced: false, // 高级搜索 展开/关闭
+      exportLoading: false,
       queryParam: { //  查询条件
-        time: [
-          getDate.getCurrMonthDays().starttime,
-          getDate.getCurrMonthDays().endtime
-        ],
-        beginDate: getDate.getCurrMonthDays().starttime,
-        endDate: getDate.getCurrMonthDays().endtime,
-        bizNo: '',
-        dealer: {
-          dealerSn: undefined,
-          dealerLevel: undefined,
-          subareaSn: undefined, //  区域
-          provinceSn: undefined
-        },
-        product: {
-          brandType: undefined,
-          productBrandSn: undefined, //  产品品牌
-          productTypeSn1: '', //  产品一级分类
-          productTypeSn2: '', //  产品二级分类
-          productTypeSn3: '' //  产品三级分类
-        },
-        bizType: undefined
+        month: undefined,
+        provinceSn: undefined,
+        rebateDealerSn: undefined,
+        dealerSn: undefined
       },
       rules: {
-        'time': [{ required: true, message: '请选择日期', trigger: 'change' }]
+        'month': [{ required: true, message: '请选择月份', trigger: 'change' }],
+        'provinceSn': [{ required: true, message: '请选择省份', trigger: 'change' }]
       },
       disabled: false, //  查询、重置按钮是否可操作
       addrProvinceList: [], //  省下拉
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
-        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
-        { title: '订单号', dataIndex: 'bizNo', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '日期', dataIndex: 'bizCreateDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户名称', dataIndex: 'dealer.dealerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '品牌', dataIndex: 'productBrandName', width: 200, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '二级分类', dataIndex: 'productTypeName2', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '数量', dataIndex: 'qty', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '分公司金额', dataIndex: 'wholesalePrice1', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '加盟商金额', dataIndex: 'wholesalePrice2', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '特约加盟店金额', dataIndex: 'wholesalePrice3', width: 120, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '直接差价', dataIndex: 'directRebateAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 100, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '类型', dataIndex: 'bizTypeValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '序号', dataIndex: 'no', width: 70, align: 'center', fixed: 'left' },
+        { title: '月份', dataIndex: 'dealer.subareaNameSet', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省份', dataIndex: 'bizNo', width: 80, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '记账门店', dataIndex: 'bizCreateDate', width: 180, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'dealer.provinceName', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '产品品牌+二级分类', dataIndex: 'directDealerName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '实售金额', dataIndex: 'qty', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '开单金额', dataIndex: 'wholesalePrice1', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '直接差额', dataIndex: 'wholesalePrice2', width: 80, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '类型', dataIndex: 'bizTypeValue', width: 80, align: 'center', customRender: function (text) { return text || '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
@@ -195,34 +127,26 @@ export default {
         const params = Object.assign(parameter, this.queryParam)
         delete params.time
         this.spinning = true
-        return headRebateDetailReportList(params).then(res => {
+        return reportRebateReportList(params).then(res => {
           // 总计
           this.getCount(params)
           const data = res.data
           const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
             data.list[i].no = no + i + 1
-            if (data.list[i].bizType) {
-              data.list[i].bizTypeValue = data.list[i].bizType == 'SALES' ? '采购差价' : data.list[i].bizType == 'SALES_RETURN' ? '退货差价' : ''
-            }
           }
           this.disabled = false
           this.spinning = false
           return data
         })
       },
-      productType: [],
-      bizTypeList: [
-        { value: 'SALES', name: '采购差价' },
-        { value: 'SALES_RETURN', name: '退货差价' }
-      ],
       totalData: null
     }
   },
   methods: {
-    // 盘点库存日期
-    handleStock () {
-      this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
+    // 月份  change
+    onChange (date, dateString) {
+      console.log(date, dateString)
     },
     //  创建时间  change
     dateChange (date) {
@@ -232,7 +156,7 @@ export default {
     },
     // 合计
     getCount (params) {
-      headRebateDetailReportCount(params).then(res => {
+      reportRebateCount(params).then(res => {
         if (res.status == 200) {
           this.totalData = res.data
         } else {
@@ -316,6 +240,42 @@ export default {
       }
       this.$refs.ruleForm.resetFields()
       this.$refs.table.clearTable()
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = this.queryParam
+      this.exportLoading = true
+      _this.spinning = true
+      reportRebateExport(params).then(res => {
+        this.exportLoading = false
+        _this.spinning = false
+        if (res.type == 'application/json') {
+          var reader = new FileReader()
+          reader.addEventListener('loadend', function () {
+            const obj = JSON.parse(reader.result)
+            _this.$notification.error({
+              message: '提示',
+              description: obj.message
+            })
+          })
+          reader.readAsText(res)
+        } else {
+          this.download(res)
+        }
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '差价明细报表' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
     }
   },
   beforeRouteEnter (to, from, next) {