|
@@ -12,7 +12,7 @@
|
|
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
|
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
|
|
|
-import { preOrder as _preOrder } from '@/api/order'
|
|
|
+import { preOrder as _preOrder, joinPink } from '@/api/order'
|
|
|
import { getDetail, pinkList } from '@/api/product'
|
|
|
import { formatNumber } from '@/utils/index'
|
|
|
import { getPageParams, goBack, toPage } from '@/utils/page'
|
|
@@ -97,12 +97,15 @@ const avatarList = ref([
|
|
|
|
|
|
// 拼团类型 join-加团 open-开团
|
|
|
const groupType = ref('open')
|
|
|
+const pinkId = ref('') // 拼团id
|
|
|
|
|
|
// sku 逻辑
|
|
|
const showSku = ref(false)
|
|
|
-function openSku(type: string) {
|
|
|
+function openSku(type: string, id?: string) {
|
|
|
showSku.value = true
|
|
|
groupType.value = type
|
|
|
+ if (id)
|
|
|
+ pinkId.value = id
|
|
|
}
|
|
|
const formData = ref({
|
|
|
productNum: 1,
|
|
@@ -250,6 +253,13 @@ async function preOrder() {
|
|
|
if (!requireLogin()) {
|
|
|
return
|
|
|
}
|
|
|
+ if (groupType.value === 'join') {
|
|
|
+ await joinPink({
|
|
|
+ cid: id.value,
|
|
|
+ pinkId: pinkId.value,
|
|
|
+ userId: userInfo.value.userId,
|
|
|
+ })
|
|
|
+ }
|
|
|
const data = {
|
|
|
orderDetails: {
|
|
|
attrValueId: matchedAttrValue.value.id,
|
|
@@ -260,8 +270,10 @@ async function preOrder() {
|
|
|
userId: userInfo.value.userId,
|
|
|
}
|
|
|
const res = await _preOrder(data)
|
|
|
- console.log(res)
|
|
|
- toPage('/pages/productDetail/checkOut', { orderId: res.data })
|
|
|
+ if (res.code === '200') {
|
|
|
+ showSku.value = false
|
|
|
+ toPage('/pages/productDetail/checkOut', { orderId: res.data })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 商品详情初始化
|
|
@@ -269,6 +281,8 @@ onLoad((options) => {
|
|
|
console.log(options)
|
|
|
const params = getPageParams(options)
|
|
|
id.value = params.id
|
|
|
+})
|
|
|
+onShow(() => {
|
|
|
queryDetail()
|
|
|
queryPinkInfo()
|
|
|
})
|
|
@@ -371,14 +385,14 @@ onLoad((options) => {
|
|
|
<view class="flex items-center">
|
|
|
<view>
|
|
|
<!-- 头像组 最多五个 -->
|
|
|
- <view class="mr-16rpx flex items-center">
|
|
|
+ <view class="mr-16rpx min-w-220rpx flex items-center">
|
|
|
<view
|
|
|
- v-for="(e, i) in avatarList.slice(0, 5)"
|
|
|
+ v-for="(e, i) in item.successAvatar.slice(0, 5)"
|
|
|
:key="i"
|
|
|
:style="{ marginLeft: i !== 0 ? '-20rpx' : '0', zIndex: 10 - i }"
|
|
|
class="h-56rpx w-56rpx overflow-hidden border-2rpx border-white rounded-full border-solid"
|
|
|
>
|
|
|
- <image :src="e" class="h-full w-full" mode="aspectFill" />
|
|
|
+ <image :src="e ? e : '/static/images/default-avatar.png'" class="h-full w-full" mode="aspectFill" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -386,13 +400,13 @@ onLoad((options) => {
|
|
|
<view class="text-28rpx">
|
|
|
Need
|
|
|
<text class="text-[var(--wot-color-theme)]">
|
|
|
- 5
|
|
|
+ {{ item.remainNum }}
|
|
|
</text>
|
|
|
More
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <wd-button size="small" @click="openSku('join')">
|
|
|
+ <wd-button size="small" @click="openSku('join', item.id)">
|
|
|
Join Group
|
|
|
</wd-button>
|
|
|
</view>
|