Browse Source

feat:运单轨迹,关于我们,个人运单

颜琼丽 8 giờ trước cách đây
mục cha
commit
adc29e827d

+ 1 - 1
jd_logistics-app/components/TimelineItem.vue

@@ -32,7 +32,7 @@
 					'status-title-active': isActive
 				}"
 			>
-				{{ title }}
+				{{ title }}{{1}}
 			</view>
 
 			<!-- 状态详情 -->

+ 6 - 2
jd_logistics-app/pages.json

@@ -49,7 +49,11 @@
 			}
 		},
 		{
-			"path": "pages/about/index"
+			"path": "pages/about/index",
+			"style" : 
+			{
+				"navigationBarTitleText" : "关于我们"
+			}
 		}
 	],
 	"subPackages": [
@@ -74,7 +78,7 @@
 					"path" : "webView",
 					"style" : 
 					{
-						"navigationBarTitleText" : "文章详情"
+						"navigationBarTitleText" : "个人寄件"
 					}
 				}
 			]

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 321 - 4
jd_logistics-app/pages/about/index.vue


+ 6 - 3
jd_logistics-app/pages/index/components/PersonalExpressDialog.vue

@@ -29,9 +29,9 @@
 			</view>
 
 			<!-- 取消按钮 -->
-			<view class="popup-footer">
+			<!-- <view class="popup-footer">
 				<button class="cancel-btn" @click="handleClose">取消</button>
-			</view>
+			</view> -->
 		</view>
 	</u-popup>
 </template>
@@ -54,11 +54,14 @@
 
 	const selectExpress = (company) => {
 		selectedExpress.value = company
-
 		// 延时关闭并传递选择结果
 		setTimeout(() => {
 			emit('select', company)
 			emit('update:visible', false)
+			const url = encodeURIComponent(company == '京东' ? "https://www.jdl.com/" : "https://www.sf-express.com/chn/sc")
+			uni.navigateTo({
+				url:'/pages/webView/webView?url=' + url
+			})
 			selectedExpress.value = ''
 		}, 300)
 	}

+ 8 - 24
jd_logistics-app/pages/logistics/index.vue

@@ -13,8 +13,8 @@
 		</view>
 
 		<!-- 当前最新物流状态 -->
-		<view v-if="currentTrace" class="current-status">
-			<view class="status-icon">
+		<!-- <view v-if="currentTrace" class="current-status"> -->
+			<!-- <view class="status-icon">
 				<text class="icon">{{ getStatusIcon(currentTrace.title) }}</text>
 			</view>
 			<view class="status-info">
@@ -26,7 +26,7 @@
 				</view>
 				<text class="status-time">{{ currentTrace.time }}</text>
 			</view>
-		</view>
+		</view> -->
 
 		<!-- 物流轨迹时间轴(滚动区域) -->
 		<scroll-view class="timeline-scroll" :style="{ height: scrollHeight + 'px' }" scroll-y>
@@ -35,7 +35,7 @@
 					v-for="(item, index) in deliverTraceList" 
 					:key="index"
 					:title="item.title"
-					:desc="item.desc"
+					:desc="item.context"
 					:time="item.time"
 					:is-active="item.isActive"
 					:show-line="index < deliverTraceList.length - 1"
@@ -48,10 +48,10 @@
 		</scroll-view>
 
 		<!-- 底部操作栏 -->
-		<view class="bottom-actions">
+	<!-- 	<view class="bottom-actions">
 			<button class="action-btn" @click="viewDetails">查看详情</button>
 			<button class="action-btn" @click="copyAllInfo">复制全部信息</button>
-		</view>
+		</view> -->
 	</view>
 </template>
 
@@ -77,10 +77,7 @@
 		if (options.orderNo) {
 			orderNo.value = options.orderNo
 			getDeliverTrace()
-		} else {
-			// 无参数时使用模拟数据(仅用于演示)
-			loadMockData()
-		}
+		} 
 	})
 
 	// 计算滚动区域高度(减去头部、当前状态、底部等固定高度)
