From 9d901b4215323c97a00a068cd962f5c9c04dadfa Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 04 九月 2025 10:15:09 +0800
Subject: [PATCH] 前端

---
 small-program/pages/index/index.vue |  187 +++++++++++++++++++++++++++++++---------------
 1 files changed, 126 insertions(+), 61 deletions(-)

diff --git a/small-program/pages/index/index.vue b/small-program/pages/index/index.vue
index 1299158..41ec7ff 100644
--- a/small-program/pages/index/index.vue
+++ b/small-program/pages/index/index.vue
@@ -20,19 +20,17 @@
 				</view>
 			</view>
 			<view class="index-j-list">
-				<view class="index-list-item" v-for="(item, index) in orderList" :key="index">
+				<view class="index-list-item" v-if="orderList && orderList.length" v-for="(item, index) in orderList" :key="index">
 					<view class="index-list-item-head">
 						<view class="index-list-item-head-l">
 							<view class="xoam"></view>
 							<text v-if="item.type === 0 && item.workType === 0">鐢ㄥ伐鍗� - 閲囨憳宸�</text>
 							<text v-else-if="item.type === 0 && item.workType === 1">鐢ㄥ伐鍗� - 鍒嗘嫞宸�</text>
 							<text v-else-if="item.type === 0 && item.workType === 2">鐢ㄥ伐鍗� - 鍖呰宸�</text>
-							
-							<text v-else-if="item.type === 1">杩愯揣鍗�-{{item.categoryName}}-{{item.carUnit}}</text>
-							
+							<text v-else-if="item.type === 1">杩愯揣鍗�-{{item.categoryName}}</text>
 							<text v-else-if="item.type === 2">璁㈤鍗�</text>
 						</view>
-						<view class="index-list-item-head-r">璺濈 {{item.distance}}km</view>
+						<view class="index-list-item-head-r">{{item.distance}}km</view>
 					</view>
 					<view class="index-list-item-info" v-if="item.type === 0 && item.workType === 0">
 						{{item.categoryName}}锝渰{item.priceNum1}}鏂�
@@ -44,7 +42,7 @@
 						{{item.categoryName}}锝渰{item.priceNum1}}浜�
 					</view>
 					<view class="index-list-item-info" v-if="item.type === 1">
-						{{item.transportTypeName}} | {{item.transportNum}}{{item.transportUnit}}锝滅敤杞{item.priceNum1}}澶�
+					{{item.carUnit}} | {{item.transportTypeName}} | {{item.transportNum}}{{item.transportUnit}}锝滅敤杞{item.priceNum1}}澶�
 					</view>
 					<view class="index-list-item-info" v-if="item.type === 2">
 						{{item.wayInfoCopy}}
@@ -52,7 +50,7 @@
 					
 					<view class="address" v-if="item.type === 1">
 						<view class="address-xian"></view>
-						<view class="address-row" v-for="(address, i) in item.wayInfo" :key="i">
+						<view class="address-row" v-if="item.wayInfo" v-for="(address, i) in item.wayInfo" :key="i">
 							<image src="/static/icon/ic_qidian@2x.png" mode="widthFix" v-if="i === 0"></image>
 							<image src="/static/icon/ic_jingguo@2x.png" mode="widthFix" v-else-if="i !== 0 && i !== item.wayInfo.length - 1"></image>
 							<image src="/static/icon/ic_zhongdian@2x.png" mode="widthFix" v-else-if="i === item.wayInfo.length - 1"></image>
@@ -78,6 +76,8 @@
 						<view class="eidt-btn" @click="show1 = true, orderId = item.id">鎶㈠崟</view>
 					</view>
 				</view>
+				<view v-if="orderList && orderList.length&& !next" class="more">宸插姞杞藉叏閮�</view>
+				<view v-if="(!orderList || !orderList.length)&& !next"  class="more">鏆傛棤璁㈠崟鍝�</view>
 			</view>
 		</view>
 		
@@ -93,6 +93,7 @@
 			
 			<view class="index-c-cate">
 				<view
