From 12330f64b5198c17c28695dd07a2b7d9b40f0c7d Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Wed, 3 Jun 2026 17:35:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E8=AE=A1=E7=AE=97:=E6=9C=80?= =?UTF-8?q?=E4=BD=8E=E4=BB=B7/=E5=9D=87=E4=BB=B7=E6=A8=A1=E5=BC=8F+?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E9=99=8D=E4=BB=B7+=E6=9C=80=E4=BD=8E?= =?UTF-8?q?=E4=B9=A6=E4=BB=B7+=E6=90=9C=E7=B4=A2=E5=90=8E=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index 38dfa79..5457917 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -840,6 +840,28 @@ export default { } return this.selectedCondition ? (map[this.selectedCondition] || '') : '' }, + calculatedPrice() { + const sorted = this.sortedProductList + if (sorted.length === 0) return 0 + const shipping = Number(this.shippingFee) || 0 + const discount = Number(this.priceDiscount) || 0 + const minPrice = Number(this.minBookPrice) || 0 + let result = 0 + if (this.priceMode === 'lowest') { + const idx = Math.min((Number(this.lowestRank) || 1) - 1, sorted.length - 1) + const selectedTotal = parseFloat(sorted[idx].totalPrice) || 0 + result = selectedTotal - shipping - discount + } else { + const count = Math.min(Number(this.averageCount) || 2, sorted.length) + let sum = 0 + for (let i = 0; i < count; i++) { + sum += parseFloat(sorted[i].totalPrice) || 0 + } + result = (sum / count) - shipping - discount + } + if (result <= minPrice) return minPrice + return parseFloat(result.toFixed(2)) + }, sortedProductList() { let list = [...this.productList] // 筛选(精确匹配,同zhizhu) @@ -1028,6 +1050,12 @@ export default { bookId: item.id || '' } }) + // 自动填充计算价格 + this.$nextTick(() => { + if (this.calculatedPrice > 0) { + this.price = String(this.calculatedPrice) + } + }) } // 市场统计:使用facet接口的真实数据(totalFound为准) this.marketData = {