Browse Source

feature(订单管理系统):
1、跟进时间范围修改

niezch 2 years ago
parent
commit
b292a6b911

+ 8 - 42
src/views/customer/follow.vue

@@ -3,7 +3,7 @@
  * @Date: 2022-12-15 15:38:21
 
  * @LastEditors: niezch@dashoo.cn
- * @LastEditTime: 2023-03-29 15:00:46
+ * @LastEditTime: 2023-04-03 13:49:41
  * @Description: file content
  * @FilePath: \opms_frontend\src\views\customer\follow.vue
 -->
@@ -55,7 +55,8 @@
           range-separator="至"
           start-placeholder="跟进开始时间"
           style="width: 100%"
-          type="daterange" />
+          type="daterange"
+          value-format="yyyy-MM-dd" />
       </el-col>
       <el-col :span="4">
         <el-button icon="el-icon-plus" type="primary" @click="search">查询</el-button>
@@ -155,7 +156,7 @@
           targetId: '',
           managerId: '',
           daysBeforeToday: 20,
-          date: [new Date(this.getLastMonth(new Date())), new Date()],
+          date: [],
           followType: '',
         },
         loadFlag: true,
@@ -197,18 +198,6 @@
       this.getFollowOptions()
     },
     methods: {
-      getLastMonth(date) {
-        const now = new Date(date)
-        const year = now.getFullYear()
-        const month = now.getMonth() + 1
-        const day = now.getDate()
-        const nowMonthDay = new Date(year, month, 0).getDate() // 当前月的总天数
-        if (month - 1 <= 0) return year - 1 + '-' + 12 + '-' + day // 如果是1月,年数往前推一年
-        const lastMonthDay = new Date(year, parseInt(month) - 1, 0).getDate()
-        if (lastMonthDay >= day) return year + '-' + (month - 1) + '-' + day
-        if (day < nowMonthDay) return year + '-' + (month - 1) + '-' + (lastMonthDay - (nowMonthDay - day)) // 1个月前所在月的总天数小于现在的天日期
-        return year + '-' + (month - 1) + '-' + lastMonthDay // 当前天日期小于当前月总天数
-      },
       getOptions() {
         Promise.all([this.getDicts('follow_target_type')])
           .then(([targetType]) => {
@@ -230,22 +219,10 @@
       },
       async fetchData() {
         let params = { ...this.queryForm }
-        let _this = this
-
-        let CreateOn = []
-        if (!_this.queryForm.date) {
-          _this.queryForm.date = []
-        }
-        // 解析时间
-        if (_this.queryForm.date.length === 2) {
-          _this.queryForm.date[1].setHours(23)
-          _this.queryForm.date[1].setMinutes(59)
-          _this.queryForm.date[1].setSeconds(59)
-          CreateOn.push(_this.formatDateTime(_this.queryForm.date[0]))
-          CreateOn.push(_this.formatDateTime(_this.queryForm.date[1]))
+        if (this.queryForm.date && this.queryForm.date.length === 2) {
+          params.beginTime = this.queryForm.date[0]
+          params.endTime = this.queryForm.date[1]
         }
-        params['CreateOn'] = CreateOn.join(',')
-
         const [err, res] = await to(api.getListByDay(params))
         if (err) return console.log(err, 'err')
         this.records = res.data.list || []
@@ -272,7 +249,7 @@
           targetId: '',
           managerId: '',
           daysBeforeToday: 20,
-          date: [new Date(this.getLastMonth(new Date())), new Date()],
+          date: [],
           followType: '',
         }
         this.fetchData()
@@ -305,17 +282,6 @@
           })
         }
       },
