From fe729234647c83f8029beba4e31dc8d364a6427b Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 27 八月 2025 16:04:35 +0800
Subject: [PATCH] 修BUG

---
 small-program/pages/index/index.vue |   91 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 64 insertions(+), 27 deletions(-)

diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index 33003ec..1299158 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -120,7 +120,7 @@
 									<view class="radio-item-label">{{item.name}}</view>
 									<view class="radio-item-list">
 										<view class="radio-item-list-l">
-											<view :class="child.active ? 'radio-item-list-item active' : 'radio-item-list-item'" v-for="(child, childIndex) in item.list" :key="childIndex" @click="selectMenu(index, childIndex)">{{child.price}}鍏�</view>
+											<view v-if="child.price" :class="child.active ? 'radio-item-list-item active' : 'radio-item-list-item'" v-for="(child, childIndex) in item.list" :key="childIndex" @click="selectMenu(index, childIndex)">{{child.price||0}}鍏�</view>
 										</view>
 										<view class="radio-item-list-data">
 											<text style="flex-shrink: 0;">浠芥暟锛�</text>
@@ -196,7 +196,7 @@
 					</view>
 					<view class="box-hz-btn" :style="{ backgroundImage: 'url(' + btn + ')' }">
 						<view class="box-hz-btn-kf" @click="contactPhone()">瀹㈡湇</view>
-						<view class="box-hz-btn-next" @click="submit">涓嬩竴姝�</view>
+						<view class="box-hz-btn-next" @click="submit">绔嬪嵆涓嬪崟</view>
 					</view>
 				</view>
 			</template>
@@ -258,14 +258,14 @@
 								<view :class="form.startDate ? 'box-hz-list-item-val active' : 'box-hz-list-item-val'">
 									<view class="box-hz-list-item-val-left">
 										<image class="icon" src="/static/icon/ic_time@2x.png" mode="widthFix"></image>
-										<text>{{ form.startDate ? form.startDate + ' 鑷� ' + form.endDate : '璇烽�夋嫨鐢ㄥ伐鏃堕棿'}}</text>
+										<text>{{ form.startDate ? form.startDate + ' 鑷� ' + form.endDate : '璇烽�夋嫨鐢ㄨ溅鏃堕棿'}}</text>
 									</view>
 									<u-icon name="arrow-right" color="#111111" size="16"></u-icon>
 								</view>
 							</view>
 							<view class="box-hz-list-item">
 								<view class="box-hz-list-item-label">
-									<text>鐢ㄨ溅鏃堕棿锛�</text>
+									<text>鐢ㄨ溅鍦扮偣锛�</text>
 									<text @click="addAddr">+澧炲姞閫旂粡鐐�</text>
 								</view>
 								<view class="item-d">
@@ -306,7 +306,7 @@
 					
 					<view class="box-hz-btn" :style="{ backgroundImage: 'url(' + btn + ')' }">
 						<view class="box-hz-btn-kf"  @click="contactPhone()" >瀹㈡湇</view>
-						<view class="box-hz-btn-next" @click="jump()">涓嬩竴姝�</view>
+						<view class="box-hz-btn-next" @click="jump()">绔嬪嵆涓嬪崟</view>
 					</view>
 				</view>
 			</view>
@@ -461,7 +461,7 @@
 				this.form.location = ''
 				this.form.locationEnd = ''
 				this.form.wayInfoDTOList = []
-				this.form.workType = 0
+				this.form.workType = 0 
 				this.form.days = ''
 				this.form.locationRemark = ''
 				this.form.supplement = ''
@@ -469,6 +469,7 @@
 				this.form.estimatedAccount = ''
 				this.form.price = ''
 				this.form.address = ''
