Browse Source

经营分析报表

lilei 6 months ago
parent
commit
b2a2e3ff7f
4 changed files with 72 additions and 33 deletions
  1. 27 0
      src/api/reportData.js
  2. 7 0
      src/libs/getDate.js
  3. 36 31
      src/views/reportData/regionTypeBusinessReport/list.vue
  4. 2 2
      vue.config.js

+ 27 - 0
src/api/reportData.js

@@ -1390,3 +1390,30 @@ export const brandTypeReportExport = (params) => {
     }
   })
 }
+
+// 经营分析报表
+export const manageAnalysisReportQuery = (params) => {
+  const url = `/report/manageAnalysis/query`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post',
+    headers: {
+      'module': encodeURIComponent('各品类经营分析报表查询')
+    }
+  })
+}
+// 经营分析报表导出
+export const manageAnalysisReportExport = (params) => {
+  return axios({
+    url: '/report/manageAnalysis/export',
+    data: params,
+    method: 'post',
+    responseType: 'blob',
+    headers: {
+      'module': encodeURIComponent('各品类经营分析报表导出')
+    }
+  })
+}

+ 7 - 0
src/libs/getDate.js

@@ -136,6 +136,13 @@ export default {
     obj.endtime = moment(moment().month(moment().month() - 2).endOf('month').valueOf()).format('YYYY-MM-DD 23:59:59')
     return obj
   },
