vue前端转后端时间格式
import * as PRODUCTDETAILS from '../service/api/financialDetail'method:{//转化时间格式formatDate(now) {var year = now.getFullYear()var month = now.getMonth() + 1var date = now.getDate()return ...
import * as PRODUCTDETAILS from '../service/api/financialDetail'
method:{
//转化时间格式
formatDate(now) {
var year = now.getFullYear()
var month = now.getMonth() + 1
var date = now.getDate()
return year + '-' + month + '-' + date
},
//获取商品详情
async getOrderDetails() {
const params = {
id: this.id
}
try {
const res = await PRODUCTDETAILS.orderDetails(params)
if (res) {
console.log(res.data)
this.data = res.data
if (res.data.status == 0) {
this.data.status = '未结束'
} else {
this.data.status = '已结束'
}
this.data.workStart = this.formatDate(new Date(this.data.workStart))
this.data.workEnd = this.formatDate(new Date(this.data.workEnd))
this.data.gmtCreate = this.formatDate(new Date(this.data.gmtCreate))
}
} catch (err) {
console.log(err)
}
},
}
更多推荐
所有评论(0)