浏览代码

feat:创建订单功能完成,关于我们功能完成,物流轨迹功能完成

颜琼丽 2 周之前
父节点
当前提交
0840671860

+ 1 - 1
jd_logistics-app/api/home.js

@@ -27,7 +27,7 @@ export function getAdSearch(id='') {
  * 
  */
 export function getAdServicePhone() {
-  return request.get(`mini/ad/servicePhone`, {}, {noAuth:true});
+  return request.get(`system/front/wxmini/getContact`, {}, {noAuth:true});
 }
 /**
  * 广告详情

+ 3 - 1
jd_logistics-app/config/env.js

@@ -3,7 +3,9 @@
 // let domain = 'http://192.168.100.199:8081' // 晋守桦IP
 // let domain = 'http://192.168.100.14:8081' // 赵乔功IP
 // let domain = 'http://192.168.100.146:8079' // 马二勇
- let domain = 'http://192.168.100.92:8080' // 朝龙
+ // let domain = 'http://192.168.100.92:8080' // 朝龙
+ let domain = 'http://192.168.101.213:8080' // 小明
+ 
 // let domain = 'https://www.bjwdys.com/prod-api' //线上环境
 
 const getBaseUrl = () => {

+ 0 - 9
jd_logistics-app/pages.json

@@ -32,15 +32,6 @@
 				"navigationStyle": "custom"
 			}
 		},
-		{
-			"path" : "pages/ai/ai",
-			"style" : 
-			{
-				"navigationBarTitleText" : "",
-				"transparentTitle": "always",
-				"navigationStyle": "custom"
-			}
-		},
 		{
 			"path" : "pages/mine/settlementCode",
 			"style" : 

+ 0 - 146
jd_logistics-app/pages/index111/index.vue

@@ -1,146 +0,0 @@
-<template>
-	<view class="content padding30">
-		<view class="bg_color_fff padding20 border_radius_20" @click="to_service_search">
-			<u-search placeholder="输入你想知道的事" v-model="keyword" 
-			@search="toAi({msgContent:keyword})" 
-			@custom="toAi({msgContent:keyword})"
-			:showAction="false" borderColor="#ffffff"></u-search>
-		</view>
-		<swiper class="swiper_list bg_color_fff border_radius_20 mt20" circular :indicator-dots="true" :autoplay="true" indicator-active-color="#ffffff">
-			<swiper-item v-for="(item, index) in swiperList" :key="index" class="swiper_item border_radius_20"
-			@click="toWebView(item)"
-			>
-				<image :src="HTTP_ADMIN_URL+item.dictValue" mode="" class="swiper_img border_radius_20"></image>
-			</swiper-item>
-		</swiper>
-		<!-- 财智工具箱 -->
-		<view class="mt20 bg_color_fff border_radius_20">
-			<view class="bold font_size30 padding20">财智工具箱</view>
-			<view class="grid-container padding20">
-				<view class="border_radius_20" 
-				@click="toAi({agentId:item.agentId})"
-				v-for="(item, index) in agentList" :key="index">
-					<image :src="HTTP_ADMIN_URL+item.imageUrl" class="item-img"></image>
-					<view class="item-content">
-						<view class="font_size30 bold title text-ellipsis">{{item.agentName}}</view>
-						<view class="font_size20 gray mt10 desc text-ellipsis">{{item.agentDesc}}</view>
-					</view>
-				</view>
-			</view>
-		</view>
-		<!-- 常见问题 -->
-		<view class="mt20 bg_color_fff border_radius_20">
-			<view class="bold font_size30 padding20">常见问题</view>
-			<view class="padding20 flex-center-between border-bottom" 
-			@click="toAi({agentId:item.cssClass*1,msgContent:item.dictValue})"
-			v-for="(item, index) in adSearchList" :key="index">
-				<text class="flex_1 mr20">#{{item.dictValue}}</text>
-				<image src="/static/img/arrow-right.png" mode="widthFix" class="menu_img"></image>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script setup>
-import { ref } from "vue";
-import { adList, getAgentList, getAdSearch } from "@/api/home.js";
-import { HTTP_ADMIN_URL } from "@/config/app.js";
-import { onLoad, onShareAppMessage} from '@dcloudio/uni-app'
-onShareAppMessage((res) => {
-  return appStore.onShareAppMessageObj
-})
-import { useAppStore } from "@/stores/app";
-const appStore = useAppStore();
-const keyword = ref('');
-const swiperList = ref([]);
-const agentList = ref([]);
-const adSearchList = ref([]);
-
-onLoad(()=>{
-	console.log('index onLoad');
-	adListFn();
-	agentListFn();
-	getAdSearchFn();
-});
-
-function toWebView({targetPath,dictCode}){
-	if(targetPath){
-		uni.navigateTo({
-			url: '/pages/webView/webView?url='+encodeURIComponent(url)
-		});
-	}else{
-		uni.navigateTo({
-			url: '/pages/policy/ad_detail?dictCode='+dictCode
-		});
-	}
-}
-function toAi({agentId='', msgContent=''}){
-	if(agentId) appStore.UPDATE_agentId(agentId);
-	if(msgContent)appStore.UPDATE_msgContent(msgContent);
-	uni.switchTab({
-		url: '/pages/ai/ai'
-	});
-}
-//获取轮播图
-function adListFn(){
-	adList().then(res=>{
-		if(res.code == 200){
-			swiperList.value = res.data || [];
-		}
-	})
-}
-//获取智能体列表
-function agentListFn(){
-	getAgentList().then(res=>{
-		if(res.code == 200){
-			agentList.value = res.rows || [];
-		}
-	})
-}
-// 搜索常用问题
-function getAdSearchFn(){
-  getAdSearch().then(res=>{
-    if(res.code == 200){
-      adSearchList.value = res.data || [];
-    }
-  })
-}
-
-</script>
-
-<style scoped lang="scss">
-	.content{
-		/* 轮播 */
-		.swiper_list{
-			height: 350rpx;
-			overflow: visible;
-			.swiper_item{
-				height: fit-content !important;
-				.swiper_img{
-					width: 100%;
-					height: 350rpx;
-				}
-			}
-		}
-		.grid-container{
-			.item-img{
-				width: 100%;
-				height: 200rpx;
-				object-fit: cover;
-				object-position: center;
-				border-radius: 20rpx 20rpx 0 0;
-			}
-			.title, .desc {
-				display: -webkit-box; /* 将对象作为弹性伸缩盒子模型显示 ,适用于webkit内核浏览器 */
-				-webkit-box-orient: vertical; /* 设置或检索伸缩盒对象的子元素的排列方式 为垂直排列 */
-				-webkit-line-clamp: 1; /* 显示的行数,这里设置为2行 */
-				overflow: hidden; /* 隐藏超出的内容 */
-			}
-		}
-		.menu_img{
-			width: 50rpx;
-			height: 50rpx;
-		}
-	}
-
-</style>

