From 75ed724fbbd7fc8e4b49746ca3bf77ea08ae69c8 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Thu, 25 Dec 2025 19:03:17 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=9B=B8=E5=85=B3=E5=95=86?=
=?UTF-8?q?=E5=93=81=E6=8E=A8=E8=8D=90=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/api/request.js | 25 +-
pages/product/components/goods-modal.vue | 594 ++++++++++++++++-------
pages/product/index.vue | 44 +-
3 files changed, 452 insertions(+), 211 deletions(-)
diff --git a/common/api/request.js b/common/api/request.js
index f8881c2..c8192cc 100644
--- a/common/api/request.js
+++ b/common/api/request.js
@@ -36,30 +36,7 @@ export default async (params) => {
}
// #ifdef H5
uni.cache.set('token', 'b61c8b0f1c9d47ad924e33c48b496ce6')
- uni.cache.set('userInfo', {
- "acQrcodeValidTime": "2025-11-17 17:57:16",
- "alipayOpenId": "",
- "birthDay": "2025-10-17",
- "createTime": "2024-07-06 11:30:16",
- "distributionAmount": 0,
- "headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
- "id": "36434",
- "idCard": "612401199810058031",
- "isAc": 0,
- "lastLoginTime": "2025-12-25 09:19:20",
- "nickName": "微信用户",
- "password": "",
- "payPwd": "e10adc3949ba59abbe56e057f20f883e",
- "phone": "18049104914",
- "realName": "叶明飞",
- "sex": 1,
- "status": 1,
- "updateTime": "2025-12-25 09:17:59",
- "usePayPwd": 0,
- "wechatAcOpenId": "1111",
- "wechatAcQrcode": "",
- "wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
- })
+ uni.cache.set('userInfo',{"acQrcodeValidTime":"2025-11-17 17:57:16","alipayOpenId":"","birthDay":"2025-10-17","createTime":"2024-07-06 11:30:16","distributionAmount":0,"headImg":"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132","id":"36434","idCard":"612401199810058031","isAc":0,"lastLoginTime":"2025-12-25 11:41:15","nickName":"微信用户","password":"","payPwd":"e10adc3949ba59abbe56e057f20f883e","phone":"18049104914","realName":"叶明飞","sex":1,"status":1,"updateTime":"2025-12-25 09:41:58","usePayPwd":0,"wechatAcOpenId":"1111","wechatAcQrcode":"","wechatOpenId":"or1l86yipGvwyfPhrKIAcQuSfAV8"})
// #endif
return new Promise((resolve, reject) => {
const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒
diff --git a/pages/product/components/goods-modal.vue b/pages/product/components/goods-modal.vue
index eff8ad2..db53d68 100644
--- a/pages/product/components/goods-modal.vue
+++ b/pages/product/components/goods-modal.vue
@@ -1,191 +1,233 @@
-
-
-
-
-
-
-
-
-
- {{ goods.name }}
-
- {{ goods.shortTitle ? goods.shortTitle : '' }}
-
-
-
-
- {{ specType }}
-
-
-
- {{ option }}
-
- 售罄
-
-
- 已下架
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
- {{ setmenu.title }} {{ setmenu.count }}
- 选{{ setmenu.number }}
+
+
+
+ {{ goods.name }}
+
+ {{ goods.shortTitle ? goods.shortTitle : '' }}
+
+
+
+
+ {{ specType }}
+
-
- {{ option.proName }}
- /{{ option.unitName }}
-
+
+ {{ option }}
+
售罄
+
+ 已下架
+
-
-
-
-
- 推荐搭配
-
-
-
-
-
- {{product.name}}
-
-
-
-
- ¥
-
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ setmenu.title }} {{ setmenu.count }}
+ 选{{ setmenu.number }}
+
+
+ {{ option.proName }}
+ /{{ option.unitName }}
+
+ 售罄
+
-
-
-
-
-
-
-
-
-
-
- ¥
-
-
+
+
+
+ 推荐搭配
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{product.name}}
+
+
+
+
+ ¥
+
+
+
+
+
+
+
+
+
+ {{returnGoodsImCartNum(product)}}
+
+
+
+
+
+
+
+
-
-
- {{
- shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
- ? goods.result.memberPrice || goods.result.salePrice
- : goods.result.salePrice
- }}
-
- /{{ goods.unitName }}
- 「{{ goods.result.suitNum }}{{ goods.result.unitName }}起点」
+
+
-
- ¥
-
-
+
+
+
+
+ ¥
+
+
+
+
+
+ {{
+ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
+ ? goods.result.memberPrice || goods.result.salePrice
+ : goods.result.salePrice
+ }}
+
+ /{{ goods.unitName }}
+ 「{{ goods.result.suitNum }}{{ goods.result.unitName }}起点」
-
- {{
- shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
- ? goods.memberPrice || goods.salePrice
- : goods.salePrice
- }}
-
- /{{ goods.unitName }}
- 「{{ goods.suitNum }}{{ goods.unitName }}起点」
-
-
-
-
-
-
+
+ ¥
+
+
+
+
+ {{
+ shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1
+ ? goods.memberPrice || goods.salePrice
+ : goods.salePrice
+ }}
+
+ /{{ goods.unitName }}
+ 「{{ goods.suitNum }}{{ goods.unitName }}起点」
- {{ shopCartNumber }}
-
-
-
+
+
+
+
+
+
+ {{ shopCartNumber }}
+
+
+
+
-
-
- {{ selectedSpecsStr }}
-
-
-
- 库存不足
+
+ {{ selectedSpecsStr }}
-
-
-
-
- 添加到购物车
-
-
- 添加到购物车
+
+
+ 库存不足
-
- 添加到购物车
-
+
+
+ 添加到购物车
+
+
+ 添加到购物车
+
+
+
+
+ 添加到购物车
+
+
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/product/index.vue b/pages/product/index.vue
index 0d7e789..6b41dde 100644
--- a/pages/product/index.vue
+++ b/pages/product/index.vue
@@ -160,7 +160,10 @@
- {{ ifcartNumber(item) }}
+
+
+ {{ returnGoodsImCartNum(item1) < 99 ? returnGoodsImCartNum(item1) : '99+' }}
@@ -849,7 +862,7 @@
// 购物车对应的商品数
const GoodsIDInCartNumMap = computed(() => {
const map = {}
- for (let cart in cartStore.carts) {
+ for (let cart of cartStore.carts) {
if (map[cart.product_id]) {
map[cart.product_id] += cart.number * 1
} else {
@@ -864,7 +877,10 @@
* 返回购物车对应的商品数量
*/
function returnGoodsImCartNum(goods) {
- if (GoodsIDInCartNumMap.value.hasOwnProperty([goods.id])) {
+ if(!goods){
+ return 0
+ }
+ if (GoodsIDInCartNumMap.value.hasOwnProperty(goods.id)) {
GoodsIDInCartNumMap.value[goods.id]
}
return 0
@@ -1356,6 +1372,15 @@
let res = await APIminiAppinfo(item.id);
prveImgs(res.images);
}
+
+ const goodsModalList=ref([])
+
+ function goodsModalClose(index){
+ goodsModalList.value.splice(index,1)
+ }
+ function modalAdd(item){
+ clickspecifications(item)
+ }
//获取多规格数据
const clickspecifications = async (item, index, indexs, type) => {
@@ -1372,7 +1397,10 @@
// }
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
- return false;
+ return uni.showToast({
+ title:'商品已下架或不在可售时间内',
+ icon:'none'
+ });
}
shopCartNumber.value = 0;
@@ -1418,7 +1446,11 @@
// 给默认数量
specifications.item.amountcartNumber = 0;
// showShopsku.value = true;
- showGoodsModal.value=true
+ goodsModalList.value.push({
+ show:true,
+ goods:specifications.item
+ })
+ // showGoodsModal.value=true
};
// 判断商品是否在可售时间内
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {