diff --git a/pages-shop/shop/detail.vue b/pages-shop/shop/detail.vue
index 1f1a004..5ddb87f 100644
--- a/pages-shop/shop/detail.vue
+++ b/pages-shop/shop/detail.vue
@@ -24,7 +24,13 @@
- 立即兑换
+
+ {{ detail.stock === 0 ? '已售罄' : '立即兑换' }}
+
@@ -62,6 +68,16 @@ function onBuy() {
async function onRedeem() {
const p = detail.value
if (!p || !p.id) return
+
+ // 检查商品库存
+ if (p.stock === 0) {
+ uni.showModal({
+ title: '商品已售罄',
+ content: '该商品库存不足,请联系客服处理',
+ showCancel: false
+ })
+ return
+ }
const token = uni.getStorageSync('token')
if (!token) {
@@ -305,7 +321,16 @@ onLoad((opts) => {
&:active { transform: scale(0.96); }
}
-.action-btn.redeem { background: linear-gradient(135deg, #FFB74D, #FF9800); box-shadow: 0 8rpx 20rpx rgba(255, 152, 0, 0.3); }
+.action-btn.redeem {
+ background: linear-gradient(135deg, #FFB74D, #FF9800);
+ box-shadow: 0 8rpx 20rpx rgba(255, 152, 0, 0.3);
+
+ &.disabled {
+ background: #ccc;
+ box-shadow: none;
+ color: #999;
+ }
+}
.action-btn.buy { background: linear-gradient(135deg, #FF6B6B, #FF3B30); box-shadow: 0 8rpx 20rpx rgba(255, 59, 48, 0.3); }
@keyframes fadeInUp {
diff --git a/pages/shop/index.vue b/pages/shop/index.vue
index 843826f..d7239f6 100644
--- a/pages/shop/index.vue
+++ b/pages/shop/index.vue
@@ -93,7 +93,13 @@
{{ p.points || 0 }}
积分
- 兑换
+
+ {{ p.stock === 0 ? '已售罄' : '兑换' }}
+
@@ -366,6 +372,15 @@ function onProductTap(p) {
}
async function onRedeemTap(item) {
+ // 检查商品库存
+ if (item.kind === 'product' && item.stock === 0) {
+ uni.showModal({
+ title: '商品已售罄',
+ content: '该商品库存不足,请联系客服处理',
+ showCancel: false
+ })
+ return
+ }
const token = uni.getStorageSync('token')
if (!token) {
uni.showModal({
@@ -615,6 +630,10 @@ onUnmounted(() => {
.redeem-btn {
background: $gradient-brand; color: #fff; font-size: 22rpx;
padding: 6rpx 18rpx; border-radius: 24rpx; font-weight: 600;
+ &.disabled {
+ background: #ccc;
+ color: #999;
+ }
}
/* 优惠券 (Ticket Style) */
diff --git a/utils/request.js b/utils/request.js
index 476da26..d94781c 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -1,4 +1,4 @@
-const BASE_URL = 'http://127.0.0.1:9991'
+const BASE_URL = 'https://mini-chat.1024tool.vip'
let authModalShown = false