From 426f56affa64d00efafc3e1fa4a9afd95464bf2e Mon Sep 17 00:00:00 2001 From: TraeAI Date: Sat, 7 Mar 2026 11:20:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=90=E8=B4=B9=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=99=A8=E5=8A=9F=E8=83=BD=EF=BC=9A1.=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=B9=E9=85=8D=E8=BD=A6=E5=9E=8B=E4=BC=98=E5=85=88?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E9=AB=98=E6=A0=8F=E8=BD=A6=E5=92=8C=E5=B9=B3?= =?UTF-8?q?=E6=9D=BF=E8=BD=A6=202.=20=E4=BF=AE=E5=A4=8D=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E5=8F=82=E8=80=83=E4=BB=B7=E8=BF=87=E9=AB=98=E9=97=AE=E9=A2=98?= =?UTF-8?q?=203.=20=E4=BC=98=E5=8C=96=E5=B8=83=E5=B1=80=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=204.=20=E5=88=A0=E9=99=A4=E8=B4=B9=E7=94=A8=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E5=92=8C=E9=A2=84=E8=AE=A1=E6=97=B6=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/freight-calculator/index.js | 394 +++++++++++++++++----------- pages/freight-calculator/index.wxml | 83 +++--- pages/freight-calculator/index.wxss | 4 +- pages/goods-detail/goods-detail.js | 4 +- 4 files changed, 288 insertions(+), 197 deletions(-) diff --git a/pages/freight-calculator/index.js b/pages/freight-calculator/index.js index 18dfdf3..be3ff7c 100644 --- a/pages/freight-calculator/index.js +++ b/pages/freight-calculator/index.js @@ -33,7 +33,7 @@ Page({ name: '张顺玟', position: '物流经理', experience: 5, - phone: '15528115321', + phone: '19123901316', description: '拥有5年专业物流管理经验,擅长整车运输和零担拼车方案设计,对鸡蛋的运输要求有深入了解,能够为客户提供高效、安全的物流解决方案。' }, { @@ -41,7 +41,7 @@ Page({ name: '刘敏', position: '物流经理', experience: 5, - phone: '19123901316', + phone: '15528115321', description: '5年物流行业经验,专注于配送路线优化,熟悉各种车型的载重和体积限制,能够根据货物特性制定最适合的运输方案,确保货物安全准时送达。' } ], @@ -173,11 +173,15 @@ Page({ if (!weight && goodsInfo.netWeight && goodsInfo.quantity) { // 计算总重量:净重(斤) * 件数 / 2(换算为公斤) weight = (parseFloat(goodsInfo.netWeight) * parseInt(goodsInfo.quantity)) / 2; + } else if (!weight && (goodsInfo.spec || goodsInfo.specification || goodsInfo.specs) && goodsInfo.quantity) { + // 从规格中提取重量数字并计算总重量 + weight = this.calculateWeightFromSpec(goodsInfo); } this.setData({ selectedGoods: goodsInfo, 'goodsInfo.weight': weight, - 'goodsInfo.quantity': goodsInfo.quantity || 1 + 'goodsInfo.quantity': goodsInfo.quantity || 1, + weight: weight // 同步到运输参数的重量输入框 }); } catch (e) { console.error('解析货源信息失败:', e); @@ -206,12 +210,16 @@ Page({ if (!weight && goodsData.netWeight && goodsData.quantity) { // 计算总重量:净重(斤) * 件数 / 2(换算为公斤) weight = (parseFloat(goodsData.netWeight) * parseInt(goodsData.quantity)) / 2; + } else if (!weight && (goodsData.spec || goodsData.specification || goodsData.specs) && goodsData.quantity) { + // 从规格中提取重量数字并计算总重量 + weight = this.calculateWeightFromSpec(goodsData); } this.setData({ selectedGoods: goodsData, 'goodsInfo.weight': weight, - 'goodsInfo.quantity': goodsData.quantity || 1 + 'goodsInfo.quantity': goodsData.quantity || 1, + weight: weight // 同步到运输参数的重量输入框 }); // 设置出发地为商品所在地 @@ -281,18 +289,49 @@ Page({ // 设置货物重量(如果有) if (goodsItem.grossWeight) { this.setData({ - 'goodsInfo.weight': goodsItem.grossWeight + 'goodsInfo.weight': goodsItem.grossWeight, + weight: goodsItem.grossWeight // 同步到运输参数的重量输入框 }); } else if (goodsItem.netWeight && goodsItem.quantity) { // 计算总重量:净重(斤) * 件数 / 2(换算为公斤) const totalWeight = (parseFloat(goodsItem.netWeight) * parseInt(goodsItem.quantity)) / 2; this.setData({ - 'goodsInfo.weight': totalWeight + 'goodsInfo.weight': totalWeight, + weight: totalWeight // 同步到运输参数的重量输入框 + }); + } else if ((goodsItem.spec || goodsItem.specification || goodsItem.specs) && goodsItem.quantity) { + // 从规格中提取重量数字并计算总重量 + const totalWeight = this.calculateWeightFromSpec(goodsItem); + this.setData({ + 'goodsInfo.weight': totalWeight, + weight: totalWeight // 同步到运输参数的重量输入框 }); } } }, + // 从规格中提取重量数字并计算总重量 + calculateWeightFromSpec: function (goodsData) { + // 获取规格信息 + const spec = goodsData.spec || goodsData.specification || goodsData.specs || ''; + const quantity = parseInt(goodsData.quantity) || 1; + + console.log('从规格计算重量:', { spec, quantity }); + + // 从规格字符串中提取数字 + const weightMatch = spec.match(/(\d+(?:\.\d+)?)/); + if (weightMatch) { + const weightPerUnit = parseFloat(weightMatch[1]); + // 计算总重量:重量(斤) * 件数 / 2(换算为公斤) + const totalWeight = (weightPerUnit * quantity) / 2; + console.log('计算得到的总重量:', totalWeight, '公斤'); + return totalWeight; + } + + console.log('无法从规格中提取重量'); + return ''; + }, + // 解析地区信息 parseRegion: function (region) { if (!region) return {}; @@ -891,10 +930,10 @@ Page({ return; } - // 检查详细地址 - if (!this.data.origin.detail || !this.data.destination.detail) { + // 检查详细地址 - 目的地需要详细地址,出发地可以不需要 + if (!this.data.destination.detail) { wx.showToast({ - title: '请填写详细地址', + title: '请填写目的地详细地址', icon: 'none' }); return; @@ -1052,10 +1091,10 @@ Page({ return; } - // 构建出发地完整地址 - const originAddress = `${origin.province}${origin.city}${origin.district}${origin.detail}`; - if (!originAddress) { - rejectOrigin(new Error('出发地地址不能为空,请输入地址或使用手动选择位置')); + // 构建出发地完整地址 - 即使没有详细地址,也可以使用省市区信息 + const originAddress = `${origin.province}${origin.city}${origin.district}${origin.detail || ''}`; + if (!origin.province || !origin.city || !origin.district) { + rejectOrigin(new Error('出发地省市区信息不能为空,请输入地址或使用手动选择位置')); return; } @@ -1146,12 +1185,7 @@ Page({ }); }, - // 切换费用明细显示/隐藏 - toggleDetail: function () { - this.setData({ - showDetail: !this.data.showDetail - }); - }, + // 运输模式选择 bindTransportModeChange: function(e) { @@ -1172,6 +1206,28 @@ Page({ const vehicleTypeIndex = e.detail.value; const vehicleType = this.data.vehicleTypes[vehicleTypeIndex]; + // 检查选择的车型是否适合当前重量和体积 + const weightNum = parseFloat(this.data.weight) || 0; + const volumeNum = parseFloat(this.data.volume) || 0; + + if (weightNum > 0 || volumeNum > 0) { + const [weightRange, volumeRange] = this.data.baseInfo[vehicleType]; + const [minWeight, maxWeight] = weightRange.split('-').map(w => parseFloat(w.replace('kg', ''))); + const [minVolume, maxVolume] = volumeRange.split('-').map(v => parseFloat(v.replace('m³', ''))); + + // 检查重量和体积是否在车型的范围内 + const isWeightSuitable = weightNum === 0 || (weightNum >= minWeight && weightNum <= maxWeight); + const isVolumeSuitable = volumeNum === 0 || (volumeNum >= minVolume && volumeNum <= maxVolume); + + if (!isWeightSuitable || !isVolumeSuitable) { + wx.showToast({ + title: '选择的车型不适合当前重量和体积', + icon: 'none' + }); + return; + } + } + // 更新车长选项 const truckLengths = this.data.vehicleLengthMap[vehicleType]; @@ -1199,11 +1255,104 @@ Page({ // 输入处理 bindWeightInput: function(e) { - this.setData({ weight: e.detail.value }); + const weight = e.detail.value; + this.setData({ weight: weight }); + // 自动匹配车型和车长 + this.autoMatchVehicle(weight, this.data.volume); }, bindVolumeInput: function(e) { - this.setData({ volume: e.detail.value }); + const volume = e.detail.value; + this.setData({ volume: volume }); + // 自动匹配车型和车长 + this.autoMatchVehicle(this.data.weight, volume); + }, + + // 根据重量和体积自动匹配车型和车长 + autoMatchVehicle: function(weight, volume) { + const weightNum = parseFloat(weight) || 0; + const volumeNum = parseFloat(volume) || 0; + + if (weightNum <= 0 && volumeNum <= 0) { + return; // 没有有效输入,不进行匹配 + } + + // 过滤适合的车型并计算每个车型的最大载重和体积 + const suitableVehicles = []; + // 使用兼容的方式遍历对象 + for (const vehicleType in this.data.baseInfo) { + if (this.data.baseInfo.hasOwnProperty(vehicleType)) { + const [weightRange, volumeRange] = this.data.baseInfo[vehicleType]; + const weightRangeParts = weightRange.split('-'); + const volumeRangeParts = volumeRange.split('-'); + if (weightRangeParts.length === 2 && volumeRangeParts.length === 2) { + const minWeight = parseFloat(weightRangeParts[0].replace('kg', '')); + const maxWeight = parseFloat(weightRangeParts[1].replace('kg', '')); + const minVolume = parseFloat(volumeRangeParts[0].replace('m³', '')); + const maxVolume = parseFloat(volumeRangeParts[1].replace('m³', '')); + + // 检查重量和体积是否在车型的范围内 + if ((weightNum === 0 || (weightNum >= minWeight && weightNum <= maxWeight)) && + (volumeNum === 0 || (volumeNum >= minVolume && volumeNum <= maxVolume))) { + suitableVehicles.push({ + type: vehicleType, + maxWeight: maxWeight, + maxVolume: maxVolume, + // 为鸡蛋货物添加优先级:高栏车和平板车优先 + priority: (vehicleType === '高栏车' || vehicleType === '平板') ? 1 : 2 + }); + } + } + } + } + + if (suitableVehicles.length > 0) { + // 按照优先级、最大载重和体积排序 + suitableVehicles.sort((a, b) => { + // 优先按优先级排序(1 > 2) + if (a.priority !== b.priority) { + return a.priority - b.priority; + } + // 然后按最大载重排序 + if (a.maxWeight !== b.maxWeight) { + return a.maxWeight - b.maxWeight; + } + // 最后按最大体积排序 + return a.maxVolume - b.maxVolume; + }); + + // 选择第一个合适的车型 + const selectedVehicle = suitableVehicles[0].type; + const vehicleIndex = this.data.vehicleTypes.indexOf(selectedVehicle); + + if (vehicleIndex !== -1) { + // 更新车型 + this.setData({ vehicleTypeIndex: vehicleIndex }); + + // 更新车长选项 + const truckLengths = this.data.vehicleLengthMap[selectedVehicle]; + if (truckLengths) { + // 根据重量和体积选择最合适的车长 + let bestTruckLengthIndex = 0; + // 简单逻辑:如果重量或体积较大,选择较长的车 + if (weightNum > 5000 || volumeNum > 20) { + // 选择较长的车 + bestTruckLengthIndex = Math.min(truckLengths.length - 1, 2); + } else if (weightNum > 1000 || volumeNum > 10) { + // 选择中等长度的车 + bestTruckLengthIndex = Math.min(truckLengths.length - 1, 1); + } + + this.setData({ + truckLengths: truckLengths, + truckLengthIndex: bestTruckLengthIndex + }); + + // 更新车型信息 + this.updateVehicleInfo(); + } + } + } }, // 更新车型信息 @@ -1248,9 +1397,9 @@ Page({ return; } - // 检查详细地址 - if (!this.data.origin.detail || !this.data.destination.detail) { - wx.showToast({ title: '请填写详细地址', icon: 'none' }); + // 检查详细地址 - 目的地需要详细地址,出发地可以不需要 + if (!this.data.destination.detail) { + wx.showToast({ title: '请填写目的地详细地址', icon: 'none' }); return; } @@ -1311,7 +1460,6 @@ Page({ marketPrice: `${result.marketPrice}元`, complianceStatus: result.compliance.isCompliant ? '✓ 运输方案合规' : '✗ 运输方案不合规', isCompliant: result.compliance.isCompliant, - detailText: this.generateDetailText(result, transportMode, weight, volume, packagingType, 40), calculationResult: res.data // 保存API返回的结果 }); @@ -1382,62 +1530,7 @@ Page({ return { weather, holiday, timePeriod }; }, - // 生成详细文本 - generateDetailText: function(result, transportMode, weight, volume, packagingType, waitTime) { - let text = `费用明细:\n`; - text += ` 最低运费: ${result.feeMin}元\n`; - text += ` 最高运费: ${result.feeMax}元\n`; - text += ` 平均运费: ${result.feeAvg}元\n\n`; - - if (result.details.breakdown) { - text += `费用组成:\n`; - for (const [key, value] of Object.entries(result.details.breakdown)) { - text += ` ${key}: ${value}元\n`; - } - text += `\n`; - } - - text += `运输详情:\n`; - text += ` 运输模式: ${transportMode}\n`; - text += ` 车型: ${result.details.vehicleType}\n`; - text += ` 包装类型: ${packagingType === 'standard' ? '标准包装' : '加强包装'}\n`; - text += ` 实际重量: ${weight}公斤\n`; - text += ` 体积: ${volume}立方米\n`; - if (result.details.volumeWeight) { - text += ` 体积重量: ${result.details.volumeWeight}公斤\n`; - } - if (result.details.chargeWeight) { - text += ` 计费重量: ${result.details.chargeWeight}公斤\n`; - } - text += ` 预计等候时间: ${waitTime}分钟\n`; - if (result.details.estimatedPackages) { - text += ` 估算包装数量: ${result.details.estimatedPackages}个\n`; - } - // 添加运输距离信息 - text += ` 运输距离: ${result.distance || 0}公里\n`; - text += `\n`; - - if (result.details.marketFactor) { - text += `市场因素:\n`; - text += ` 天气状况: ${result.details.weather}\n`; - text += ` 是否节假日: ${result.details.holiday}\n`; - text += ` 时间段: ${result.details.timePeriod}\n`; - text += ` 市场因素系数: ${result.details.marketFactor}\n\n`; - } - - text += `市场参考:\n`; - text += ` 市场参考价: ${result.marketPrice}元\n`; - text += ` 价格合理性: ${result.priceReasonability}\n\n`; - - if (!result.compliance.isCompliant) { - text += `不合规原因:\n`; - for (const issue of result.compliance.issues) { - text += ` - ${issue}\n`; - } - } - - return text; - }, + // 计算鸡蛋运输运费 calculateEggShippingFee: function(transportMode, distance, weight, volume, packagingType, vehicleType, truckLength, waitTime, weather, holiday, timePeriod) { @@ -1920,7 +2013,7 @@ Page({ } }; - // 整车运输收费标准 + // 整车运输收费标准 - 调整为更接近运满满的实际价格 const rates = { '面包车': { startFee: 80, @@ -1935,70 +2028,70 @@ Page({ unitPriceMax: 1.8 }, '平板': { - startFee: 300, + startFee: 200, startDistance: 10, - unitPriceMin: 2.5, - unitPriceMax: 2.9 + unitPriceMin: 1.8, + unitPriceMax: 2.2 }, '厢式': { - startFee: 220, + startFee: 180, startDistance: 10, - unitPriceMin: 2.1, - unitPriceMax: 2.4 + unitPriceMin: 1.7, + unitPriceMax: 2.0 }, '高栏车': { - startFee: 200, + startFee: 150, startDistance: 10, - unitPriceMin: 2.5, - unitPriceMax: 2.8 + unitPriceMin: 1.8, + unitPriceMax: 2.2 }, '集装箱': { - startFee: 300, + startFee: 250, startDistance: 10, - unitPriceMin: 2.8, - unitPriceMax: 3.1 + unitPriceMin: 2.0, + unitPriceMax: 2.4 }, '自卸': { - startFee: 250, + startFee: 200, startDistance: 10, - unitPriceMin: 2.2, - unitPriceMax: 2.5 + unitPriceMin: 1.9, + unitPriceMax: 2.3 }, '冷藏': { - startFee: 300, + startFee: 250, startDistance: 10, - unitPriceMin: 2.5, - unitPriceMax: 2.8 + unitPriceMin: 2.0, + unitPriceMax: 2.4 }, '保温': { - startFee: 280, + startFee: 220, startDistance: 10, - unitPriceMin: 2.3, - unitPriceMax: 2.6 + unitPriceMin: 1.8, + unitPriceMax: 2.2 }, '棉被车': { - startFee: 260, + startFee: 200, startDistance: 10, - unitPriceMin: 2.2, - unitPriceMax: 2.5 + unitPriceMin: 1.7, + unitPriceMax: 2.1 }, '爬梯车': { - startFee: 280, + startFee: 220, startDistance: 10, - unitPriceMin: 2.3, - unitPriceMax: 2.6 + unitPriceMin: 1.8, + unitPriceMax: 2.2 }, '飞翼车': { - startFee: 270, + startFee: 210, startDistance: 10, - unitPriceMin: 2.2, - unitPriceMax: 2.5 + unitPriceMin: 1.7, + unitPriceMax: 2.1 }, '高低板': { - startFee: 350, + startFee: 280, startDistance: 10, - unitPriceMin: 2.8, - unitPriceMax: 3.1 + unitPriceMin: 2.0, + unitPriceMax: 2.4 } }; @@ -2022,10 +2115,13 @@ Page({ feeMin *= truckLengthFactor; feeMax *= truckLengthFactor; - // 根据货物重量和体积调整价格 - if (weight > 1000 || volume > 10) { - feeMin *= 1.1; - feeMax *= 1.1; + // 根据货物重量和体积调整价格 - 调整为更合理的系数 + if (weight > 3000 || volume > 15) { + feeMin *= 1.05; + feeMax *= 1.05; + } else if (weight > 1000 || volume > 10) { + feeMin *= 1.02; + feeMax *= 1.02; } // 添加平台佣金(运费的5%左右) @@ -2166,7 +2262,7 @@ Page({ // 应用车长系数 marketPrice *= truckLengthFactor; } else if (transportMode === '整车运输') { - // 基于整车运输真实收费标准 + // 基于整车运输真实收费标准 - 与 calculateYunmanmanFee 使用相同的费率 const rates = { '面包车': { startFee: 80, @@ -2179,59 +2275,59 @@ Page({ unitPrice: 1.65 }, '平板': { - startFee: 300, + startFee: 200, startDistance: 10, - unitPrice: 2.7 + unitPrice: 2.0 }, '厢式': { - startFee: 220, + startFee: 180, startDistance: 10, - unitPrice: 2.25 + unitPrice: 1.85 }, '高栏车': { - startFee: 200, + startFee: 150, startDistance: 10, - unitPrice: 2.65 + unitPrice: 2.0 }, '集装箱': { - startFee: 300, + startFee: 250, startDistance: 10, - unitPrice: 2.95 + unitPrice: 2.2 }, '自卸': { - startFee: 250, + startFee: 200, startDistance: 10, - unitPrice: 2.35 + unitPrice: 2.1 }, '冷藏': { - startFee: 300, + startFee: 250, startDistance: 10, - unitPrice: 2.65 + unitPrice: 2.2 }, '保温': { - startFee: 280, + startFee: 220, startDistance: 10, - unitPrice: 2.45 + unitPrice: 2.0 }, '棉被车': { - startFee: 260, + startFee: 200, startDistance: 10, - unitPrice: 2.35 + unitPrice: 1.9 }, '爬梯车': { - startFee: 280, + startFee: 220, startDistance: 10, - unitPrice: 2.45 + unitPrice: 2.0 }, '飞翼车': { - startFee: 270, + startFee: 210, startDistance: 10, - unitPrice: 2.35 + unitPrice: 1.9 }, '高低板': { - startFee: 350, + startFee: 280, startDistance: 10, - unitPrice: 2.95 + unitPrice: 2.2 } }; @@ -2244,16 +2340,18 @@ Page({ marketPrice = rate.startFee + extraDistance * rate.unitPrice; } - // 根据货物重量和体积调整价格 - if (weight > 1000 || volume > 10) { - marketPrice *= 1.1; + // 应用车长系数 + marketPrice *= truckLengthFactor; + + // 根据货物重量和体积调整价格 - 与 calculateYunmanmanFee 使用相同的系数 + if (weight > 3000 || volume > 15) { + marketPrice *= 1.05; + } else if (weight > 1000 || volume > 10) { + marketPrice *= 1.02; } // 添加平台佣金 marketPrice *= 1.05; - - // 应用车长系数 - marketPrice *= truckLengthFactor; } else { // 零担拼车市场参考价 const chargeWeight = Math.max(weight, volume * 333); diff --git a/pages/freight-calculator/index.wxml b/pages/freight-calculator/index.wxml index 138461d..b69647c 100644 --- a/pages/freight-calculator/index.wxml +++ b/pages/freight-calculator/index.wxml @@ -87,34 +87,34 @@ - - - 包装类型 - - - {{packagingTypes[packagingIndex]}} - - - - - - - 车型 - - - {{vehicleTypes[vehicleTypeIndex]}} - - - - - - - 车长 - - - {{truckLengths[truckLengthIndex]}} - - + + + + 包装类型 + + + {{packagingTypes[packagingIndex]}} + + + + + + 车型 + + + {{vehicleTypes[vehicleTypeIndex]}} + + + + + + 车长 + + + {{truckLengths[truckLengthIndex]}} + + + @@ -131,11 +131,11 @@ - - - @@ -152,10 +152,7 @@ 运输距离 {{calculationResult ? calculationResult.distance + ' km' : ''}} - - 预计时效 - {{calculationResult ? calculationResult.deliveryTime + ' 天' : ''}} - + 市场参考价 {{marketPrice}} @@ -171,15 +168,7 @@ 注:预估运费可能与实际费用存在误差,仅供参考。如需准确报价,建议联系下方专业物流老师获取详细方案。 - - - 费用明细 - - - {{detailText}} - + @@ -231,8 +220,10 @@ {{item.name.charAt(0)}} - {{item.name}} - {{item.position}} + 物流张经理 + 物流刘经理 + {{item.name}} + {{item.position}} {{item.experience}}年物流经验 认证物流师 diff --git a/pages/freight-calculator/index.wxss b/pages/freight-calculator/index.wxss index cb97f9e..857fdb8 100644 --- a/pages/freight-calculator/index.wxss +++ b/pages/freight-calculator/index.wxss @@ -449,14 +449,16 @@ color: #666; font-weight: 500; flex: 1; + min-width: 100rpx; } .result-value { font-size: 24rpx; font-weight: 600; color: #333; - flex: 1; + flex: 0 0 auto; text-align: right; + min-width: 200rpx; } .result-value.freight { diff --git a/pages/goods-detail/goods-detail.js b/pages/goods-detail/goods-detail.js index a1c82e6..c3c2db8 100644 --- a/pages/goods-detail/goods-detail.js +++ b/pages/goods-detail/goods-detail.js @@ -991,7 +991,7 @@ Page({ }); if (bargainPrice > minPrice) { - const step = bargainPrice < 20 ? 0.1 : 1; + const step = 0.1; const newPrice = formatPrice(bargainPrice - step); console.log('计算新价格:', newPrice); this.updatePrice(newPrice); @@ -1008,7 +1008,7 @@ Page({ }); if (bargainPrice < maxPrice) { - const step = bargainPrice < 20 ? 0.1 : 1; + const step = 0.1; const newPrice = formatPrice(bargainPrice + step); console.log('计算新价格:', newPrice); this.updatePrice(newPrice);