Commit df2fe553 by 韩达

修改上架有效期

parent 9b9308b9
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
<el-table-column prop="cp_time_temp" label="上架有效期" width="160" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="cp_time_temp" label="上架有效期" width="160" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="修改上架有效期" width="160"> <el-table-column label="修改上架有效期" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.cp_time" type="date" placeholder="选择日期" style="width: 128px" value-format="yyyy-MM-dd"></el-date-picker> <el-date-picker v-model="scope.row.cp_time" type="date" placeholder="选择日期" style="width: 128px" value-format="yyyy-MM-dd" :picker-options="pickerOptions"></el-date-picker>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -354,7 +354,10 @@ export default { ...@@ -354,7 +354,10 @@ export default {
disabled: false, disabled: false,
timer: null, timer: null,
skuStatistics: {},//统计数据 skuStatistics: {},//统计数据
skuRankList: {}//sku的型号统计排名列表 skuRankList: {},//sku的型号统计排名列表
pickerOptions: {
disabledDate: this.disabledDate
}
}; };
}, },
created() { created() {
...@@ -534,6 +537,23 @@ export default { ...@@ -534,6 +537,23 @@ export default {
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
disabledDate(date) {
var maxDate = new Date(); // 设置最大日期
var minDate = new Date(); // 设置最小日期
var cp_time_day = localStorage.getItem('cp_time_day');
if( cp_time_day == -1 ){
// “无限制”,则修改上架有效期默认为:2035-01-01
var maxDate = new Date('2035-01-01');
}else{
var maxDate = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
}
return date > maxDate || date < minDate; // 返回 true 禁用日期,返回 false 启用日期
},
/** /**
* *
* @param date 时间类型 * @param date 时间类型
...@@ -542,7 +562,16 @@ export default { ...@@ -542,7 +562,16 @@ export default {
*/ */
getTimes(date, type) { getTimes(date, type) {
if (type) { if (type) {
var date = new Date(new Date(date).getTime() + 30 * 24 * 60 * 60 * 1000);
var cp_time_day = localStorage.getItem('cp_time_day');
if( cp_time_day == -1 ){
// “无限制”,则修改上架有效期默认为:2035-01-01
var date = new Date('2035-01-01');
}else{
var date = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
}
// var date = new Date(new Date(date).getTime() + 30 * 24 * 60 * 60 * 1000);
} else { } else {
var date = new Date(date); var date = new Date(date);
} }
...@@ -602,7 +631,6 @@ export default { ...@@ -602,7 +631,6 @@ export default {
//修改上架有效期 //修改上架有效期
this.dialogVisible3 = true; this.dialogVisible3 = true;
let currentTime = new Date().getTime();//当前日期毫秒 let currentTime = new Date().getTime();//当前日期毫秒
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;
......
...@@ -164,7 +164,9 @@ export default { ...@@ -164,7 +164,9 @@ export default {
if (res.code === 0) { if (res.code === 0) {
sessionStorage.removeItem('tabs'); sessionStorage.removeItem('tabs');
localStorage.removeItem('supplier_id'); localStorage.removeItem('supplier_id');
localStorage.removeItem('cp_time_day');
localStorage.setItem('supplier_id', res.data.supplier_id); localStorage.setItem('supplier_id', res.data.supplier_id);
localStorage.setItem('cp_time_day', res.data.cp_time_day);
Util.setCookie("token", res.data.api_token, 1); Util.setCookie("token", res.data.api_token, 1);
//强制要求微信绑定 //强制要求微信绑定
if (!res.data.is_bind_wechat) { if (!res.data.is_bind_wechat) {
......
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