+					v-if="type"
 					:class="typeId === item.id ? 'index-c-cate-item active' : 'index-c-cate-item'"
 					v-for="(item, index) in type"
 					:key="index"
@@ -116,11 +117,11 @@
 						<view class="list-item-row">
 							<view class="list-item-row-label">鐢ㄩ鏃堕棿<b>*</b></view>
 							<view class="list-item-row-radio">
-								<view class="radio-item" v-for="(item, index) in orderFood" :key="index">
+								<view class="radio-item" v-if="orderFood" v-for="(item, index) in orderFood" :key="index">
 									<view class="radio-item-label">{{item.name}}</view>
 									<view class="radio-item-list">
 										<view class="radio-item-list-l">
-											<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 v-if="item.list" :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>
@@ -154,7 +155,7 @@
 						<view class="list-item-row" v-if="viewStatus">
 							<view class="list-item-row-label">鍥剧墖</view>
 							<view class="list-item-row-upload">
-								<view class="upload-item" v-for="(item, index) in form.multifileList" :key="index">
+								<view class="upload-item" v-if=" form.multifileList" v-for="(item, index) in form.multifileList" :key="index">
 									<image :src="item.url" mode="widthFix"></image>
 									<image class="upload-item-dele" @click="form.multifileList.splice(index, 1)" src="/static/icon/ic_delete1@2x.png" mode="widthFix"></image>
 								</view>
@@ -207,7 +208,7 @@
 					<!-- 鐢ㄥ伐 -->
 					<template v-if="typeId === 0">
 						<view class="box-hz-cate">
-							<view :class="form.workType === item.id ? 'box-hz-cate-item active' : 'box-hz-cate-item'" v-for="(item, index) in typeWork" :key="index" @click="clickTypeWork(item.id)">
+							<view v-if="typeWork" :class="form.workType === item.id ? 'box-hz-cate-item active' : 'box-hz-cate-item'" v-for="(item, index) in typeWork" :key="index" @click="clickTypeWork(item.id)">
 								<text>{{item.name}}</text>
 								<view class="box-hz-cate-item-x" v-if="form.workType === item.id"></view>
 							</view>
@@ -238,12 +239,13 @@
 					
 					<!-- 杩愯揣 -->
 					<template v-if="typeId === 1">
-						<view class="box-hz-cate">
-							<view :class="form.categoryId === item.id ? 'box-hz-cate-item active' : 'box-hz-cate-item'" v-for="(item, index) in car" :key="index" @click="clickCar(item)">
+						<scroll-view class="nav-scroll" scroll-x="true">
+							<view v-if="car" :class="form.categoryId === item.id ? 'nav-item active' : 'nav-item'" v-for="(item, index) in car" :key="index" @click="clickCar(item)">
 								<text>{{item.name}}</text>
-								<view class="box-hz-cate-item-x" v-if="form.categoryId === item.id"></view>
+								<view class="nav-item-x" v-if="form.categoryId === item.id"></view>
 							</view>
-						</view>
+						</scroll-view>
+						
 						<view class="box-hz-car">
 							<view class="box-hz-car-image">
 								<image :src="carImage" mode="widthFix"></image>
@@ -278,7 +280,7 @@
 											<u-icon name="arrow-right" color="#111111" size="16"></u-icon>
 										</view>
 									</view>
-									<view class="item-d-row" v-for="(item, index) in form.wayInfoDTOList" :key="index" @click="selectAddress(4, index)">
+									<view class="item-d-row" v-if="form.wayInfoDTOList" v-for="(item, index) in form.wayInfoDTOList" :key="index" @click="selectAddress(4, index)">
 										<view class="item-d-row-icon">
 											<image src="/static/icon/ic_jingguo@2x.png" mode="widthFix"></image>
 										</view>
@@ -303,10 +305,10 @@
 							</view>
 						</view>
 					</template>
-					
 					<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()" v-if="typeId  == 2">绔嬪嵆涓嬪崟</view>
+						<view class="box-hz-btn-next"  @click="jump()" v-if="typeId !== 2">涓嬩竴姝�</view>
 					</view>
 				</view>
 			</view>
