Przeglądaj źródła

修复跨年问题

Changpeng Duan 5 lat temu
rodzic
commit
b58d5d1360
3 zmienionych plików z 21 dodań i 22 usunięć
  1. 20 20
      app/src/page/appoint.vue
  2. 0 1
      app/src/page/mainpage.vue
  3. 1 1
      app/src/router/index.js

+ 20 - 20
app/src/page/appoint.vue

@@ -3,8 +3,8 @@
 
         <div class="as">
             <img src="../static/images/main/banner.png" height="121" width="414"/>
-            <mu-tabs :value.sync="active" color="#F2F2F2" indicator-color="#ffffff">
-                <mu-tab v-for="(day,i) in weeks">{{ day.data }} <br> <em>{{ day.name }}</em></mu-tab>
+            <mu-tabs :value.sync="active" color="#F2F2F2" indicator-color="#ffffff" @change="getIndex" v-if="reFresh">
+                <mu-tab v-for="day in weeks">{{ day.data }} <br> <em>{{ day.name }}</em></mu-tab>
             </mu-tabs>
             <span class="sum">
         {{ today }} 预约名额剩余
@@ -100,6 +100,7 @@
                 sum: 0,
                 HaveDays: 0,
                 openAlert: false,
+                reFresh: true,
                 list: [],
                 weeks: [],
                 today: '',
@@ -116,17 +117,23 @@
             // this.alertInfo( window.screen.height);
         },
         watch: {
-            '$route': function (val) {
-                if (val.path == '/appoint') {
-                    this.active = 0;
-                    this.getQueryNextWeek();
-                }
-            },
-            'active'() {
+            'active'(to) {
                 this.getList();
             }
         },
+        activated() {
+            this.active = 0;
+            this.reFresh = false;
+            this.$nextTick(() => {
+                this.reFresh = true;
+                this.getQueryNextWeek();
+            });
+
+        },
         methods: {
+            getIndex(val) {
+                console.log(val);
+            },
             getQueryNextWeek() {
                 let that = this;
                 let param = {
@@ -134,12 +141,14 @@
                     shopId: this.$route.query.shopId,
                 };
                 let postdata = qs.stringify(param);
+                this.weeks = [];
                 QueryNextWeek(postdata).then(res => {
                     let json = res;
                     if (json.Code == 0) {
                         this.HaveDays = json.Rs;
                         this.getFurtherDays(this.HaveDays);
                     } else {
+                        that.list = [];
                         that.$message.error(json.Memo);
                     }
                 })
@@ -154,14 +163,6 @@
                     }
                 });
             },
-            // 计算距离11/8号还有集体那
-            calcHaveDays(sDate1) {
-                var date2 = new Date();
-                var date1 = new Date(Date.parse(sDate1.replace(/-/g, "/")));
-                var iDays = parseInt(Math.abs(date2.getTime() - date1.getTime()) / 1000 / 60 / 60 / 24) + 2;
-                return iDays;
-
-            },
             // 获取未来7天的
             getFurtherDays(HaveDays) {
                 let now = new Date();
@@ -276,9 +277,8 @@
             },
             getList() {
                 let that = this;
-                this.today = this.weeks[this.active].name;
-                let curDay = this.weeks[this.active].orderDate;
-                console.log(curDay);
+                    this.today = this.weeks[this.active].name;
+                    let curDay = this.weeks[this.active].orderDate;
                 let param = {
                     token: localStorage.token,
                     orderDate: curDay,

+ 0 - 1
app/src/page/mainpage.vue

@@ -64,7 +64,6 @@
         mounted() {
             this.getManagerSelfQuery();
             // this.alertInfo(document.body.clientWidth)
-            console.log(123);
             // navigator.geolocation.getCurrentPosition(function (position) {
             //   console.log(position.coords.longitude);
             // },function (err) {

+ 1 - 1
app/src/router/index.js

@@ -11,7 +11,7 @@ let NPconfig = {
     color: '#E75296',      // color
     size: 2,               // progress size
     className: ''          // progress custom class
-}
+};
 Vue.use(NProgress,NPconfig);
 
 const routes = [