Fix(云灵AI):[#5376]单规格产品点击“送给朋友”“立即下单”按钮,未跳转至送礼页面,错误触发“加入购物车”提示-2
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
getBottomNavigationConfigList
|
||||
} from '@/api/public'
|
||||
import {
|
||||
getProductDetail,
|
||||
postCartAdd
|
||||
} from '@/api/store'
|
||||
import { VUE_APP_API_URL } from '@/config'
|
||||
@@ -516,16 +517,58 @@ export const chatMixinsV2 = {
|
||||
})
|
||||
},
|
||||
productItemBuyNowClickHandle(item) {
|
||||
this.productItemBuyNowOrGiftBuy(item, 1)
|
||||
},
|
||||
productItemGiftBuyClickHandle(item) {
|
||||
this.productItemBuyNowOrGiftBuy(item, 2)
|
||||
},
|
||||
productItemBuyNowOrGiftBuy(item, BuyNowOrGiftBuyType) {
|
||||
this.audioStopHandle()
|
||||
this.showGiftBtn = false
|
||||
this.cart_num = 1
|
||||
this.addToCart(item)
|
||||
},
|
||||
productItemGiftBuyClickHandle(item) {
|
||||
this.audioStopHandle()
|
||||
this.showGiftBtn = true
|
||||
this.cart_num = 1
|
||||
this.addToCart(item)
|
||||
this.m_id = item.id
|
||||
getProductDetail(item.id).then(res => {
|
||||
const { data } = res
|
||||
this.storeInfo = {...data.storeInfo}
|
||||
if(data.storeInfo.stock === 0) {
|
||||
uni.showToast({
|
||||
title: "产品库存不足,请选择其他商品",
|
||||
icon: "none",
|
||||
duration: 5000
|
||||
})
|
||||
return
|
||||
}
|
||||
this.isWenwan = data.isWenwan
|
||||
this.qualifications = data.qualifications || []
|
||||
// 给 attr 赋值,将请求回来的规格赋值给 attr
|
||||
if (this.source !== 'pre' && this.source !== 'day' && this.source !== 'kill' && this.source !== 'spe') {
|
||||
this.attr.productAttr = data.productAttr || []
|
||||
this.productValueArr = []
|
||||
for (const key in data.productValue) {
|
||||
this.productValueArr.push({
|
||||
attrItemkey: key,
|
||||
...data.productValue[key]
|
||||
})
|
||||
}
|
||||
// 初始化认为所有的规格都是可以选的
|
||||
this.attr.productAttr.map(item => {
|
||||
item.attrValue.map(subItem => {
|
||||
subItem.canUsed = true
|
||||
})
|
||||
})
|
||||
}
|
||||
this.attr.defaultSku = data.defaultSku
|
||||
this.attr.defaultSkuIndex = data.defaultSkuIndex
|
||||
this.DefaultSelect()
|
||||
// 是否单一规格
|
||||
const onlyOne = Object.keys(data.productValue).length === 1
|
||||
|
||||
if(onlyOne && this.onlyOneToAddCart) {
|
||||
this.buyNowOrGiftBuyReq(BuyNowOrGiftBuyType)
|
||||
return
|
||||
}
|
||||
this.attr.cartAttr = !this.isOpen ? true : false
|
||||
})
|
||||
},
|
||||
buyNowOrGiftBuyReq(type) {
|
||||
const _this = this
|
||||
|
||||
Reference in New Issue
Block a user