@@ -321,7 +323,7 @@
 					<view></view>
 					<text>瀹㈡湇鐢佃瘽</text> 
 				</view>
-				 <view class="phone-item" v-for="(item,index) in serverPhone"    :key="item" @click="contactPhoneDo(item)">
+				 <view class="phone-item" v-if="serverPhone" v-for="(item,index) in serverPhone"    :key="item" @click="contactPhoneDo(item)">
 				 	<view></view>
 				 	<text>{{item}}</text> 
 				 </view>  
@@ -342,6 +344,20 @@
 			<view slot="confirmButton" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
 				<view class="btn1" @click="show1 = false">鍙栨秷</view>
 				<view class="btn2" @click="getaccept1">纭</view>
+			</view>
+		</u-modal>
+		<u-modal
+			title="鏀粯鏈垚鍔�"
+			:show="show2"
+			closeOnClickOverlay
+			showCancelButton
+		>
+			<view class="slot-content">
+				璇风‘璁ゆ槸鍚﹀彇娑堟敮浠樻垨鏌ョ湅璁㈠崟缁х画鏀粯锛�
+			</view>
+			<view slot="confirmButton" style="display: flex; justify-content: space-between; align-items: center; width: 100%;">
+				<view class="btn1" @click="show2 = false;payOrderId=null">鍙栨秷鏀粯</view>
+				<view class="btn2" @click="goOrderDetail(payOrderId)">鏌ョ湅璁㈠崟</view>
 			</view>
 		</u-modal>
 	</view>
@@ -431,7 +447,9 @@
 				
 				isOnce: true,
 				show1: false,
-				orderId: null
+				show2: false,
+				orderId: null,
+				payOrderId:null
 			}
 		},
 		async onLoad() { 
@@ -483,25 +501,6 @@
 		},
 		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('宸茬櫥闄�')
 				this.isLogin = true
@@ -520,28 +519,12 @@
 				this.isLogin = false
 				console.log('鏈櫥闄�')
 			}
+			this.payOrderId=null 
 		},
 		watch: {
 			typeId: {
 				handler(news, old) {
-					console.log('typeId')
-					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()
+					this.clearFormParam()
 				}
 			},
 			orderFood: {
@@ -559,12 +542,14 @@
 							price += num * item.num
 						}
 					})
+					console.log("========================",price)
 					this.form.price = price
 				}
 			},
 			'form.price': {
 				handler(news, old) {
-					if (news > 0) {
+					console.log(news,"==========",old)
+					if (news != old) {
 						this.getPrice()
 					}
 				}
@@ -576,11 +561,38 @@
 			}
 		},
 		methods: {
+			goOrderDetail(id){
+				uni.navigateTo({
+					url: `/pages/order-details/order-details?id=`+id
+				})
+				this.orderId=null 
+				this.payOrderId=null 
+				this.show2=false
+			},
+			clearFormParam(){
+				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()
+			},
 			clear(index) {
 				this.orderFood[index].num = ''
 				this.orderFood[index].list.forEach(item => {
 					item.active = false
-				})
+				}) 
 			},
 			clearAll() { 
 				this.orderFood.forEach(p=>{
@@ -619,6 +631,7 @@
 								that.next = true
 								that.orderList = []
 								that.getOrderList()
+								that.goOrderDetail(that.orderId)
 							}, 2000)
 						}
 					})
