Pārlūkot izejas kodu

销售(开单统计)报表

chenrui 3 gadi atpakaļ
vecāks
revīzija
b41b2be4a7

+ 28 - 0
src/api/reportData.js

@@ -251,3 +251,31 @@ export const reportSalesBillDetailExport = (params) => {
     responseType: 'blob'
   })
 }
+//  销售(开单统计)报表
+export const reportSalesBillList = (params) => {
+  const url = `/report/reportSales/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+//  销售(开单统计)报表  合计
+export const reportSalesBillCount = (params) => {
+  return axios({
+    url: '/report/reportSales/queryCount',
+    data: params,
+    method: 'post'
+  })
+}
+// 销售(开单统计)报表 导出
+export const reportSalesBillExport = (params) => {
+  return axios({
+    url: '/report/reportSales/exportExcel',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}

+ 26 - 1
src/config/router.config.js

@@ -771,7 +771,7 @@ export const asyncRouterMap = [
       // 报表
       {
         path: '/reportData',
-        redirect: '/reportData/countryTypeProvinceSalesDetails',
+        redirect: '/reportData/salesOrderTotal',
         component: PageView,
         meta: {
           title: '报表',
@@ -779,6 +779,31 @@ export const asyncRouterMap = [
           permission: 'M_reportData'
         },
         children: [
+          {
+            path: '/reportData/salesOrderTotal',
+            redirect: '/reportData/salesOrderTotal/list',
+            name: 'salesOrderTotal',
+            component: BlankLayout,
+            meta: {
+              title: '销售(开单统计)',
+              icon: 'profile',
+              permission: 'M_salesOrderTotalList'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'salesOrderTotalList',
+                component: () => import(/* webpackChunkName: "reportData" */ '@/views/reportData/salesOrderTotal/list.vue'),
+                meta: {
+                  title: '销售(开单统计)列表',
+                  icon: 'profile',
+                  hidden: true,
+                  permission: 'M_salesOrderTotalList'
+                }
+              }
+            ]
+          },
           {
             path: '/reportData/salesDetails',
             redirect: '/reportData/salesDetails/list',

+ 1 - 0
src/views/reportData/salesDetails/list.vue

@@ -122,6 +122,7 @@
                 @click="handleExport"
                 :disabled="disabled"
                 :loading="exportLoading"
+                v-if="$hasPermissions('B_salesDetailsExport')"
                 id="salesDetailsList-export">导出</a-button>
               <a @click="advanced=!advanced" style="margin-left: 5px">
                 {{ advanced ? '收起' : '展开' }}

+ 353 - 0
src/views/reportData/salesOrderTotal/list.vue

@@ -0,0 +1,353 @@
+<template>
+  <a-card size="small" :bordered="false" class="salesOrderTotalList-wrap">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <!-- 搜索条件 -->
+      <div class="table-page-search-wrapper">
+        <a-form-model
+          id="salesOrderTotalList-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">
+                <rangeDateTime ref="rangeDate" :value="queryParam.time" @change="dateChange" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="销售单号">
+                <a-input id="salesOrderTotalList-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入退货单号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="5" :sm="24">
+              <a-form-model-item label="客户名称">
+                <a-input id="salesOrderTotalList-dealerName" v-model.trim="queryParam.dealerName" allowClear placeholder="请输入客户名称"/>
+              </a-form-model-item>
+            </a-col>
+            <template v-if="advanced">
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="客户级别">
+                  <v-select
+                    v-model="queryParam.dealerLevel"
+                    ref="dealerLevel"
+                    id="salesOrderTotalList-dealerLevel"
+                    code="DEALER_LEVEL"
+                    placeholder="请选择客户级别"
+                    allowClear></v-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-model-item label="操作员">
+                  <a-select
+                    id="salesOrderTotalList-creatorId"
+                    allowClear
+                    v-model="queryParam.creatorId"
+                    placeholder="请选择操作员"
+                    :showSearch="true"
+                    option-filter-prop="children"
+                    :filter-option="filterOption">
+                    <a-select-option v-for="item in operatorList" :key="item.sn" :value="item.sn">{{ item.name }}</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="5" :sm="24">
+                <a-form-model-item label="所在区域">
+                  <subarea id="salesOrderTotalList-subareaSn" v-model="queryParam.subareaSn"></subarea>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="5" :sm="24">
+                <a-form-model-item label="地区">
+                  <a-form-model-item prop="dealerProvinceSn" style="margin: 0;">
+                    <a-select v-model="queryParam.dealerProvinceSn" allowClear placeholder="请选择省">
+                      <a-select-option v-for="item in addrProvinceList" :value="item.id" :key="item.id + 'a'">{{ item.name }}</a-select-option>
+                    </a-select>
+                  </a-form-model-item>
+                </a-form-model-item>
+              </a-col>
+            </template>
+            <a-col :md="8" :sm="24" style="margin-bottom: 10px;">
+              <a-button
+                type="primary"
+                class="button-info"
+                size="small"
+                @click="handleStock"
+                id="salesOrderTotalList-stockDate">盘点区间日期</a-button>
+              <a-button style="margin-left: 5px" type="primary" @click="handleSearch" :disabled="disabled" id="salesOrderTotalList-refresh">查询</a-button>
+              <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="salesOrderTotalList-reset">重置</a-button>
+              <a-button
+                style="margin-left: 10px"
+                type="primary"
+                class="button-warning"
+                @click="handleExport"
+                :disabled="disabled"
+                :loading="exportLoading"
+                v-if="$hasPermissions('B_salesOrderTotalExport')"
+                id="salesOrderTotalList-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"
+        :rowKey="(record) => record.id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ x: 2110 }"
+        :defaultLoadData="false"
+        bordered>
+        <template slot="footer">
+          <a-row :gutter="15">
+            <a-col :md="4" :sm="24">
+              数量:{{ (totalData && (totalData.totalQty || totalData.totalQty==0)) ? totalData.totalQty : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              实售价:{{ (totalData && (totalData.totalRealSaleAmount || totalData.totalRealSaleAmount==0)) ? totalData.totalRealSaleAmount : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              开单价:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? totalData.totalAmount : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              成本:{{ (totalData && (totalData.totalCost || totalData.totalCost==0)) ? totalData.totalCost : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              毛利:{{ (totalData && (totalData.grossProfit || totalData.grossProfit==0)) ? totalData.grossProfit : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              返利:{{ (totalData && (totalData.rebateAmount || totalData.rebateAmount==0)) ? totalData.rebateAmount : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              折扣金额:{{ (totalData && (totalData.totalDiscountAmount || totalData.totalDiscountAmount==0)) ? totalData.totalDiscountAmount : '--' }}
+            </a-col>
+            <a-col :md="4" :sm="24">
+              折后金额:{{ (totalData && (totalData.totalDiscountedAmount || totalData.totalDiscountedAmount==0)) ? totalData.totalDiscountedAmount : '--' }}
+            </a-col>
+          </a-row>
+        </template>
+      </s-table>
+    </a-spin>
+  </a-card>
+</template>
+
+<script>
+import getDate from '@/libs/getDate.js'
+import { STable, VSelect } from '@/components'
+import rangeDateTime from '@/views/common/rangeDateTime.vue'
+import subarea from '@/views/common/subarea.js'
+import custList from '@/views/common/custList.vue'
+import { getArea } from '@/api/data'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { userQueryList } from '@/api/power-user'
+import { reportSalesBillList, reportSalesBillCount, reportSalesBillExport } from '@/api/reportData'
+export default {
+  components: { STable, VSelect, rangeDateTime, custList, subarea },
+  data () {
+    return {
+      spinning: false,
+      advanced: false, // 高级搜索 展开/关闭
+      tableHeight: 0,
+      queryParam: { //  查询条件
+        time: [
+          getDate.getCurrMonthDays().starttime,
+          getDate.getCurrMonthDays().endtime
+        ],
+        beginDate: getDate.getCurrMonthDays().starttime,
+        endDate: getDate.getCurrMonthDays().endtime,
+        salesBillNo: '',
+        dealerName: '',
+        dealerLevel: undefined,
+        creatorId: undefined,
+        subareaSn: undefined,
+        dealerProvinceSn: undefined
+      },
+      rules: {
+        'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
+      },
+      disabled: false, //  查询、重置按钮是否可操作
+      exportLoading: false,
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 60, align: 'center', fixed: 'left' },
+        { title: '销售单号', dataIndex: 'salesBillNo', width: 160, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '开单日期', dataIndex: 'createDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售日期', dataIndex: 'auditDate', width: 130, align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'dealerName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '客户级别', dataIndex: 'dealerLevelDictValue', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '直接绑定客户名称', dataIndex: 'directDealerName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '间接绑定客户名称', dataIndex: 'indirectDealerName', width: 150, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '总数量', dataIndex: 'totalQty', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '实售价', dataIndex: 'totalRealSaleAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '开单价', dataIndex: 'totalAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '成本价', dataIndex: 'totalCost', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '毛利', dataIndex: 'grossProfit', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '省级价', dataIndex: 'totalProvinceAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '市级价', dataIndex: 'totalCityAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '特约加盟店价', dataIndex: 'totalSpecialAmount', width: 90, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '直接差价', dataIndex: 'directRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '间接差价', dataIndex: 'indirectRebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '返利', dataIndex: 'rebateAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '折扣金额', dataIndex: 'totalDiscountAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '折后金额', dataIndex: 'totalDiscountedAmount', width: 70, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '操作员', dataIndex: 'operatorName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        const params = Object.assign(parameter, this.queryParam)
+        delete params.time
+        return reportSalesBillList(params).then(res => {
+          this.getCount(params)
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.disabled = false
+          this.spinning = false
+          return data
+        })
+      },
+      totalData: null,
+      operatorList: [], //  操作员下拉数据
+      addrProvinceList: [] //  省下拉
+    }
+  },
+  methods: {
+    // 盘点库存日期
+    handleStock () {
+      this.$message.info('无盘点区间的起始/终止时间,请自行选择日期区间查询!')
+    },
+    // 总计
+    getCount (params) {
+      reportSalesBillCount(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) {
+      this.queryParam.time = date
+      this.queryParam.beginDate = date[0] || ''
+      this.queryParam.endDate = date[1] || ''
+    },
+    custChange (val) {
+      this.queryParam.dealerSn = val.key
+    },
+    //  重置
+    resetSearchForm () {
+      this.queryParam.time = [
+        getDate.getCurrMonthDays().starttime,
+        getDate.getCurrMonthDays().endtime
+      ]
+      this.$refs.rangeDate.resetDate(this.queryParam.time)
+      this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrMonthDays().endtime
+      this.queryParam.salesBillNo = ''
+      this.queryParam.dealerName = ''
+      this.queryParam.dealerLevel = undefined
+      this.queryParam.creatorId = undefined
+      this.queryParam.subareaSn = undefined
+      this.queryParam.dealerProvinceSn = undefined
+      this.totalData = null
+      this.$refs.ruleForm.resetFields()
+      this.$refs.table.clearTable()
+    },
+    //  导出
+    handleExport () {
+      const _this = this
+      const params = this.queryParam
+      this.exportLoading = true
+      this.spinning = true
+      hdExportExcel(reportSalesBillExport, params, '销售(开单统计)报表', function () {
+        _this.exportLoading = false
+        _this.spinning = false
+      })
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    // 操作员
+    getUserList () {
+      userQueryList({}).then(res => {
+        if (res.status == 200) {
+          this.operatorList = res.data
+        } else {
+          this.operatorList = []
+        }
+      })
+    },
+    //  省/市/区
+    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.getUserList()
+      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>