Commit 360988a8 by huaying

fix: 优惠券导出订单时间限制

parent b9883a80
......@@ -458,7 +458,30 @@ export default {
this.dialogVisible = true;
// window.location = `${exportOnlineListExcel}?orderStatus=${this.listParams.orderStatus}&changeType=${this.listParams.changeType}&searchParams=${this.listParams.searchParams}&beginTime=${this.listParams.beginTime}&endTime=${this.listParams.endTime}&requestProject=marketing`;
},
// 计算自然月
natureMonth (curDate, step) {
if (!curDate || !step) return curDate;
if (typeof curDate === 'string') curDate = new Date(curDate.replace(/[\/|\.]/g, '-')); // new Date(str) 对str格式的,ios只支持yyyy-MM-dd
const targetDateLastDay = new Date(curDate.getFullYear(), curDate.getMonth() + step + 1, 0);
const targetDate = new Date(curDate.getFullYear(), curDate.getMonth() + step, Math.min(curDate.getDate(), targetDateLastDay.getDate()));
return this.formatDate(targetDate, 'yyyy-MM-dd');
},
formatDate (dateObj, format) {
const month = dateObj.getMonth() + 1;
const date = dateObj.getDate();
return format.replace(/yyyy|MM|dd/g, field => {
switch (field) {
case 'yyyy':
return dateObj.getFullYear();
case 'MM':
return month < 10 ? '0' + month : month;
case 'dd':
return date < 10 ? '0' + date : date;
}
});
},
// 导出列表
exportExcelAll () {
if (this.dateValue) {
......@@ -472,10 +495,16 @@ export default {
this.$message.error('时间不能为空');
return;
}
if (new Date(this.endTime).getTime() - new Date(this.beginTime).getTime() > 90 * 24 * 3600 * 1000) {
const data = this.natureMonth(this.beginTime, 3);
this.endTime = this.endTime.split(' ')[0];
if (new Date(data).getTime() - 1 * 24 * 1000 < new Date(this.endTime).getTime()) {
this.$message.error('导出订单不支持导出超过3个月时长的数据,请重新选择时间');
return;
}
// if (new Date(this.endTime).getTime() - new Date(this.beginTime).getTime() > 90 * 24 * 3600 * 1000) {
// this.$message.error('导出订单不支持导出超过3个月时长的数据,请重新选择时间');
// return;
// }
this.paramsAll = {
orderStatus: this.orderStatus,
changeType: -1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment