Task:送礼相关接口

This commit is contained in:
linxi
2025-02-19 18:31:38 +08:00
parent 5dc1f5ad92
commit dbc31c72fb
9 changed files with 18138 additions and 160 deletions
+30 -9
View File
@@ -63,7 +63,7 @@
</view>
</view>
<view class="introduce bold">{{ storeInfo.storeName }}</view>
<view class="v12-primary v12-white-text v12-px-2 v12-py-1 v12-mt-2 v12-radius-20 v12-font-bold v12-justify-between v12-align-center">
<view v-if="storeInfo.isGiftCard === 1" class="v12-primary v12-white-text v12-px-2 v12-py-1 v12-mt-2 v12-radius-20 v12-font-bold v12-justify-between v12-align-center">
<view class="v12-font-28 v12-align-center">
<img class="gift-img" :src="webUrl + '/orderIcon/gift.png'" mode="widthFix">
支持礼包赠送
@@ -473,6 +473,8 @@
:attr="attr"
:cartNum="cart_num"
@changeFun="changeFun"
@gift="gift"
:isGift="isGift"
/>
<ServiceWin ref="serviceWin" :info="storeInfo.guarantee" />
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
@@ -554,6 +556,7 @@ export default {
mixins: [pageListenMixins],
data: function () {
return {
isGift: false,
// 商品信息是否展开
isProductInfoExpand: true,
shareInfoStatus: false,
@@ -772,10 +775,19 @@ export default {
}
},
methods: {
gift() {
this.goCat(2)
},
toGift() {
uni.navigateTo({
url: '/pkg_user/views/gift/gift'
})
if ((this.attr.productSelect.stock === 0 && this.attr.cartAttr) || this.storeInfo.stock === 0) {
return
}
this.isGift = true
// 2=送给朋友
this.goCat(2)
// uni.navigateTo({
// url: '/pkg_user/views/gift/gift'
// })
},
showService() {
this.$refs.serviceWin.show = true
@@ -1335,6 +1347,7 @@ export default {
return
}
// 0=加入购物车
this.isGift = false
this.goCat(0)
},
// 立即购买
@@ -1343,6 +1356,7 @@ export default {
return
}
// 1=直接购买
this.isGift = false
this.goCat(1)
},
// 加入购物车
@@ -1379,7 +1393,7 @@ export default {
const q = {
productId: that.id,
cartNum: that.attr.productSelect.cart_num,
new: news,
new: news === 2 ? 1 : news,
uniqueId: that.attr.productSelect !== undefined ?
that.attr.productSelect.unique : ""
}
@@ -1398,16 +1412,22 @@ export default {
postCartAdd(q).then(function (res) {
that.isOpen = false
that.attr.cartAttr = false
console.log( that.couponId)
if (news) {
if (news === 1) {
that.$yrouter.push({
path: "/pages/order/OrderSubmission/index",
query: {
id: res.data.cartId,
couponId: that.couponId
couponId: that.couponId // 优惠券ID
}
})
} else {
return
}
if(news === 2) {
uni.navigateTo({
url: '/pkg_user/views/gift/gift?cartId=' + res.data.cartId + '&couponId=' + that.couponId
})
}
if(news === 0) {
uni.showToast({
title: "添加购物车成功",
icon: "success",
@@ -1416,6 +1436,7 @@ export default {
that.getCartCount(true)
}
})
return
}
}).catch(error => {
that.isOpen = false;