Browse Source

优化修改

sunny 3 tháng trước cách đây
mục cha
commit
cd35a39d7a
2 tập tin đã thay đổi với 35 bổ sung6 xóa
  1. 7 0
      src/api/index.js
  2. 28 6
      src/views/historicalVisit/historAllVisit.vue

+ 7 - 0
src/api/index.js

@@ -276,6 +276,13 @@ export function getVisits(query) {
     params: query,
   });
 }
+export function getListTotal(query) {
+  return request({
+    url: 'mobile/visit/listTotal',
+    method: 'get',
+    params: query,
+  });
+}
 export function storeMyList(query) {
   return request({
     url: 'mobile/store/myList',

+ 28 - 6
src/views/historicalVisit/historAllVisit.vue

@@ -59,7 +59,7 @@
         </van-search>
       </div>
       <div class="lineGrey"></div>
-      <div v-if="refreshTotal" class="refreshBtn" @click="onSearch">检测到 {{ refreshTotal }} 条更新,点击刷新</div>
+      <div v-if="refreshTotal" class="refreshBtn" @click="refresh">检测到 {{ refreshTotal }} 条更新,点击刷新</div>
       <div v-if="refreshTotal" class="lineGrey"></div>
     </div>
     <!--        主体内容-->
@@ -195,7 +195,7 @@
 </template>
 
 <script>
-import { getVisits, getvisitDeptInfo } from '@/api/index';
+import { getVisits, getvisitDeptInfo, getListTotal } from '@/api/index';
 import timeico from '@/assets/Icon/datatims.png';
 
 export default {
@@ -264,9 +264,9 @@ export default {
     };
   },
   activated() {
-    // if(this.latestUpdateTime!=null){ 
-    //    this.refreshTotal = 18;
-    // }
+    if(this.latestUpdateTime!=null){ 
+       this.getListTotalFn();
+    }
     // setTimeout(() => {
     //   this.onSearch();
     // }, 1000);
@@ -308,6 +308,28 @@ export default {
     this.onSearch();
   },
   methods: {
+    refresh(){
+      this.refreshTotal = 0;
+      this.onSearch();
+    },
+    getListTotalFn(){
+      getListTotal({
+        startTime: this.startTime + ' 00:00:00', 
+        stopTime: this.endTime + ' 24:00:00', 
+        storeRequest: this.storeName.trim(),
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+        companyId: this.companyCode,
+        regionId: this.regionCode,
+        userId: this.userCode,
+        deptId: this.deptCode,
+        queryStartTime:this.latestUpdateTime
+      }).then((res) => {
+        if (res.code == 200) {
+          this.refreshTotal = res.data;
+        }
+      });
+    },
     onLoad() {
       // this.loading = false;
       this.getVisitsListFn();
@@ -410,8 +432,8 @@ export default {
       }).then((res) => {
         loading1.clear();
         if (res.code == 200) {
-          // this.latestUpdateTime = '2025-09-03 13:47:47';
           this.loading = false;
+          this.latestUpdateTime = res.dataTime;
           this.list = this.list.concat(res.data);
           if (this.list.length >= res.total) {
             this.finished = true;