quaryconsumption(){
let token = getToken();
let userid = localStorage.getItem("userId");
let schoolname = this.schoolName;
getOrderListBySchoolName({token:token,userid:userid,schoolname:schoolname,}).then((res) =>{
let ordertime = [];
for(let i in res.orderList){
res.orderList[i].ordertime = res.orderList[i].ordertime.replace(/T/g," ")
res.orderList[i].ordertime = res.orderList[i].ordertime.substring( 0,16 );
}
this.tableData = res.orderList;
console.log(res,"6656")
})
},
后端返回来的数据日期格式不对,需要前端自己截取格式、replace替换字符串,substring截取字符串
这是获取到的日期格式
这是替换以后的值