Commit 9f9b111f by 梁建民

Merge branch 'dev/ver/3.0.0' into 'master'

bug

See merge request !16
parents e21d1c03 cf908663
Showing with 11 additions and 10 deletions
...@@ -540,21 +540,22 @@ export default { ...@@ -540,21 +540,22 @@ export default {
* @param type 是否加30天 * @param type 是否加30天
* @returns {string} * @returns {string}
*/ */
getTime(date, type) { getTimes(date, type) {
var date = new Date(date);
var year = date.getFullYear();
var month = date.getMonth() + 1;
if (type) { if (type) {
var day = date.getDate() + 30; var date = new Date(new Date(date).getTime() + 31 * 24 * 60 * 60 * 1000);
} else { } else {
var day = date.getDate(); var date = new Date(date);
} }
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours(); var hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes(); var minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var second = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds(); var second = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? (month = '0' + month) : ''; month >= 1 && month <= 9 ? (month = '0' + month) : '';
day >= 0 && day <= 9 ? (day = '0' + day) : ''; day >= 0 && day <= 9 ? (day = '0' + day) : '';
var timer = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; var timer = year + '-' + month + '-' + day + ' ' + 0 + ':' + 0 + ':' + 0;
return timer; return timer;
}, },
/** /**
...@@ -601,17 +602,17 @@ export default { ...@@ -601,17 +602,17 @@ export default {
//修改上架有效期 //修改上架有效期
this.dialogVisible3 = true; this.dialogVisible3 = true;
let currentTime = new Date().getTime();//当前日期毫秒 let currentTime = new Date().getTime();//当前日期毫秒
let currentTimeFormate = this.getTime(new Date());//当前日期格式化 let currentTimeFormate = this.getTimes(new Date());//当前日期格式化
for (let i = 0; i < this.selectData.length; i++) { for (let i = 0; i < this.selectData.length; i++) {
this.selectData[i].cp_time_temp = this.selectData[i].cp_time; this.selectData[i].cp_time_temp = this.selectData[i].cp_time;
var time = Date.parse(this.selectData[i].cp_time);//上架有效期 var time = Date.parse(this.selectData[i].cp_time);//上架有效期
if (time > currentTime) { if (time > currentTime) {
//上架有效期大于当前日期 //上架有效期大于当前日期
this.selectData[i].cp_time = this.getTime(this.selectData[i].cp_time, true); this.selectData[i].cp_time = this.getTimes(this.selectData[i].cp_time, true);
} else { } else {
//上架有效期小于等于当前日期 //上架有效期小于等于当前日期
this.selectData[i].cp_time = this.getTime(new Date(), true); this.selectData[i].cp_time = this.getTimes(new Date(), true);
} }
} }
this.cpdata = this.selectData; this.cpdata = this.selectData;
......
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 sign in to comment