xiongzhu 4 лет назад
Родитель
Сommit
1ebbdaebbb
3 измененных файлов с 6 добавлено и 15 удалено
  1. 5 10
      src/components/product/productLarge.vue
  2. 1 4
      src/mixins/coupon.js
  3. 0 1
      src/views/order/Detail.vue

+ 5 - 10
src/components/product/productLarge.vue

@@ -56,11 +56,6 @@
 
 <script>
 import product from '../../mixins/product';
-import dayjs from 'dayjs';
-var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
-dayjs.extend(isSameOrBefore);
-var duration = require('dayjs/plugin/duration');
-dayjs.extend(duration);
 export default {
     mixins: [product],
     props: {
@@ -74,8 +69,8 @@ export default {
     computed: {
         time() {
             if (this.info.startTime) {
-                if (dayjs().isSameOrBefore(this.info.startTime)) {
-                    return dayjs(this.info.startTime).format('MM月DD日');
+                if (this.dayjs().isSameOrBefore(this.info.startTime, 'YYYY-MM-DD HH:mm:ss')) {
+                    return this.dayjs(this.info.startTime).format('MM月DD日');
                 }
             }
 
@@ -84,9 +79,9 @@ export default {
     },
     mounted() {
         if (this.info.startTime) {
-            var x = dayjs(this.info.startTime);
-            var y = dayjs();
-            let d = dayjs.duration(x.diff(y));
+            var x = this.dayjs(this.info.startTime, 'YYYY-MM-DD HH:mm:ss');
+            var y = this.dayjs();
+            let d = this.dayjs.duration(x.diff(y));
             let day = parseInt(d.asDays());
             if (day <= 0) {
                 this.getTime(this.info.startTime);

+ 1 - 4
src/mixins/coupon.js

@@ -1,10 +1,7 @@
-import dayjs from 'dayjs';
-var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
-dayjs.extend(isSameOrBefore);
 export default {
     methods: {
         checkTime(info) {
-            return dayjs().isSameOrBefore(info.expiration);
+            return this.dayjs().isSameOrBefore(this.dayjs(info.expiration, 'YYYY-MM-DD HH:mm:ss'));
         },
         checkUse(info, collectionId = 0) {
             if (collectionId && info.limited) {

+ 0 - 1
src/views/order/Detail.vue

@@ -83,7 +83,6 @@
 import OrderOpen from '../../components/order/OrderOpen.vue';
 import order from '../../mixins/order';
 import product from '../../mixins/product';
-import dayjs from 'dayjs';
 export default {
     components: { OrderOpen },
     name: 'detail',