chenrui %!s(int64=2) %!d(string=hai) anos
pai
achega
0d89ed68e9

+ 82 - 0
src/api/reportData.js

@@ -45,6 +45,7 @@ export const salesReportReturnCount = (params) => {
     method: 'post'
   })
 }
+
 //  实售退货报表
 export const salesReportReturnRebateList = (params) => {
   const url = `/report/salesReturnBillReport/returnRebateQueryPage/${params.pageNo}/${params.pageSize}`
@@ -694,3 +695,84 @@ export const rebateDetailQueryCount = (params) => {
     method: 'post'
   })
 }
+
+/*
+** 开单采退报表
+*/
+
+// 开单采退报表 列表
+export const querySupplierPage = (params) => {
+  const url = `/report/sparePartsReturn/querySupplierPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 开单采退报表 合计
+export const querySupplierCount = (params) => {
+  const url = `/report/sparePartsReturn/querySupplierCount`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 开单采退报表 标题
+export const querySupplierTitle = (params) => {
+  const url = `/report/sparePartsReturn/querySupplierTitle`
+  return axios({
+    url: url,
+    data: params,
+    method: 'get'
+  })
+}
+// 开单采退报表 导出
+export const supplierExport = (params) => {
+  return axios({
+    url: '/report/sparePartsReturn/supplierExport',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
+// 开单采退dan报表 列表
+export const queryBillNoPage = (params) => {
+  const url = `/report/sparePartsReturn/queryBillNoPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 开单采退dan报表 合计
+export const queryBillNoCount = (params) => {
+  const url = `/report/sparePartsReturn/queryBillNoCount`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 开单采退dan报表 标题
+export const queryBillNoTitle = (params) => {
+  const url = `/report/sparePartsReturn/queryBillNoTitle`
+  return axios({
+    url: url,
+    data: params,
+    method: 'get'
+  })
+}
+// 开单采退dan报表 导出
+export const billNoExport = (params) => {
+  return axios({
+    url: '/report/sparePartsReturn/BillNoExport',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 75 - 123
src/views/reportData/billingBackReport/list.vue

@@ -16,9 +16,9 @@
                 <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange"/>
               </a-form-model-item>
             </a-col>
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-model-item label="供应商名称">
-                <a-input id="billingBackReport-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
+                <supplier id="billingBackReport-supplierName" v-model="queryParam.supplier.supplierSn" @change="getSupplierName" placeholder="请输入供应商名称"></supplier>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -27,10 +27,10 @@
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-                <a-form-model-item label="地区">
-                    <AreaList id="returnSlipReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
-                </a-form-model-item>
-              </a-col>
+              <a-form-model-item label="地区">
+                <AreaList id="billingBackReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
+              </a-form-model-item>
+            </a-col>
             <a-col :md="24" :sm="24" style="margin-bottom: 10px;display:flex;algin-item:center;justify-content: center;">
               <a-button type="primary" @click="handleSearch" :disabled="disabled" id="billingBackReportList-refresh">查询</a-button>
               <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="billingBackReportList-reset">重置</a-button>
@@ -64,42 +64,9 @@
             <a-col span="2">合计:</a-col>
             <a-col span="22">
               <a-row>
-                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌变速箱滤清器:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">滤清器合计:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨燕雨刮片:{{ (totalData && (totalData.jpAmount || totalData.jpAmount==0)) ? toThousands(totalData.jpAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">雨刮片合计:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
-                <a-col span="4">TBU+箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车片:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车油:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">刹车片合计:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">TBU-P刹车盘:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
-                <a-col span="4">汇箭蓄电池:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
-                <a-col span="4">布瑞斯蓄电池:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯机油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯变速箱油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯刹车油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯合计:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">稳升点火线圈:{{ (totalData && (totalData.wsDhxqAmount || totalData.wsDhxqAmount==0)) ? toThousands(totalData.wsDhxqAmount) : '--' }}</a-col>
-                <a-col span="4">稳升LED灯:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
-                <a-col span="4">稳升合计:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
-                <a-col span="4">NGK火花塞:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
-                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
-                <a-col span="4">车仆防冻液:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
-                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
-                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
-                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
-                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
-                <a-col span="4" style="margin-top:20px;">品牌合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
-                <a-col span="4" style="margin-top:20px;">代理品牌合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
-                <a-col span="4" style="margin-top:20px;">开单采退金额合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
-
+                <a-col span="4" v-for="item in countLabel" :key="item.key">
+                  {{ item.title }}:{{ totalData?(totalData[item.dataIndex] ||totalData[item.dataIndex]==0)?toThousands(totalData[item.dataIndex]):'--':'--' }}
+                </a-col>
               </a-row>
             </a-col>
           </a-row>
@@ -119,109 +86,76 @@ import AreaList from '@/views/common/areaList.js'
 import subarea from '@/views/common/subarea.js'
 import { hdExportExcel } from '@/libs/exportExcel'
 import reportModal from '@/views/common/reportModal.vue'
-import { realReportSalesByProvince, realReportSalesByProvinceExport, realReportSalesBySubArea, realReportSalesBySubAreaExport } from '@/api/reportData.js'
+import supplier from '@/views/common/supplier.js'
+import { querySupplierPage, querySupplierCount, querySupplierTitle, supplierExport } from '@/api/reportData.js'
 export default {
   name: 'RegionTypeSalesReportList',
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate, subarea, reportModal, AreaList },
+  components: { STable, VSelect, rangeDate, subarea, reportModal, AreaList, supplier },
   data () {
     return {
       spinning: false,
-      activeKey: 0,
       showExport: false,
       queryParam: {
         time: [],
         beginDate: '',
         endDate: '',
-        supplierName: '',
-        dealerSn: undefined,
-        provinceSn: undefined,
-        citySn: undefined,
-        districtSn: undefined,
-        dealerLevel: undefined,
         subareaSn: undefined,
+        supplier: {
+          supplierSn: undefined,
+          supplierName: undefined,
+          provinceSn: undefined,
+          citySn: undefined,
+          districtSn: undefined
+        }
       },
+      countLabel: [],
+      columns: [],
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false,
       totalData: null,
       rules: {
-        'time': [{ required: true, message: '请选择退货完成时间', trigger: 'change' }],
+        'time': [{ required: true, message: '请选择退货完成时间', trigger: 'change' }]
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        const paramsPage = Object.assign(this.queryParam) //  无分页
-        const jkUrl = this.activeKey == 0 ? realReportSalesByProvince : realReportSalesBySubArea
-        return jkUrl(paramsPage).then(res => {
+        const params = Object.assign(parameter, this.queryParam) //  无分页
+        delete params.time
+        return querySupplierPage(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
+            this.getCount(params)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
           }
-          this.disabled = false
           this.spinning = false
           return data
         })
       }
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '分区', dataIndex: 'subareaNames1', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '供应商名称', dataIndex: 'subareaNames2', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '箭牌滤清器', dataIndex: 'jpLqqAmount', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌变速箱滤清器', dataIndex: 'jpLqqAmount1', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌滤清器', dataIndex: 'gpLqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '滤清器合计', dataIndex: 'lqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌雨刮片', dataIndex: 'jpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌雨燕雨刮片', dataIndex: 'jpYgpAmount1', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌雨刮片', dataIndex: 'gpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '雨刮片合计', dataIndex: 'ygpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌喇叭', dataIndex: 'jpLbAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌刹车片', dataIndex: 'jpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU+箭牌感应线', dataIndex: 'jpGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌刹车片', dataIndex: 'gpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU刹车片', dataIndex: 'tbuScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU刹车油', dataIndex: 'tbuScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '刹车片合计', dataIndex: 'scpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU-P刹车盘', dataIndex: 'tbupAmount', align: 'right', width: 50, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '汇箭蓄电池', dataIndex: 'hjAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '布瑞斯蓄电池', dataIndex: 'brsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯机油', dataIndex: 'dlsJyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯变速箱油', dataIndex: 'dlsBsxyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯刹车油', dataIndex: 'dlsScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-
-        // { title: '德路斯汽车养护产品', dataIndex: 'dlsQcyhAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯合计', dataIndex: 'dlsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升点火线圈', dataIndex: 'wsDhxqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升LED灯', dataIndex: 'wsDpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升合计', dataIndex: 'wsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
 
-        // { title: 'TBU感应线', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '品牌合计', dataIndex: 'ppAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'NGK火花塞', dataIndex: 'ngkAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '飞利浦', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '车仆防冻液', dataIndex: 'tbuGyxAmount1', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '瓦尔塔', dataIndex: 'tbuGyxAmount2', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '雷贝斯托', dataIndex: 'tbuGyxAmount3', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德尔福', dataIndex: 'tbuGyxAmount4', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '巴诺德', dataIndex: 'tbuGyxAmount5', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '代理品牌合计', dataIndex: 'ppAndNgkAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '开单采退金额合计', dataIndex: 'tbuGyxAmount6', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
-      ]
-      // if (this.activeKey == 0) {
-      //   arr.splice(1, 0, { title: '省份', dataIndex: 'dealerProvinceName', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      // }
-      return arr
-    }
-  },
   methods: {
-    callback (key) {
-      this.activeKey = key
-      this.resetSearchForm()
+    // 总计
+    getCount (params) {
+      querySupplierCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    // 选择供应商
+    getSupplierName (val, item) {
+      this.queryParam.supplier.supplierName = item.supplierName
+      this.queryParam.supplier.supplierSn = val
     },
     //  创建时间  change
     dateChange (date) {
@@ -240,7 +174,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error("请选择退货完成时间")
+          _this.$message.error('请选择退货完成时间')
           return false
         }
       })
@@ -252,15 +186,16 @@ export default {
       this.$refs.rangeDate.resetDate(this.queryParam.time)
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.queryParam.supplierName = ''
-      this.queryParam.provinceSn = undefined
-      this.queryParam.citySn = undefined
-      this.queryParam.districtSn = undefined
+      this.queryParam.supplier.supplierName = undefined
+      this.queryParam.supplier.supplierSn = undefined
+      this.queryParam.supplier.provinceSn = undefined
+      this.queryParam.supplier.citySn = undefined
+      this.queryParam.supplier.districtSn = undefined
       this.queryParam.subareaSn = undefined
       this.$refs.areaList.clearData()
       this.$refs.table.clearTable()
     },
-    areaChange(val){
+    areaChange (val) {
       this.queryParam.provinceSn = val[0] ? val[0] : ''
       this.queryParam.citySn = val[1] ? val[1] : ''
       this.queryParam.districtSn = val[2] ? val[2] : ''
@@ -268,28 +203,45 @@ export default {
     //  导出
     handleExport () {
       const _this = this
-      const jkUrl = _this.activeKey == 0 ? realReportSalesByProvinceExport : realReportSalesBySubAreaExport
-      const excelTitle = _this.activeKey == 0 ? '各省品类实售明细报表' : '各区品类实售明细报表'
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const params = _this.queryParam
-          _this.$store.state.app.curActionPermission = 'B_regionTypeSalesReportExport'
+          _this.$store.state.app.curActionPermission = 'B_billingReturn_Report'
           _this.showExport = true
           _this.exportLoading = true
           _this.spinning = true
-          hdExportExcel(jkUrl, params, excelTitle, function () {
+          hdExportExcel(supplierExport, params, '开单采退', function () {
             _this.exportLoading = false
             _this.spinning = false
             _this.$store.state.app.curActionPermission = ''
           })
         } else {
+          _this.$message.error('请选择退货完成时间')
           return false
         }
       })
     },
-    pageInit () {
-      this.activeKey = 0
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await querySupplierTitle().then(res => res.data)
+      this.columns = tableTitle.list
+      this.countLabel = tableTitle.count
+      this.columns.map(item => {
+        let mw = 40
+        if (item.customRender == 'amount') {
+          mw = 15
+          item.customRender = function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
+        }
+        const w = item.title.length * mw
+        const tw = w <= 80 && item.customRender != 'amount' ? w * 2 : (w >= 360 ? 200 : w)
+        item.width = tw + 'px'
+        this.tableWidth = this.tableWidth + tw
+      })
       this.resetSearchForm()
+    },
+    pageInit () {
+      this.getTableTitle()
     }
   },
   mounted () {

+ 92 - 143
src/views/reportData/billingOrderReport/list.vue

@@ -3,7 +3,7 @@
     <a-spin :spinning="spinning" tip="Loading...">
       <div class="table-page-search-wrapper newTableSearchName">
         <a-form-model
-          id="billingBackReportList-form"
+          id="billingOrderReport-form"
           ref="ruleForm"
           class="form-model-con"
           layout="inline"
@@ -11,34 +11,34 @@
           :model="queryParam"
           @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
-            <a-col :md="6" :sm="24">
+            <a-col :md="5" :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="4" :sm="24">
+            <a-col :md="5" :sm="24">
               <a-form-model-item label="供应商名称">
-                <a-input id="billingBackReport-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
+                <supplier id="billingBackReport-supplierName" v-model="queryParam.supplier.supplierSn" @change="getSupplierName" placeholder="请输入供应商名称"></supplier>
               </a-form-model-item>
             </a-col>
             <a-col :md="4" :sm="24">
               <a-form-model-item label="采购退货单号" >
-                <a-input id="billingBackReport-supplierName" v-model.trim="queryParam.supplierName" allowClear placeholder="请输入供应商名称"/>
+                <a-input id="billingBackReport-sparePartsReturnNo" v-model.trim="queryParam.sparePartsReturnNo" allowClear placeholder="请输入采购退货单号"/>
               </a-form-model-item>
             </a-col>
-            <a-col :md="4" :sm="24">
+            <a-col :md="5" :sm="24">
               <a-form-model-item label="所在区域/分区">
-                <subarea id="billingBackReportList-subareaSn" v-model="queryParam.subareaSn"></subarea>
+                <subarea id="billingOrderReport-subareaSn" v-model="queryParam.subareaSn"></subarea>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="地区">
+                <AreaList id="returnSlipReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
               </a-form-model-item>
             </a-col>
-            <a-col :md="4" :sm="24">
-                <a-form-model-item label="地区">
-                    <AreaList id="returnSlipReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
-                </a-form-model-item>
-              </a-col>
             <a-col :md="24" :sm="24" style="margin-bottom: 10px;display:flex;algin-item:center;justify-content: center;">
-              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="billingBackReportList-refresh">查询</a-button>
-              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="billingBackReportList-reset">重置</a-button>
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="billingOrderReport-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="billingOrderReport-reset">重置</a-button>
               <a-button
                 style="margin-left: 5px"
                 type="primary"
@@ -47,7 +47,7 @@
                 :disabled="disabled"
                 :loading="exportLoading"
                 v-if="$hasPermissions('B_regionTypeSalesReportExport')"
-                id="billingBackReportList-export">导出</a-button>
+                id="billingOrderReport-export">导出</a-button>
             </a-col>
           </a-row>
         </a-form-model>
@@ -69,41 +69,9 @@
             <a-col span="2">合计:</a-col>
             <a-col span="22">
               <a-row>
-                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌变速箱滤清器:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">滤清器合计:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌雨燕雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">雨刮片合计:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
-                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
-                <a-col span="4">TBU+箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
-                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车片:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">TBU刹车油:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">刹车片合计:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
-                <a-col span="4">TBU-P刹车盘:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
-                <a-col span="4">汇箭蓄电池:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
-                <a-col span="4">布瑞斯蓄电池:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯机油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯变速箱油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯刹车油:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">德路斯合计:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
-                <a-col span="4">稳升点火线圈:{{ (totalData && (totalData.wsDhxqAmount || totalData.wsDhxqAmount==0)) ? toThousands(totalData.wsDhxqAmount) : '--' }}</a-col>
-                <a-col span="4">稳升LED灯:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
-                <a-col span="4">稳升合计:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
-                <a-col span="4">NGK火花塞:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
-                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
-                <a-col span="4">车仆防冻液:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
-                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
-                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
-                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
-                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
-                <a-col span="4" style="margin-top:20px;">品牌合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
-                <a-col span="4" style="margin-top:20px;">代理品牌合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
-                <a-col span="4" style="margin-top:20px;">开单采退金额合计:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
+                <a-col span="4" v-for="item in countLabel" :key="item.key">
+                  {{ item.title }}:{{ totalData?(totalData[item.dataIndex]||totalData[item.dataIndex]==0)?toThousands(totalData[item.dataIndex]):'--':'--' }}
+                </a-col>
               </a-row>
             </a-col>
           </a-row>
@@ -123,113 +91,78 @@ import AreaList from '@/views/common/areaList.js'
 import subarea from '@/views/common/subarea.js'
 import { hdExportExcel } from '@/libs/exportExcel'
 import reportModal from '@/views/common/reportModal.vue'
-import { realReportSalesByProvince, realReportSalesByProvinceExport, realReportSalesBySubArea, realReportSalesBySubAreaExport } from '@/api/reportData.js'
+import supplier from '@/views/common/supplier.js'
+import { queryBillNoPage, queryBillNoCount, queryBillNoTitle, billNoExport } from '@/api/reportData.js'
 export default {
   name: 'BillingOrderReportList',
   mixins: [commonMixin],
-  components: { STable, VSelect, rangeDate, subarea, reportModal,AreaList },
+  components: { STable, VSelect, rangeDate, subarea, reportModal, AreaList, supplier },
   data () {
     return {
       spinning: false,
-      activeKey: 0,
-      showExport: false,
+      showExport: false, // 导出弹窗
       queryParam: {
         time: [],
         beginDate: '',
         endDate: '',
-        dealer: {
-          'dealerSn': undefined,
-          'provinceSn': undefined,
-          'citySn': undefined,
-          'districtSn': undefined,
-          'subareaSn': undefined,
-          'dealerLevel': undefined
-        },
         subareaSn: undefined,
+        sparePartsReturnNo: undefined,
+        supplier: {
+          supplierSn: undefined,
+          supplierName: undefined,
+          provinceSn: undefined,
+          citySn: undefined,
+          districtSn: undefined
+        }
       },
+      countLabel: [],
+      columns: [],
+      totalData: null,
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false,
       rules: {
-        'time': [{ required: true, message: '请选择退货完成时间', trigger: 'change' }],
+        'time': [{ required: true, message: '请选择退货完成时间', trigger: 'change' }]
       },
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        const paramsPage = Object.assign(this.queryParam) //  无分页
-        const jkUrl = this.activeKey == 0 ? realReportSalesByProvince : realReportSalesBySubArea
-        return jkUrl(paramsPage).then(res => {
+        const params = Object.assign(parameter, this.queryParam)
+        delete params.time
+        return queryBillNoPage(params).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
+            this.getCount(params)
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+            }
+            this.disabled = false
           }
-          this.disabled = false
           this.spinning = false
           return data
         })
       }
     }
   },
-  computed: {
-    columns () {
-      const _this = this
-      const arr = [
-        { title: '区域', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '分区', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '供应商名称', dataIndex: 'subareaNames', width: 50, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '箭牌滤清器', dataIndex: 'jpLqqAmount', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌变速箱滤清器', dataIndex: 'jpLqqAmount', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌滤清器', dataIndex: 'gpLqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '滤清器合计', dataIndex: 'lqqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌雨刮片', dataIndex: 'jpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌雨燕雨刮片', dataIndex: 'jpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌雨刮片', dataIndex: 'gpYgpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '雨刮片合计', dataIndex: 'ygpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌喇叭', dataIndex: 'jpLbAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '箭牌刹车片', dataIndex: 'jpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU+箭牌感应线', dataIndex: 'jpGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '冠牌刹车片', dataIndex: 'gpScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU刹车片', dataIndex: 'tbuScpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU刹车油', dataIndex: 'tbuScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '刹车片合计', dataIndex: 'scpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'TBU-P刹车盘', dataIndex: 'tbupAmount', align: 'right', width: 50, customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '汇箭蓄电池', dataIndex: 'hjAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '布瑞斯蓄电池', dataIndex: 'brsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯机油', dataIndex: 'dlsJyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯变速箱油', dataIndex: 'dlsBsxyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯刹车油', dataIndex: 'dlsScyAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-
-        // { title: '德路斯汽车养护产品', dataIndex: 'dlsQcyhAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德路斯合计', dataIndex: 'dlsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升点火线圈', dataIndex: 'wsDhxqAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升LED灯', dataIndex: 'wsDpAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '稳升合计', dataIndex: 'wsAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-
-        // { title: 'TBU感应线', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '品牌合计', dataIndex: 'ppAmount', width: 70, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: 'NGK火花塞', dataIndex: 'ngkAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '飞利浦', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '车仆防冻液', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '瓦尔塔', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '雷贝斯托', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '德尔福', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '巴诺德', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '代理品牌合计', dataIndex: 'ppAndNgkAmount', width: 80, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
-        { title: '开单采退金额合计', dataIndex: 'tbuGyxAmount', width: 50, align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
-      ]
-      // if (this.activeKey == 0) {
-      //   arr.splice(1, 0, { title: '省份', dataIndex: 'dealerProvinceName', width: 50, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
-      // }
-      return arr
-    }
-  },
   methods: {
-    callback (key) {
-      this.activeKey = key
-      this.resetSearchForm()
-      console.log(key, this.activeKey)
+    // 选择供应商
+    getSupplierName (val, item) {
+      this.queryParam.supplier.supplierName = item.supplierName
+      this.queryParam.supplier.supplierSn = val
     },
-    //  创建时间  change
+    // 总计
+    getCount (params) {
+      queryBillNoCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    //  退货完成时间  change
     dateChange (date) {
       if (date[0] && date[1]) {
         this.queryParam.time = date
@@ -246,7 +179,7 @@ export default {
         if (valid) {
           _this.$refs.table.refresh(true)
         } else {
-          _this.$message.error("请选择退货完成时间")
+          _this.$message.error('请选择退货完成时间')
           return false
         }
       })
@@ -258,43 +191,63 @@ export default {
       this.$refs.rangeDate.resetDate(this.queryParam.time)
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.queryParam.provinceSn = undefined
-      this.queryParam.citySn = undefined
-      this.queryParam.districtSn = undefined
+      this.queryParam.supplier.provinceSn = undefined
+      this.queryParam.supplier.citySn = undefined
+      this.queryParam.supplier.districtSn = undefined
       this.queryParam.subareaSn = undefined
+      this.queryParam.sparePartsReturnNo = undefined
+      this.queryParam.supplier.supplierName = undefined
+      this.queryParam.supplier.supplierSn = undefined
       this.$refs.areaList.clearData()
       this.$refs.table.clearTable()
     },
-    areaChange(val){
-      this.queryParam.provinceSn = val[0] ? val[0] : ''
-      this.queryParam.citySn = val[1] ? val[1] : ''
-      this.queryParam.districtSn = val[2] ? val[2] : ''
+    areaChange (val) {
+      this.queryParam.supplier.provinceSn = val[0] ? val[0] : ''
+      this.queryParam.supplier.citySn = val[1] ? val[1] : ''
+      this.queryParam.supplier.districtSn = val[2] ? val[2] : ''
     },
     //  导出
     handleExport () {
       const _this = this
-      const jkUrl = _this.activeKey == 0 ? realReportSalesByProvinceExport : realReportSalesBySubAreaExport
-      const excelTitle = _this.activeKey == 0 ? '各省品类实售明细报表' : '各区品类实售明细报表'
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
           const params = _this.queryParam
-          _this.$store.state.app.curActionPermission = 'B_regionTypeSalesReportExport'
+          _this.$store.state.app.curActionPermission = 'B_billingReturn_Report'
           _this.showExport = true
           _this.exportLoading = true
           _this.spinning = true
-          hdExportExcel(jkUrl, params, excelTitle, function () {
+          hdExportExcel(billNoExport, params, '开单采退单', function () {
             _this.exportLoading = false
             _this.spinning = false
             _this.$store.state.app.curActionPermission = ''
           })
         } else {
+          _this.$message.error('请选择退货完成时间')
           return false
         }
       })
     },
-    pageInit () {
-      this.activeKey = 0
+    // 获取表头
+    async getTableTitle () {
+      const _this = this
+      const tableTitle = await queryBillNoTitle().then(res => res.data)
+      this.columns = tableTitle.list
+      this.countLabel = tableTitle.count
+      this.columns.map(item => {
+        let mw = 40
+        if (item.customRender == 'amount') {
+          mw = 15
+          item.customRender = function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
+        }
+        const w = item.title.length * mw
+        const tw = w <= 80 && item.customRender != 'amount' ? w * 2 : (w >= 360 ? 200 : w)
+        item.width = tw + 'px'
+        this.tableWidth = this.tableWidth + tw
+      })
       this.resetSearchForm()
+    },
+    pageInit () {
+      this.getTableTitle()
     }
   },
   mounted () {
@@ -313,7 +266,3 @@ export default {
   }
 }
 </script>
-
-<style style="less">
-  
-</style>