更新:提取公共选择商品组件
This commit is contained in:
@@ -43,10 +43,10 @@
|
||||
<view v-if="!isIOS" class="comments-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">{{ $t('bookDetails.message') }}</text>
|
||||
<text v-if="commentList.length > 0" class="more-link" @click="goToReview">
|
||||
{{ $t('bookDetails.more') }}
|
||||
<view v-if="commentList.length > 0" class="more-link" @click="goToReview">
|
||||
<text>{{ $t('bookDetails.more') }}</text>
|
||||
<wd-icon name="arrow-right" size="14px" />
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="comment-wrapper">
|
||||
<CommentList
|
||||
@@ -108,7 +108,13 @@
|
||||
</view>
|
||||
|
||||
<!-- 购买弹窗 -->
|
||||
<wd-popup v-model="purchaseVisible" position="bottom">
|
||||
<GoodsSelector
|
||||
:show="purchaseVisible"
|
||||
:goods="goodsList"
|
||||
@confirm="handlePurchase"
|
||||
@close="closePurchasePopup"
|
||||
/>
|
||||
<!-- <wd-popup v-model="purchaseVisible" position="bottom">
|
||||
<view class="purchase-popup">
|
||||
<view class="book-info-mini">
|
||||
<image :src="bookInfo.images" mode="aspectFill" />
|
||||
@@ -132,7 +138,7 @@
|
||||
{{ $t('bookDetails.buy') }}
|
||||
</wd-button>
|
||||
</view>
|
||||
</wd-popup>
|
||||
</wd-popup> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -142,7 +148,8 @@ import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { bookApi } from '@/api/modules/book'
|
||||
import type { IBookDetail, IBook, IComment } from '@/types/book'
|
||||
import CustomNavbar from '@/components/book/CustomNavbar.vue'
|
||||
import type { IGoods } from '@/types/order'
|
||||
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
||||
import CommentList from '@/components/book/CommentList.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
@@ -160,6 +167,7 @@ const bookInfo = ref<IBookDetail>({
|
||||
isBuy: false,
|
||||
freeChapterCount: 0
|
||||
})
|
||||
const goodsList = ref<IGoods[]>([])
|
||||
const readCount = ref(0)
|
||||
const listenCount = ref(0)
|
||||
const buyCount = ref(0)
|
||||
@@ -226,6 +234,16 @@ async function loadBookInfo() {
|
||||
|
||||
if (res.bookInfo) {
|
||||
bookInfo.value = res.bookInfo
|
||||
goodsList.value = [{
|
||||
productId: bookId.value,
|
||||
productName: bookInfo.value.name,
|
||||
productImages: bookInfo.value.images,
|
||||
price: bookInfo.value.priceData?.dictValue || 0,
|
||||
vipPrice: null,
|
||||
activityPrice: null,
|
||||
isVipPrice: 0,
|
||||
productAmount: 1,
|
||||
}]
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to load book info:', error)
|
||||
@@ -281,6 +299,11 @@ function showPurchasePopup() {
|
||||
purchaseVisible.value = true
|
||||
}
|
||||
|
||||
// 关闭购买弹窗
|
||||
function closePurchasePopup() {
|
||||
purchaseVisible.value = false
|
||||
}
|
||||
|
||||
// 处理购买
|
||||
function handlePurchase() {
|
||||
uni.navigateTo({
|
||||
|
||||
Reference in New Issue
Block a user