-      formatDateTime(date) {
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? '0' + m : m
-        var d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var h = date.getHours()
-        var minute = date.getMinutes()
-        minute = minute < 10 ? '0' + minute : minute
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
-      },
       // 详情
       showDetail(row) {
         this.$refs.followDetail.init({ ...row })

+ 8 - 41
src/views/customer/followsell.vue

@@ -2,7 +2,7 @@
  * @Author: wanglj 471442253@qq.com
  * @Date: 2022-12-15 15:38:21
  * @LastEditors: niezch@dashoo.cn
- * @LastEditTime: 2023-03-29 15:02:12
+ * @LastEditTime: 2023-04-03 13:50:53
  * @Description: file content
  * @FilePath: \opms_frontend\src\views\customer\followsell.vue
 -->
@@ -46,7 +46,8 @@
           range-separator="至"
           start-placeholder="跟进开始时间"
           style="width: 100%"
-          type="daterange" />
+          type="daterange"
+          value-format="yyyy-MM-dd" />
       </el-col>
       <el-col :span="4">
         <el-button icon="el-icon-plus" type="primary" @click="search">查询</el-button>
@@ -146,7 +147,7 @@
           targetId: '',
           managerId: '',
           daysBeforeToday: 20,
-          date: [new Date(this.getLastMonth(new Date())), new Date()],
+          date: [],
           followType: '',
         },
         loadFlag: true,
@@ -188,18 +189,6 @@
       this.getFollowOptions()
     },
     methods: {
-      getLastMonth(date) {
-        const now = new Date(date)
-        const year = now.getFullYear()
-        const month = now.getMonth() + 1
-        const day = now.getDate()
-        const nowMonthDay = new Date(year, month, 0).getDate() // 当前月的总天数
-        if (month - 1 <= 0) return year - 1 + '-' + 12 + '-' + day // 如果是1月,年数往前推一年
-        const lastMonthDay = new Date(year, parseInt(month) - 1, 0).getDate()
-        if (lastMonthDay >= day) return year + '-' + (month - 1) + '-' + day
-        if (day < nowMonthDay) return year + '-' + (month - 1) + '-' + (lastMonthDay - (nowMonthDay - day)) // 1个月前所在月的总天数小于现在的天日期
-        return year + '-' + (month - 1) + '-' + lastMonthDay // 当前天日期小于当前月总天数
-      },
       getOptions() {
         Promise.all([this.getDicts('follow_target_type')])
           .then(([targetType]) => {
@@ -221,21 +210,10 @@
       },
       async fetchData() {
         let params = { ...this.queryForm }
-        let _this = this
-
-        let CreateOn = []
-        if (!_this.queryForm.date) {
-          _this.queryForm.date = []
+        if (this.queryForm.date && this.queryForm.date.length === 2) {
+          params.beginTime = this.queryForm.date[0]
+          params.endTime = this.queryForm.date[1]
         }
-        // 解析时间
-        if (_this.queryForm.date.length === 2) {
-          _this.queryForm.date[1].setHours(23)
-          _this.queryForm.date[1].setMinutes(59)
-          _this.queryForm.date[1].setSeconds(59)
-          CreateOn.push(_this.formatDateTime(_this.queryForm.date[0]))
-          CreateOn.push(_this.formatDateTime(_this.queryForm.date[1]))
-        }
-        params['CreateOn'] = CreateOn.join(',')
         params['Sell'] = '1'
         const [err, res] = await to(api.getListByDay(params))
         if (err) return console.log(err, 'err')
@@ -263,7 +241,7 @@
           targetId: '',
           managerId: '',
           daysBeforeToday: 20,
-          date: [new Date(this.getLastMonth(new Date())), new Date()],
+          date: [],
           followType: '',
         }
         this.fetchData()
@@ -296,17 +274,6 @@
           })
         }
       },
