评论需要添加功能,提交订单有问题
This commit is contained in:
@@ -1,16 +1,28 @@
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { getProductDetail } from '@/api/mall'
|
||||
import { getProductDetail, getProductCommentList } from '@/api/mall'
|
||||
import { ref, computed } from 'vue'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
|
||||
const viewData = ref({})
|
||||
const productId = ref('')
|
||||
/** 评论数量 */
|
||||
const commentNum = ref(0)
|
||||
const getData = async productId => {
|
||||
const res = await getProductDetail(productId)
|
||||
viewData.value = res.data
|
||||
}
|
||||
|
||||
/** 评论数量获取 */
|
||||
const getComment = async productId => {
|
||||
const res = await getProductCommentList({
|
||||
productId,
|
||||
pageNum: 1,
|
||||
pageSize: 1
|
||||
})
|
||||
commentNum.value = res.total
|
||||
}
|
||||
|
||||
/** 拼单人数 */
|
||||
const getPeople = computed(() => {
|
||||
if (!viewData.value.groupActivities?.length) return 0
|
||||
@@ -31,9 +43,10 @@
|
||||
})
|
||||
}
|
||||
|
||||
onLoad(e => {
|
||||
onLoad(async e => {
|
||||
productId.value = e.productId
|
||||
getData(e.productId)
|
||||
await getData(e.productId)
|
||||
await getComment(e.productId)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -106,6 +119,22 @@
|
||||
<button>去拼单</button>
|
||||
</view>-->
|
||||
|
||||
<!-- 评论入口 -->
|
||||
<view
|
||||
class="comment-box"
|
||||
@click="navigateTo('/pages/mall/comment', { productId })"
|
||||
>
|
||||
<text class="comment-name">评论({{ commentNum }})</text>
|
||||
<view class="right-box">
|
||||
<text>查看全部</text>
|
||||
<image
|
||||
src="/static/images/public/right-arrow.png"
|
||||
mode="heightFix"
|
||||
class="right-img"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品详情 -->
|
||||
<view class="detail-content">
|
||||
<text class="title">商品详情</text>
|
||||
@@ -233,8 +262,8 @@
|
||||
}
|
||||
.detail-content {
|
||||
border-top: 2rpx solid #f9f9f9;
|
||||
padding-top: 46rpx;
|
||||
margin-top: 46rpx;
|
||||
padding-top: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
.title {
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
@@ -246,5 +275,33 @@
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
.comment-box {
|
||||
border-top: 2rpx solid #f9f9f9;
|
||||
padding-top: 20rpx;
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
.comment-name {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.right-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.right-img {
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user