From aae76b43ae83544200a6a26055f78daf124f1782 Mon Sep 17 00:00:00 2001 From: wei <1937506227@qq.com> Date: Tue, 21 Oct 2025 17:14:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=8F=9C=E5=93=81=E8=AF=A6=E6=83=85):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8F=9C=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=92=8C=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建新的菜品详情页面组件 dishDetail.vue - 在 pages.json 中添加菜品详情页路由配置 - 将原分类页面改为全部菜品页面并更新底部导航栏文本 - 删除无用的测试文件 test.js --- pages.json | 10 +- pages/allDish/dishDetail.vue | 23 +++++ test.js | 194 ----------------------------------- 3 files changed, 30 insertions(+), 197 deletions(-) create mode 100644 pages/allDish/dishDetail.vue diff --git a/pages.json b/pages.json index 6e4a3c8..cf7e588 100644 --- a/pages.json +++ b/pages.json @@ -16,11 +16,15 @@ } }, { - "path": "pages/classification/classification", + "path": "pages/allDish/allDish", "style": { "navigationBarTitleText": "" } }, + { + "path": "pages/allDish/dishDetail", + "text": "菜品详情" + }, { "path": "pages/recipeOrder/recipeOrder", "style": { @@ -72,10 +76,10 @@ "text": "首页" }, { - "pagePath": "pages/classification/classification", + "pagePath": "pages/allDish/allDish", // "iconPath": "static/tabbar/alls.png", // "selectedIconPath": "static/tabbar/alls-selected.png", - "text": "分类" + "text": "全部菜品" }, { "pagePath": "pages/recipeOrder/recipeOrder", diff --git a/pages/allDish/dishDetail.vue b/pages/allDish/dishDetail.vue new file mode 100644 index 0000000..732e6ab --- /dev/null +++ b/pages/allDish/dishDetail.vue @@ -0,0 +1,23 @@ + + + + + diff --git a/test.js b/test.js index ee2cd88..e69de29 100644 --- a/test.js +++ b/test.js @@ -1,194 +0,0 @@ -// const clickItem = { -// id: "c64a7f8fad6840298d37bcae9d04fb0b", -// name: "土豆", -// imageUrl: "http://cdn.boofoo.top/product/53e9a8b6-f9bf-41c4-b7e5-fce85655c05f_small", -// type: "a22663477eb54bf2b2f895b631aae577", -// oneTypeId: "decd4ccd5e334809977a2375f1717962", -// minPrice: 1.28, -// maxPrice: 1.28, -// minMeasurePrice: null, -// maxMeasurePrice: null, -// unit: "普/斤", -// stock: -1, -// measureUnit: "斤", -// specialOrder: 4, -// oldPrice: null, -// foodName: null, -// mealTime: null, -// specs: [ -// { -// id: "d764e74bc24f483ba3c5fe76a4d63018", -// unit: "普/斤", -// stock: -1, -// price: 1.28, -// measureUnit: "斤", -// measurePrice: 1.5, -// oldPrice: null, -// promotePrice: 0.98, -// virtualStock: true, -// minNum: 1, -// chuxiao: false, -// sum: 0, -// }, -// ], -// chuxiao: false, -// showChoose: 0, -// }; - -// // console.log(inputValue) -// // console.log(inputValue) -// const item = clickItem.item; -// const exa = clickItem.exa; -// if ((inputValue !== "" && clickItem.quantity == -1) || clickItem.quantity != -1) { -// if (exa == "sum") { -// products.value.forEach((each) => { -// each.specs.forEach((child) => { -// if (child.id == clickItem.id) { -// if (child.sum === "") { -// child.sum = inputValue.value; -// } -// if (child.stock == child.sum) { -// uni.showToast({ -// title: "采购数量不能大于库存数量", -// }); -// return; -// }; -// if (child.stock == 0) { -// uni.showToast({ -// title: "库存数量为0无法添加", -// }); -// return; -// }; -// if (clickItem.quantity == 1) { -// // 核心逻辑:判断首次添加还是后续添加 -// let addQuantity = 1; // 默认每次加1 -// let newNum; -// // 首次添加(当前数量为0) -// if (item.sum === 0) { -// // 使用minNum作为首次添加数量,确保至少添加1个 -// addQuantity = item.minNum > 0 ? item.minNum : 1; -// newNum = addQuantity; -// } -// else { -// // 后续添加,每次加1 -// newNum = Number(item.sum) + 1; -// // 后续添加时,实际增加的数量就是1 -// addQuantity = 1; -// } -// console.log("当前数量:", newNum, "本次添加:", addQuantity); -// // 更新商品数量 -// child.sum = newNum; -// addNum = addQuantity; - -// // child.sum++; -// } -// else if (clickItem.quantity == -1) { -// let reduceQuantity = -1; // 默认每次减1 -// // 确保minNum有合理的值,默认为1 -// const minNum = item.minNum > 0 ? item.minNum : 1; -// // 核心逻辑:判断是否需要按起订量减少 -// if (item.sum > minNum) { -// // 数量大于起订量,正常减1 -// item.sum = Number(item.sum) + reduceQuantity; -// } -// else if (item.sum === minNum) { -// // 数量等于起订量,直接减少起订量 -// reduceQuantity = -minNum; -// item.sum = Number(item.sum) + reduceQuantity; -// } -// else { -// // 数量小于起订量,正常减1(但不小于0) -// item.sum = Math.max(0, Number(item.num) + reduceQuantity); -// } - -// addNum = reduceQuantity; -// child.sum = item.sum; -// // child.sum--; -// console.log(child.sum); -// if (child.sum <= 0) { -// that.clearOneCart(clickItem.id); -// } -// }; -// _this.setData({ -// products: products.value, -// inputValue: child.sum, -// }); -// } -// }); -// }); -// } -// else if (exa == "quantity") { -// cartList.value.forEach((child) => { -// if (child.productId == clickItem.id) { -// if (child.quantity === "") { -// child.quantity = inputValue.value; -// } -// if (clickItem.quantity == 1) { -// child.quantity++; -// } -// else if (clickItem.quantity == -1) { -// child.quantity--; -// }; -// _this.setData({ -// cartList: cartList.value, -// inputValue: child.quantity, -// }); -// } -// }); -// if (clickItem.quantity == -1) { -// if (clickItem.num - 1 <= 0) { -// that.clearOneCart(clickItem.id); -// } -// } -// } -// console.log(item); -// let data = { -// // quantity: clickItem.quantity, -// quantity: addNum, -// specId: clickItem.id, -// Chuxiao: clickItem.chuxiao, -// warehouseId: uni.getStorageSync("warehousId"), -// addrId: uni.getStorageSync("addressId"), -// }; -// if (!data.specId) { -// uni.showModal({ -// title: "提示", -// content: "当前商品规格错误,请稍候再试", -// showCancel: false, -// confirmText: "确定", -// success: (res) => { - -// }, -// }); -// } -// if (data.isChuxiao === "" || data.isChuxiao === undefined) { -// data.isChuxiao = false; -// } -// if (!data.warehouseId || !data.addrId) { -// uni.showModal({ -// title: "提示", -// content: "请先选择收货地址,再添加商品", -// showCancel: false, -// confirmText: "确定", -// success: (res) => { - -// }, -// }); -// } -// keys.push(clickItem.id); -// serve.addCart(data, (res) => { -// // console.log(res) -// // console.log(keys); -// keys.splice(clickItem.id, 1); -// // console.log(keys); -// if (res.data.code == 0) { -// _this.initCartInfo(); -// } -// else { -// uni.showToast({ -// title: res.data.message, -// icon: "none", -// }); -// } -// }); -// }