更新:课程与图书选择商品公共组件价格处理

This commit is contained in:
2025-11-25 15:20:27 +08:00
parent 7dea269e6a
commit 6b76173b5c
5 changed files with 101 additions and 68 deletions

View File

@@ -202,6 +202,7 @@ onLoad((options: any) => {
onShow(() => {
loadBookInfo()
loadGoodsInfo()
if (!isIOS.value) {
loadComments()
}
@@ -250,6 +251,18 @@ async function loadBookInfo() {
}
}
// 加载购买商品信息
async function loadGoodsInfo() {
try {
const res = await bookApi.getBookGoods(bookId.value)
if (res.code === 0) {
goodsList.value = res.productList || []
}
} catch (error) {
console.error('Failed to load goods info:', error)
}
}
// 加载统计数据
async function loadBookCount() {
try {
@@ -305,9 +318,9 @@ function closePurchasePopup() {
}
// 处理购买
function handlePurchase() {
function handlePurchase(goods: IGoods) {
uni.navigateTo({
url: `/pages/order/goodsConfirm?goods=${bookId.value}`
url: `/pages/order/goodsConfirm?goods=${goods.productId}`
})
}

View File

@@ -162,7 +162,7 @@
>
<image :src="item.images" />
<text class="book-text">{{ item.name }}</text>
<text class="book-price">{{ item.abroadPrice }} 天医币</text>
<text class="book-price">{{ item.minPrice }} 天医币</text>
<text v-if="formatStats(item)" class="book-flag">{{
formatStats(item)
}}</text>