From 192a365e0685a06ed9f64d19f25dd843d2e48f59 Mon Sep 17 00:00:00 2001
From: sjeam <359824901@qq.com>
Date: Wed, 13 Aug 2025 11:00:58 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=B4=E5=B8=AD2.1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 1 +
pnpm-lock.yaml | 8 +
src/pages/banquet/combo/index.vue | 438 ++++++++++++++++++++++--------
src/pages/banquet/cook/detail.vue | 103 ++++---
src/pages/banquet/cook/list.vue | 23 +-
src/pages/banquet/hotel/list.vue | 12 +-
6 files changed, 391 insertions(+), 194 deletions(-)
diff --git a/package.json b/package.json
index fbdf21d..b022099 100644
--- a/package.json
+++ b/package.json
@@ -75,6 +75,7 @@
"uview-plus": "^3.4.28",
"vue": "3.4.21",
"vue-i18n": "9.1.9",
+ "weixin-js-sdk": "^1.6.5",
"wot-design-uni": "^1.11.1",
"z-paging": "^2.8.4"
},
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e292633..c0b6570 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -44,6 +44,9 @@ importers:
vue-i18n:
specifier: 9.1.9
version: 9.1.9(vue@3.4.21(typescript@5.8.3))
+ weixin-js-sdk:
+ specifier: ^1.6.5
+ version: 1.6.5
wot-design-uni:
specifier: ^1.11.1
version: 1.11.1(vue@3.4.21(typescript@5.8.3))
@@ -5963,6 +5966,9 @@ packages:
webpack-virtual-modules@0.6.2:
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
+ weixin-js-sdk@1.6.5:
+ resolution: {integrity: sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ==}
+
whatwg-encoding@1.0.5:
resolution: {integrity: sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==}
@@ -13178,6 +13184,8 @@ snapshots:
webpack-virtual-modules@0.6.2: {}
+ weixin-js-sdk@1.6.5: {}
+
whatwg-encoding@1.0.5:
dependencies:
iconv-lite: 0.4.24
diff --git a/src/pages/banquet/combo/index.vue b/src/pages/banquet/combo/index.vue
index e355a9b..1a36c66 100644
--- a/src/pages/banquet/combo/index.vue
+++ b/src/pages/banquet/combo/index.vue
@@ -21,16 +21,14 @@ body {
-
-
-
-
@@ -55,41 +53,28 @@ body {
searchIconColor="#909399" color="#606266" placeholderColor="#909399" searchIcon="search" margin="10rpx"
maxlength="-1" height="60rpx" @change="searchSP()">
-
-
-
-
-
-
-
-
- -->
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
+
@@ -128,17 +117,24 @@ body {
-
+
+ {{ orderInfo.is_set ? '修改餐标' : '设置餐标' }}
+
+
+
+
+
- 已选{{this.menu_list.length}}餐,合计¥213213元
+ 已选{{ this.set_num }}餐,合计¥{{ totalPrice }}元
{
- if (res.confirm) {
- // 删除数组
- const index = this.currentTab; // 假设 currentTab 是您想要删除的餐项的索引
- if (index !== undefined && index >= 0 && index < this.menu_list.length) {
- this.menu_list.splice(index, 1);
- }
+ useModal().showModal('success', {
+ title: '删除提示',
+ content: '确定删除' + this.menu_name + '吗?',
+ showCancel: true,
+ confirmText: '确定',
+ cancelText: '取消',
+ success: (res) => {
+ if (res.confirm) {
+ // 删除数组
+ const index = this.currentTab; // 假设 currentTab 是您想要删除的餐项的索引
+ if (index !== undefined && index >= 0 && index < this.menu_list.length) {
+ this.menu_list.splice(index, 1);
+ }
- // CommonApi.commonPost('/api/user/deleteAddress', { id: id }).catch((res) => {
- // if (res.code === 1) {
- // // this.propShowAddress = false;
- // this.getAddressInfoListData();
- // } else {
- // uni.$u.toast(res.msg);
- // }
- // });
- }
- else if (res.cancel) {
- // console.log('用户点击取消');
- }
- },
- });
+ // CommonApi.commonPost('/api/user/deleteAddress', { id: id }).catch((res) => {
+ // if (res.code === 1) {
+ // // this.propShowAddress = false;
+ // this.getAddressInfoListData();
+ // } else {
+ // uni.$u.toast(res.msg);
+ // }
+ // });
+ }
+ else if (res.cancel) {
+ // console.log('用户点击取消');
+ }
+ },
+ });
},
@@ -266,7 +379,7 @@ export default defineComponent({
this.$nextTick(() => {
this.handleClickCategory(this.currentTab)
this.menu_name = this.menu_list[this.currentTab].name; // 更新 menu_name
- this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo
+ // this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo
});
},
@@ -277,8 +390,8 @@ export default defineComponent({
if (valid) {
this.menu_list[this.currentTab].is_set = 1;
this.menu_list[this.currentTab].orderInfo = this.orderInfo;
+ this.editCart()
// this.menu_list[this.currentTab].orderInfo.columns = this.columns[this.currentTab].value;
- // this.menu_list[this.currentTab].orderInfo.total_price = this.totalPrice;
this.close();
}
@@ -293,16 +406,19 @@ export default defineComponent({
handleSubmit () {
this.propShowOrder = true;
},
-
+
//提交订单
handleConfirm () {
// console.log(value)
- var id = 1;
- uni.navigateTo({
- url: `/pages/banquet/combo/detail?id=${id}`
- });
+
+ console.log(this.set_num);
+
+ // var id = 1;
+ // uni.navigateTo({
+ // url: `/pages/banquet/combo/detail?id=${id}`
+ // });
},
-
+
formatter (day) {
const date = new Date(day.date)
@@ -328,30 +444,74 @@ export default defineComponent({
},
handleTimeConfirm (res) {
- console.log(res.value)
- this.orderInfo.time = res.value
+ // console.log(res.value)
+ this.orderInfo.date = res.value
},
//分类切换
handleClickCategory (index: number) {
+ // console.log(index);
+ // this.categoryIndex = index;
+ // this.tabList = this.categoryList[index].children;
+ // this.handleChildrenClick(0);
+ this.getCategoryList();
- console.log(index);
- this.categoryIndex = index;
- this.tabList = this.categoryList[index].children;
- this.handleChildrenClick(0);
},
handleChildrenClick (index: number) {
this.childrenIndex = index;
- this.search.category_id = this.tabList[index].id;
+ // this.search.category_id = this.tabList[this.childrenIndex].id;
this.$refs.pagingRefSP?.reload();
},
+ //购物车验证
+ getCartCheck () {
+ CommonApi.commonPost('/api/banquet/order/check', { server_user_id: this.search.server_user_id }).catch((res) => {
+ var num = 0;
+ var is_set_cart = 0;
+ var newCartList = [];
+ this.set_num = 0;
+ if (res.code === 1) {
+ for (let val in res.data.cart_list) {
+ // console.log(res.data.cart_list[val][0]);
+ num++;
+ is_set_cart = res.data.cart_list[val][0].banquet_date ? 1 : 0; // 餐标已设置 日期
+ if (is_set_cart) {
+ this.set_num += 1;
+ }
+ newCartList.push({
+ name: '第' + num + '餐', orderInfo: {
+ id: 0,
+ is_set: is_set_cart,
+ date: new Date(res.data.cart_list[val][0].banquet_date).getTime(),
+ columns: res.data.cart_list[val][0].banquet_time ? res.data.cart_list[val][0].banquet_time : '早上',
+ number: res.data.cart_list[val][0].table_number ? res.data.cart_list[val][0].table_number : 1,
+ }
+ })
+ this.menu_list[val].orderInfo.is_set = is_set_cart;
+ }
+ //更新购物车餐标--获取已填数据
+ if (num > 0 && newCartList[this.currentTab]) {
+ this.orderInfo = newCartList[this.currentTab].orderInfo; // 更新 orderInfo --已填值
+ } else {
+ this.orderInfo = this.menu_list[this.currentTab].orderInfo; // 更新 orderInfo --默认值
+ }
+ this.totalPrice = res.data.total_price;
+ } else {
+ // uni.$u.toast(res.msg);
+ }
+ });
+ },
getCategoryList () {
- CommonApi.commonGet('/api/dishes/category').catch((res) => {
+ CommonApi.commonGet('/api/banquet/dishes/category', {
+ server_user_id: this.search.server_user_id,
+ index: this.currentTab
+ }).catch((res) => {
if (res.code === 1) {
- this.categoryList = res.data;
- this.handleClickCategory(0)
+ // this.categoryList = res.data;
+ this.tabList = res.data;
+ this.search.category_id = this.tabList[0].id;
+ this.getCartCheck() // 检查购物车
} else {
uni.$u.toast(res.msg);
}
@@ -364,9 +524,11 @@ export default defineComponent({
},
//列表分页
changeSP (pageNo: number) {
+ this.search.category_id = this.tabList[this.childrenIndex] ? this.tabList[this.childrenIndex].id : 0;
// console.log(pageNo);
this.search.page = pageNo;
- CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
+ this.search.index = this.currentTab;
+ CommonApi.commonGet('/api/banquet/dishes/list', this.search).catch((res) => {
if (res.code === 1) {
// this.matchedItems_sp = res.data;
this.$refs.pagingRefSP?.complete(res.data);
@@ -386,18 +548,66 @@ export default defineComponent({
},
//加入购物车
- addCart (id) {
- CommonApi.commonPost('/api/cart/add', {
- buy_now: false,
- dishes_id: id,
+ addCart (e) {
+ console.log(e);
+ CommonApi.commonPost('/api/banquet/cart/add', {
+ server_user_id: this.search.server_user_id,
+ index: this.currentTab,
+ dishes_id: e.id,
+ number: e.cart_count,
}).catch((res) => {
if (res.code === 1) {
- uni.$u.toast('加入购物车成功');
+ //等于0 删除商品
+ if (e.cart_count === 0) {
+ this.delCart(e.cart_id)
+ }
+ this.getCategoryList() // 更新购物车
+ this.searchSP() // 更新列表
} else {
uni.$u.toast(res.msg);
}
});
- }
+ },
+ delCart (id) {
+ CommonApi.commonPost('/api/banquet/cart/delete', {
+ id: id,
+ }).catch((res) => {
+ if (res.code === 1) {
+ uni.$u.toast('删除成功');
+ this.getCartCheck() // 检查购物车
+ } else {
+ uni.$u.toast(res.msg);
+ }
+ });
+ },
+
+ editCart () {
+ CommonApi.commonPost('/api/banquet/cart/edit', {
+ server_user_id: this.search.server_user_id,
+ index: this.currentTab,
+ date: this.formatDate(this.orderInfo.date),
+ time: this.orderInfo.columns,
+ number: this.orderInfo.number,
+
+ }).catch((res) => {
+ if (res.code === 1) {
+ uni.$u.toast('设置餐标成功');
+ this.getCartCheck() // 检查购物车
+ } else {
+ uni.$u.toast(res.msg);
+ }
+ });
+ },
+ // 时间戳转换为 Y-m-d 格式
+ formatDate (timestamp: number) {
+ const date = new Date(timestamp);
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0');
+ const day = String(date.getDate()).padStart(2, '0');
+ const formattedDate = `${year}-${month}-${day}`;
+ console.log('格式化后的日期:', formattedDate);
+ return formattedDate;
+ },
},
diff --git a/src/pages/banquet/cook/detail.vue b/src/pages/banquet/cook/detail.vue
index 178a213..16ca1d8 100644
--- a/src/pages/banquet/cook/detail.vue
+++ b/src/pages/banquet/cook/detail.vue
@@ -1,9 +1,5 @@
-
-
@@ -14,12 +10,12 @@
-
-
@@ -28,32 +24,24 @@
- 家常菜
- 川菜
- 粤菜
- 湘菜
- 特色菜
-
-
+ {{ matchedItems_sc.district_name }}
+
-
-
- 下单预定
+ 下单预定
@@ -62,14 +50,13 @@
-
-
-
+
-
+
@@ -97,10 +84,10 @@ export default defineComponent({
id: 0,
},
is_add: 0, //是否显示购物车
- time_value:[],
+ time_value: [],
min_data: new Date().getTime(),
max_data: this.calculateMaxDate(),
- isDisabledDate: [1754755200000, 1754755200000],
+ isDisabledDate: [],
matchedItems_sc: [],
matchedItems_sp: [],
imageList: [],
@@ -110,15 +97,15 @@ export default defineComponent({
// console.log(option);
this.search.id = option.id;
this.is_add = option.is_add | 0;
- this.getCategoryList()
- this.changeSP()
+ this.getChefDetail()
+ // this.changeSP()
},
created () {
},
methods: {
// 最多显示下个月档期
- calculateMaxDate() {
+ calculateMaxDate () {
const currentDate = new Date();
const futureDate = new Date(currentDate.setMonth(currentDate.getMonth() + 1));
return futureDate.getTime();
@@ -146,42 +133,48 @@ export default defineComponent({
}
return day
},
- getCategoryList () {
- CommonApi.commonGet('/api/dishes/detail', this.search).catch((res) => {
+ handleChange () {
+ },
+ getChefDetail () {
+ CommonApi.commonGet('/api/banquet/chef/detail', this.search).catch((res) => {
if (res.code === 1) {
this.matchedItems_sc = res.data;
+ this.matchedItems_sc.street_name = this.matchedItems_sc.street_name.join('')
+ this.matchedItems_sc.phone = this.matchedItems_sc.certification.phone
+ //格式化日历
+ this.isDisabledDate = this.matchedItems_sc.calendar;
+ this.time_value = [0]
+
//轮播图是数组
- this.imageList = res.data.image ? [{
- url: res.data.image,
- title: res.data.name,
- poster: res.data.image
+ this.imageList = res.data.certification.video ? [{
+ url: res.data.certification.video,
+ title: res.data.certification.public_name,
+ poster: res.data.certification.public_image
}] : [];
} else {
uni.$u.toast(res.msg);
}
});
},
- //列表分页
- changeSP () {
- // console.log(pageNo);
- // this.search.page = pageNo;
- CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
- if (res.code === 1) {
- this.matchedItems_sp = res.data;
- // this.$refs.pagingRefSP?.complete(res.data);
- } else {
- uni.$u.toast(res.msg);
- }
- });
+ // //列表分页
+ // changeSP () {
+ // // console.log(pageNo);
+ // // this.search.page = pageNo;
+ // CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
+ // if (res.code === 1) {
+ // this.matchedItems_sp = res.data;
+ // // this.$refs.pagingRefSP?.complete(res.data);
+ // } else {
+ // uni.$u.toast(res.msg);
+ // }
+ // });
- },
-
+ // },
//加入购物车
addCart (id) {
-
uni.navigateTo({
- url: `/pages/banquet/combo/index??id=${id}`
- });
+ url: `/pages/banquet/combo/index??id=${id}`
+ });
// CommonApi.commonPost('/api/cart/add', {
// buy_now: false,
// dishes_id: this.search.id,
@@ -192,7 +185,7 @@ export default defineComponent({
// uni.navigateTo({
// url: '/pages/cart/index'
// });
-
+
// } else {
// uni.$u.toast(res.msg);
// }
@@ -201,6 +194,6 @@ export default defineComponent({
},
});
-
+
\ No newline at end of file
diff --git a/src/pages/banquet/cook/list.vue b/src/pages/banquet/cook/list.vue
index 62aafcd..207a574 100644
--- a/src/pages/banquet/cook/list.vue
+++ b/src/pages/banquet/cook/list.vue
@@ -19,12 +19,12 @@
-
-
@@ -33,26 +33,21 @@
- 家常菜
- 川菜
+ {{item.district_name}}
+
-
+ 特色菜 -->
-
-
@@ -85,7 +80,7 @@ export default defineComponent({
data () {
return {
search: {
- category_id: '',
+ // category_id: '',
keyword: '',
page: 1,
limit: 10,
@@ -233,7 +228,7 @@ export default defineComponent({
changeSP (pageNo: number) {
// console.log(pageNo);
this.search.page = pageNo;
- CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
+ CommonApi.commonGet('/api/banquet/chef/list', this.search).catch((res) => {
if (res.code === 1) {
// this.matchedItems_sp = res.data;
this.$refs.pagingRefSP?.complete(res.data);
diff --git a/src/pages/banquet/hotel/list.vue b/src/pages/banquet/hotel/list.vue
index 351b9d0..963a8b4 100644
--- a/src/pages/banquet/hotel/list.vue
+++ b/src/pages/banquet/hotel/list.vue
@@ -180,16 +180,6 @@ export default defineComponent({
day.disabled = true; // 禁用日期
day.disabled_class = 'disabled-date'; // 添加自定义样式类
}
- // if (day.type === 'start') {
- // day.bottomInfo = '开始'
- // }
-
- // if (day.type === 'end') {
- // day.bottomInfo = '结束'
- // }
- // if (day.type === 'same') {
- // day.bottomInfo = '开始/结束'
- // }
return day
},
@@ -233,7 +223,7 @@ export default defineComponent({
changeSP (pageNo: number) {
// console.log(pageNo);
this.search.page = pageNo;
- CommonApi.commonGet('/api/dishes/dishes', this.search).catch((res) => {
+ CommonApi.commonGet('/api/banquet/chef/list', this.search).catch((res) => {
if (res.code === 1) {
// this.matchedItems_sp = res.data;
this.$refs.pagingRefSP?.complete(res.data);