Task:抽奖

This commit is contained in:
LinCyJang
2026-05-07 00:10:09 +08:00
parent 91aad660e6
commit 59565871d9
7 changed files with 286 additions and 27 deletions
+35 -6
View File
@@ -99,8 +99,14 @@
:key="index"
class="goods-item"
>
<image
v-if="Number(item.isGiftCard) === 1"
class="goods-gift-tag"
:src="webUrl + '/home/gift-tag.png'"
mode="widthFix"
/>
<image class="goods-image" :src="item.image" mode="aspectFill" @click="goGoodsDetail(item)" />
<view class="goods-name more-t">{{ item.name }}</view>
<view class="goods-name more-t">{{ item.storeName }}</view>
<view class="goods-bottom">
<text class="goods-price">¥{{ item.price }}</text>
<view class="goods-cart" @click.stop="openGoodsSku(item)">购</view>
@@ -114,7 +120,7 @@
:attr="attr"
:cartNum="cart_num"
:showOk="true"
okText="立即下单"
:okText="currentGoodsItem && Number(currentGoodsItem.isGiftCard) === 1 ? '送给朋友' : '立即下单'"
@changeFun="changeFun"
@ok="submitFromSku()"
/>
@@ -155,7 +161,9 @@ export default {
time: '--:--:--'
},
countdownTimer: null,
currentSwiperIndex: 0
currentSwiperIndex: 0,
webUrl: this.$VUE_APP_RESOURCES_URL,
currentGoodsItem: null
}
},
computed: {
@@ -173,15 +181,18 @@ export default {
return list.map(item => ({
id: item.productId || item.id || 0,
image: item.productImage || item.image || item.pic || '',
name: item.productName || item.name || item.prizeName || '',
price: item.productPrice || item.price || item.salePrice || 0
storeName: item.storeName || '',
productName: item.productName || item.name || item.prizeName || '',
price: item.productPrice || item.price || item.salePrice || 0,
isGiftCard: Number(item.isGiftCard || 0)
}))
}
return this.prizeList.map(item => ({
id: item.productId || 0,
image: item.prizeImage || '',
name: item.prizeName || '',
price: item.productPrice || item.price || 0
price: item.productPrice || item.price || 0,
isGiftCard: Number(item.isGiftCard || 0)
}))
},
winnerSortedList() {
@@ -329,11 +340,13 @@ export default {
},
openGoodsSku(item) {
if (!item.id) return
this.currentGoodsItem = item
this.addToCart(item)
},
submitFromSku() {
const productSelect = this.getAttrItemData(this.attrValue)
const currentSelect = productSelect || this.attr.productSelect || {}
const isGiftOrder = Number(this.currentGoodsItem && this.currentGoodsItem.isGiftCard) === 1
const stock = Number(currentSelect.stock || 0)
const hasNo = (this.attr.productAttr.length && !productSelect && this.isOpen) || stock <= 0
if (hasNo) {
@@ -360,6 +373,12 @@ export default {
this.cart_num = 1
const cartId = (res.data && res.data.cartId) || ''
if (!cartId) return
if (isGiftOrder) {
uni.navigateTo({
url: `/pkg_user/views/gift/gift?cartId=${cartId}&from=countyLottery&drawActivityId=${this.activityId || 0}`
})
return
}
uni.navigateTo({
url: `/pages/order/OrderSubmission/index?id=${cartId}`
})
@@ -786,6 +805,16 @@ export default {
width: 316rpx;
background: #fff;
margin-bottom: 30rpx;
position: relative;
.goods-gift-tag {
position: absolute;
left: 0;
top: 0;
width: 120rpx;
z-index: 2;
pointer-events: none;
}
.goods-image {
width: 100%;