|
|
@@ -1,15 +1,4 @@
|
|
|
-import dayjs from 'dayjs';
|
|
|
import { abs } from 'mathjs';
|
|
|
-require('dayjs/locale/zh-cn');
|
|
|
-dayjs.locale('zh-cn');
|
|
|
-var relativeTime = require('dayjs/plugin/relativeTime');
|
|
|
-dayjs.extend(relativeTime);
|
|
|
-var calendar = require('dayjs/plugin/calendar');
|
|
|
-dayjs.extend(calendar);
|
|
|
-var duration = require('dayjs/plugin/duration');
|
|
|
-dayjs.extend(duration);
|
|
|
-var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
|
|
|
-dayjs.extend(isSameOrBefore);
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -60,7 +49,7 @@ export default {
|
|
|
},
|
|
|
isAppointment() {
|
|
|
if (this.info.startTime) {
|
|
|
- return dayjs().isBefore(dayjs(this.info.startTime));
|
|
|
+ return this.dayjs().isBefore(this.dayjs(this.info.startTime));
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
@@ -90,21 +79,21 @@ export default {
|
|
|
if (!this.isAppointment) {
|
|
|
return;
|
|
|
}
|
|
|
- var x = dayjs(startTime);
|
|
|
- var y = dayjs();
|
|
|
- let d = dayjs.duration(x.diff(y));
|
|
|
+ var x = this.dayjs(startTime, 'YYYY-MM-DD HH:mm:ss');
|
|
|
+ var y = this.dayjs();
|
|
|
+ let d = this.dayjs.duration(x.diff(y));
|
|
|
let day = parseInt(d.asDays());
|
|
|
let str = '';
|
|
|
if (abs(day) > 0) {
|
|
|
str += day + '天 ';
|
|
|
}
|
|
|
|
|
|
- this.startTime = str + dayjs.duration(x.diff(y)).format('HH:mm:ss');
|
|
|
+ this.startTime = str + this.dayjs.duration(x.diff(y)).format('HH:mm:ss');
|
|
|
if (this.timer) {
|
|
|
clearTimeout(this.timer);
|
|
|
this.timer = null;
|
|
|
}
|
|
|
- if (!dayjs().isBefore(dayjs(startTime))) {
|
|
|
+ if (!this.dayjs().isBefore(this.dayjs(startTime))) {
|
|
|
if (this.getProduct) {
|
|
|
this.getProduct();
|
|
|
}
|