data: {
list: {
firstShowTime: "2021-11-12 19:30:00",
lastShowTime: "2021-11-14 21:00:00",
name: "北京曲剧《离婚》",
ticketStatus: 3
},
picUrl: picUrl,
}
var onSaleTime = parseInt(new Date(res.data.onSaleTime).getTime());
var nowTime = parseInt(new Date().getTime());
let ticketStatus = 'list.ticketStatus';
if(nowTime - onSaleTime >= 0){
this.setData({
[ticketStatus]: 2
})
}else{
this.setData({
[ticketStatus]: 1
})
}
console.log(this.data.list.ticketStatus);