Commit cf908663 by LJM

bug

parent 9f4e6d35
Showing with 11 additions and 10 deletions
......@@ -540,21 +540,22 @@ export default {
* @param type 是否加30天
* @returns {string}
*/
getTime(date, type) {
var date = new Date(date);
var year = date.getFullYear();
var month = date.getMonth() + 1;
getTimes(date, type) {
if (type) {
var day = date.getDate() + 30;
var date = new Date(new Date(date).getTime() + 31 * 24 * 60 * 60 * 1000);
} 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 minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var second = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? (month = '0' + month) : '';
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;
},
/**
......@@ -601,17 +602,17 @@ export default {
//修改上架有效期
this.dialogVisible3 = true;
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++) {
this.selectData[i].cp_time_temp = this.selectData[i].cp_time;
var time = Date.parse(this.selectData[i].cp_time);//上架有效期
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 {
//上架有效期小于等于当前日期
this.selectData[i].cp_time = this.getTime(new Date(), true);
this.selectData[i].cp_time = this.getTimes(new Date(), true);
}
}
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