-      formatDateTime(date) {
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? '0' + m : m
-        var d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var h = date.getHours()
-        var minute = date.getMinutes()
-        minute = minute < 10 ? '0' + minute : minute
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
-      },
       // 详情
       showDetail(row) {
         this.$refs.followDetail.init({ ...row })

+ 8 - 40
src/views/customer/list.vue

@@ -2,7 +2,7 @@
  * @Author: wanglj 471442253@qq.com
  * @Date: 2022-12-26 16:34:37
  * @LastEditors: niezch@dashoo.cn
- * @LastEditTime: 2023-03-29 14:42:13
+ * @LastEditTime: 2023-04-03 13:51:12
  * @Description: file content
  * @FilePath: \opms_frontend\src\views\customer\list.vue
 -->
@@ -66,7 +66,8 @@
           range-separator="至"
           start-placeholder="跟进开始时间"
           style="width: 100%"
-          type="daterange" />
+          type="daterange"
+          value-format="yyyy-MM-dd" />
       </el-col>
       <el-col :span="4">
         <el-button icon="el-icon-plus" type="primary" @click="handleSearch">查询</el-button>
@@ -211,7 +212,7 @@
           pageSize: 10,
           isPublic: false,
           salesName: '',
-          followUpDate: [new Date(this.getLastMonth(new Date())), new Date()],
+          followUpDate: [],
           custProvince: '',
           custCity: '',
           province: {},
@@ -328,29 +329,6 @@
       this.fetchData()
     },
     methods: {
-      formatDateTime(date) {
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? '0' + m : m
-        var d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var h = date.getHours()
-        var minute = date.getMinutes()
-        minute = minute < 10 ? '0' + minute : minute
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
-      },
-      getLastMonth(date) {
-        const now = new Date(date)
-        const year = now.getFullYear()
-        const month = now.getMonth() + 1
-        const day = now.getDate()
-        const nowMonthDay = new Date(year, month, 0).getDate() // 当前月的总天数
-        if (month - 1 <= 0) return year - 1 + '-' + 12 + '-' + day // 如果是1月,年数往前推一年
-        const lastMonthDay = new Date(year, parseInt(month) - 1, 0).getDate()
-        if (lastMonthDay >= day) return year + '-' + (month - 1) + '-' + day
-        if (day < nowMonthDay) return year + '-' + (month - 1) + '-' + (lastMonthDay - (nowMonthDay - day)) // 1个月前所在月的总天数小于现在的天日期
-        return year + '-' + (month - 1) + '-' + lastMonthDay // 当前天日期小于当前月总天数
-      },
       getOptions() {
         Promise.all([
           api.getProvinceDetail(),
@@ -380,20 +358,10 @@
       async fetchData() {
         this.listLoading = true
         const params = { ...this.queryForm }
-        let _this = this
-        let CreateOn = []
-        if (!_this.queryForm.followUpDate) {
-          _this.queryForm.followUpDate = []
-        }
-        // 解析时间
-        if (_this.queryForm.followUpDate.length === 2) {
-          _this.queryForm.followUpDate[1].setHours(23)
-          _this.queryForm.followUpDate[1].setMinutes(59)
-          _this.queryForm.followUpDate[1].setSeconds(59)
-          CreateOn.push(_this.formatDateTime(_this.queryForm.followUpDate[0]))
-          CreateOn.push(_this.formatDateTime(_this.queryForm.followUpDate[1]))
+        if (this.queryForm.followUpDate && this.queryForm.followUpDate.length === 2) {
+          params.beginTime = this.queryForm.followUpDate[0]
+          params.endTime = this.queryForm.followUpDate[1]
         }
-        params['CreateOn'] = CreateOn.join(',')
         params.custProvince = params.province.distName ? params.province.distName : ''
         const [err, res] = await to(api.getList(params))
         if (err) return (this.listLoading = false)
@@ -430,7 +398,7 @@
           custName: '', //客户名称
           indusTry: '', // 客户类型  ()
           salesName: '',
-          followUpDate: [new Date(this.getLastMonth(new Date())), new Date()],
+          followUpDate: [],
           custProvince: '',
           custCity: '',
           province: {},

+ 16 - 46
src/views/customer/openSea.vue

@@ -61,19 +61,22 @@
           </el-form-item> -->
           <el-form-item>
             <!-- <el-date-picker
-              v-model="queryForm.followUpDate"
-              placeholder="最后跟进时间"
-              style="width: 100%"
-              type="date"
-
-              value-format="yyyy-MM-dd" /> -->
+          v-model="queryForm.followUpDate"
+          end-placeholder="跟进结束时间"
+          placeholder="时间范围"
+          start-placeholder="跟进开始时间"
+          style="width: 100%"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+          @keyup.enter.native="fetchData" /> -->
             <el-date-picker
               v-model="queryForm.followUpDate"
               end-placeholder="跟进结束时间"
               range-separator="至"
               start-placeholder="跟进开始时间"
               style="width: 100%"
-              type="daterange" />
+              type="daterange"
+              value-format="yyyy-MM-dd" />
           </el-form-item>
           <el-form-item>
             <el-button icon="el-icon-plus" type="primary" @click="handleSearch">查询</el-button>
@@ -230,7 +233,7 @@
           custName: '', //客户名称
           custIndustry: '', // 客户类型  ()
           custLevel: '', //客户级别
-          followUpDate: [new Date(this.getLastMonth(new Date())), new Date()], //最后跟进时间
+          followUpDate: [], //最后跟进时间
           isPublic: true,
           custProvince: '',
           province: {},
@@ -345,18 +348,6 @@
       this.getOptions()
     },
     methods: {
-      getLastMonth(date) {
-        const now = new Date(date)
-        const year = now.getFullYear()
-        const month = now.getMonth() + 1
-        const day = now.getDate()
-        const nowMonthDay = new Date(year, month, 0).getDate() // 当前月的总天数
-        if (month - 1 <= 0) return year - 1 + '-' + 12 + '-' + day // 如果是1月,年数往前推一年
-        const lastMonthDay = new Date(year, parseInt(month) - 1, 0).getDate()
-        if (lastMonthDay >= day) return year + '-' + (month - 1) + '-' + day
-        if (day < nowMonthDay) return year + '-' + (month - 1) + '-' + (lastMonthDay - (nowMonthDay - day)) // 1个月前所在月的总天数小于现在的天日期
-        return year + '-' + (month - 1) + '-' + lastMonthDay // 当前天日期小于当前月总天数
-      },
       getOptions() {
         Promise.all([api.getProvinceDetail(), this.getDicts('cust_level'), this.getDicts('cust_idy')])
           .then(([province, level, industry, sell]) => {
@@ -370,22 +361,12 @@
       async fetchData() {
         this.listLoading = true
         const params = { ...this.queryForm }
-        let _this = this
-        let CreateOn = []
-        if (!_this.queryForm.followUpDate) {
-          _this.queryForm.followUpDate = []
-        }
-        // 解析时间
-        if (_this.queryForm.followUpDate.length === 2) {
-          _this.queryForm.followUpDate[1].setHours(23)
-          _this.queryForm.followUpDate[1].setMinutes(59)
-          _this.queryForm.followUpDate[1].setSeconds(59)
-          CreateOn.push(_this.formatDateTime(_this.queryForm.followUpDate[0]))
-          CreateOn.push(_this.formatDateTime(_this.queryForm.followUpDate[1]))
+        if (!params.followUpDate) params.followUpDate = null
+        if (this.queryForm.followUpDate && this.queryForm.followUpDate.length === 2) {
+          params.beginTime = this.queryForm.followUpDate[0]
+          params.endTime = this.queryForm.followUpDate[1]
         }
-        params['CreateOn'] = CreateOn.join(',')
         params.custProvince = params.province.distName ? params.province.distName : ''
-        if (!params.followUpDate) params.followUpDate = null
         const [err, res] = await to(api.getPublicList(params))
         if (err) return (this.listLoading = false)
         this.list = res.data.list || []
@@ -393,17 +374,6 @@
         this.listLoading = false
         this.$nextTick(() => this.$refs.table.doLayout())
       },
-      formatDateTime(date) {
-        var y = date.getFullYear()
-        var m = date.getMonth() + 1
-        m = m < 10 ? '0' + m : m
-        var d = date.getDate()
-        d = d < 10 ? '0' + d : d
-        var h = date.getHours()
-        var minute = date.getMinutes()
-        minute = minute < 10 ? '0' + minute : minute
-        return y + '-' + m + '-' + d + ' ' + h + ':' + minute
-      },
       handleSearch() {
         this.queryForm.pageNum = 1
         this.fetchData()
@@ -431,7 +401,7 @@
           custName: '', //客户名称
           custIndustry: '', // 客户类型  ()
           custLevel: '', //客户级别
-          followUpDate: [new Date(this.getLastMonth(new Date())), new Date()], //最后跟进时间
+          followUpDate: [], //最后跟进时间
           isPublic: true,
           custProvince: '',
           custCity: '',