提交 8350146c 编写于 作者: 张敬贤's avatar 张敬贤

add

上级 3f39f247
...@@ -6,3 +6,17 @@ export const highLight = (str, val) => { ...@@ -6,3 +6,17 @@ export const highLight = (str, val) => {
} }
return str; return str;
}; };
export const formatDate = (datetime) => {
var date = new Date(datetime); // 时间戳为10位需*1000,时间戳为13位的话不需乘1000
var year = date.getFullYear(),
month = ('0' + (date.getMonth() + 1)).slice(-2),
sdate = ('0' + date.getDate()).slice(-2),
hour = ('0' + date.getHours()).slice(-2),
minute = ('0' + date.getMinutes()).slice(-2),
second = ('0' + date.getSeconds()).slice(-2);
// 拼接
var result =
year + '-' + month + '-' + sdate + ' ' + hour + ':' + minute + ':' + second;
// 返回
return result;
};
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
下单时间: 下单时间:
</div> </div>
<div class="value"> <div class="value">
{{ detailInfo.orderTime || "--" }} {{ formatDate(detailInfo.orderTime) || "--" }}
</div> </div>
</div> </div>
<div class="detail-bottom-item"> <div class="detail-bottom-item">
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
<script> <script>
import {getDetailByYunOrderNo} from '@/api/appoint'; import {getDetailByYunOrderNo} from '@/api/appoint';
import store from 'storejs'; import store from 'storejs';
import { formatDate } from '@/utils/common';
export default { export default {
data() { data() {
return { return {
...@@ -190,7 +191,13 @@ export default { ...@@ -190,7 +191,13 @@ export default {
this.getDetailByYunOrderNo(yunOrderNo); this.getDetailByYunOrderNo(yunOrderNo);
}, },
methods: { methods: {
formatDate(orderTime) {
if (!orderTime) {
return '--';
}
return formatDate(orderTime);
},
getDetailByYunOrderNo(yunOrderNo) { getDetailByYunOrderNo(yunOrderNo) {
getDetailByYunOrderNo(yunOrderNo).then(res => { getDetailByYunOrderNo(yunOrderNo).then(res => {
console.log(res); console.log(res);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册