Commit 527877a5 by huaying

Merge branch 'bugfix/积分订单导出订单时间限制' into test

# Conflicts:
#	src/views/order/couponExchange.vue
parents 344a7ff7 fa67060d
......@@ -833,6 +833,30 @@ export default {
betachDeliver () {
this.deliverModal.dialogVisible = true;
},
// 计算自然月
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;
}
});
},
// 导出发货单
exportExcel () {
if (this.dateValue) {
......@@ -846,10 +870,19 @@ 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);
const endTimes = this.endTime.split(' ')[0];
// console.log(this.endTime.split(' '), 'iiii');
// console.log(data, typeof data, '选择时间', this.endTime, typeof this.endTime);
// console.log(new Date(data).getTime(), new Date(this.endTime).getTime());
if (new Date(data).getTime() - 1 * 24 * 1000 < new Date(endTimes).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.params = {
orderStatus: this.orderStatus,
changeType: this.changeType ? this.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