Commit 1500f46f by huaying

fix: 日期选择器

parent 7ec1f7df
...@@ -21,19 +21,19 @@ export default { ...@@ -21,19 +21,19 @@ export default {
start = new Date(`${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`); start = new Date(`${start.getFullYear()}-${start.getMonth() + 1}-${start.getDate()}`);
let start2 = new Date(pickerMinDate); let start2 = new Date(pickerMinDate);
let end = new Date(); let end = new Date();
end = new Date(`${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate()} 23:59:59`); end = new Date(`${end.getFullYear()}-${end.getMonth() + 1}-${end.getDate() + 1}`);
let end2 = new Date(pickerMinDate); let end2 = new Date(pickerMinDate);
if (pickerMinDate) { if (pickerMinDate) {
start = start.setFullYear(start.getFullYear() - 2); start = start.setFullYear(start.getFullYear() - 2);
start2 = start2.setDate(start2.getDate() - 60); start2 = start2.setMonth(start2.getMonth() - 6);
start = start > start2 ? start : start2; start = start > start2 ? start : start2;
end2 = end2.setDate(end2.getDate() + 60); end2 = end2.setMonth(end2.getMonth() + 6);
end = end.getTime() > end2 ? end2 : end.getTime(); end = end.getTime() > end2 ? end2 : end.getTime();
} else { } else {
start = start.setFullYear(start.getFullYear() - 2); start = start.setFullYear(start.getFullYear() - 2);
end = end.getTime(); end = end.getTime();
} }
return time.getTime() < start || time.getTime() > end; return time.getTime() <= start || time.getTime() >= end;
} }
}; };
} }
...@@ -60,9 +60,9 @@ export default { ...@@ -60,9 +60,9 @@ export default {
return [getDate(start), getDate(end)]; return [getDate(start), getDate(end)];
}, },
btnChange(index) { btnChange(index) {
let that = this; //把index值赋给active,点击改变样式
that.dateKey = index; this.dateKey = index;
that.dateDefault = []; this.dateDefault = [];
let setDate; let setDate;
if (index == 0) { if (index == 0) {
// 近7天 // 近7天
...@@ -80,15 +80,14 @@ export default { ...@@ -80,15 +80,14 @@ export default {
// 近三个月 // 近三个月
setDate = endDate => { setDate = endDate => {
endDate.setMonth(endDate.getMonth() - 3); endDate.setMonth(endDate.getMonth() - 3);
endDate.setDate(1); endDate.setDate(endDate.getDate() + 1);
return new Date(endDate); return new Date(endDate);
}; };
} else if (index == 3) { } else if (index == 3) {
// 近半年 // 近半年
setDate = endDate => { setDate = endDate => {
endDate.setMonth(endDate.getMonth() - 6); endDate.setMonth(endDate.getMonth() - 6);
endDate.setDate(1); // 以1号为开端 endDate.setDate(endDate.getDate() + 1);
// endDate.setDate(endDate.getDate() + 1);
return new Date(endDate); return new Date(endDate);
}; };
} else { } else {
...@@ -100,10 +99,10 @@ export default { ...@@ -100,10 +99,10 @@ export default {
return new Date(endDate); return new Date(endDate);
}; };
} }
const [start, end] = that.getDateRange(setDate); const [start, end] = this.getDateRange(setDate);
that.dateDefault.push(end); this.dateDefault.push(end);
that.dateDefault.push(start); this.dateDefault.push(start);
that.getChartList(); this.getTableList();
} }
} }
}; };
...@@ -223,6 +223,9 @@ export default { ...@@ -223,6 +223,9 @@ export default {
return true; return true;
} }
}, },
props: {
limitCode: this.$buttonCode.dataActCode
},
handler: row => { handler: row => {
this.$router.push(`/actCodeDetail?hmId=${row.hmId}&activeName=second`); this.$router.push(`/actCodeDetail?hmId=${row.hmId}&activeName=second`);
} }
...@@ -234,6 +237,9 @@ export default { ...@@ -234,6 +237,9 @@ export default {
return true; return true;
} }
}, },
props: {
limitCode: this.$buttonCode.infoActCode
},
handler: row => { handler: row => {
this.$router.push('/actCodeDetails?hmId=' + row.hmId); this.$router.push('/actCodeDetails?hmId=' + row.hmId);
} }
...@@ -248,6 +254,9 @@ export default { ...@@ -248,6 +254,9 @@ export default {
return true; return true;
} }
}, },
props: {
limitCode: this.$buttonCode.editActCode
},
handler: row => { handler: row => {
this.$router.push('/actCodeEdit?hmId=' + row.hmId); this.$router.push('/actCodeEdit?hmId=' + row.hmId);
} }
...@@ -262,6 +271,9 @@ export default { ...@@ -262,6 +271,9 @@ export default {
return true; return true;
} }
}, },
props: {
limitCode: this.$buttonCode.downActCode
},
handler: row => { handler: row => {
this.wxQrcode = row.wxQrcode; this.wxQrcode = row.wxQrcode;
this.imageName = `${row.hmId}_${row.name}`; this.imageName = `${row.hmId}_${row.name}`;
...@@ -276,16 +288,22 @@ export default { ...@@ -276,16 +288,22 @@ export default {
return true; return true;
} }
}, },
props: {
limitCode: this.$buttonCode.delActCode
},
handler: row => { handler: row => {
this.$confirm('确认要作废该活码?此操作将永久废弃该活码,请确保不影响其他投放使用!', '作废提示', { this.$confirm('确认要作废该活码?此操作将永久废弃该活码,请确保不影响其他投放使用!', '作废提示', {
confirmButtonText: '删除', confirmButtonText: '删除',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.loadingStatus = true;
deleteRequest('/haoban-manage3-web/hm/qrcode/del', { hmId: row.hmId }).then(res => { deleteRequest('/haoban-manage3-web/hm/qrcode/del', { hmId: row.hmId }).then(res => {
if (res.data.code == 0) { if (res.data.code == 0) {
this.getTableList(); setTimeout(() => {
// this.$router.go(0); this.getTableList();
this.loadingStatus = false;
}, 1000);
} }
}); });
}); });
......
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