@@ -108,9 +105,7 @@
 		queryDeliverTrace(params).then(response => {
 			if (response.code === 200 && response.data) {
 				// 按时间倒序排列(最新的在前)
-				const list = response.data.sort((a, b) => 
-					new Date(b.time) - new Date(a.time)
-				).map((item, index) => ({
+				const list = response.data.data.map((item, index) => ({
 					...item,
 					isActive: index === 0
 				}))
@@ -128,17 +123,6 @@
 		})
 	}
 
-	// 模拟数据(用于无参数时演示)
-	const loadMockData = () => {
-		orderNo.value = 'JDVA40141037033'
-		deliverTraceList.value = [
-			{ title: '已代收', desc: '您的快件已由[门卫]代收,快递员:马新宽、联系...', time: '2026-01-11 17:32:32', isActive: true, courier: { name: '马新宽', phone: '13800138000' } },
-			{ title: '派送中', desc: '快件已投递至【北京海淀区北京大学菜鸟驿站】...', time: '2026-01-11 15:20:10', isActive: false },
-			{ title: '运输中', desc: '快件已到达【北京转运中心】', time: '2026-01-10 08:45:22', isActive: false },
-			{ title: '运输中', desc: '快件已从【上海转运中心】发出', time: '2026-01-09 20:12:05', isActive: false },
-			{ title: '已揽件', desc: '快件已被【上海浦东营业部】揽收', time: '2026-01-09 14:30:00', isActive: false }
-		]
-	}
 
 	// 复制运单号
 	const copyTrackingNumber = (text) => {

+ 1 - 0
jd_logistics-app/pages/order/components/OrderItem.vue

@@ -58,6 +58,7 @@
 		<TrackPopup 
 			v-model:showPopup="showTrackPopup" 
 			:expressData="expressData"
+			:orderNo="orderDetail.externalWaybillNo"
 		/>
 	</view>
 </template>

+ 57 - 46
jd_logistics-app/pages/order/components/TrackPopup.vue

@@ -14,9 +14,19 @@
 			</view>
 			<!-- 物流轨迹时间线 -->
 			<scroll-view class="timeline-container" scroll-y="true">
-				<TimelineItem v-for="(item, index) in trackList" :key="index" :title="item.title" :desc="item.desc"
-					:time="item.time" :is-active="item.isActive" :show-line="index < trackList.length - 1"
-					:show-dot-bg="index == 0" />
+					<TimelineItem
+						v-for="(item, index) in deliverTraceList" 
+						:key="index"
+						:title="item.title"
+						:desc="item.context"
+						:time="item.time"
+						:is-active="item.isActive"
+						:show-line="index < deliverTraceList.length - 1"
+						:show-dot-bg="index === 0"
+					/>
+					<view v-if="deliverTraceList.length === 0 && !loading" class="empty-trace">
+						暂无物流轨迹
+					</view>
 			</scroll-view>
 		</view>
 	</u-popup>
@@ -26,15 +36,21 @@
 	import {
 		ref,
 		defineProps,
-		defineEmits
+		defineEmits,
+		watch
 	} from 'vue'
 	import TimelineItem from '@/components/TimelineItem.vue'
+	import { queryDeliverTrace } from '@/api/order'
 
 	const props = defineProps({
 		showPopup: {
 			type: Boolean,
 			default: false
 		},
+		orderNo:{
+			type: String,
+			default: ""
+		}
 		expressData: {
 			type: Object,
 			default: () => ({
@@ -48,49 +64,44 @@
 	const emit = defineEmits(['update:showPopup', 'close'])
 
 	// 模拟物流轨迹数据,实际应用中应该通过API获取
-	const trackList = ref([{
-			title: '已代收',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿...】',
-			time: '2026-01-11 17:32:32',
-			isActive: true
-		},
-		{
-			title: '派送中',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿...】',
-			time: '2026-01-11 17:32:32',
-			isActive: false
-		},
-		{
-			title: '运输中',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿.北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿..】',
-			time: '2026-01-11 17:32:32',
-			isActive: false
-		},
-		{
-			title: '',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿.北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿..】',
-			time: '2026-01-11 17:32:32',
-			isActive: false
-		},
-		{
-			title: '',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿.北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿..】',
-			time: '2026-01-11 17:32:32',
-			isActive: false
-		},
-		{
-			title: '',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿.北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿北京海淀区北京大学菜鸟驿..】',
-			time: '2026-01-11 17:32:32',
-			isActive: false
-		},
-		{
-			title: '已揽件',
-			desc: '快件已投递至【北京海淀区北京大学菜鸟驿..北京海淀区北京大学菜鸟驿.】',
-			time: '2026-01-11 17:32:32',
-			isActive: false
+	const trackList = ref([])
+	
+	watch( showPopup,(olddata,newData) => {
+		if(showPopup){
+			getDeliverTrace()
 		}
-	])
+	})
+	
+	// 获取真实物流轨迹
+	const getDeliverTrace = () => {
+		if (!props.orderNo) return
+		loading.value = true
+		const params = {
+			number: props.orderNo,
+			company: ''  // 可传入快递公司编码
+		}
+		queryDeliverTrace(params).then(response => {
+			if (response.code === 200 && response.data) {
+				// 按时间倒序排列(最新的在前)
+				const list = response.data.data.map((item, index) => ({
+					...item,
+					isActive: index === 0
+				}))
+				deliverTraceList.value = list
+			} else {
+				uni.showToast({ title: '未查询到物流信息', icon: 'none' })
+				deliverTraceList.value = []
+			}
+		}).catch(error => {
+			console.error('查询物流轨迹失败:', error)
+			uni.showToast({ title: '查询物流信息失败', icon: 'error' })
+			deliverTraceList.value = []
+		}).finally(() => {
+			loading.value = false
+		})
+	}
+	
+	
 
 	const closePopup = () => {
 		emit('update:showPopup', false)

+ 4 - 5
jd_logistics-app/pages/order/create_order.vue

@@ -146,7 +146,7 @@
 			</view>
 
 			<!-- 签单返还 -->
-			<view class="goods-item">
+			<view class="goods-item" >
 				<view class="item-label">签单返还</view>
 				<view class="item-control">
 					<switch color="#007AFF" :checked="valueServices.isReceiptCollect" @change="onSignReturnChange" />
@@ -724,10 +724,11 @@
 			if (res.code === 200) {
 				uni.showToast({
 					title: '下单成功',
-					icon: 'success'
+					icon: 'success',
+					mask: true
 				})
 				setTimeout(() => {
-					uni.switchTab({
+					uni.navigateTo({
 						url: '/pages/order/index'
 					})
 				}, 1000)
@@ -766,8 +767,6 @@
 		if (option.product) {
 			product.value = option.product
 		}
-		// 获取默认寄件地址
-		fetchDefaultSenderAddress()
 		// 获取快递类型字典
 		fetchDictData()
 	})

+ 1 - 1
jd_logistics-app/pages/search/search.vue

@@ -60,7 +60,7 @@
 			return
 		}
 		uni.navigateTo({
-			url:'/pages/logistics/index?orderNo=' + trackingNumber
+			url:'/pages/logistics/index?orderNo=' + trackingNumber.value.trim()
 		})
 		return
 	}