+				this.clearAll()
 			})
 			// 鍒锋柊棣栭〉鏁版嵁
 			uni.$on('refresh', () => {
@@ -483,6 +484,23 @@
 		async onShow(options) {
 			await this.$onLaunched;
 			console.log('2')
+			this.form.startDate = ''
+			this.form.address = ''
+			this.form.endDate = ''
+			this.form.latitude = ''
+			this.form.longitude = ''
+			this.form.location = ''
+			this.form.locationEnd = ''
+			this.form.wayInfoDTOList = []
+			this.form.workType = 0
+			this.form.days = '' 
+			this.form.locationRemark = ''
+			this.form.supplement = ''
+			this.form.multifileList = []
+			this.form.estimatedAccount = ''
+			this.form.price = ''
+			this.viewStatus = false
+			this.clearAll()
 			
 			if(this.token && this.token != '' && this.userInfo && JSON.stringify(this.userInfo) != '{}') {
 				console.log('宸茬櫥闄�')
@@ -523,6 +541,7 @@
 					this.form.estimatedAccount = ''
 					this.form.price = ''
 					this.viewStatus = false
+					this.clearAll()
 				}
 			},
 			orderFood: {
@@ -562,6 +581,14 @@
 				this.orderFood[index].list.forEach(item => {
 					item.active = false
 				})
+			},
+			clearAll() { 
+				this.orderFood.forEach(p=>{
+					p.num=null
+					p.list.forEach(item => {
+						item.active = false
+					})
+				})				
 			},
 			getDictInfo(){
 				var that = this;
@@ -664,9 +691,31 @@
 				var that = this
 				if (!this.form.startDate) {
 					return uni.showToast({ title: '璇烽�夋嫨鐢ㄩ鏃堕棿', icon: 'none' })
+				} 
+				let cateringDTOList = []
+				let valid = true
+				let msg ='璇烽�夋嫨'
+				that.orderFood.forEach(item => {
+					item.list.forEach(child => {
+						if (child.active) {
+							// (Number(child.price) * Number(item.num))
+							if( !item.num){								 
+								msg =msg +'銆�'+item.name+'銆�';
+								valid =false  		 
+							}
+							cateringDTOList.push({
+								name: item.name,
+								num: item.num,
+								price: child.price * 100
+							})
+						}
+					})
+				})
+				if(!valid){
+					return uni.showToast({ title: msg+'鐢ㄩ浠芥暟', icon: 'none' })
 				}
-				if (this.form.price === 0) {
-					return uni.showToast({ title: '璇烽�夋嫨鐢ㄩ鏃堕棿', icon: 'none' })
+				if (cateringDTOList.length === 0) {
+					return uni.showToast({ title: '璇烽�夋嫨鐢ㄩ鏍囧噯', icon: 'none' })
 				}
 				if (!this.form.address) {
 					return uni.showToast({ title: '璇烽�夋嫨鐢ㄩ鍦扮偣', icon: 'none' })
@@ -676,20 +725,7 @@
 				}
 				uni.requestSubscribeMessage({
 					tmplIds: ['oVjOBLcHxIlGzOMJsdInmgI5CHGXh-UTvMzQqfFOnIg'],
-					success(res) {
-						let cateringDTOList = []
-						that.orderFood.forEach(item => {
-							item.list.forEach(child => {
-								if (child.active) {
-									// (Number(child.price) * Number(item.num))
-									cateringDTOList.push({
-										name: item.name,
-										num: item.num,
-										price: child.price * 100
-									})
-								}
-							})
-						})
+					success(res) { 
 						that.$u.api.release({
 							...that.form,
 							type: 2,
@@ -792,18 +828,19 @@
 			selectAddress(type, index) {
 				uni.chooseLocation({
 					success: (res) => { 
+						console.log("==================",res)
 						if ([1,2].includes(type)) {
 							this.form.latitude = res.latitude
 							this.form.longitude = res.longitude
-							this.form.address = res.address
+							this.form.address = res.name ||res.address
 						} else if (type === 3) {
-							this.form.locationEnd = res.address
+							this.form.locationEnd = res.name ||res.address
 							this.form.latEnd = res.latitude
 							this.form.lgtEnd = res.longitude
 						} else if (type === 4) {
-							this.form.wayInfoDTOList[0].lat = res.latitude
-							this.form.wayInfoDTOList[0].lgt = res.longitude
-							this.form.wayInfoDTOList[0].location = res.address
+							this.form.wayInfoDTOList[index].lat = res.latitude
+							this.form.wayInfoDTOList[index].lgt = res.longitude
+							this.form.wayInfoDTOList[index].location = res.name||  res.address
 						}else if (type == -1) {
 							console.log(res)
 							this.location.latitude = res.latitude

--
Gitblit v1.9.3