+ 2 - 2
jd_logistics-app/pages/mine/mine.vue

@@ -193,8 +193,8 @@ async function checkUserStatus() {
 
 // 获取客服电话
 function getAdServicePhoneFn() {
-	getAdServicePhone({}).then(res => {
-		phoneNumber.value = res.data?.servicePhone || '';
+	getAdServicePhone({}).then(res => {	
+		phoneNumber.value = res.contact || '';
 	}).catch(err => {
 		console.log(err);
 	});

+ 44 - 38
jd_logistics-app/pages/order/components/TrackPopup.vue

@@ -53,52 +53,50 @@
 		},
 		expressData: {
 			type: Object,
-			default: () => ({
-				company: '顺丰速运',
-				number: 'SF1234567890123',
-				status: '已签收'
-			})
+			default: () => ({})
 		}
 	})
 
 	const emit = defineEmits(['update:showPopup', 'close'])
 
-	// 模拟物流轨迹数据,实际应用中应该通过API获取
-	const trackList = ref([])
+	const loading = ref(false)
+	const deliverTraceList = ref([])
+
 	
-	watch( showPopup,(olddata,newData) => {
-		if(showPopup){
-			getDeliverTrace()
-		}
+	watch(() => props.showPopup, (newVal) => {
+	  if (newVal) {
+		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 getDeliverTrace = async () => {
+	  if (!props.orderNo) {
+	    deliverTraceList.value = []
+	    return
+	  }
+	  loading.value = true
+	  try {
+	    const response = await queryDeliverTrace({
+	      number: props.orderNo,
+	      company: ''
+	    })
+	    if (response.code === 200 && response.data) {
+	      const list = response.data.data.map((item, index) => ({
+	        ...item,
+	        isActive: index === 0
+	      }))
+	      deliverTraceList.value = list
+	    } else {
+	      deliverTraceList.value = []
+	      uni.showToast({ title: '未查询到物流信息', icon: 'none' })
+	    }
+	  } catch (error) {
+	    console.error('查询物流轨迹失败:', error)
+	    uni.showToast({ title: '查询物流信息失败', icon: 'error' })
+	    deliverTraceList.value = []
+	  } finally {
+	    loading.value = false
+	  }
 	}
 	
 	
@@ -116,6 +114,7 @@
 		border-radius: 32rpx;
 		padding: 32rpx;
 		max-height: 88vh;
+		min-height: 50vh;
 		display: flex;
 		flex-direction: column;
 	}
@@ -145,6 +144,13 @@
 	.timeline-container {
 		overflow-y: auto;
 		max-height: calc(88vh - 120rpx);
+
+		.empty-trace {
+			text-align: center;
+			padding: 90rpx 0;
+			color: #999;
+			font-size: 28rpx;
+		}
 	}
 
 	/* 弹框样式调整 */

+ 29 - 20
jd_logistics-app/pages/order/create_order.vue

@@ -177,12 +177,12 @@
 
 		<!-- 协议同意 -->
 		<view class="agreement-card">
-			<view class="agreement-item">
+			<!-- <view class="agreement-item">
 				<checkbox color="#1B64F0" :checked="agreed" @click="toggleAgreement" style="transform:scale(0.8)" />
 				<text class="agreement-text">我已理解并同意遵守《快件服务协议》</text>
-			</view>
+			</view> -->
 			<view class="price-notice">
-				实际费用以快递员核实为准,四舍五入取整
+				实际费用以快递员核实为准
 			</view>
 		</view>
 
@@ -249,7 +249,7 @@
 
 	// ==================== 物品信息 ====================
 	const goodsInfo = ref('')
-	const weight = ref(1)
+	const weight = ref(0.5)
 	const volume = ref(0.001)
 	const quantity = ref(1)
 
@@ -345,17 +345,17 @@
 	])
 
 	// ==================== 协议 ====================
-	const agreed = ref(false)
+	const agreed = ref(true)
 
 	// ==================== 表单操作 ====================
 	// 重量
 	const increaseWeight = () => {
-		weight.value = parseFloat((weight.value + 0.5).toFixed(3))
+		weight.value = parseFloat((weight.value + 0.1).toFixed(3))
 		if (weight.value > 100) weight.value = 100
 	}
 	const decreaseWeight = () => {
-		weight.value = parseFloat((weight.value - 0.5).toFixed(3))
-		if (weight.value < 0.5) weight.value = 0.5
+		weight.value = parseFloat((weight.value - 0.1).toFixed(3))
+		if (weight.value < 0.1) weight.value = 0.1
 	}
 	const handleWeightInput = (e) => {
 		let value = e.detail.value.replace(/[^\d.]/g, '')
@@ -365,14 +365,14 @@
 			const decimal = value.split('.')[1]
 			if (decimal && decimal.length > 3) value = parseFloat(value).toFixed(3)
 		}
-		const num = parseFloat(value) || 0.5
-		weight.value = Math.max(0.5, Math.min(100, num))
+		const num = parseFloat(value) || 0.1
+		weight.value = Math.max(0.1, Math.min(100, num))
 	}
 
 	// 体积
 	const increaseVolume = () => {
 		volume.value = parseFloat((volume.value + 0.001).toFixed(3))
-		if (volume.value > 10) volume.value = 10
+		// if (volume.value > 10) volume.value = 10
 	}
 	const decreaseVolume = () => {
 		volume.value = parseFloat((volume.value - 0.001).toFixed(3))
@@ -393,7 +393,7 @@
 	// 件数
 	const increaseQuantity = () => {
 		quantity.value += 1
-		if (quantity.value > 99) quantity.value = 99
+		// if (quantity.value > 99) quantity.value = 99
 	}
 	const decreaseQuantity = () => {
 		quantity.value -= 1
@@ -402,7 +402,7 @@
 	const handleQuantityInput = (e) => {
 		let value = e.detail.value.replace(/\D/g, '')
 		const int = parseInt(value) || 1
-		quantity.value = Math.max(1, Math.min(99, int))
+		// quantity.value = Math.max(1, Math.min(99, int))
 	}
 
 	// 物品信息
@@ -667,9 +667,12 @@
 		return true
 	}
 
+	const isSubmit = ref(false)
 	// ==================== 提交订单 ====================
 	const submitOrder = async () => {
 		if (!validateForm()) return
+		if (isSubmit.value) return
+		isSubmit.value = true
 
 		// 构建增值服务JSON
 		const addedService = {
@@ -716,35 +719,38 @@
 		}
 
 		uni.showLoading({
-			title: '提交中...'
+			title: '提交中...',
+			mask:true
 		})
 		try {
 			const res = await createOrder(orderData)
-			uni.hideLoading()
+			// uni.hideLoading()
 			if (res.code === 200) {
 				uni.showToast({
 					title: '下单成功',
 					icon: 'success',
 					mask: true
 				})
-				setTimeout(() => {
-					uni.navigateTo({
-						url: '/pages/order/index'
-					})
-				}, 1000)
+				uni.redirectTo({
+					url: '/pages/order/index'
+				})
 			} else {
+				isSubmit.value = false
 				uni.showToast({
 					title: res.msg || '下单失败',
 					icon: 'none'
 				})
 			}
 		} catch (error) {
+			isSubmit.value = false
 			uni.hideLoading()
 			uni.showToast({
 				title: '网络错误,请重试',
 				icon: 'none'
 			})
 			console.error('订单提交失败', error)
+		} finally{
+			uni.hideLoading()
 		}
 	}
 
@@ -782,6 +788,9 @@
 				saveAddressToStorage('receiverAddress', data.address)
 			}
 		})
+		if(!addressSend.addressId){
+			fetchDefaultSenderAddress()
+		}
 	})
 
 	// 组件卸载时取消监听