Browse Source

退货交单报表

chenrui 3 years ago
parent
commit
7a1513aa71

+ 28 - 0
src/api/reportData.js

@@ -391,3 +391,31 @@ export const reportAllocateDbjdReportExport = (params) => {
     responseType: 'blob'
   })
 }
+//  退货交单报表
+export const reportSalesReturnThjdReportList = (params) => {
+  const url = `/report/salesReturnBillReport/thjd/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  退货交单报表  合计
+export const reportSalesReturnThjdReportCount = (params) => {
+  return axios({
+    url: '/report/salesReturnBillReport/thjd/querySum',
+    data: params,
+    method: 'post'
+  })
+}
+// 退货交单报表 导出
+export const reportSalesReturnThjdReportExport = (params) => {
+  return axios({
+    url: '/report/salesReturnBillReport/thjd/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 25 - 0
src/config/router.config.js

@@ -1375,6 +1375,31 @@ export const asyncRouterMap = [
               }
             ]
           },
+          {
+            path: '/reportData/returnGoodsPresentation',
+            redirect: '/reportData/returnGoodsPresentation/list',
+            name: 'returnGoodsPresentation',
+            component: BlankLayout,
+            meta: {
+              title: '退货交单报表',
+              icon: 'profile',
+              permission: 'M_returnGoodsPresentationList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'returnGoodsPresentationList',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/returnGoodsPresentation/list.vue'),
+                meta: {
+                  title: '退货交单报表列表',
+                  icon: 'profile',
+                  hidden: true,
+                  permission: 'M_returnGoodsPresentationList'
+                }
+              }
+            ]
+          },
           {
             path: '/reportData/provinceTypeSalesDetails',
             redirect: '/reportData/provinceTypeSalesDetails/list',

+ 509 - 0
src/views/reportData/returnGoodsPresentation/list.vue

@@ -0,0 +1,509 @@
+<template>
+  <a-card size="small" :bordered="false" class="returnGoodsPresentationList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="returnGoodsPresentationList-form"
+          ref="ruleForm"
+          class="form-model-con"
+          layout="inline"
+          :model="queryParam"
+          :rules="rules"
+          @keyup.enter.native="handleSearch">
+          <a-row :gutter="15">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="确认日期" prop="time">
+                <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="客户名称">
+                <a-input id="returnGoodsPresentationList-dealerName" v-model.trim="queryParam.dealer.dealerName" allowClear placeholder="请输入客户名称"/>
+              </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="returnGoodsPresentationList-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-model-item label="退货单号">
+                  <a-input id="returnGoodsPresentationList-salesReturnBillNo" v-model.trim="queryParam.salesReturnBillNo" allowClear placeholder="请输入退货单号"/>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <subarea id="returnGoodsPresentationList-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="地区" style="margin-bottom: 0!important;">
+                    <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="returnGoodsPresentationList-refresh">查询</a-button>
+              <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="returnGoodsPresentationList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 5px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_returnGoodsPresentationExport')"
+                id="returnGoodsPresentationList-export">导出</a-button>
+              <a @click="advanced=!advanced" style="margin-left: 5px">
+                {{ advanced ? '收起' : '展开' }}
+                <a-icon :type="advanced ? 'up' : 'down'"/>
+              </a>
+            </a-col>
+          </a-row>
+        </a-form-model>
+      </div>
+      <!-- 列表 -->
+      <s-table
+        class="sTable"
+        ref="table"
+        size="small"
+        :defaultLoadData="false"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 2370 }"
+        bordered>
+        <template slot="footer">
+          <a-row>
+            <a-col span="2">合计:</a-col>
+            <a-col span="22">
+              <a-row>
+                <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? totalData.jpLqqAmount : '--' }}</a-col>
+                <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? totalData.jpYgpAmount : '--' }}</a-col>
+                <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? totalData.jpLbAmount : '--' }}</a-col>
+                <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? totalData.jpScpAmount : '--' }}</a-col>
+                <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? totalData.jpGyxAmount : '--' }}</a-col>
+                <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? totalData.gpLqqAmount : '--' }}</a-col>
+                <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? totalData.gpYgpAmount : '--' }}</a-col>
+                <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? totalData.gpScpAmount : '--' }}</a-col>
+                <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? totalData.hjAmount : '--' }}</a-col>
+                <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? totalData.dlsAmount : '--' }}</a-col>
+                <a-col span="4">稳升:{{ (totalData && (totalData.wsAmount || totalData.wsAmount==0)) ? totalData.wsAmount : '--' }}</a-col>
+                <a-col span="4">TBU:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? totalData.tbuAmount : '--' }}</a-col>
+                <a-col span="4">TBU-P:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? totalData.tbupAmount : '--' }}</a-col>
+                <a-col span="4">布瑞斯:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? totalData.brsAmount : '--' }}</a-col>
+                <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? totalData.ngkAmount : '--' }}</a-col>
+                <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? totalData.flpAmount : '--' }}</a-col>
+                <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? totalData.cpAmount : '--' }}</a-col>
+                <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? totalData.wetAmount : '--' }}</a-col>
+                <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? totalData.lbstAmount : '--' }}</a-col>
+                <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? totalData.defAmount : '--' }}</a-col>
+                <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? totalData.bndAmount : '--' }}</a-col>
+                <a-col span="6">开单销售单合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? totalData.totalAmount : '--' }}</a-col>
+              </a-row>
+            </a-col>
+          </a-row>
+        </template>
+      </s-table>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import rangeDate from '@/views/common/rangeDate.vue'
+import subarea from '@/views/common/subarea.js'
+import { getArea } from '@/api/data'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { reportSalesReturnThjdReportList, reportSalesReturnThjdReportCount, reportSalesReturnThjdReportExport } from '@/api/reportData'
+export default {
+  components: { STable, VSelect, rangeDate, subarea },
+  data () {
+    return {
+      spinning: false,
+      advanced: true, // 高级搜索 展开/关闭
+      queryParam: { //  查询条件
+        time: [],
+        beginDate: '',
+        endDate: '',
+        salesReturnBillNo: '',
+        dealer: {
+          'dealerName': '',
+          'provinceSn': undefined,
+          'citySn': undefined,
+          'districtSn': undefined,
+          'subareaSn': undefined,
+          'dealerLevel': undefined
+        }
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择调拨日期', trigger: 'change' }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      columns: [
+        { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 120, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
+        { title: '退货单号', dataIndex: 'salesReturnBillNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '省份', dataIndex: 'dealer.provinceName', width: 90, 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: 120, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '品牌',
+          align: 'center',
+          children: [
+            {
+              title: '箭牌',
+              align: 'center',
+              children: [
+                {
+                  title: '滤清器',
+                  dataIndex: 'jpLqqAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                },
+                {
+                  title: '雨刮片',
+                  dataIndex: 'jpYgpAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                },
+                {
+                  title: '喇叭',
+                  dataIndex: 'jpLbAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                },
+                {
+                  title: '刹车片',
+                  dataIndex: 'jpScpAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                },
+                {
+                  title: '感应线',
+                  dataIndex: 'jpGyxAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                }
+              ]
+            },
+            {
+              title: '冠牌',
+              align: 'center',
+              children: [
+                {
+                  title: '滤清器',
+                  dataIndex: 'gpLqqAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                },
+                {
+                  title: '雨刮片',
+                  dataIndex: 'gpYgpAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                },
+                {
+                  title: '刹车片',
+                  dataIndex: 'gpScpAmount',
+                  align: 'center',
+                  width: 80,
+                  customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+                }
+              ]
+            },
+            {
+              title: '汇箭',
+              dataIndex: 'hjAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '德路斯',
+              dataIndex: 'dlsAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '稳升',
+              dataIndex: 'wsAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: 'TBU',
+              dataIndex: 'tbuAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: 'TBU-P',
+              dataIndex: 'tbupAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '布瑞斯',
+              dataIndex: 'brsAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            }
+          ]
+        },
+        { title: '代理品牌',
+          align: 'center',
+          children: [
+            {
+              title: 'NGK',
+              dataIndex: 'ngkAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '飞利浦',
+              dataIndex: 'flpAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '车仆',
+              dataIndex: 'cpAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '瓦尔塔',
+              dataIndex: 'wetAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '雷贝斯托',
+              dataIndex: 'lbstAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '德尔福',
+              dataIndex: 'defAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            },
+            {
+              title: '巴诺德',
+              dataIndex: 'bndAmount',
+              align: 'center',
+              width: 80,
+              customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' }
+            }
+          ]
+        },
+        { title: '开单退货单合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? ('¥' + text) : '--' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) //  有分页
+        return reportSalesReturnThjdReportList(paramsPage).then(res => {
+          this.getCount(paramsPage)
+          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
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null,
+      addrProvinceList: [], //  省下拉
+      addrCityList: [], //  市下拉
+      addrDistrictList: [] //  区下拉
+    }
+  },
+  methods: {
+    //  导出
+    handleExport () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = _this.queryParam
+          delete params.time
+          _this.exportLoading = true
+          _this.spinning = true
+          hdExportExcel(reportSalesReturnThjdReportExport, params, '退货交单报表', function () {
+            _this.exportLoading = false
+            _this.spinning = false
+          })
+        } else {
+          return false
+        }
+      })
+    },
+    // 总计
+    getCount (params) {
+      reportSalesReturnThjdReportCount(params).then(res => {
+        if (res.status == 200 && res.data) {
+          this.totalData = res.data
+        } else {
+          this.totalData = null
+        }
+      })
+    },
+    handleSearch () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          _this.$refs.table.refresh(true)
+        } else {
+          return false
+        }
+      })
+    },
+    //  创建时间  change
+    dateChange (date) {
+      if (date[0] && date[1]) {
+        this.queryParam.time = date
+      } else {
+        this.queryParam.time = []
+      }
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.time = []
+      this.$refs.rangeDate.resetDate(this.queryParam.time)
+      this.queryParam.beginDate = ''
+      this.queryParam.endDate = ''
+      this.queryParam.salesReturnBillNo = ''
+      this.queryParam.dealer = {
+        'dealerName': '',
+        'provinceSn': undefined,
+        'citySn': undefined,
+        'districtSn': undefined,
+        'subareaSn': undefined,
+        'dealerLevel': undefined
+      }
+      this.totalData = null
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
+    },
+    // 获取城市列表
+    getCityList (val) {
+      this.addrCityList = []
+      this.addrDistrictList = []
+      this.queryParam.dealer.citySn = undefined
+      this.queryParam.dealer.districtSn = undefined
+      if (val) {
+        this.getArea('city', val)
+      }
+    },
+    // 获取区县列表
+    getAreaList (val) {
+      this.addrDistrictList = []
+      this.queryParam.dealer.districtSn = undefined
+      if (val) {
+        this.getArea('district', val)
+      }
+    },
+    //  省/市/区
+    getArea (leve, sn) {
+      let params
+      if (leve == 'province') {
+        params = { type: '2' }
+      } else {
+        params = { parentId: sn, type: leve == 'city' ? '3' : '4' }
+      }
+      getArea(params).then(res => {
+        if (res.status == 200) {
+          if (leve == 'province') {
+            this.addrProvinceList = res.data || []
+          } else if (leve == 'city') {
+            this.addrCityList = res.data || []
+          } else if (leve == 'district') {
+            this.addrDistrictList = res.data || []
+          }
+        } else {
+          if (leve == 'province') {
+            this.addrProvinceList = []
+          } else if (leve == 'city') {
+            this.addrCityList = []
+          } else if (leve == 'district') {
+            this.addrDistrictList = []
+          }
+        }
+      })
+    },
+    pageInit () {
+      this.getArea('province')
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.resetSearchForm()
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
+  }
+}
+</script>