Просмотр исходного кода

列表页和详情页刷新问题

shish 7 месяцев назад
Родитель
Сommit
1acc53475d
3 измененных файлов с 25 добавлено и 28 удалено
  1. 13 15
      hdApp/src/admin/home/order.vue
  2. 11 12
      hdApp/src/admin/order/detail.vue
  3. 1 1
      hdApp/src/pages.json

+ 13 - 15
hdApp/src/admin/home/order.vue

@@ -196,7 +196,7 @@ export default {
       tabs: [ { name: "全部", value: 0 }, { name: "待付款", value: 0 }, { name: "待发货", value: 0 }, { name: "配送中", value: 0 }, { name: "已完成", value: 0 } ],
       staffList:[],
       shopAdminId:0,
-      refreshPage:0,
+      refreshPage:1,
       showSearch:false,
       searchList:[],
       customId:0,
@@ -249,29 +249,27 @@ export default {
       uni.removeStorageSync("switchTabQuery");
       this.tabIndex = parseInt(tabIndex.tabIndex);
     }
-    let that = this
-    getStaffList().then(res=>{
-      if(res.code ==1){
-        this.staffList = res.data.list
-      }
-    })
-
-    if(this.refreshPage == 1){
-      this.resetList();
-      this.getOrderList()
-      this.refreshPage = 0
-    }
 
     // 重置搜索
     if (this.customId !== 0) {
       this.clearFn()
     }
 
-    this.getOrderList();
+    //需要控制订单详情页,返回到列表页时不需要刷新页面
+    if(this.refreshPage == 1){
+      this.resetList();
+      this.getOrderList()
+    }else{
+      this.refreshPage = 1
+    }
   },
   methods: {
     init () {
-      //this.getOrderList();
+      getStaffList().then(res=>{
+        if(res.code ==1){
+          this.staffList = res.data.list
+        }
+      })
     },
     // 面板相关
     openFilterPanel () {

+ 11 - 12
hdApp/src/admin/order/detail.vue

@@ -455,20 +455,22 @@ export default {
       currentExpressInfo: {}
     };
   },
-  
   onLoad() {
-    //返回上一页时不需要刷新
+    //返回列表页时不需要刷新
     let pages = getCurrentPages();
     let prevPage = pages[pages.length - 2];
     prevPage.$vm.refreshPage = 0
   },
-  
   onShow() {
-    // if (this.refreshPage == 1) {
-    //   this.refreshPage = 0
-    //   this.init()
-    // }
-    this.init()
+    if (this.refreshPage == 1) {
+      this.refreshPage = 0
+      this.init()
+    }
+  },
+  onPullDownRefresh() {
+    this.init().then(res => {
+      uni.stopPullDownRefresh()
+    })
   },
   
   methods: {
@@ -614,15 +616,12 @@ export default {
     goRefund() {
       this.$util.pageTo({url: '/admin/order/refund?id=' + this.option.id})
     },
-    
     goShOrder(info) {
       this.$util.pageTo({url: '/admin/order/detail?id=' + info.shOrderId})
     },
-    
     init() {
-      this.getDetailInfo()
+      return this.getDetailInfo()
     },
-
     getDetailInfo() {
       return getDetB({ id: this.option.id }).then(res => {
         this.orderInfo = res.data;

+ 1 - 1
hdApp/src/pages.json

@@ -408,7 +408,7 @@
 		{
 			"root": "admin/order",
 			"pages": [
-				{ "path": "detail", "style": { "navigationBarTitleText": "详情" } },
+				{ "path": "detail", "style": { "navigationBarTitleText": "详情" , "enablePullDownRefresh": true} },
 				{ "path": "info", "style": { "navigationBarTitleText": "详情" } },
 				{ "path": "addOrder", "style": { "navigationBarTitleText": "开单" } },
 				{ "path": "addOrderConfirm", "style": { "navigationBarTitleText": "确认" } },