From 4e3e18cdb0d75c098b68353ef8c86cdd7c0f79b2 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期四, 21 八月 2025 15:27:34 +0800
Subject: [PATCH] 111

---
 small-program/pages/index/index.vue |   81 ++++++++++++++++++++++++----------------
 1 files changed, 49 insertions(+), 32 deletions(-)

diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index 9a93d5f..7d73195 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -392,23 +392,32 @@
 		},
 		async onLoad() {
 			await this.$onLaunched;
-			this.getCategoryLists()
-			this.getOrderList()
+			if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
+				this.getOrderList()
+				this.getCategoryLists()
+			}
 			this.form.linkPhone = this.userInfo.telephone
 		},
 		onShow(options) {
 			this.typeViewId = 0
-			if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}'){
+			if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
+				console.log('宸茬櫥闄�')
 				this.isLogin = true
+				
+				if (!this.isOnce && this.userInfo.useIdentity == 1) {
+					this.page = 1
+					this.next = true
+					this.orderList = []
+					this.getOrderList()
+				}
+				
+			} else {
+				this.isLogin = false
+				console.log('鏈櫥闄�')
 			}
+			
 			if (this.userInfo && this.userInfo.useIdentity == 1) {
 				this.typeViewId = 1
-			}
-			if (!this.isOnce && this.userInfo.useIdentity == 1) {
-				this.page = 1
-				this.next = true
-				this.orderList = []
-				this.getOrderList()
 			}
 		},
 		watch: {
@@ -421,7 +430,7 @@
 					this.form.longitude = ''
 					this.form.location = ''
 					this.form.locationEnd = ''
-					this.form.wayInfoDTOList = ''
+					this.form.wayInfoDTOList = []
 					this.form.workType = ''
 					this.form.days = ''
 					this.form.locationRemark = ''
@@ -467,13 +476,15 @@
 			getaccept(e, orderId, index) {
 				this.$u.api.accept({ orderId })
 					.then(res => {
-						uni.showToast({ title: '鎶㈠崟鎴愬姛锛�', icon: 'success', duration: 2000 })
-						setTimeout(() => {
-							this.page = 1
-							this.next = true
-							this.orderList = []
-							this.getOrderList()
-						}, 2000)
+						if (res.code === 200) {
+							uni.showToast({ title: '鎶㈠崟鎴愬姛锛�', icon: 'success', duration: 2000 })
+							setTimeout(() => {
+								this.page = 1
+								this.next = true
+								this.orderList = []
+								this.getOrderList()
+							}, 2000)
+						}
 					})
 			},
 			clickSort(id) {
@@ -620,7 +631,9 @@
 						priceNum1: that.form.days,
 						type: 2
 					}).then(res => {
-						that.form.estimatedAccount = res.data
+						if (res.code === 200) {
+							that.form.estimatedAccount = res.data
+						}
 					})
 				}
 			},
@@ -758,24 +771,28 @@
 			getCategoryLists() {
 				this.$u.api.getCategoryList({ type: 1 })
 					.then(res => {
-						this.car = res.data
-						this.form.categoryId = res.data[0].id
-						this.form.categoryName = res.data[0].name
-						this.carRemark = res.data[0].remark
-						this.carImage = res.data[0].iconFull
+						if (res.code === 200) {
+							this.car = res.data
+							this.form.categoryId = res.data[0].id
+							this.form.categoryName = res.data[0].name
+							this.carRemark = res.data[0].remark
+							this.carImage = res.data[0].iconFull
+						}
 					})
 				this.$u.api.getCategoryList({ type: 2 })
 					.then(res => {
-						res.data.forEach(item => {
-							item.num = ''
-							item.list = item.detailList.map(child => {
-								return {
-									active: false,
-									price: child
-								}
+						if (res.code === 200) {
+							res.data.forEach(item => {
+								item.num = ''
+								item.list = item.detailList.map(child => {
+									return {
+										active: false,
+										price: child
+									}
+								})
 							})
-						})
-						this.orderFood = res.data
+							this.orderFood = res.data
+						}
 					})
 			}
 		}

--
Gitblit v1.9.3