From 7f7699682972edc32c47c90c7cbe7ac3e10471ab Mon Sep 17 00:00:00 2001 From: gyq <875626088@qq.com> Date: Mon, 24 Nov 2025 10:52:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=87=E6=8D=A2=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E6=B2=A1=E6=9C=89=E6=B8=85=E9=99=A4=E4=BB=A3=E5=AE=A2?= =?UTF-8?q?=E4=B8=8B=E5=8D=95=E5=8E=86=E5=8F=B2=E8=AE=A2=E5=8D=95=E5=B9=B2?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sidebar/components/SidebarLogo.vue | 3 +- src/store/modules/carts.ts | 26 +++- .../components/couponDialog.vue | 4 +- .../consume_ticket/components/dialogForm.vue | 10 +- .../marketing_center/consume_ticket/index.vue | 27 ++-- .../marketing_center/king_dine/index.vue | 2 + src/views/order/index/components/detail.vue | 116 +++++------------- src/views/tool/Instead/components/order.vue | 105 +++------------- 8 files changed, 94 insertions(+), 199 deletions(-) diff --git a/src/layout/components/Sidebar/components/SidebarLogo.vue b/src/layout/components/Sidebar/components/SidebarLogo.vue index 5e9e00f..85759ee 100644 --- a/src/layout/components/Sidebar/components/SidebarLogo.vue +++ b/src/layout/components/Sidebar/components/SidebarLogo.vue @@ -7,7 +7,7 @@ @@ -58,6 +58,7 @@ async function handleCommand(command) { return } await ShopApi.getBranchChange(res.shopId) + localStorage.setItem("Instead_olold_order", {}) // localStorage.setItem("branch_shopId", res.shopId) localStorage.setItem("shopName", res.shopName) state.shopName = res.shopName diff --git a/src/store/modules/carts.ts b/src/store/modules/carts.ts index 8afd4bf..449ae77 100644 --- a/src/store/modules/carts.ts +++ b/src/store/modules/carts.ts @@ -146,6 +146,7 @@ export const useCartsStore = defineStore("carts", () => { }; console.log('changeUser', vipUser.value); + await getConsumeDiscountAjax() await getGoods({}) // 选择用户后重新刷新历史订单限时折扣信息 @@ -157,6 +158,24 @@ export const useCartsStore = defineStore("carts", () => { payParamsInit() } + // 根据用户id获取新客立减金额,返回null代表不可用 + async function getConsumeDiscountAjax() { + try { + if (vipUser.value.id) { + const res = await limitTimeDiscountApi.getConsumeDiscount({ + shopId: localStorage.getItem("shopId"), + shopUserId: vipUser.value.id, + orderId: oldOrder.value.id, + }); + console.log("根据用户id获取新客立减金额,返回null代表不可用", res); + if (res !== null) { + newUserDiscount.value = res; + } + } + } catch (error) { + console.log(error); + } + } // 给长连接发送更新购物车限时折扣信息 const sendWsTimeDiscount = _.throttle(function () { @@ -406,8 +425,8 @@ export const useCartsStore = defineStore("carts", () => { //使用积分数量 const userPoints = ref(0); - // 新客立减金额 - const newUserDiscount = ref(0) + // 新客立减配置 + const newUserDiscount = ref(null) // 订单额外配置(现在依赖响应式的 merchantReduction) const orderExtraConfig = computed(() => ({ @@ -424,7 +443,7 @@ export const useCartsStore = defineStore("carts", () => { currentDinnerType: dinnerType.value, limitTimeDiscount: limitDiscountRes.value, shopUserInfo: vipUser.value, - newUserDiscount: newUserDiscount.value + newUserDiscount: newUserDiscount.value !== null ? newUserDiscount.value.amount : 0 }) as OrderExtraConfig); // 营销活动列表 @@ -1001,6 +1020,7 @@ export const useCartsStore = defineStore("carts", () => { // 支付成功后清楚订单/用户信息 function clearHistory() { vipUser.value = {} + newUserDiscount.value = {} } return { diff --git a/src/views/marketing_center/components/couponDialog.vue b/src/views/marketing_center/components/couponDialog.vue index a817e53..546002e 100644 --- a/src/views/marketing_center/components/couponDialog.vue +++ b/src/views/marketing_center/components/couponDialog.vue @@ -174,7 +174,7 @@ - + @@ -435,7 +435,7 @@ const form = ref({ validStartTime: "", // 有效期开始时间 validEndTime: "", // 有效期结束时间 daysToTakeEffect: 0, // 隔天生效 - useDays: ["周一", "周二", "周三", "周四", "周五", "周六", "周七"], // 可用周期,如:'周一','周二','周三' , '周四' , '周五', '周六' , '周七' + useDays: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"], // 可用周期,如:'周一','周二','周三' , '周四' , '周五', '周六' , '周七' useTimeType: "all", // 可用时间段类型:all-全时段,custom-指定时段 useStartTime: "", // 可用开始时间 useEndTime: "", // 可用结束时间 diff --git a/src/views/marketing_center/consume_ticket/components/dialogForm.vue b/src/views/marketing_center/consume_ticket/components/dialogForm.vue index 5de6c8c..3939e32 100644 --- a/src/views/marketing_center/consume_ticket/components/dialogForm.vue +++ b/src/views/marketing_center/consume_ticket/components/dialogForm.vue @@ -26,10 +26,10 @@
指定设置
- - - - + + + +
发放设置
@@ -159,7 +159,7 @@ const form = ref({ couponType: 1, // 1-满减券,2-商品兑换券,3-折扣券,4-第二件半价券,5-消费送券,6-买一送一券,7-固定价格券,8-免配送费券 fullAmount: "", // 使用门槛:满多少金额 couponGiftList: [], // 优惠券,目前单选 - useType: ["dine"], // 可使用类型:dine堂食/pickup自取/deliv配送/express快递 + useType: ["dine-in"], // 堂食 dine-in 外带 take-out 外卖 take-away 配送 post giveNum: "", // 总发放数量,-10086为不限量 getLimit: "", // 每人领取限量,-10086为不限量 status: 1, // 状态:0-禁用,1-启用 diff --git a/src/views/marketing_center/consume_ticket/index.vue b/src/views/marketing_center/consume_ticket/index.vue index e58c9b0..4c23318 100644 --- a/src/views/marketing_center/consume_ticket/index.vue +++ b/src/views/marketing_center/consume_ticket/index.vue @@ -50,10 +50,7 @@
{{ scope.row.giftNum }} | - + 详情
@@ -61,34 +58,23 @@