From 98a9f10bbf2c5d13b74586e63e4e97deb5f5b60f Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Thu, 25 Jun 2026 14:19:08 +0800 Subject: [PATCH] =?UTF-8?q?Fix(=E4=BA=91=E7=81=B5AI):[#5376]=E5=8D=95?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E4=BA=A7=E5=93=81=E7=82=B9=E5=87=BB=E2=80=9C?= =?UTF-8?q?=E9=80=81=E7=BB=99=E6=9C=8B=E5=8F=8B=E2=80=9D=E2=80=9C=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E4=B8=8B=E5=8D=95=E2=80=9D=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E6=9C=AA=E8=B7=B3=E8=BD=AC=E8=87=B3=E9=80=81=E7=A4=BC=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E9=94=99=E8=AF=AF=E8=A7=A6=E5=8F=91=E2=80=9C?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=B4=AD=E7=89=A9=E8=BD=A6=E2=80=9D=E6=8F=90?= =?UTF-8?q?=E7=A4=BA-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aiChat/mixins/chatMixinsV2.js | 57 ++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/aiChat/mixins/chatMixinsV2.js b/aiChat/mixins/chatMixinsV2.js index 09cc537..9b2e92c 100644 --- a/aiChat/mixins/chatMixinsV2.js +++ b/aiChat/mixins/chatMixinsV2.js @@ -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