Procházet zdrojové kódy

修改订单切换状态

付晓文。 před 2 měsíci
rodič
revize
62649f9882
1 změnil soubory, kde provedl 35 přidání a 22 odebrání
  1. 35 22
      pages/order/index.vue

+ 35 - 22
pages/order/index.vue

@@ -501,6 +501,7 @@
 			},
 			},
 			mescrollInit(mescroll) {
 			mescrollInit(mescroll) {
 				this.mescroll = mescroll;
 				this.mescroll = mescroll;
+				mescroll.optDown.use = false;
 			},
 			},
 			InputBlur(e) {
 			InputBlur(e) {
 				this.search = e.detail.value
 				this.search = e.detail.value
@@ -577,11 +578,14 @@
 					this.orderList.forEach(item => {
 					this.orderList.forEach(item => {
 						item.isShow = false
 						item.isShow = false
 					})
 					})
-					console.log(this.orderList)
-					this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
+					if (this.mescroll) {
+						this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
+					}
 					uni.showTabBar()
 					uni.showTabBar()
 				}).catch(() => {
 				}).catch(() => {
-					this.mescroll.endErr()
+					if (this.mescroll) {
+						this.mescroll.endErr()
+					}
 				})
 				})
 			},
 			},
 			geDetail(item) {
 			geDetail(item) {
@@ -602,10 +606,14 @@
 				}
 				}
 				this.$http.post("/ts/merchant/serviceOrder", data).then(res => {
 				this.$http.post("/ts/merchant/serviceOrder", data).then(res => {
 						this.serviceList = this.serviceList.concat(res.data.result.records)
 						this.serviceList = this.serviceList.concat(res.data.result.records)
-						this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
+						if (this.mescroll) {
+							this.mescroll.endSuccess(res.data.result.records.length, res.data.result.total);
+						}
 					})
 					})
 					.catch(() => {
 					.catch(() => {
-						this.mescroll.endErr()
+						if (this.mescroll) {
+							this.mescroll.endErr()
+						}
 					})
 					})
 
 
 			},
 			},
@@ -985,31 +993,36 @@
 				})
 				})
 			}
 			}
 		},
 		},
-		mounted() {
-			this.mescroll.optDown.use = false
-			// this.getList()
-		},
 		onShow() {
 		onShow() {
-			let that = this
+			const app = getApp()
+			if (app.globalData) {
+				const { currentIndex, tabIndex } = app.globalData
+				if (currentIndex !== '' && currentIndex != null) {
+					this.currentIndex = currentIndex
+				}
+				if (tabIndex !== '' && tabIndex != null) {
+					this.tabIndex = tabIndex
+				}
+				app.globalData.currentIndex = ''
+				app.globalData.tabIndex = ''
+			}
+			const that = this
 			uni.getStorage({
 			uni.getStorage({
 				key: 'login_user_info',
 				key: 'login_user_info',
-				success: function(res) {
+				success(res) {
 					that.merchantId = res.data.merchantId
 					that.merchantId = res.data.merchantId
 					that.serviceList = []
 					that.serviceList = []
 					that.orderList = []
 					that.orderList = []
-					let page = {
-						num: 1,
-						size: 10
-					}
-					that.getList(page)
-					that.getserviceList(page)
+					const page = { num: 1, size: 10 }
+					that.$nextTick(() => {
+						if (that.tabIndex == 0) {
+							that.getList(page)
+						} else if (that.tabIndex == 1) {
+							that.getserviceList(page)
+						}
+					})
 				}
 				}
 			})
 			})
-			const app = getApp();
-      this.currentIndex=app.globalData.currentIndex
-			this.tabIndex=app.globalData.tabIndex
-			app.globalData.currentIndex=''
-			app.globalData.tabIndex=''
 		},
 		},
 	}
 	}
 </script>
 </script>