修复已知问题
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { getProductDetail, getProductCommentList } from '@/api/mall'
|
||||
import {
|
||||
getProductDetail,
|
||||
getProductCommentList,
|
||||
getParticipateList
|
||||
} from '@/api/mall'
|
||||
import { ref, computed } from 'vue'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
import { navigateTo, navigateBack } from '@/utils/router'
|
||||
import { getRemainingTime, parseDateTime } from '../../utils/dateUtils'
|
||||
|
||||
const viewData = ref({})
|
||||
const productId = ref('')
|
||||
@@ -12,9 +17,31 @@
|
||||
const commentNum = ref(0)
|
||||
/** 分享弹窗 */
|
||||
const shareDialog = ref(false)
|
||||
/** 是否显示拼团数据 */
|
||||
const isPingTuan = ref(false)
|
||||
/** 拼团列表 */
|
||||
const pingtuanList = ref([])
|
||||
const getData = async productId => {
|
||||
const res = await getProductDetail(productId)
|
||||
viewData.value = res.data
|
||||
try {
|
||||
const res = await getProductDetail(productId)
|
||||
viewData.value = res.data
|
||||
if (res.data.groupActivities.length > 0) {
|
||||
const c = await getParticipateList(res.data.groupActivities[0].id)
|
||||
console.log(c.data, '====')
|
||||
console.log(getRemainingTime('2026-01-28 23:46:40'))
|
||||
pingtuanList.value = c.data.map(v => {
|
||||
return {
|
||||
...v,
|
||||
showDate: true
|
||||
}
|
||||
})
|
||||
isPingTuan.value = c.data.length > 0
|
||||
} else {
|
||||
isPingTuan.value = false
|
||||
}
|
||||
} catch (error) {
|
||||
navigateBack()
|
||||
}
|
||||
}
|
||||
|
||||
/** 评论数量获取 */
|
||||
@@ -36,14 +63,6 @@
|
||||
return viewData.value.groupActivities[0].totalPeople
|
||||
})
|
||||
|
||||
/**
|
||||
* 顶部导航按钮点击事件
|
||||
* @param index 0 返回 1 分享
|
||||
*/
|
||||
const onTopNav = index => {
|
||||
console.log(index)
|
||||
}
|
||||
|
||||
const onConfirm = () => {
|
||||
navigateTo('/pages/mall/confirm-order', {
|
||||
productId: productId.value,
|
||||
@@ -82,11 +101,21 @@
|
||||
</nav-bar>
|
||||
<!-- 顶部图片 -->
|
||||
<view class="top-img">
|
||||
<image
|
||||
:src="viewData.mainImage"
|
||||
mode="scaleToFill"
|
||||
class="img"
|
||||
></image>
|
||||
<swiper
|
||||
class="swiper"
|
||||
circular
|
||||
indicator-dots
|
||||
autoplay
|
||||
:interval="4000"
|
||||
:duration="500"
|
||||
>
|
||||
<swiper-item
|
||||
v-for="(item, index) in viewData.imageGallery"
|
||||
:key="index"
|
||||
>
|
||||
<image :src="item" mode="scaleToFill" class="img"></image>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<!-- 商品详情 -->
|
||||
@@ -100,37 +129,64 @@
|
||||
<text>拼单数量:{{ viewData.salesCount }}件</text>
|
||||
<text>好评率:99%</text>
|
||||
</view>
|
||||
<!-- 拼单量 -->
|
||||
<view class="line-box">
|
||||
<view class="left-img">
|
||||
<text>拼单</text>
|
||||
<image
|
||||
src="/static/images/public/random1.png"
|
||||
mode="scaleToFill"
|
||||
class="avatar"
|
||||
></image>
|
||||
<image
|
||||
src="/static/images/public/random2.png"
|
||||
mode="scaleToFill"
|
||||
class="avatar"
|
||||
></image>
|
||||
<image
|
||||
src="/static/images/public/random3.png"
|
||||
mode="scaleToFill"
|
||||
class="avatar"
|
||||
></image>
|
||||
</view>
|
||||
<text class="right-name">还需{{ getPeople }}人拼单</text>
|
||||
</view>
|
||||
<!-- 去拼团 -->
|
||||
<!-- <view class="bottom-name">
|
||||
<view class="count-down">
|
||||
<text>拼单倒计时:</text>
|
||||
<text>23:53:00</text>
|
||||
</view>
|
||||
<button>去拼单</button>
|
||||
</view>-->
|
||||
|
||||
<view v-if="!groupId && isPingTuan" class="ping-box">
|
||||
<view v-for="(item, index) in pingtuanList" :key="index">
|
||||
<!-- 拼单量 -->
|
||||
<view class="line-box">
|
||||
<view class="left-img">
|
||||
<text>拼单</text>
|
||||
<image
|
||||
src="/static/images/public/random1.png"
|
||||
mode="scaleToFill"
|
||||
class="avatar"
|
||||
></image>
|
||||
<image
|
||||
src="/static/images/public/random2.png"
|
||||
mode="scaleToFill"
|
||||
class="avatar"
|
||||
></image>
|
||||
<image
|
||||
src="/static/images/public/random3.png"
|
||||
mode="scaleToFill"
|
||||
class="avatar"
|
||||
></image>
|
||||
</view>
|
||||
<text class="right-name">
|
||||
还需{{ item.needPeople }}人拼单
|
||||
</text>
|
||||
</view>
|
||||
<!-- 去拼团 -->
|
||||
<view class="bottom-name">
|
||||
<view class="count-down">
|
||||
<text>拼单倒计时:</text>
|
||||
<uni-countdown
|
||||
:day="parseDateTime(item.endTime).day"
|
||||
:hour="parseDateTime(item.endTime).hour"
|
||||
:minute="parseDateTime(item.endTime).minute"
|
||||
:second="parseDateTime(item.endTime).second"
|
||||
:show-colon="false"
|
||||
@timeup="
|
||||
() => {
|
||||
item.showDate = false
|
||||
}
|
||||
"
|
||||
/>
|
||||
</view>
|
||||
<button
|
||||
v-if="item.showDate"
|
||||
@click="
|
||||
navigateTo('/pages/mall/confirm-order', {
|
||||
productId: productId,
|
||||
groupId: item.id
|
||||
})
|
||||
"
|
||||
>
|
||||
去拼单
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 评论入口 -->
|
||||
<view
|
||||
class="comment-box"
|
||||
@@ -168,11 +224,17 @@
|
||||
:id="productId"
|
||||
:text="viewData.productName"
|
||||
:cover="viewData.mainImage"
|
||||
:price="viewData.minPrice"
|
||||
></share-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ping-box {
|
||||
max-height: 500rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.left-icon,
|
||||
.right-icon {
|
||||
height: 64rpx;
|
||||
@@ -183,13 +245,17 @@
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
bottom: -2rpx;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 56rpx;
|
||||
background: #fff;
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
}
|
||||
.swiper {
|
||||
width: 100%;
|
||||
height: 628rpx;
|
||||
}
|
||||
.img {
|
||||
width: 100%;
|
||||
height: 628rpx;
|
||||
@@ -197,9 +263,7 @@
|
||||
}
|
||||
.detail-box {
|
||||
padding: 0 58rpx 150rpx;
|
||||
font-family:
|
||||
PingFang SC,
|
||||
PingFang SC;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
.title {
|
||||
@@ -257,7 +321,8 @@
|
||||
}
|
||||
.bottom-name {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-weight: 500;
|
||||
.count-down {
|
||||
display: flex;
|
||||
@@ -307,9 +372,7 @@
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-family:
|
||||
PingFang SC,
|
||||
PingFang SC;
|
||||
font-family: PingFang SC, PingFang SC;
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
text-transform: none;
|
||||
|
||||
Reference in New Issue
Block a user