diff --git a/pages/freight-calculator/index.js b/pages/freight-calculator/index.js index bc8d66f..1881b1f 100644 --- a/pages/freight-calculator/index.js +++ b/pages/freight-calculator/index.js @@ -28,24 +28,19 @@ Page({ logisticsPersonnel: [ { id: 1, - name: '张三', + name: '张顺玟', position: '物流经理', experience: 5, - phone: '13800138000' + phone: '15528115321', + description: '拥有5年专业物流管理经验,擅长整车运输和零担拼车方案设计,对鸡蛋的运输要求有深入了解,能够为客户提供高效、安全的物流解决方案。' }, { id: 2, - name: '李四', + name: '刘敏', position: '物流经理', - experience: 3, - phone: '13900139000' - }, - { - id: 3, - name: '王五', - position: '物流经理', - experience: 2, - phone: '13700137000' + experience: 5, + phone: '19123901316', + description: '5年物流行业经验,专注于配送路线优化,熟悉各种车型的载重和体积限制,能够根据货物特性制定最适合的运输方案,确保货物安全准时送达。' } ], // 选中的货源信息 @@ -865,9 +860,18 @@ Page({ // 计算运费 calculateFreight: function () { // 验证输入 - if (!this.data.origin.province || !this.data.destination.province) { + if (!this.data.origin.province || !this.data.origin.city || !this.data.destination.province || !this.data.destination.city) { + wx.showToast({ + title: '请完整填写出发地和目的地信息', + icon: 'none' + }); + return; + } + + // 检查详细地址 + if (!this.data.origin.detail || !this.data.destination.detail) { wx.showToast({ - title: '请填写完整的出发地和目的地', + title: '请填写详细地址', icon: 'none' }); return; @@ -1018,7 +1022,7 @@ Page({ convertAddressToCoordinates: function (origin, destination) { return new Promise((resolve, reject) => { // 转换出发地地址 - const convertOrigin = new Promise((resolveOrigin) => { + const convertOrigin = new Promise((resolveOrigin, rejectOrigin) => { // 如果出发地已经有经纬度,直接返回 if (origin.latitude && origin.longitude) { resolveOrigin(origin); @@ -1028,7 +1032,7 @@ Page({ // 构建出发地完整地址 const originAddress = `${origin.province}${origin.city}${origin.district}${origin.detail}`; if (!originAddress) { - resolveOrigin(origin); + rejectOrigin(new Error('出发地地址不能为空,请输入地址或使用手动选择位置')); return; } @@ -1049,18 +1053,18 @@ Page({ }); } else { console.error('出发地地址转换失败:', res.data); - resolveOrigin(origin); + rejectOrigin(new Error('出发地地址无效,请检查输入或使用手动选择位置')); } }, fail: function (err) { console.error('出发地地址转换失败:', err); - resolveOrigin(origin); + rejectOrigin(new Error('出发地地址转换失败,请稍后重试')); } }); }); // 转换目的地地址 - const convertDestination = new Promise((resolveDestination) => { + const convertDestination = new Promise((resolveDestination, rejectDestination) => { // 如果目的地已经有经纬度,直接返回 if (destination.latitude && destination.longitude) { resolveDestination(destination); @@ -1070,7 +1074,7 @@ Page({ // 构建目的地完整地址 const destinationAddress = `${destination.province}${destination.city}${destination.district}${destination.detail}`; if (!destinationAddress) { - resolveDestination(destination); + rejectDestination(new Error('目的地地址不能为空,请输入地址或使用手动选择位置')); return; } @@ -1091,18 +1095,27 @@ Page({ }); } else { console.error('目的地地址转换失败:', res.data); - resolveDestination(destination); + rejectDestination(new Error('目的地地址无效,请检查输入或使用手动选择位置')); } }, fail: function (err) { console.error('目的地地址转换失败:', err); - resolveDestination(destination); + rejectDestination(new Error('目的地地址转换失败,请稍后重试')); } }); }); // 等待两个地址转换完成 Promise.all([convertOrigin, convertDestination]).then(([originWithCoords, destinationWithCoords]) => { + // 验证两个地址都有经纬度 + if (!originWithCoords.latitude || !originWithCoords.longitude) { + reject(new Error('出发地地址无效,请检查输入')); + return; + } + if (!destinationWithCoords.latitude || !destinationWithCoords.longitude) { + reject(new Error('目的地地址无效,请检查输入')); + return; + } resolve({ originWithCoords, destinationWithCoords }); }).catch(err => { reject(err); @@ -1207,8 +1220,14 @@ Page({ } // 检查是否有出发地和目的地信息 - if (!this.data.origin.province || !this.data.destination.province) { - wx.showToast({ title: '请选择出发地和目的地', icon: 'none' }); + if (!this.data.origin.province || !this.data.origin.city || !this.data.destination.province || !this.data.destination.city) { + wx.showToast({ title: '请完整填写出发地和目的地信息', icon: 'none' }); + return; + } + + // 检查详细地址 + if (!this.data.origin.detail || !this.data.destination.detail) { + wx.showToast({ title: '请填写详细地址', icon: 'none' }); return; } @@ -1300,7 +1319,7 @@ Page({ this.setData({ loading: false }); console.error('地址转换失败:', err); wx.showToast({ - title: '地址转换失败,请稍后重试', + title: err.message || '地址转换失败,请检查输入', icon: 'none' }); }); diff --git a/pages/freight-calculator/index.wxml b/pages/freight-calculator/index.wxml index aec0a3a..470e5bf 100644 --- a/pages/freight-calculator/index.wxml +++ b/pages/freight-calculator/index.wxml @@ -165,6 +165,12 @@ {{complianceStatus}} + + + + 注:预估运费可能与实际费用存在误差,仅供参考。如需准确报价,建议联系下方专业物流老师获取详细方案。 + + 费用明细 @@ -220,7 +226,9 @@ - {{item.name.charAt(0)}} + + + {{item.name.charAt(0)}} {{item.name}} diff --git a/pages/freight-calculator/index.wxss b/pages/freight-calculator/index.wxss index a6b4e56..cb97f9e 100644 --- a/pages/freight-calculator/index.wxss +++ b/pages/freight-calculator/index.wxss @@ -103,6 +103,13 @@ text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.2); } +.avatar-image { + width: 100%; + height: 100%; + border-radius: 50%; + object-fit: cover; +} + .personnel-header-info { flex: 1; display: flex; @@ -134,11 +141,20 @@ .personnel-tag { font-size: 18rpx; - color: #1989fa; - background-color: rgba(25, 137, 250, 0.1); - padding: 6rpx 14rpx; - border-radius: 16rpx; - border: 1rpx solid rgba(25, 137, 250, 0.2); + color: #1890ff; + background: linear-gradient(135deg, rgba(25, 137, 250, 0.15), rgba(24, 144, 255, 0.05)); + padding: 8rpx 16rpx; + border-radius: 20rpx; + border: 1rpx solid rgba(25, 137, 250, 0.3); + box-shadow: 0 2rpx 6rpx rgba(25, 137, 250, 0.15); + font-weight: 500; + transition: all 0.3s ease; +} + +.personnel-tag:hover { + background: linear-gradient(135deg, rgba(25, 137, 250, 0.2), rgba(24, 144, 255, 0.1)); + box-shadow: 0 3rpx 8rpx rgba(25, 137, 250, 0.2); + transform: translateY(-1rpx); } .personnel-description { @@ -186,16 +202,17 @@ background: linear-gradient(135deg, #1989fa 0%, #1890ff 100%); color: #fff; border: none; - border-radius: 8rpx; - padding: 14rpx 28rpx; - font-size: 22rpx; + border-radius: 6rpx; + padding: 10rpx 16rpx; + font-size: 20rpx; font-weight: 600; display: flex; align-items: center; justify-content: center; - gap: 8rpx; - box-shadow: 0 4rpx 12rpx rgba(25, 137, 250, 0.3); + gap: 6rpx; + box-shadow: 0 2rpx 8rpx rgba(25, 137, 250, 0.3); transition: all 0.3s ease; + white-space: nowrap; } .contact-btn:hover { @@ -447,6 +464,24 @@ font-size: 28rpx; } +/* 结果提示信息 */ +.result-note { + margin-top: 16rpx; + padding: 16rpx; + background-color: #fff7e6; + border-radius: 8rpx; + border-left: 4rpx solid #fa8c16; + width: 100%; + box-sizing: border-box; +} + +.note-text { + font-size: 20rpx; + color: #fa8c16; + line-height: 1.5; + font-weight: 500; +} + /* 历史记录 */ .history-list { margin-top: 12rpx;