From 3546c0c8485b2bc60fa453fe2e513805bc40d390 Mon Sep 17 00:00:00 2001
From: Jacob <hlnie@tohours.com>
Date: 星期二, 13 十月 2026 16:45:10 +0800
Subject: [PATCH] refactor: 页面按业务拆分至分包并配置分包预加载优化主包体积

---
 pages/goods_details/index.vue |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue
index c6fb732..770c02a 100644
--- a/pages/goods_details/index.vue
+++ b/pages/goods_details/index.vue
@@ -191,7 +191,7 @@
 					</view>
 					<view>璐墿杞�</view>
 				</view>
-				<view class="bnt acea-row" v-if="productInfo.id && attr.productSelect && attr.productSelect.stock <= 0">
+				<view class="bnt acea-row" v-if="isStockEmpty">
 					<form @submit="joinCart" report-submit="true"><button class="joinCart bnts" form-type="submit"
 							:class="(seckillId || (zoneId && zoneType == 2) || (couponMoneyType && couponMoneyType > 0) || productInfo.isVisual || birthdayGift) ? 'disable' : ''">鍔犲叆璐墿杞�</button>
 					</form>
@@ -208,7 +208,7 @@
 				</view>
 			</block>
 			<view class="bnt bntVideo acea-row"
-				v-if="productInfo.id && attr.productSelect && attr.productSelect.stock <= 0 && type === 'video'">
+				v-if="isStockEmpty && type === 'video'">
 				<form report-submit="true"><button class="buy bnts bg-color-hui" form-type="submit">宸插敭缃�</button></form>
 			</view>
 			<view class="bnt bntVideo acea-row" v-if="attr.productSelect.stock > 0 && type === 'video'">
@@ -475,7 +475,16 @@
 			priceName: null,
 		};
 	},
-	computed: mapGetters(['isLogin', 'uid', 'chatUrl']),
+	computed: {
+		...mapGetters(['isLogin', 'uid', 'chatUrl']),
+		// 搴撳瓨瀛楁鏈姞杞斤紙undefined/null锛夋椂涓嶈涓� 0锛岄伩鍏嶈鎯呮帴鍙h繑鍥炲墠璇樉绀哄凡鍞絼
+		isStockEmpty() {
+			if (!this.productInfo.id) return false;
+			const stock = this.attr.productSelect && this.attr.productSelect.stock;
+			if (stock === undefined || stock === null || stock === '') return false;
+			return Number(stock) <= 0;
+		}
+	},
 	watch: {
 		isLogin: {
 			handler: function (newV, oldV) {

--
Gitblit v1.4.0