Browse Source

报表对接

chenrui 3 years ago
parent
commit
010b3f6244

+ 35 - 0
src/api/reportData.js

@@ -0,0 +1,35 @@
+import { axios } from '@/utils/request'
+
+//  开单退货单报表
+export const salesReportReturnBillList = (params) => {
+  const url = `/report/salesReturnBillReport/returnBillQueryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  开单退货报表
+export const salesReportReturnList = (params) => {
+  const url = `/report/salesReturnBillReport/returnQueryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  实售退货报表
+export const salesReportReturnRebateList = (params) => {
+  const url = `/report/salesReturnBillReport/returnRebateQueryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 196 - 359
src/views/reportData/billingReturnReport/list.vue

@@ -1,176 +1,139 @@
 <template>
-  <a-card size="small" :bordered="false" class="shortageStatisticsCList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="销售日期">
-              <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户名称">
-              <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户类型">
-              <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
+  <a-card size="small" :bordered="false" class="billingReturnReportList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="returnSlipReportList-form"
+          layout="inline"
+          ref="ruleForm"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="所在区域">
-                <subarea id="shortageStatisticsCList-subarea" v-model="queryParam.subareaSn"></subarea>
-              </a-form-item>
+              <a-form-model-item label="销售日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
             </a-col>
-            <a-col :md="12" :sm="24">
-              <a-row>
-                <a-form-item label="地区">
-                  <a-col span="7">
-                    <a-form-item prop="dealerProvinceSn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerProvinceSn" @change="getCityList" 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-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="dealerCitySn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerCitySn" @change="getAreaList" placeholder="请选择市">
-                        <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="dealerCountySn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerCountySn" placeholder="请选择区/县">
-                        <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                </a-form-item>
-              </a-row>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <custList id="billingReturnReportList-custList" ref="custList" @change="custChange"></custList>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户类型">
+                <v-select
+                  v-model="queryParam.dealer.dealerLevel"
+                  ref="dealerLevel"
+                  id="billingReturnReportList-dealerLevel"
+                  code="DEALER_LEVEL"
+                  placeholder="请选择客户类型"
+                  allowClear></v-select>
+              </a-form-model-item>
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shortageStatisticsCList-refresh">查询</a-button>
-            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="shortageStatisticsCList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 2880, y: tableHeight }"
-      bordered>
-    </s-table>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <subarea id="billingReturnReportList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="12" :sm="24">
+                <a-row>
+                  <a-form-model-item label="地区">
+                    <a-col span="7">
+                      <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" 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 span="7" offset="1">
+                      <a-form-model-item prop="dealerCitySn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-model-item>
+                    </a-col>
+                    <a-col span="7" offset="1">
+                      <a-form-model-item prop="dealerCountySn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-model-item>
+                    </a-col>
+                  </a-form-model-item>
+                </a-row>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24">
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="billingReturnReportList-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="billingReturnReportList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 8px">
+                {{ 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: 3020, y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+    </a-spin>
   </a-card>
 </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 { oosBuyerList, oosBuyerDetailCount, oosBuyerDetailPageCount, oosDetailExport } from '@/api/oos'
+import { salesReportReturnList } from '@/api/reportData'
 export default {
   components: { STable, VSelect, custList, subarea, rangeDate },
   data () {
     return {
+      spinning: false,
       advanced: false, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
+        time: [],
         beginDate: '',
         endDate: '',
-        buyerSn: undefined,
-        subareaSn: undefined, //  区域
-        provinceSn: undefined,
-        citySn: undefined,
-        districtSn: undefined
+        dealer: {
+          'dealerSn': undefined,
+          'provinceSn': undefined,
+          'citySn': undefined,
+          'districtSn': undefined,
+          'subareaSn': undefined,
+          'dealerLevel': undefined
+        }
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      time: [], //  创建时间
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '区域',
-          dataIndex: 'area',
-          width: 150,
-          align: 'center',
-          customRender: (text, row, index) => {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 4
-                }
-              }
-            }
-            return text
-          }
-        },
-        { title: '省份',
-          dataIndex: 'provinceName',
-          width: 150,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
-        { title: '客户名称',
-          dataIndex: 'custName',
-          width: 200,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
-        { title: '客户类型',
-          dataIndex: 'custType',
-          width: 200,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return text.join('/') || '--' } },
+        { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { 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: '品牌',
           align: 'center',
           children: [
@@ -180,38 +143,38 @@ export default {
               children: [
                 {
                   title: '滤清器',
-                  dataIndex: 'pp1',
+                  dataIndex: 'jpLqqAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '雨刮片',
-                  dataIndex: 'pp2',
+                  dataIndex: 'jpYgpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '喇叭',
-                  dataIndex: 'pp3',
+                  dataIndex: 'jpLbAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '刹车片',
-                  dataIndex: 'pp4',
+                  dataIndex: 'jpScpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '感应线',
-                  dataIndex: 'pp5',
+                  dataIndex: 'jpGyxAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 }
               ]
             },
@@ -221,54 +184,54 @@ export default {
               children: [
                 {
                   title: '滤清器',
-                  dataIndex: 'pp6',
+                  dataIndex: 'gpLqqAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '雨刮片',
-                  dataIndex: 'pp7',
+                  dataIndex: 'gpYgpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '刹车片',
-                  dataIndex: 'pp8',
+                  dataIndex: 'gpScpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 }
               ]
             },
             {
               title: '汇箭',
-              dataIndex: 'pp9',
+              dataIndex: 'hjAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '德路斯',
-              dataIndex: 'pp10',
+              dataIndex: 'dlsAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '稳升',
-              dataIndex: 'pp11',
+              dataIndex: 'wsAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: 'TBU',
-              dataIndex: 'pp12',
+              dataIndex: 'tbuAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             }
           ] },
         { title: '代理品牌',
@@ -276,163 +239,74 @@ export default {
           children: [
             {
               title: 'NGK',
-              dataIndex: 'pp13',
+              dataIndex: 'ngkAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '飞利浦',
-              dataIndex: 'pp14',
+              dataIndex: 'flpAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '车仆',
-              dataIndex: 'pp15',
+              dataIndex: 'cpAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '瓦尔塔',
-              dataIndex: 'pp16',
+              dataIndex: 'wetAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '雷贝斯托',
-              dataIndex: 'pp17',
+              dataIndex: 'lbstAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '德尔福',
-              dataIndex: 'pp18',
+              dataIndex: 'defAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '巴诺德',
-              dataIndex: 'pp19',
+              dataIndex: 'bndAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             }
           ] },
-        { title: '开单退货合计金额', width: 200, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return text ? ('¥' + text) : '--' } }
+        { title: '开单退货合计金额', width: 200, dataIndex: 'sumAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        // this.disabled = true
-        // if (this.tableHeight == 0) {
-        //   this.tableHeight = window.innerHeight - 380
-        // }
-        // const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) //  有分页
-        // const params = Object.assign(parameter, this.queryParam) //  无分页
-        // return oosBuyerList(params).then(res => {
-        //   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
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [{
-              area: 'A区',
-              provinceName: '广东省',
-              custName: '剪冠汽配佛山白坭店',
-              custType: '省级服务中心',
-              pp1: '0',
-              pp2: '0',
-              pp3: '0',
-              pp4: '0',
-              pp5: '0',
-              pp6: '0',
-              pp7: '0',
-              pp8: '0',
-              pp9: '0',
-              pp10: '0',
-              pp11: '0',
-              pp12: '0',
-              pp13: '37.00',
-              pp14: '0',
-              pp15: '0',
-              pp16: '0',
-              pp17: '0',
-              pp18: '0',
-              pp19: '0',
-              totalAmount: '37.00'
-            },
-            {
-              area: 'A区',
-              provinceName: '广东省',
-              custName: '支持省级',
-              custType: '省级服务中心',
-              pp1: '0',
-              pp2: '36.50',
-              pp3: '0',
-              pp4: '0',
-              pp5: '0',
-              pp6: '0',
-              pp7: '0',
-              pp8: '0',
-              pp9: '0',
-              pp10: '0',
-              pp11: '0',
-              pp12: '0',
-              pp13: '0',
-              pp14: '0',
-              pp15: '0',
-              pp16: '0',
-              pp17: '0',
-              pp18: '0',
-              pp19: '0',
-              totalAmount: '36.50'
-            },
-            {
-              area: '合计',
-              provinceName: '合计',
-              custName: '合计',
-              custType: '合计',
-              pp1: '0',
-              pp2: '36.50',
-              pp3: '0',
-              pp4: '0',
-              pp5: '0',
-              pp6: '0',
-              pp7: '0',
-              pp8: '0',
-              pp9: '0',
-              pp10: '0',
-              pp11: '0',
-              pp12: '0',
-              pp13: '37.00',
-              pp14: '0',
-              pp15: '0',
-              pp16: '0',
-              pp17: '0',
-              pp18: '0',
-              pp19: '0',
-              totalAmount: '73.50'
-            }],
-            count: 1
-          }
+        this.disabled = true
+        this.spinning = true
+        if (this.tableHeight == 0) {
+          this.tableHeight = window.innerHeight - 380
+        }
+        const params = Object.assign(parameter, this.queryParam) //  无分页
+        delete params.time
+        return salesReportReturnList(params).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
+            data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          this.spinning = false
+          return data
         })
       },
       productType: [],
@@ -441,46 +315,57 @@ export default {
     }
   },
   methods: {
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          return false
+        }
+      })
+    },
     //  创建时间  change
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
     },
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key
+    custChange (val) {
+      this.queryParam.dealer.dealerSn = val.key
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate()
+      this.queryParam.time = []
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.queryParam.dealer = {
+        'dealerSn': undefined,
+        'provinceSn': undefined,
+        'citySn': undefined,
+        'districtSn': undefined,
+        'subareaSn': undefined,
+        'dealerLevel': undefined
+      }
+      this.$refs.custList.resetForm()
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
-      this.queryParam.citySn = undefined
-      this.queryParam.districtSn = undefined
-      this.queryParam.address = ''
+      this.queryParam.dealerCitySn = undefined
+      this.queryParam.dealerCountySn = undefined
       this.getArea('city', val)
     },
     // 获取区县列表
     getAreaList (val) {
-      const index = this.addrCityList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
-      this.queryParam.districtSn = undefined
-      this.queryParam.address = ''
+      this.queryParam.dealerCountySn = undefined
       this.getArea('district', val)
     },
-    // 区县变更
-    areaCharged (val) {
-      const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.districtName = this.addrDistrictList[index].name
-      }
-      this.queryParam.address = ''
-    },
     //  省/市/区
     getArea (leve, sn) {
       let params
@@ -508,54 +393,6 @@ export default {
           }
         }
       })
-    },
-    //  重置
-    resetSearchForm () {
-      this.$refs.rangeDate.resetDate(this.time)
-      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
-      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.buyerSn = undefined
-      this.queryParam.subareaSn = undefined
-      this.queryParam.productName = ''
-      this.queryParam.productCode = ''
-      this.queryParam.productTypeSn1 = ''
-      this.queryParam.productTypeSn2 = ''
-      this.queryParam.productTypeSn3 = ''
-      this.queryParam.salesBillNo = ''
-      this.productType = []
-      this.$refs.table.refresh(true)
-    },
-    // 详情
-    handleDetail (row) {
-      this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
-    },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      if (this.time && this.time.length) {
-        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
-        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginDate = ''
-        params.endDate = ''
-      }
-      this.exportLoading = true
-      oosDetailExport(params).then(res => {
-        this.exportLoading = false
-        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) {

+ 202 - 383
src/views/reportData/returnSlipReport/list.vue

@@ -1,197 +1,146 @@
 <template>
-  <a-card size="small" :bordered="false" class="shortageStatisticsCList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="销售日期">
-              <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户名称">
-              <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户类型">
-              <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
+  <a-card size="small" :bordered="false" class="returnSlipReportList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="returnSlipReportList-form"
+          layout="inline"
+          ref="ruleForm"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="退货单号">
-                <a-input id="salesSlipReportList-allocateTypeSn" v-model.trim="queryParam.allocateTypeSn" allowClear placeholder="请输入退货单号"/>
-              </a-form-item>
+              <a-form-model-item label="退货日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
-              <a-form-item label="所在区域">
-                <subarea id="shortageStatisticsCList-subarea" v-model="queryParam.subareaSn"></subarea>
-              </a-form-item>
+              <a-form-model-item label="客户名称">
+                <custList id="returnSlipReportList-custList" ref="custList" @change="custChange"></custList>
+              </a-form-model-item>
             </a-col>
-            <a-col :md="12" :sm="24">
-              <a-row>
-                <a-form-item label="地区">
-                  <a-col span="7">
-                    <a-form-item prop="dealerProvinceSn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerProvinceSn" @change="getCityList" 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-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="dealerCitySn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerCitySn" @change="getAreaList" placeholder="请选择市">
-                        <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="dealerCountySn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerCountySn" placeholder="请选择区/县">
-                        <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户类型">
+                <v-select
+                  v-model="queryParam.dealer.dealerLevel"
+                  ref="dealerLevel"
+                  id="returnSlipReportList-dealerLevel"
+                  code="DEALER_LEVEL"
+                  placeholder="请选择客户类型"
+                  allowClear></v-select>
+              </a-form-model-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-item label="退货单号">
+                  <a-input id="returnSlipReportList-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入退货单号"/>
                 </a-form-item>
-              </a-row>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <subarea id="returnSlipReportList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="12" :sm="24">
+                <a-row>
+                  <a-form-model-item label="地区">
+                    <a-col span="7">
+                      <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" 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 span="7" offset="1">
+                      <a-form-model-item prop="dealerCitySn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-model-item>
+                    </a-col>
+                    <a-col span="7" offset="1">
+                      <a-form-model-item prop="dealerCountySn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-model-item>
+                    </a-col>
+                  </a-form-model-item>
+                </a-row>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24">
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="returnSlipReportList-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="returnSlipReportList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 8px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shortageStatisticsCList-refresh">查询</a-button>
-            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="shortageStatisticsCList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 2880, y: tableHeight }"
-      bordered>
-    </s-table>
+          </a-row>
+        </a-form-model>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 3240, y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+    </a-spin>
   </a-card>
 </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 { oosBuyerList, oosBuyerDetailCount, oosBuyerDetailPageCount, oosDetailExport } from '@/api/oos'
+import { salesReportReturnBillList } from '@/api/reportData'
 export default {
   components: { STable, VSelect, custList, subarea, rangeDate },
   data () {
     return {
+      spinning: false,
       advanced: false, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
+        time: [],
         beginDate: '',
         endDate: '',
-        buyerSn: undefined,
-        subareaSn: undefined, //  区域
-        provinceSn: undefined,
-        citySn: undefined,
-        districtSn: undefined
+        dealer: {
+          'dealerSn': undefined,
+          'provinceSn': undefined,
+          'citySn': undefined,
+          'districtSn': undefined,
+          'subareaSn': undefined,
+          'dealerLevel': undefined
+        },
+        salesReturnBillNo: ''
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择退货日期', trigger: 'change' }]
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      time: [], //  创建时间
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '区域',
-          dataIndex: 'area',
-          width: 150,
-          align: 'center',
-          customRender: (text, row, index) => {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 4
-                }
-              }
-            }
-            return text
-          }
-        },
-        { title: '退货单号',
-		  dataIndex: 'allocateTypeSn',
-		  width: 150,
-		  align: 'center',
-		  customRender: (text, row, index) => {
-		    if (text == '合计') {
-		      return {
-		        children: <span>{ text }</span>,
-		        attrs: {
-		          colSpan: 4
-		        }
-		      }
-		    }
-		    return text
-		  }
-        },
-        { title: '省份',
-          dataIndex: 'provinceName',
-          width: 150,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
-        { title: '客户名称',
-          dataIndex: 'custName',
-          width: 200,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
-        { title: '客户类型',
-          dataIndex: 'custType',
-          width: 200,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return text.join('/') || '--' } },
+        { title: '退货单号', dataIndex: 'salesReturnBillNo', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { 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: '品牌',
           align: 'center',
           children: [
@@ -201,38 +150,38 @@ export default {
               children: [
                 {
                   title: '滤清器',
-                  dataIndex: 'pp1',
+                  dataIndex: 'jpLqqAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '雨刮片',
-                  dataIndex: 'pp2',
+                  dataIndex: 'jpYgpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '喇叭',
-                  dataIndex: 'pp3',
+                  dataIndex: 'jpLbAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '刹车片',
-                  dataIndex: 'pp4',
+                  dataIndex: 'jpScpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '感应线',
-                  dataIndex: 'pp5',
+                  dataIndex: 'jpGyxAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 }
               ]
             },
@@ -242,54 +191,54 @@ export default {
               children: [
                 {
                   title: '滤清器',
-                  dataIndex: 'pp6',
+                  dataIndex: 'gpLqqAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '雨刮片',
-                  dataIndex: 'pp7',
+                  dataIndex: 'gpYgpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '刹车片',
-                  dataIndex: 'pp8',
+                  dataIndex: 'gpScpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 }
               ]
             },
             {
               title: '汇箭',
-              dataIndex: 'pp9',
+              dataIndex: 'hjAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '德路斯',
-              dataIndex: 'pp10',
+              dataIndex: 'dlsAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '稳升',
-              dataIndex: 'pp11',
+              dataIndex: 'wsAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: 'TBU',
-              dataIndex: 'pp12',
+              dataIndex: 'tbuAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             }
           ] },
         { title: '代理品牌',
@@ -297,213 +246,131 @@ export default {
           children: [
             {
               title: 'NGK',
-              dataIndex: 'pp13',
+              dataIndex: 'ngkAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '飞利浦',
-              dataIndex: 'pp14',
+              dataIndex: 'flpAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '车仆',
-              dataIndex: 'pp15',
+              dataIndex: 'cpAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '瓦尔塔',
-              dataIndex: 'pp16',
+              dataIndex: 'wetAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '雷贝斯托',
-              dataIndex: 'pp17',
+              dataIndex: 'lbstAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '德尔福',
-              dataIndex: 'pp18',
+              dataIndex: 'defAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '巴诺德',
-              dataIndex: 'pp19',
+              dataIndex: 'bndAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             }
           ] },
-        { title: '开单退货合计金额', width: 200, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return text ? ('¥' + text) : '--' } }
+        { title: '开单退货单合计金额', width: 200, dataIndex: 'sumAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        // this.disabled = true
-        // if (this.tableHeight == 0) {
-        //   this.tableHeight = window.innerHeight - 380
-        // }
-        // const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) //  有分页
-        // const params = Object.assign(parameter, this.queryParam) //  无分页
-        // return oosBuyerList(params).then(res => {
-        //   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
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [{
-              area: 'A区',
-			  allocateTypeSn: 'TH201622021245541',
-              provinceName: '广东省',
-              custName: '剪冠汽配佛山白坭店',
-              custType: '省级服务中心',
-              pp1: '0',
-              pp2: '0',
-              pp3: '0',
-              pp4: '0',
-              pp5: '0',
-              pp6: '0',
-              pp7: '0',
-              pp8: '0',
-              pp9: '0',
-              pp10: '0',
-              pp11: '0',
-              pp12: '0',
-              pp13: '37.00',
-              pp14: '0',
-              pp15: '0',
-              pp16: '0',
-              pp17: '0',
-              pp18: '0',
-              pp19: '0',
-              totalAmount: '37.00'
-            },
-            {
-              area: 'A区',
-			  allocateTypeSn: 'TH201722021245582',
-              provinceName: '广东省',
-              custName: '支持省级',
-              custType: '省级服务中心',
-              pp1: '0',
-              pp2: '36.50',
-              pp3: '0',
-              pp4: '0',
-              pp5: '0',
-              pp6: '0',
-              pp7: '0',
-              pp8: '0',
-              pp9: '0',
-              pp10: '0',
-              pp11: '0',
-              pp12: '0',
-              pp13: '0',
-              pp14: '0',
-              pp15: '0',
-              pp16: '0',
-              pp17: '0',
-              pp18: '0',
-              pp19: '0',
-              totalAmount: '36.50'
-            },
-            {
-              area: '合计',
-              provinceName: '合计',
-              custName: '合计',
-              custType: '合计',
-              pp1: '0',
-              pp2: '36.50',
-              pp3: '0',
-              pp4: '0',
-              pp5: '0',
-              pp6: '0',
-              pp7: '0',
-              pp8: '0',
-              pp9: '0',
-              pp10: '0',
-              pp11: '0',
-              pp12: '0',
-              pp13: '37.00',
-              pp14: '0',
-              pp15: '0',
-              pp16: '0',
-              pp17: '0',
-              pp18: '0',
-              pp19: '0',
-              totalAmount: '73.50'
-            }],
-            count: 1
-          }
+        this.disabled = true
+        this.spinning = true
+        if (this.tableHeight == 0) {
+          this.tableHeight = window.innerHeight - 380
+        }
+        const params = Object.assign(parameter, this.queryParam) //  无分页
+        delete params.time
+        return salesReportReturnBillList(params).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
+            data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          this.spinning = false
+          return data
         })
-      },
-      productType: [],
-      productTotal: null,
-      currentTotal: null
+      }
     }
   },
   methods: {
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          return false
+        }
+      })
+    },
     //  创建时间  change
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    custChange (val) {
+      this.queryParam.dealer.dealerSn = val.key
     },
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate()
+      this.queryParam.time = []
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.queryParam.dealer = {
+        'dealerSn': undefined,
+        'provinceSn': undefined,
+        'citySn': undefined,
+        'districtSn': undefined,
+        'subareaSn': undefined,
+        'dealerLevel': undefined
+      }
+      this.queryParam.salesReturnBillNo = ''
+      this.$refs.custList.resetForm()
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
-      this.queryParam.citySn = undefined
-      this.queryParam.districtSn = undefined
-      this.queryParam.address = ''
+      this.queryParam.dealerCitySn = undefined
+      this.queryParam.dealerCountySn = undefined
       this.getArea('city', val)
     },
     // 获取区县列表
     getAreaList (val) {
-      const index = this.addrCityList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
-      this.queryParam.districtSn = undefined
-      this.queryParam.address = ''
+      this.queryParam.dealerCountySn = undefined
       this.getArea('district', val)
     },
-    // 区县变更
-    areaCharged (val) {
-      const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.districtName = this.addrDistrictList[index].name
-      }
-      this.queryParam.address = ''
-    },
     //  省/市/区
     getArea (leve, sn) {
       let params
@@ -531,54 +398,6 @@ export default {
           }
         }
       })
-    },
-    //  重置
-    resetSearchForm () {
-      this.$refs.rangeDate.resetDate(this.time)
-      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
-      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.buyerSn = undefined
-      this.queryParam.subareaSn = undefined
-      this.queryParam.productName = ''
-      this.queryParam.productCode = ''
-      this.queryParam.productTypeSn1 = ''
-      this.queryParam.productTypeSn2 = ''
-      this.queryParam.productTypeSn3 = ''
-      this.queryParam.salesBillNo = ''
-      this.productType = []
-      this.$refs.table.refresh(true)
-    },
-    // 详情
-    handleDetail (row) {
-      this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
-    },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      if (this.time && this.time.length) {
-        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
-        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginDate = ''
-        params.endDate = ''
-      }
-      this.exportLoading = true
-      oosDetailExport(params).then(res => {
-        this.exportLoading = false
-        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) {

+ 2 - 2
src/views/reportData/salesAmountReport/list.vue

@@ -9,7 +9,7 @@
           ref="ruleForm"
           :model="queryParam"
           :rules="rules"
-          @keyup.enter.native="$refs.table.refresh(true)">
+          @keyup.enter.native="handleSearch">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-model-item label="销售日期" prop="time">
@@ -129,7 +129,7 @@ export default {
         { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
         { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return text.join('/') || '--' } },
         { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '客户名称', dataIndex: 'dealer.dealerName', align: 'center', customRender: function (text) { return text || '--' } },
+        { 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: '品牌',
           align: 'center',

+ 196 - 334
src/views/reportData/salesReturnReport/list.vue

@@ -1,176 +1,139 @@
 <template>
-  <a-card size="small" :bordered="false" class="shortageStatisticsCList-wrap">
-    <!-- 搜索条件 -->
-    <div class="table-page-search-wrapper">
-      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
-        <a-row :gutter="15">
-          <a-col :md="6" :sm="24">
-            <a-form-item label="销售日期">
-              <rangeDate ref="rangeDate" :value="time" @change="dateChange" />
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户名称">
-              <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
-            </a-form-item>
-          </a-col>
-          <a-col :md="6" :sm="24">
-            <a-form-item label="客户类型">
-              <custList ref="custList" id="shortageStatisticsCList-buyerSn" @change="custChange"></custList>
-            </a-form-item>
-          </a-col>
-          <template v-if="advanced">
+  <a-card size="small" :bordered="false" class="salesReturnReportList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="returnSlipReportList-form"
+          layout="inline"
+          ref="ruleForm"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
             <a-col :md="6" :sm="24">
-              <a-form-item label="所在区域">
-                <subarea id="shortageStatisticsCList-subarea" v-model="queryParam.subareaSn"></subarea>
-              </a-form-item>
+              <a-form-model-item label="销售日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
             </a-col>
-            <a-col :md="12" :sm="24">
-              <a-row>
-                <a-form-item label="地区">
-                  <a-col span="7">
-                    <a-form-item prop="dealerProvinceSn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerProvinceSn" @change="getCityList" 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-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="dealerCitySn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerCitySn" @change="getAreaList" placeholder="请选择市">
-                        <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                  <a-col span="7" offset="1">
-                    <a-form-item prop="dealerCountySn" style="margin: 0;">
-                      <a-select v-model="queryParam.dealerCountySn" placeholder="请选择区/县">
-                        <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
-                      </a-select>
-                    </a-form-item>
-                  </a-col>
-                </a-form-item>
-              </a-row>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <custList id="salesReturnReportList-custList" ref="custList" @change="custChange"></custList>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户类型">
+                <v-select
+                  v-model="queryParam.dealer.dealerLevel"
+                  ref="dealerLevel"
+                  id="salesReturnReportList-dealerLevel"
+                  code="DEALER_LEVEL"
+                  placeholder="请选择客户类型"
+                  allowClear></v-select>
+              </a-form-model-item>
             </a-col>
-          </template>
-          <a-col :md="6" :sm="24">
-            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="shortageStatisticsCList-refresh">查询</a-button>
-            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="shortageStatisticsCList-reset">重置</a-button>
-            <a @click="advanced=!advanced" style="margin-left: 8px">
-              {{ advanced ? '收起' : '展开' }}
-              <a-icon :type="advanced ? 'up' : 'down'"/>
-            </a>
-          </a-col>
-        </a-row>
-      </a-form>
-    </div>
-    <!-- 列表 -->
-    <s-table
-      class="sTable"
-      ref="table"
-      size="small"
-      :rowKey="(record) => record.id"
-      :columns="columns"
-      :data="loadData"
-      :scroll="{ x: 2880, y: tableHeight }"
-      bordered>
-    </s-table>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <subarea id="salesReturnReportList-subareaSn" v-model="queryParam.dealer.subareaSn"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="12" :sm="24">
+                <a-row>
+                  <a-form-model-item label="地区">
+                    <a-col span="7">
+                      <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.provinceSn" allowClear @change="getCityList" 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 span="7" offset="1">
+                      <a-form-model-item prop="dealerCitySn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.citySn" allowClear @change="getAreaList" placeholder="请选择市">
+                          <a-select-option v-for="item in addrCityList" :value="item.id" :key="item.id + 'b'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-model-item>
+                    </a-col>
+                    <a-col span="7" offset="1">
+                      <a-form-model-item prop="dealerCountySn" style="margin: 0;">
+                        <a-select v-model="queryParam.dealer.districtSn" allowClear placeholder="请选择区/县">
+                          <a-select-option v-for="item in addrDistrictList" :value="item.id" :key="item.id + 'c'">{{ item.name }}</a-select-option>
+                        </a-select>
+                      </a-form-model-item>
+                    </a-col>
+                  </a-form-model-item>
+                </a-row>
+              </a-col>
+            </template>
+            <a-col :md="6" :sm="24">
+              <a-button type="primary" @click="handleSearch" :disabled="disabled" id="salesReturnReportList-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="salesReturnReportList-reset">重置</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 8px">
+                {{ 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: 3020, y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+      </s-table>
+    </a-spin>
   </a-card>
 </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 { oosBuyerList, oosBuyerDetailCount, oosBuyerDetailPageCount, oosDetailExport } from '@/api/oos'
+import { salesReportReturnRebateList } from '@/api/reportData'
 export default {
   components: { STable, VSelect, custList, subarea, rangeDate },
   data () {
     return {
+      spinning: false,
       advanced: false, // 高级搜索 展开/关闭
       tableHeight: 0,
       queryParam: { //  查询条件
+        time: [],
         beginDate: '',
         endDate: '',
-        buyerSn: undefined,
-        subareaSn: undefined, //  区域
-        provinceSn: undefined,
-        citySn: undefined,
-        districtSn: undefined
+        dealer: {
+          'dealerSn': undefined,
+          'provinceSn': undefined,
+          'citySn': undefined,
+          'districtSn': undefined,
+          'subareaSn': undefined,
+          'dealerLevel': undefined
+        }
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
       },
       disabled: false, //  查询、重置按钮是否可操作
       exportLoading: false, // 导出loading
       addrProvinceList: [], //  省下拉
       addrCityList: [], //  市下拉
       addrDistrictList: [], //  区下拉
-      time: [], //  创建时间
       columns: [
-        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
-        { title: '区域',
-          dataIndex: 'area',
-          width: 150,
-          align: 'center',
-          customRender: (text, row, index) => {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 4
-                }
-              }
-            }
-            return text
-          }
-        },
-        { title: '省份',
-          dataIndex: 'provinceName',
-          width: 150,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
-        { title: '客户名称',
-          dataIndex: 'custName',
-          width: 200,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
-        { title: '客户类型',
-          dataIndex: 'custType',
-          width: 200,
-          align: 'center',
-          customRender: function (text, row, index) {
-            if (text == '合计') {
-              return {
-                children: <span>{ text }</span>,
-                attrs: {
-                  colSpan: 0
-                }
-              }
-            }
-            return text || '--'
-          } },
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center', fixed: 'left' },
+        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 220, align: 'center', customRender: function (text) { return text.join('/') || '--' } },
+        { title: '省份', dataIndex: 'dealer.provinceName', width: 200, align: 'center', customRender: function (text) { return text || '--' } },
+        { 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: '品牌',
           align: 'center',
           children: [
@@ -180,38 +143,38 @@ export default {
               children: [
                 {
                   title: '滤清器',
-                  dataIndex: 'pp1',
+                  dataIndex: 'jpLqqAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '雨刮片',
-                  dataIndex: 'pp2',
+                  dataIndex: 'jpYgpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '喇叭',
-                  dataIndex: 'pp3',
+                  dataIndex: 'jpLbAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '刹车片',
-                  dataIndex: 'pp4',
+                  dataIndex: 'jpScpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '感应线',
-                  dataIndex: 'pp5',
+                  dataIndex: 'jpGyxAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 }
               ]
             },
@@ -221,54 +184,54 @@ export default {
               children: [
                 {
                   title: '滤清器',
-                  dataIndex: 'pp6',
+                  dataIndex: 'gpLqqAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '雨刮片',
-                  dataIndex: 'pp7',
+                  dataIndex: 'gpYgpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 },
                 {
                   title: '刹车片',
-                  dataIndex: 'pp8',
+                  dataIndex: 'gpScpAmount',
                   align: 'center',
                   width: 100,
-                  customRender: function (text) { return text ? ('¥' + text) : '--' }
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
                 }
               ]
             },
             {
               title: '汇箭',
-              dataIndex: 'pp9',
+              dataIndex: 'hjAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '德路斯',
-              dataIndex: 'pp10',
+              dataIndex: 'dlsAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '稳升',
-              dataIndex: 'pp11',
+              dataIndex: 'wsAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: 'TBU',
-              dataIndex: 'pp12',
+              dataIndex: 'tbuAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             }
           ] },
         { title: '代理品牌',
@@ -276,138 +239,74 @@ export default {
           children: [
             {
               title: 'NGK',
-              dataIndex: 'pp13',
+              dataIndex: 'ngkAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '飞利浦',
-              dataIndex: 'pp14',
+              dataIndex: 'flpAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '车仆',
-              dataIndex: 'pp15',
+              dataIndex: 'cpAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '瓦尔塔',
-              dataIndex: 'pp16',
+              dataIndex: 'wetAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '雷贝斯托',
-              dataIndex: 'pp17',
+              dataIndex: 'lbstAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '德尔福',
-              dataIndex: 'pp18',
+              dataIndex: 'defAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             },
             {
               title: '巴诺德',
-              dataIndex: 'pp19',
+              dataIndex: 'bndAmount',
               align: 'center',
               width: 100,
-              customRender: function (text) { return text ? ('¥' + text) : '--' }
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
             }
           ] },
-        { title: '实售退货合计金额', width: 200, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return text ? ('¥' + text) : '--' } }
+        { title: '开单退货合计金额', width: 200, dataIndex: 'sumAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        // this.disabled = true
-        // if (this.tableHeight == 0) {
-        //   this.tableHeight = window.innerHeight - 380
-        // }
-        // const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) //  有分页
-        // const params = Object.assign(parameter, this.queryParam) //  无分页
-        // return oosBuyerList(params).then(res => {
-        //   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
-        //   }
-        //   this.disabled = false
-        //   return data
-        // })
-        const _this = this
-        return new Promise(function (resolve, reject) {
-          const data = {
-            pageNo: 1,
-            pageSize: 10,
-            list: [
-              {
-                area: 'A区',
-                provinceName: '广东省',
-                custName: '支持省级',
-                custType: '省级服务中心',
-                pp1: '0',
-                pp2: '36.50',
-                pp3: '0',
-                pp4: '0',
-                pp5: '0',
-                pp6: '0',
-                pp7: '0',
-                pp8: '0',
-                pp9: '0',
-                pp10: '0',
-                pp11: '0',
-                pp12: '0',
-                pp13: '0',
-                pp14: '0',
-                pp15: '0',
-                pp16: '0',
-                pp17: '0',
-                pp18: '0',
-                pp19: '0',
-                totalAmount: '36.50'
-              },
-              {
-                area: '合计',
-                provinceName: '合计',
-                custName: '合计',
-                custType: '合计',
-                pp1: '0',
-                pp2: '36.50',
-                pp3: '0',
-                pp4: '0',
-                pp5: '0',
-                pp6: '0',
-                pp7: '0',
-                pp8: '0',
-                pp9: '0',
-                pp10: '0',
-                pp11: '0',
-                pp12: '0',
-                pp13: '37.00',
-                pp14: '0',
-                pp15: '0',
-                pp16: '0',
-                pp17: '0',
-                pp18: '0',
-                pp19: '0',
-                totalAmount: '36.50'
-              }],
-            count: 1
-          }
+        this.disabled = true
+        this.spinning = true
+        if (this.tableHeight == 0) {
+          this.tableHeight = window.innerHeight - 380
+        }
+        const params = Object.assign(parameter, this.queryParam) //  无分页
+        delete params.time
+        return salesReportReturnRebateList(params).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
           for (var i = 0; i < data.list.length; i++) {
-            data.list[i].no = i + 1
+            data.list[i].no = no + i + 1
           }
-          _this.disabled = false
-          resolve(data)
+          this.disabled = false
+          this.spinning = false
+          return data
         })
       },
       productType: [],
@@ -416,46 +315,57 @@ export default {
     }
   },
   methods: {
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          return false
+        }
+      })
+    },
     //  创建时间  change
     dateChange (date) {
-      this.queryParam.beginDate = date[0]
-      this.queryParam.endDate = date[1]
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
     },
-    custChange (obj) {
-      this.queryParam.buyerSn = obj.key
+    custChange (val) {
+      this.queryParam.dealer.dealerSn = val.key
+    },
+    //  重置
+    resetSearchForm () {
+      this.$refs.rangeDate.resetDate()
+      this.queryParam.time = []
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.queryParam.dealer = {
+        'dealerSn': undefined,
+        'provinceSn': undefined,
+        'citySn': undefined,
+        'districtSn': undefined,
+        'subareaSn': undefined,
+        'dealerLevel': undefined
+      }
+      this.$refs.custList.resetForm()
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
     },
     // 获取城市列表
     getCityList (val) {
-      const index = this.addrProvinceList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.provinceName = this.addrProvinceList[index].name
-      }
       this.addrCityList = []
       this.addrDistrictList = []
-      this.queryParam.citySn = undefined
-      this.queryParam.districtSn = undefined
-      this.queryParam.address = ''
+      this.queryParam.dealerCitySn = undefined
+      this.queryParam.dealerCountySn = undefined
       this.getArea('city', val)
     },
     // 获取区县列表
     getAreaList (val) {
-      const index = this.addrCityList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.cityName = this.addrCityList[index].name
-      }
       this.addrDistrictList = []
-      this.queryParam.districtSn = undefined
-      this.queryParam.address = ''
+      this.queryParam.dealerCountySn = undefined
       this.getArea('district', val)
     },
-    // 区县变更
-    areaCharged (val) {
-      const index = this.addrDistrictList.findIndex(item => item.areaSn == val)
-      if (index >= 0) {
-        this.queryParam.districtName = this.addrDistrictList[index].name
-      }
-      this.queryParam.address = ''
-    },
     //  省/市/区
     getArea (leve, sn) {
       let params
@@ -483,54 +393,6 @@ export default {
           }
         }
       })
-    },
-    //  重置
-    resetSearchForm () {
-      this.$refs.rangeDate.resetDate(this.time)
-      this.queryParam.beginDate = getDate.getThreeMonthDays().starttime
-      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
-      this.queryParam.buyerSn = undefined
-      this.queryParam.subareaSn = undefined
-      this.queryParam.productName = ''
-      this.queryParam.productCode = ''
-      this.queryParam.productTypeSn1 = ''
-      this.queryParam.productTypeSn2 = ''
-      this.queryParam.productTypeSn3 = ''
-      this.queryParam.salesBillNo = ''
-      this.productType = []
-      this.$refs.table.refresh(true)
-    },
-    // 详情
-    handleDetail (row) {
-      this.$router.push({ name: 'salesDetail', params: { sn: row.salesBillSn } })
-    },
-    //  导出
-    handleExport () {
-      const params = this.queryParam
-      if (this.time && this.time.length) {
-        params.beginDate = moment(this.time[0]).format('YYYY-MM-DD')
-        params.endDate = moment(this.time[1]).format('YYYY-MM-DD')
-      } else {
-        params.beginDate = ''
-        params.endDate = ''
-      }
-      this.exportLoading = true
-      oosDetailExport(params).then(res => {
-        this.exportLoading = false
-        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) {