diff --git a/src/views/ebiz/cardList/information.vue b/src/views/ebiz/cardList/information.vue index 8f745f6bc..9d22c0be6 100644 --- a/src/views/ebiz/cardList/information.vue +++ b/src/views/ebiz/cardList/information.vue @@ -722,25 +722,38 @@ export default { let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日' let insuYear = JSON.parse(localStorage.insuYear) let insuYearM, productDate, productDateTime - let insuYearD,hoDate + let insuYearD, hoDate switch (insuYear.insuYearFlag) { case 'D': - hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 + hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 break - case 'Y': - var y = new Date().getFullYear(),isLeap = (0 === y % 4 && 0 === y % 100) || 0 === y % 400,days = isLeap ? 366 : 365; - hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (days - 1) + case 'Y': + hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * 364 break } - productDate = new Date(parseInt(hoDate) * 1000) - insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 - insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() - productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' - this.productDate = currentData + '0时至' + productDateTime + '24时止' + productDate = new Date(parseInt(hoDate) * 1000) + insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 + insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() + productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' + this.productDate = currentData + '0时至' + productDateTime + '24时止' } break } }, + isLeapYear(year) { + var cond1 = year % 4 == 0 //条件1:年份必须要能被4整除 + var cond2 = year % 100 != 0 //条件2:年份不能是整百数 + var cond3 = year % 400 == 0 //条件3:年份是400的倍数 + //当条件1和条件2同时成立时,就肯定是闰年,所以条件1和条件2之间为“与”的关系。 + //如果条件1和条件2不能同时成立,但如果条件3能成立,则仍然是闰年。所以条件3与前2项为“或”的关系。 + //所以得出判断闰年的表达式: + var cond = (cond1 && cond2) || cond3 + if (cond) { + return 366 + } else { + return 365 + } + }, GetNextMonthDay(date, monthNum) { var dateArr = date.split('-') var year = dateArr[0] //获取当前日期的年份