@@ -627,7 +640,7 @@
 				var that = this;
 				this.show1 = false
 				uni.requestSubscribeMessage({
-					tmplIds: ['tDpYImlrdv-0d3euTrHbYZ1cEZvjVHTNlqHvV0tpLHg'],
+					tmplIds: ['AA97cHjvlPiNO4viMkVe4JifCf9TD5b5Eb7s6El3VS8','3YSC7gouRlSjHXz4CrWOGFzPmGwEBtFj4snwdfMvKHk','tDpYImlrdv-0d3euTrHbYZ1cEZvjVHTNlqHvV0tpLHg'],
 					success(res) {
 						that.getaccept()
 					},
@@ -689,6 +702,7 @@
 			// 鎻愪氦璁㈠崟
 			submit() {
 				var that = this
+				this.payOrderId=null
 				if (!this.form.startDate) {
 					return uni.showToast({ title: '璇烽�夋嫨鐢ㄩ鏃堕棿', icon: 'none' })
 				} 
@@ -704,6 +718,7 @@
 								valid =false  		 
 							}
 							cateringDTOList.push({
+								id:item.id,
 								name: item.name,
 								num: item.num,
 								price: child.price * 100
@@ -724,7 +739,7 @@
 					return uni.showToast({ title: '璇疯緭鍏ヨ仈绯荤數璇�', icon: 'none' })
 				}
 				uni.requestSubscribeMessage({
-					tmplIds: ['oVjOBLcHxIlGzOMJsdInmgI5CHGXh-UTvMzQqfFOnIg'],
+					tmplIds: ['oVjOBLcHxIlGzOMJsdInmgI5CHGXh-UTvMzQqfFOnIg','AA97cHjvlPiNO4viMkVe4JifCf9TD5b5Eb7s6El3VS8'],
 					success(res) { 
 						that.$u.api.release({
 							...that.form,
@@ -737,6 +752,7 @@
 							cateringDTOList
 						}).then(res => {
 							if (res.code == 200) {
+								that.clearFormParam();
 								wx.requestPayment({
 									timeStamp: res.data.object.timeStamp,
 									nonceStr: res.data.object.nonceStr,
@@ -754,6 +770,8 @@
 										}
 									},
 									fail(err) {
+										that.payOrderId = res.data.id
+										that.show2=true
 										console.log(err)
 									}
 								})
@@ -804,6 +822,8 @@
 							that.form.estimatedAccount = res.data
 						}
 					})
+				}else{
+					that.form.estimatedAccount = 0
 				}
 			},
 			addAddr() {
@@ -1110,6 +1130,13 @@
 				width: 100%;
 				padding: 24rpx 30rpx;
 				box-sizing: border-box;
+				.more{
+					width: 100%;
+					margin-top: 40rpx;
+					text-align: center;
+					font-size: 24rpx;
+					color: #666666;
+				}
 				.index-list-item {
 					width: 100%;
 					padding: 30rpx;
@@ -1754,6 +1781,44 @@
 							margin-top: 30rpx;
 						}
 					}
+					.nav-scroll {
+					    white-space: nowrap; /* 闃叉瀵艰埅椤规崲琛� */						
+						margin-bottom: 50rpx;
+						height: 66rpx;
+					    overflow: auto; /* 鍏佽婊氬姩鏉″嚭鐜� */
+						.nav-item {
+						  display: inline-block; /* 浣垮鑸」姘村钩鎺掑垪 */
+						  margin-right: 60rpx;
+						  position: relative;
+						  text {
+						  	font-weight: 400;
+						  	font-size: 30rpx;
+						  	color: #666666;
+						  }
+						  .nav-item-x {
+						  	width: 40rpx;
+						  	height: 6rpx;
+						  	position: absolute;
+						  	bottom: -10rpx;
+						  	left: 50%;
+						  	transform: translate(-50%, 0);
+						  	background: #FF5A40;
+						  	border-radius: 3rpx;
+						  }
+						  // padding: 10px 20px; /* 璁剧疆鍐呰竟璺� */
+						  // margin-right: 10px; /* 璁剧疆鍙宠竟璺� */
+						  // background-color: #f0f0f0; /* 璁剧疆鑳屾櫙鑹� */
+						  // border: 1px solid #ddd; /* 璁剧疆杈规 */
+						  // border-radius: 5px; /* 璁剧疆鍦嗚 */
+					  }
+					  .active {
+					  	text {
+					  		font-weight: 600 !important;
+					  		font-size: 32rpx !important;
+					  		color: #222222 !important;
+					  	}
+					  }
+					}
 					.box-hz-cate {
 						width: 100%;
 						display: flex;

--
Gitblit v1.9.3