+  // 获取某年某个月的开始和结束时间
+  getBeDateByMonth (str) {
+    return {
+      	beginDate: moment(str).startOf('month').format('YYYY-MM-DD 00:00:00'),
+      	endDate: moment(str).endOf('month').format('YYYY-MM-DD 23:59:59')
+    }
+  },
   // 获取某一年的开始和结束时间
   getBeDateByYear (year) {
     return {

+ 36 - 31
src/views/reportData/regionTypeBusinessReport/list.vue

@@ -29,7 +29,7 @@
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-model-item label="地区">
-                <Area id="regionTypeBusinessReportList-areaList" v-model="queryParam.dealerEntity.provinceSn" placeholder="请选择省份"></Area>
+                <Area id="regionTypeBusinessReportList-areaList" v-model="queryParam.provinceSn" @change="areaChange" placeholder="请选择省份"></Area>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -90,8 +90,9 @@ import { STable, VSelect } from '@/components'
 import Area from '@/views/common/area.js'
 import reportModal from '@/views/common/reportModal.vue'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+import getDate from '@/libs/getDate'
 // 接口
-import { tireFeeReportList, tireFeeListExport } from '@/api/reportData'
+import { manageAnalysisReportQuery, manageAnalysisReportExport } from '@/api/reportData'
 export default {
   name: 'RegionTypeBusinessReportList',
   mixins: [commonMixin],
@@ -107,13 +108,12 @@ export default {
       monthVal: moment().format('YYYY-MM'), // 初始化月份值
       //  查询条件
       queryParam: {
-        queryType: 'month', // 月度
         queryDate: moment().format('YYYYMM'), // 选择月份
-        customSn: undefined, // 客户sn
-        dealerEntity: {
-          dealerName: undefined, // 客户名称
-          provinceSn: undefined // 省
-        }
+        beginDate: getDate.getCurrLastMonthDays().starttime, // 开始日期
+        endDate: getDate.getCurrLastMonthDays().endtime, // 结束日期
+        dealerName: undefined, // 客户名称
+        provinceName: undefined, // 省
+        provinceSn: undefined
       },
       rules: {
         'queryDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
@@ -122,17 +122,13 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        const params = Object.assign(parameter, this.queryParam)
+        const { beginDate, endDate, dealerName, provinceName } = this.queryParam
+        const params = Object.assign(parameter, { beginDate, endDate, dealerName, provinceName })
         // 获取列表数据  有分页
-        return tireFeeReportList(params).then(res => {
+        return manageAnalysisReportQuery(params).then(res => {
           let data
           if (res.status == 200) {
             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
@@ -155,14 +151,14 @@ export default {
   computed: {
     columns () {
       const arr = [
-        { title: '类别', dataIndex: 'subareaArea.subareaName', width: '20%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
-        { title: '成本', dataIndex: 'dealerEntity.dealerName', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
-        { title: '销售额', dataIndex: 'dealerEntity.dealerLevelDictValue', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
-        { title: '毛利', dataIndex: 'parentDealerEntity.dealerName', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
-        { title: '毛利率', dataIndex: 'increaseRewardAmount', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '促销费用', dataIndex: 'increaseRewardShareFactory', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '减促销费用的毛利', dataIndex: 'serviceAmountSys', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '促销费用占比', dataIndex: 'serviceAmountProvince', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
+        { title: '类别', dataIndex: 'category', width: '20%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '成本', dataIndex: 'cost', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '销售额', dataIndex: 'amount', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '毛利', dataIndex: 'gross', width: '10%', align: 'center', customRender: function (text) { return (text || text == 0) || '--' } },
+        { title: '毛利率', dataIndex: 'grossMargin', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '促销费用', dataIndex: 'promo', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '减促销费用的毛利', dataIndex: 'removePromoGross', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '促销费用占比', dataIndex: 'promoRatio', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } }
       ]
       return arr
     }
@@ -177,8 +173,13 @@ export default {
       this.monthVal = dateString
       if (date && dateString != '') {
         this.queryParam.queryDate = dateString.replace('-', '')
+        const { beginDate, endDate } = getDate.getBeDateByMonth(dateString)
+        this.queryParam.beginDate = beginDate
+        this.queryParam.endDate = endDate
       } else {
         this.queryParam.queryDate = void 0
+        this.queryParam.beginDate = undefined
+        this.queryParam.endDate = undefined
       }
     },
     // 查询
@@ -195,17 +196,21 @@ export default {
     },
     // 客户名称 change
     custChange (val) {
-      this.queryParam.dealerEntity.dealerName = val.name
-      this.queryParam.customSn = val.key
+      this.queryParam.dealerName = val.name
+    },
+    // 地区
+    areaChange (val, item) {
+      this.queryParam.provinceName = item.name
     },
     //  重置
     resetSearchForm () {
-      this.queryParam.queryType = 'month'
       this.monthVal = moment().format('YYYY-MM')
       this.queryParam.queryDate = moment().format('YYYYMM')
-      this.queryParam.dealerEntity.provinceSn = undefined
-      this.queryParam.dealerEntity.dealerName = undefined
-      this.queryParam.customSn = undefined
+      this.queryParam.provinceName = undefined
+      this.queryParam.provinceSn = undefined
+      this.queryParam.dealerName = undefined
+      this.queryParam.beginDate = getDate.getCurrLastMonthDays().starttime
+      this.queryParam.endDate = getDate.getCurrLastMonthDays().endtime
       if (this.$refs.dealerSubareaScopeList) {
         this.$refs.dealerSubareaScopeList.resetForm()
       }
@@ -219,7 +224,7 @@ export default {
         if (valid) {
           _this.exportList()
         } else {
-          _this.$message.error('请选择查询月份')
+          _this.$message.error('请选择月份')
           return false
         }
       })
@@ -231,7 +236,7 @@ export default {
       _this.exportLoading = true
       _this.spinning = true
       _this.showExport = true
-      hdExportExcel(tireFeeListExport, params, '各品类经营分析表-' + this.monthVal, function () {
+      hdExportExcel(manageAnalysisReportExport, params, '各品类经营分析表-' + this.monthVal, function () {
         _this.exportLoading = false
         _this.spinning = false
       })

+ 2 - 2
vue.config.js

@@ -108,9 +108,9 @@ const vueConfig = {
     // If you want to turn on the proxy, please remosve the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.2.103:8602/ocs-admin',
+        target: 'http://192.168.2.131/ocs-admin',
         // target: 'https://t.ocs.360arrow.com/ocs-admin', //  练习
-        target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
+        // target: 'https://p.ocs.360arrow.com/ocs-admin', //  预发布
         ws: false,
         changeOrigin: true,
         pathRewrite: {