lilei 1 dzień temu
rodzic
commit
10e298b7e5

+ 114 - 0
src/views/common/month.vue

@@ -0,0 +1,114 @@
+<template>
+  <div class="monthBox" style="display:flex;align-item:center;">
+    <a-month-picker
+      id="customerCountList-startValue"
+      :disabled-date="disabledStartDate"
+      format="YYYY-MM"
+      v-model="startValue"
+      placeholder="开始月份"
+      @openChange="handleStartOpenChange"
+    />
+    <span>~</span>
+    <a-month-picker
+      id="customerCountList-endValue"
+      :disabled-date="disabledEndDate"
+      format="YYYY-MM"
+      v-model="endValue"
+      placeholder="结束月份"
+      :open="endOpen"
+      @openChange="handleEndOpenChange"
+    />
+  </div>
+</template>
+
+<script>
+import moment from 'moment'
+export default {
+  props: {
+    value: {
+      type: Array,
+      default: () => []
+    }
+  },
+  data () {
+    return {
+      startValue: moment().format('YYYY-MM'),
+      endValue: moment().format('YYYY-MM'),
+      endOpen: false
+    }
+  },
+  watch: {
+    startValue (a, b) {
+      this.hanldChange(a ? moment(a).format('YYYY-MM') : '', this.endValue)
+    },
+    endValue (a, b) {
+      this.hanldChange(this.startValue, a ? moment(a).format('YYYY-MM') : '')
+    }
+  },
+  methods: {
+    // 统计月份  选择月份限制
+    disabledStartDate (current) {
+      const endValue = this.endValue
+      const md = moment(current).startOf('month').valueOf()
+      const cd = moment().startOf('month').valueOf() // 当前月份
+      if (!current || !endValue) {
+        return md > cd
+      }
+      const ed = moment(endValue).startOf('month').valueOf()
+      return md > ed || md > cd
+    },
+    disabledEndDate (current) {
+      const startValue = this.startValue
+      const md = moment(current).startOf('month').valueOf()
+      const cd = moment().startOf('month').valueOf() // 当前月份
+      if (!current || !startValue) {
+        return md > cd
+      }
+      const sd = moment(startValue).startOf('month').valueOf()
+      return md < sd || md > cd
+    },
+    // 开始时间
+    handleStartOpenChange (open) {
+      if (!open) {
+        this.endOpen = true
+      }
+    },
+    // 结束时间
+    handleEndOpenChange (open) {
+      this.endOpen = open
+    },
+    hanldChange (s, e) {
+      console.log(s, e)
+      const val = [s, e]
+      this.startValue = val[0]
+      this.endValue = val[1]
+      this.$emit('change', val)
+      this.$emit('input', val)
+    },
+    // 获取指定月份   第一天和最后一天
+    getMonthRange (targetMonth) {
+      // 获取指定月第一天(格式化为 YYYY-MM-DD)
+      const firstDay = moment(targetMonth).startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
+      // 获取指定月最后一天(格式化为 YYYY-MM-DD)
+      const lastDay = moment(targetMonth).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
+      return { firstDay, lastDay }
+    },
+    resetDate () {
+      this.startValue = moment().format('YYYY-MM')
+      this.endValue = moment().format('YYYY-MM')
+      this.hanldChange(this.startValue, this.endValue)
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+  .monthBox{
+    /deep/.ant-calendar-picker-icon{
+      display:none !important;
+    }
+    /deep/.ant-calendar-picker input{
+      text-align:center;
+    }
+  }
+</style>

+ 7 - 28
src/views/reportData/billingStatistics/customerCountList.vue

@@ -12,15 +12,7 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-model-item label="月份" required>
-                <a-range-picker
-                  id="customerCountList-monthBox"
-                  class="monthBox"
-                  :placeholder="['开始月份', '结束月份']"
-                  format="YYYY-MM"
-                  v-model="monthVal"
-                  :mode="mode"
-                  @panelChange="handlePanelChange"
-                />
+                <month ref="monthDate" id="customerCountList-monthBox" v-model="monthVal"></month>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -147,7 +139,6 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { hdExportExcel } from '@/libs/exportExcel'
-import moment from 'moment'
 // 组件
 import { STable, VSelect } from '@/components'
 import subarea from '@/views/common/subarea.js'
@@ -155,12 +146,13 @@ import AreaList from '@/views/common/areaList.js'
 import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import BizUser from '@/views/common/bizUser.js'
 import customerService from '@/views/common/customerService.vue'
+import month from '@/views/common/month.vue'
 // 接口
 import { salesStatsDealerList, salesStatsDealerCount, salesStatsDealerExport } from '@/api/reportData'
 export default {
   name: 'CustomerCountList',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser, customerService },
+  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser, customerService, month },
   props: {
     removeReportFlag: {
       type: [String, Number],
@@ -178,8 +170,7 @@ export default {
       advanced: true, // 高级搜索 展开/关闭
       tableHeight: 0, // 表格高度
       exportLoading: false, // 导出按钮加载状态
-      monthVal: [moment().format('YYYY-MM'), moment().format('YYYY-MM')], // 初始化月份值
-      mode: ['month', 'month'],
+      monthVal: [], // 初始化月份值
       //  查询条件
       queryParam: {
         beginDate: '', // 月份开始时间
@@ -206,8 +197,8 @@ export default {
         this.disabled = true
         this.spinning = true
         if (this.monthVal) {
-          this.queryParam.beginDate = this.getMonthRange(this.monthVal[0]).firstDay
-          this.queryParam.endDate = this.getMonthRange(this.monthVal[1]).lastDay
+          this.queryParam.beginDate = this.$refs.monthDate.getMonthRange(this.monthVal[0]).firstDay
+          this.queryParam.endDate = this.$refs.monthDate.getMonthRange(this.monthVal[1]).lastDay
         } else {
           this.queryParam.beginDate = undefined
           this.queryParam.endDate = undefined
@@ -262,18 +253,6 @@ export default {
     }
   },
   methods: {
-    handlePanelChange (value, mode) {
-      this.monthVal = value
-      this.mode = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
-    },
-    // 获取指定月份   第一天和最后一天
-    getMonthRange (targetMonth) {
-      // 获取指定月第一天(格式化为 YYYY-MM-DD)
-      const firstDay = moment(targetMonth).startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
-      // 获取指定月最后一天(格式化为 YYYY-MM-DD)
-      const lastDay = moment(targetMonth).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
-      return { firstDay, lastDay }
-    },
     // 获取表头
     async getTableTitle () {
       const _this = this
@@ -344,7 +323,7 @@ export default {
     resetSearchForm () {
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.monthVal = [moment().format('YYYY-MM'), moment().format('YYYY-MM')]
+      this.$refs.monthDate.resetDate()
       this.queryParam.provinceSn = undefined
       this.queryParam.citySn = undefined
       this.queryParam.districtSn = undefined

+ 19 - 30
src/views/reportData/billingStatistics/provinceCountList.vue

@@ -13,15 +13,7 @@
           <a-row :gutter="15">
             <a-col :md="4" :sm="24">
               <a-form-model-item label="月份" required>
-                <a-range-picker
-                  id="customerCountList-monthBox"
-                  class="monthBox"
-                  :placeholder="['开始月份', '结束月份']"
-                  format="YYYY-MM"
-                  v-model="monthVal"
-                  :mode="mode"
-                  @panelChange="handlePanelChange"
-                />
+                <month ref="monthDate" id="customerCountList-monthBox" v-model="monthVal"></month>
               </a-form-model-item>
             </a-col>
             <a-col :md="4" :sm="24">
@@ -39,6 +31,14 @@
                 <BizUser id="provinceCountList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
               </a-form-model-item>
             </a-col>
+            <a-col :md="4" :sm="24">
+              <a-form-model-item label="新/老客户">
+                <a-select id="customerCountList-dealerNewFlag" v-model="queryParam.dealerNewFlag" placeholder="请选择" allowClear>
+                  <a-select-option value="1">新客户</a-select-option>
+                  <a-select-option value="0">老客户</a-select-option>
+                </a-select>
+              </a-form-model-item>
+            </a-col>
             <a-col :md="4" :sm="24" v-if="removeReportFlag==1">
               <a-form-item label="业务类型">
                 <v-select
@@ -50,7 +50,7 @@
                   allowClear></v-select>
               </a-form-item>
             </a-col>
-            <a-col :md="4" :sm="24">
+            <a-col :md="removeReportFlag==1 ? 24 : 4" :style="{textAlign: removeReportFlag==1 ? 'center': ''}" :sm="24">
               <a-button
                 type="primary"
                 @click="handleSearch"
@@ -110,18 +110,18 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { hdExportExcel } from '@/libs/exportExcel'
-import moment from 'moment'
 // 组件
 import { STable, VSelect } from '@/components'
 import subarea from '@/views/common/subarea.js'
 import Area from '@/views/common/area.js'
 import BizUser from '@/views/common/bizUser.js'
+import month from '@/views/common/month.vue'
 // 接口
 import { salesStatsProvinceList, salesStatsProvinceCount, salesStatsProvinceExport } from '@/api/reportData'
 export default {
   name: 'ProvinceCountList',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, Area, BizUser },
+  components: { STable, VSelect, subarea, Area, BizUser, month },
   props: {
     removeReportFlag: {
       type: [String, Number],
@@ -138,8 +138,7 @@ export default {
       disabled: false, //  查询、重置按钮是否可操作
       tableHeight: 0, // 表格高度
       exportLoading: false, // 导出按钮加载状态
-      monthVal: [moment().format('YYYY-MM'), moment().format('YYYY-MM')], // 初始化月份值
-      mode: ['month', 'month'],
+      monthVal: [], // 初始化月份值
       //  查询条件
       queryParam: {
         beginDate: '', // 月份开始时间
@@ -150,7 +149,8 @@ export default {
           subareaAreaSn: '', // 分区
           bizUserSn: undefined// 区域负责人
         },
-        bizType: undefined // 业务类型
+        bizType: undefined, // 业务类型
+        dealerNewFlag: undefined // 新老客户
       },
       columns: [], // 表格列
       countLabel: null, // 统计名称合集
@@ -163,8 +163,8 @@ export default {
         this.disabled = true
         this.spinning = true
         if (this.monthVal) {
-          this.queryParam.beginDate = this.getMonthRange(this.monthVal[0]).firstDay
-          this.queryParam.endDate = this.getMonthRange(this.monthVal[1]).lastDay
+          this.queryParam.beginDate = this.$refs.monthDate.getMonthRange(this.monthVal[0]).firstDay
+          this.queryParam.endDate = this.$refs.monthDate.getMonthRange(this.monthVal[1]).lastDay
         } else {
           this.queryParam.beginDate = undefined
           this.queryParam.endDate = undefined
@@ -196,18 +196,6 @@ export default {
     }
   },
   methods: {
-    handlePanelChange (value, mode) {
-      this.monthVal = value
-      this.mode = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
-    },
-    // 获取指定月份   第一天和最后一天
-    getMonthRange (targetMonth) {
-      // 获取指定月第一天(格式化为 YYYY-MM-DD)
-      const firstDay = moment(targetMonth).startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
-      // 获取指定月最后一天(格式化为 YYYY-MM-DD)
-      const lastDay = moment(targetMonth).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
-      return { firstDay, lastDay }
-    },
     // 获取表头
     async getTableTitle () {
       const _this = this
@@ -267,12 +255,13 @@ export default {
     resetSearchForm () {
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.monthVal = [moment().format('YYYY-MM'), moment().format('YYYY-MM')]
+      this.$refs.monthDate.resetDate()
       this.queryParam.provinceSn = undefined
       this.queryParam.subareaArea.subareaSn = ''
       this.queryParam.subareaArea.subareaAreaSn = ''
       this.queryParam.subareaArea.bizUserSn = undefined
       this.queryParam.bizType = undefined
+      this.queryParam.dealerNewFlag = undefined
       this.$refs.subarea.clearData()
       this.totalData = null
       this.$refs.table.clearTable()

+ 8 - 29
src/views/reportData/newCustomSales/list.vue

@@ -12,15 +12,7 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-model-item label="销售月份" required>
-                <a-range-picker
-                  id="customerCountList-monthBox"
-                  class="monthBox"
-                  :placeholder="['开始月份', '结束月份']"
-                  format="YYYY-MM"
-                  v-model="monthVal"
-                  :mode="mode"
-                  @panelChange="handlePanelChange"
-                />
+                <month ref="monthDate" id="customerCountList-monthBox" v-model="monthVal"></month>
               </a-form-model-item>
             </a-col>
             <a-col :md="6" :sm="24">
@@ -142,7 +134,6 @@
 <script>
 import { commonMixin } from '@/utils/mixin'
 import { hdExportExcel } from '@/libs/exportExcel'
-import moment from 'moment'
 // 组件
 import { STable, VSelect } from '@/components'
 import subarea from '@/views/common/subarea.js'
@@ -151,12 +142,13 @@ import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
 import reportModal from '@/views/common/reportModal.vue'
 import BizUser from '@/views/common/bizUser.js'
 import customerService from '@/views/common/customerService.vue'
+import month from '@/views/common/month.vue'
 // 接口
 import { reportDealerNewLogList, reportDealerNewLogCount, reportDealerNewLogTitle, reportDealerNewLogExport } from '@/api/reportData'
 export default {
   name: 'CustomerCountList',
   mixins: [commonMixin],
-  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser, customerService, reportModal },
+  components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser, customerService, reportModal, month },
   data () {
     return {
       spinning: false,
@@ -165,8 +157,7 @@ export default {
       showExport: false,
       tableHeight: 0, // 表格高度
       exportLoading: false, // 导出按钮加载状态
-      monthVal: [moment().format('YYYY-MM'), moment().format('YYYY-MM')], // 初始化月份值
-      mode: ['month', 'month'],
+      monthVal: [], // 初始化月份值
       //  查询条件
       queryParam: {
         beginDate: '', // 月份开始时间
@@ -192,8 +183,8 @@ export default {
         this.disabled = true
         this.spinning = true
         if (this.monthVal) {
-          this.queryParam.beginDate = this.getMonthRange(this.monthVal[0]).firstDay
-          this.queryParam.endDate = this.getMonthRange(this.monthVal[1]).lastDay
+          this.queryParam.beginDate = this.$refs.monthDate.getMonthRange(this.monthVal[0]).firstDay
+          this.queryParam.endDate = this.$refs.monthDate.getMonthRange(this.monthVal[1]).lastDay
         } else {
           this.queryParam.beginDate = undefined
           this.queryParam.endDate = undefined
@@ -230,18 +221,6 @@ export default {
     }
   },
   methods: {
-    handlePanelChange (value, mode) {
-      this.monthVal = value
-      this.mode = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]]
-    },
-    // 获取指定月份   第一天和最后一天
-    getMonthRange (targetMonth) {
-      // 获取指定月第一天(格式化为 YYYY-MM-DD)
-      const firstDay = moment(targetMonth).startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
-      // 获取指定月最后一天(格式化为 YYYY-MM-DD)
-      const lastDay = moment(targetMonth).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
-      return { firstDay, lastDay }
-    },
     // 获取表头
     async getTableTitle () {
       const _this = this
@@ -313,7 +292,7 @@ export default {
     resetSearchForm () {
       this.queryParam.beginDate = ''
       this.queryParam.endDate = ''
-      this.monthVal = [moment().format('YYYY-MM'), moment().format('YYYY-MM')]
+      this.$refs.monthDate.resetDate()
       this.queryParam.provinceSn = undefined
       this.queryParam.citySn = undefined
       this.queryParam.districtSn = undefined
@@ -353,7 +332,7 @@ export default {
       const params = JSON.parse(JSON.stringify(_this.queryParam))
       _this.exportLoading = true
       _this.spinning = true
-      hdExportExcel(reportDealerNewLogExport, params, '新客户首笔销售统计', function () {
+      hdExportExcel(reportDealerNewLogExport, params, '新客户首笔销售统计(' + params.amountType === 'total_real_amount' ? '实售' : '开单' + ')', function () {
         _this.exportLoading = false
         _this.showExport = true
         _this.spinning = false

+ 11 - 1
src/views/reportData/promotionFeeReport/promoFeeList.vue

@@ -65,6 +65,14 @@
                   ></v-select>
                 </a-form-model-item>
               </a-col>
+              <a-col :md="4" :sm="24">
+                <a-form-model-item label="新/老客户">
+                  <a-select id="customerFeeList-dealerNewFlag" v-model="queryParam.dealerNewFlag" placeholder="请选择" allowClear>
+                    <a-select-option value="1">新客户</a-select-option>
+                    <a-select-option value="0">老客户</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </a-col>
             </template>
             <a-col :md="6" :sm="24">
               <a-button
@@ -168,7 +176,8 @@ export default {
           subareaSn: '', // 区域
           subareaAreaSn: '', // 分区
           bizUserSn: undefined// 区域负责人
-        }
+        },
+        dealerNewFlag: undefined
       },
       columns: [], // 表头
       countLabel: null, // 合计名称
@@ -322,6 +331,7 @@ export default {
       this.queryParam.subareaArea.subareaAreaSn = ''
       this.queryParam.subareaArea.bizUserSn = undefined
       this.queryParam.dealerLevel = undefined
+      this.queryParam.dealerNewFlag = undefined
       this.$refs.dealerSubareaScopeList.resetForm()
       if (this.advanced) {
         this.$refs.subarea && this.$refs.subarea.clearData()

+ 17 - 7
src/views/reportData/promotionFeeReport/provinceFeeList.vue

@@ -11,7 +11,7 @@
           :rules="rules"
           :model="queryParam">
           <a-row :gutter="15" type="flex">
-            <a-col :md="3" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-model-item label="月份" prop="beginDate">
                 <a-month-picker
                   id="provinceFeeList-monthBox"
@@ -22,22 +22,22 @@
                   @change="onChangeMonth" />
               </a-form-model-item>
             </a-col>
-            <a-col :md="3" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-model-item label="地区">
                 <Area id="provinceFeeList-areaList" v-model="queryParam.provinceSn" placeholder="请选择省份"></Area>
               </a-form-model-item>
             </a-col>
-            <a-col :md="5" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-item label="所在区域">
                 <subarea id="provinceFeeList-subarea" ref="subarea" @change="subareaChange"></subarea>
               </a-form-item>
             </a-col>
-            <a-col :md="3" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-model-item label="区域负责人">
                 <BizUser id="provinceFeeList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
               </a-form-model-item>
             </a-col>
-            <a-col :md="3" :sm="24">
+            <a-col :md="6" :sm="24">
               <a-form-model-item label="是否包含特价">
                 <v-select
                   v-model="queryParam.discountFlag"
@@ -48,7 +48,15 @@
                 ></v-select>
               </a-form-model-item>
             </a-col>
-            <a-col :md="7" :sm="24">
+            <a-col :md="6" :sm="24">
+              <a-form-model-item label="新/老客户">
+                <a-select id="customerFeeList-dealerNewFlag" v-model="queryParam.dealerNewFlag" placeholder="请选择" allowClear>
+                  <a-select-option value="1">新客户</a-select-option>
+                  <a-select-option value="0">老客户</a-select-option>
+                </a-select>
+              </a-form-model-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
               <a-button
                 type="primary"
                 @click="handleSearch"
@@ -127,7 +135,8 @@ export default {
           subareaSn: '', // 区域
           subareaAreaSn: '', // 分区
           bizUserSn: undefined// 区域负责人
-        }
+        },
+        dealerNewFlag: undefined
       },
       countLabel: null, // 统计名称合集
       totalData: null, // 统计数据
@@ -241,6 +250,7 @@ export default {
       this.queryParam.subareaArea.subareaAreaSn = ''
       this.queryParam.subareaArea.bizUserSn = undefined
       this.queryParam.discountFlag = '0'
+      this.queryParam.dealerNewFlag = undefined
       this.totalData = null
       this.$refs.subarea && this.$refs.subarea.clearData()
       this.$refs.areaList && this.$refs.areaList.clearData()

+ 3 - 1
src/views/reportData/promotionSalesOrderReport/list.vue

@@ -242,7 +242,8 @@ export default {
         productBrand: undefined, // 产品品牌
         productTypeSn1: '', //  产品一级分类
         productType: '', //  产品二级分类
-        dealerLevel: undefined// 客户等级
+        dealerLevel: undefined, // 客户等级
+        dealerNewFlag: undefined
       },
       productType: [], // 产品分类
       form: {
@@ -446,6 +447,7 @@ export default {
       this.queryParam.productTypeSn1 = undefined
       this.queryParam.productType = undefined
       this.queryParam.dealerLevel = undefined
+      this.queryParam.dealerNewFlag = undefined
 
       this.productType = []
       this.totalData = null

+ 3 - 1
src/views/reportData/salesSlipReport/list.vue

@@ -181,7 +181,8 @@ export default {
           subareaAreaSn: undefined, // 分区
           bizUserSn: undefined// 区域负责人
         },
-        bizUserSn: undefined// 客服
+        bizUserSn: undefined, // 客服
+        dealerNewFlag: undefined
       },
       columns: [], // 表格列
       countLabel: [], // 统计品牌数据
@@ -308,6 +309,7 @@ export default {
       this.queryParam.subareaArea.bizUserSn = undefined
       this.queryParam.dealerLevel = undefined
       this.queryParam.bizUserSn = undefined
+      this.queryParam.dealerNewFlag = undefined
       this.totalData = null
       if (this.advanced) {
         this.$refs.subarea.clearData()