diff --git a/http/yskApi/market/consumeDiscount.js b/http/yskApi/market/consumeDiscount.js index 0adaf2a..25032d7 100644 --- a/http/yskApi/market/consumeDiscount.js +++ b/http/yskApi/market/consumeDiscount.js @@ -3,7 +3,7 @@ const request = http.request import {marketUrl} from '../prveUrl.js' /** - * 限时折扣 + * 新客立减 * @returns */ export function getDiscountByUserId(params) { diff --git a/lib/coupon.ts b/lib/coupon.ts index deb8abd..cea989c 100644 --- a/lib/coupon.ts +++ b/lib/coupon.ts @@ -188,7 +188,7 @@ function returnGoodsIsUseVipPrice( user: ShopUserInfo, goods: BaseCartItem ) { - if (goods.is_time_discount) { + if (goods.is_time_discount || goods.isTimeDiscount) { return false; } if (shopInfo.isMemberPrice != 1 || user.isVip != 1) { @@ -213,15 +213,16 @@ function returnCanCalcGoodsList( shopInfo: ShopInfo, user: ShopUserInfo ) { + return canCalcGoodsArr.filter((goods) => { - console.log("goods"); - console.log(goods); if ( !coupon.discountShare && (goods.is_time_discount || goods.isTimeDiscount) ) { return false; } + + if ( !coupon.vipPriceShare && returnGoodsIsUseVipPrice(shopInfo, user, goods) @@ -290,14 +291,15 @@ export function returnCouponCanUse(args: couponCalcParams) { return coupon.thresholdFoods.find((food) => food.id == v.productId); }); } + canCalcGoodsArr = returnCanCalcGoodsList( canCalcGoodsArr, coupon, shopInfo, user ); - console.log("canCalcGoodsArr"); - console.log(canCalcGoodsArr); + + fullAmount = canCalcGoodsArr.reduce((pre, cur) => { return ( pre + @@ -332,8 +334,10 @@ export function returnCouponCanUse(args: couponCalcParams) { reason: "当前选中的券不可与其他券同享", }; } + // 满减券和折扣券计算门槛金额是否满足 if ([1, 3].includes(coupon.type)) { + if (canCalcGoodsArr.length <= 0) { return { canUse: false, @@ -644,8 +648,8 @@ export function returnCouponProductDiscount( return result; } -// 返回买一送一券抵扣详情 /** + * 返回买一送一券抵扣详情 * @param canDikouGoodsArr 可抵扣商品列表 * @param coupon 优惠券 * @param user 用户信息 @@ -784,6 +788,7 @@ export function returnCanDikouGoods( }); return result; } + export const utils = { returnGoodsPrice, returnGoodsGroupMap, diff --git a/lib/goods.ts b/lib/goods.ts index f120522..868e199 100644 --- a/lib/goods.ts +++ b/lib/goods.ts @@ -117,6 +117,7 @@ export function returnCanUseLimitTimeDiscount( useVipPrice: boolean, idKey = "product_id" ) { + goods={...goods,product_id:goods.product_id||goods.productId|| goods.id|| ''} if (!limitTimeDiscount || !limitTimeDiscount.id) { return false; } @@ -135,8 +136,12 @@ export function returnCanUseLimitTimeDiscount( return true; } if (useVipPrice && goods.hasOwnProperty("memberPrice")) { - if (goods.memberPrice && goods.memberPrice * 1 <= 0) { + + if ( goods.memberPrice * 1 <= 0) { + return true; + }else{ + return false; } } } @@ -166,12 +171,18 @@ function returnLimitPrice( const discountRate = new BigNumber(limitTimeDiscount.discountRate).dividedBy( 100 ); + let canuseLimit=false; + if(goods.hasOwnProperty('isTimeDiscount')||goods.hasOwnProperty('is_time_discount')){ + canuseLimit=goods.isTimeDiscount?true:goods.is_time_discount?true:false; + }else{ + canuseLimit = returnCanUseLimitTimeDiscount( + goods, + limitTimeDiscount, + useVipPrice + ); + } + - const canuseLimit = returnCanUseLimitTimeDiscount( - goods, - limitTimeDiscount, - useVipPrice - ); if (canuseLimit) { //可以使用限时折扣 if (limitTimeDiscount.discountPriority == "limit-time") { @@ -183,6 +194,7 @@ function returnLimitPrice( return result; } if (limitTimeDiscount.discountPriority == "vip-price") { + //会员价优先 if (useVipPrice && goods.memberPrice && goods.memberPrice * 1 > 0) { //使用会员价 @@ -228,7 +240,8 @@ export function returnCalcPrice( fullReductionActivitie.discountShare == 1 && fullReductionActivitie.vipPriceShare == 1 ) { - //与限时折扣同享,与会员价不同享 + console.log("与限时折扣同享,与会员价同享", goods); + //与限时折扣同享,与会员价同享 return returnLimitPrice(goods, limitTimeDiscount, useVipPrice); } if ( @@ -316,7 +329,7 @@ export function filterOptimalFullReductionActivity( // 第一步:基础筛选(未删除+当前店铺+活动进行中+就餐类型匹配) const baseEligible = activities.filter((activity) => { return ( - activity.isDel !== true && // 未删除 + // activity.isDel !== true && // 未删除 // activity.shopId === currentShopId && // 当前店铺 // activity.status === 2 && // 状态=2(进行中) isDinnerTypeMatch(activity, currentDinnerType) && // 就餐类型匹配 @@ -1090,7 +1103,7 @@ export function calculateOrderCostSummary( seatFee, packFee ); - + console.log("计算当前满减活动的门槛金额", usedFullReductionActivityFullAmount); usedFullReductionThreshold = selectOptimalThreshold( usedFullReductionActivity.thresholds, usedFullReductionActivityFullAmount, @@ -1098,7 +1111,6 @@ export function calculateOrderCostSummary( goodsRealAmount, usedFullReductionActivity.discountShare || 0 // 与限时折扣同享规则 ); - // 2.4 计算满减实际减免金额 fullReductionAmount = calcFullReductionAmount( baseAfterNewUserDiscount, diff --git a/lib/limit.ts b/lib/limit.ts index 5a6d4fa..f0591b3 100644 --- a/lib/limit.ts +++ b/lib/limit.ts @@ -29,6 +29,9 @@ export function canUseLimitTimeDiscount( ) { shopInfo = shopInfo || {}; shopUserInfo = shopUserInfo || {}; + if(shopInfo.isMemberPrice){ + shopUserInfo.isMemberPrice=1 + } if (!limitTimeDiscountRes || !limitTimeDiscountRes.id) { return false; } @@ -45,17 +48,15 @@ export function canUseLimitTimeDiscount( return true; } if (limitTimeDiscountRes.discountPriority == "vip-price") { - if (shopUserInfo.isVip != 1 || shopUserInfo.isMemberPrice != 1) { - return true; - } - if ( shopUserInfo.isVip == 1 && shopUserInfo.isMemberPrice == 1 && - goods.memberPrice * 1 <= 0 + goods.memberPrice * 1 > 0 ) { - return true; + return false; } + return true; + } return false; @@ -138,7 +139,6 @@ export function returnPrice(args: returnPriceArgs) { return memberPrice; } } else { - // console.log('不是会员或者没有启用会员价',goods,limitTimeDiscountRes); //不是会员或者没有启用会员价 if (limitTimeDiscountRes && limitTimeDiscountRes.id && includesGoods) { const price = returnLimitPrice({ diff --git a/lib/types.ts b/lib/types.ts index ee1b059..4cb709c 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -286,6 +286,7 @@ export interface ShopUserInfo { isVip: number | null; //是否会员 discount: number | null; //用户折扣 isMemberPrice: number | null; //会员折扣与会员价是否同时使用 + id?: number; //用户ID } /** 订单额外费用配置 */ export interface OrderExtraConfig { diff --git a/main.js b/main.js index 580b161..526da49 100644 --- a/main.js +++ b/main.js @@ -7,6 +7,9 @@ import uviewPlus,{setConfig} from 'uview-plus' import dict from '@/commons/utils/dict.js' // 下面的在特殊场景下才需要配置,通常不用配置即可直接使用uvire-plus框架。 import {utils} from '@/commons/utils/index.js' + +import * as Pinia from 'pinia'; + // 调用setConfig方法,方法内部会进行对象属性深度合并,可以放心嵌套配置 // 需要在app.use(uview-plus)之后执行 setConfig({ @@ -55,6 +58,7 @@ import { createSSRApp } from 'vue' import App from './App.vue' export function createApp() { const app = createSSRApp(App) + app.use(Pinia.createPinia()); app.use(uviewPlus) app.config.globalProperties.$appName = appConfig.appName uni.$appName = appConfig.appName @@ -63,7 +67,8 @@ export function createApp() { app.config.globalProperties.$dict = dict uni.$dict = dict return { - app + app, + Pinia, // 此处必须将 Pinia 返回 } } // #endif \ No newline at end of file diff --git a/package.json b/package.json index 23b589e..90c3bd0 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "jsencrypt": "^3.3.2", "lodash": "^4.17.21", "uview-plus": "^3.3.32", - "ysk-utils": "^1.0.70" + "ysk-utils": "^1.0.72" }, "devDependencies": { "copy-webpack-plugin": "^12.0.2", diff --git a/pagesCreateOrder/confirm-order/confirm-order.vue b/pagesCreateOrder/confirm-order/confirm-order.vue index 606adf7..295936b 100644 --- a/pagesCreateOrder/confirm-order/confirm-order.vue +++ b/pagesCreateOrder/confirm-order/confirm-order.vue @@ -507,6 +507,8 @@ import { createOrder, getHistoryOrder } from "@/http/api/order.js"; import { shopUserDetail } from "@/http/yskApi/shop-user.js"; import { discountActivity } from "@/http/yskApi/market/discountActivity.js"; import BigNumber from "bignumber.js"; +import * as limitTimeDiscountApi from "@/http/yskApi/limitTimeDiscount.js"; + const models = new Map(); const modelData = reactive({ @@ -589,6 +591,28 @@ async function getDiscountActivity() { } } const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例 + +const limitTimeDiscountRes = ref(null); +async function getLimit() { + const res = await limitTimeDiscountApi.limitTimeDiscount(); + limitTimeDiscountRes.value = res.data; + if (pageData.table.tableCode) { + pageData.limitTimeDiscount = limitTimeDiscountRes.value; + + websocketUtil.send( + JSON.stringify({ + type: "shopping", + operate_type: "time_discount_save", + table_code: pageData.table.tableCode, + shop_id: uni.getStorageSync("shopInfo").id, + operate_type: "time_discount_save", + data: limitTimeDiscountRes.value, + }) + ); + console.log("limitTimeDiscount",pageData.limitTimeDiscount ); + } +} + onLoad(async (opt) => { Object.assign(option, opt); console.log("opt====", opt); @@ -596,6 +620,8 @@ onLoad(async (opt) => { pageData.table.id = opt.tableId; pageData.table.tableCode = opt.tableCode; } + //获取限时折扣 + await getLimit(); //获取满减活动 await getDiscountActivity(); pageData.shopInfo = uni.getStorageSync("shopInfo"); @@ -640,6 +666,7 @@ onUnmounted(() => { * @param {Object} tableCode */ async function getHistoryOrderDetail(tableCode) { + let res = await getHistoryOrder({ tableCode: tableCode, }); @@ -868,6 +895,9 @@ async function getTableInfo(opt) { // 获取购物车数据 getCart(); // 获取购物车数据 + if(shopInfo.registerType==='before'){ + return + } getHistoryOrderDetail(opt.tableCode); } diff --git a/pagesCreateOrder/index/components/cart-goods-item.vue b/pagesCreateOrder/index/components/cart-goods-item.vue index ce94d5a..254228b 100644 --- a/pagesCreateOrder/index/components/cart-goods-item.vue +++ b/pagesCreateOrder/index/components/cart-goods-item.vue @@ -290,6 +290,7 @@ const is_time_discount = computed(() => { null, "id" ); + console.log("isCanuse", isCanuse,props.data); return isCanuse; }); diff --git a/pagesCreateOrder/index/components/guige.vue b/pagesCreateOrder/index/components/guige.vue index 1f4caa7..ab5fff7 100644 --- a/pagesCreateOrder/index/components/guige.vue +++ b/pagesCreateOrder/index/components/guige.vue @@ -250,7 +250,7 @@ function confirm() { if (isDisabled.value) { return; } - emits("confirm", goods.value, number.value,is_time_discount.value); + emits("confirm", goods.value, number.value,is_time_discount.value?1:0); } defineExpose({ open, diff --git a/pagesCreateOrder/index/components/pop-search.vue b/pagesCreateOrder/index/components/pop-search.vue index 8e8cba0..f5cf890 100644 --- a/pagesCreateOrder/index/components/pop-search.vue +++ b/pagesCreateOrder/index/components/pop-search.vue @@ -2,7 +2,7 @@ - + 搜索 @@ -54,7 +54,6 @@ } function search() { - console.log(searchVal.value, '值啊啊啊啊 ') emits('search', searchVal.value) close() } diff --git a/pagesCreateOrder/index/index.vue b/pagesCreateOrder/index/index.vue index 706eeef..cd74da0 100644 --- a/pagesCreateOrder/index/index.vue +++ b/pagesCreateOrder/index/index.vue @@ -344,7 +344,8 @@ import myCar from "./components/car"; import go from "@/commons/utils/go.js"; import infoBox from "@/commons/utils/infoBox.js"; import { getNowCart } from "@/pagesCreateOrder/util.js"; -import yskUtils from "ysk-utils"; +// import yskUtils from "ysk-utils"; +import yskUtils from "@/lib/index"; provide("yskUtils", yskUtils); import { $productCategory, diff --git a/pagesOrder/index/compoents/order-item.vue b/pagesOrder/index/compoents/order-item.vue index 05a05e9..047df9e 100644 --- a/pagesOrder/index/compoents/order-item.vue +++ b/pagesOrder/index/compoents/order-item.vue @@ -87,7 +87,7 @@ 总计¥ - {{originAmount.toFixed(2)}} + {{data.payAmount||data.orderAmount}} 重新打印 diff --git a/pagesOrder/pay-order/pay-order.vue b/pagesOrder/pay-order/pay-order.vue index f924728..6c65af0 100644 --- a/pagesOrder/pay-order/pay-order.vue +++ b/pagesOrder/pay-order/pay-order.vue @@ -58,7 +58,10 @@ 满减活动 @@ -67,20 +70,27 @@ - 优惠券 - 满减活动不可与优惠券同享 + 选择优惠券 -¥{{ orderCostSummary.couponDeductionAmount }} - + @@ -229,9 +239,9 @@ * 100积分等于{{ - to2(accountPoints.calcRes.equivalentPoints * 100) - }}元,{{ + accountPoints.calcRes.equivalentPoints + }}积分等于1元, 最大抵扣积分{{ accountPoints.calcRes.maxUsablePoints }} @@ -360,7 +370,8 @@ import { consumeAwardPoints, } from "@/http/api/points.js"; -import yskUtils from "ysk-utils"; +// import yskUtils from "ysk-utils"; +import yskUtils from "@/lib/index"; const websocketUtil = inject("websocketUtil"); // 注入 WebSocket 工具类实例 const modal = reactive({ @@ -431,14 +442,14 @@ async function getDiscountActivity() { shopId: uni.getStorageSync("shopId"), }); if (res.code == 200) { - fullReductionActivities.value = res.data?[res.data]:[]; + fullReductionActivities.value = res.data ? [res.data] : []; } } onLoad(async (opt) => { Object.assign(order, opt); Object.assign(options, opt); await getPayType(); - await getDiscountActivity() + await getDiscountActivity(); console.log("pays.payTypes.list"); init(); }); @@ -503,6 +514,7 @@ async function init() { }); } pageData.seatNum = order.seatNum; + seatFeeConfig.personCount = order.seatNum; } /** @@ -524,22 +536,6 @@ const coupAllPrice = computed(() => { return n; }); -/** - * 菜品打包费 - */ -const packAmount = computed(() => { - if (pageData.goodsList) { - let price = pageData.goodsList - .filter((v) => v.packNumber > 0 && v.status !== "return") - .reduce((a, b) => { - console.log(b); - return a + ((b.packAmount || 0) * b.packNumber).toFixed(2) * 1; - }, 0); - // console.log("菜品打包费===",price) - return price; - } -}); - /** * 桌位费 */ @@ -548,29 +544,6 @@ const tableFee = computed(() => { return order.seatNum > 0 ? order.seatNum * pageData.shopInfo.tableFee : 0; }); -/** - * 菜品金额 - */ -const originPrice = computed(() => { - if (pageData.goodsList) { - let goodsPrice = pageData.goodsList - .filter((v) => v.price != 0 && v.status !== "return") - .reduce((a, b) => { - return a + parseFloat(mathFloorPrice(b.num * b.price, b)); - }, 0); - // console.log("菜品原金额===",goodsPrice) - return ( - parseFloat(goodsPrice) + - parseFloat(tableFee.value) + - parseFloat(packAmount.value) - ).toFixed(2); - } -}); - - - - - // 计算商家减免前金额(使用bignumber.js确保精度) const returnMerchantReductionBeforeMoney = computed(() => { const total = BigNumber(orderCostSummary.value.finalPayAmount).plus( @@ -715,6 +688,14 @@ watch( } } ); +watch( + () => pageData.user.id, + (newval) => { + if (newval) { + getCalcUsablePoints(); + } + } +); watch( () => orderCostSummary.value.finalPayAmount, (newval) => { @@ -787,10 +768,12 @@ function getPayParam() { : "", discountActAmount: orderCostSummary.value.fullReduction.actualAmount, //满减抵扣金额 - discountActId: (orderCostSummary.value.fullReduction.usedActivity&&orderCostSummary.value.fullReduction.usedThreshold) - ? orderCostSummary.value.fullReduction.usedActivity.id - : null, - vipPrice:isVip.value? 1 : 0, // 是否使用会员价 + discountActId: + orderCostSummary.value.fullReduction.usedActivity && + orderCostSummary.value.fullReduction.usedThreshold + ? orderCostSummary.value.fullReduction.usedActivity.id + : null, + vipPrice: isVip.value ? 1 : 0, // 是否使用会员价 limitRate: order.limitRate && order.limitRate.id ? { @@ -852,7 +835,7 @@ async function getPayType() { } pays.payTypes.list.push({ ...v, - disabled + disabled, }); } }); @@ -919,20 +902,20 @@ function changeAccountPoints() { * 选择优惠券 */ function toQuan() { - console.log("toQuan", order); - console.log("pageData.user", pageData.user); - if(orderCostSummary.value.usedActivity){ - return infoBox.showToast("满减活动不可与优惠券同享") + if (orderCostSummary.value.fullReduction.usedThreshold) { + return infoBox.showToast("满减活动不可与优惠券同享"); } if (!order.userId && !pageData.user.id) { return infoBox.showToast("请先选择会员", 0.5).then(() => { chooseUser(); }); } + uni.setStorageSync("selCoupon", selCoupon.value); + go.to("PAGES_ORDER_QUAN", { orderId: order.id, shopUserId: pageData.user.id, - orderPrice: (payPrice.value * 1 + coupAllPrice.value * 1).toFixed(2), + orderPrice: BigNumber(payPrice.value).plus(BigNumber(orderCostSummary.value.couponDeductionAmount)).decimalPlaces(2, BigNumber.ROUND_DOWN) }); } @@ -1016,7 +999,6 @@ function uodateCartAndHistory() { history: [], cart: [], }; - console.log("uodateCartAndHistory", pageData.user); for (let cart of pageData.goodsList) { const canUseLimitTimeDiscount = yskUtils.limitUtils.canUseLimitTimeDiscount( cart, @@ -1027,14 +1009,14 @@ function uodateCartAndHistory() { ) ? 1 : 0; - console.log("uodateCartAndHistory", pageData.user); - if (canUseLimitTimeDiscount != cart.is_time_discount) { - newData.cart.push({ + if (canUseLimitTimeDiscount != cart.isTimeDiscount) { + newData.history.push({ id: cart.id, is_time_discount: canUseLimitTimeDiscount, }); } } + if (newData.history.length <= 0 && newData.cart.length <= 0) { return; } @@ -1062,8 +1044,7 @@ function getShopUserDetail() { }); } - -const newUserDiscountRes=ref(null) +const newUserDiscountRes = ref(null); //获取用户新客立减 function getNewUserDiscount() { getDiscountByUserId({ @@ -1391,7 +1372,7 @@ function onMessage() { websocketUtil.offMessage(); websocketUtil.onMessage((res) => { let msg = JSON.parse(res); - + console.log("onMessage", msg); switch (msg.operate_type) { case "pad_init": getHistoryAndUpdateGoodsList(); @@ -1402,6 +1383,9 @@ function onMessage() { case "pad_edit": case "edit": break; + case "bulk_edit": + getHistoryAndUpdateGoodsList(); + break; case "pad_del": case "del": break; diff --git a/pagesOrder/quan/quan.vue b/pagesOrder/quan/quan.vue index e2f2ca9..b8349d2 100644 --- a/pagesOrder/quan/quan.vue +++ b/pagesOrder/quan/quan.vue @@ -336,12 +336,7 @@ const limitTimeDiscount = reactive({ id: "" }); const quansSelArr = computed(() => { return [couponSel.value, goodsCouponSel.value].filter((v) => v.id); }); -const querForm = ref({ - searchValue: "", - shopId: "", - shopName: "", - statusActiveIndex: 0, -}); + const list = reactive({ page: 1, size: 10, @@ -372,8 +367,9 @@ function formatCoupon() { for (let i = 0; i < couponList.value.length; i++) { const coupon = couponList.value[i]; + console.log('quansSelArr',quansSelArr.value) const selCoupon = - myQuan.types.sel != 1 + myQuan.types.sel ==1 ? quansSelArr.value.filter((v) => v.type != 2) : quansSelArr.value.filter((v) => v.type == 2); const canuseResult = yskUtils.couponUtils.returnCouponCanUse({ @@ -585,6 +581,14 @@ async function getShopUser() { } onLoad(async (opt) => { Object.assign(option, opt); + const selCoupon=uni.getStorageSync("selCoupon")||[]; + for(let i=0;i=0.10'} hasBin: true - electron-to-chromium@1.5.252: - resolution: {integrity: sha512-53uTpjtRgS7gjIxZ4qCgFdNO2q+wJt/Z8+xAvxbCqXPJrY6h7ighUkadQmNMXH96crtpa6gPFNP7BF4UBGDuaA==} + electron-to-chromium@1.5.254: + resolution: {integrity: sha512-DcUsWpVhv9svsKRxnSCZ86SjD+sp32SGidNB37KpqXJncp1mfUgKbHvBomE89WJDbfVKw1mdv5+ikrvd43r+Bg==} emojis-list@3.0.0: resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==} @@ -688,8 +688,8 @@ packages: webpack-cli: optional: true - ysk-utils@1.0.70: - resolution: {integrity: sha512-fCro0XPI3m94vUWufCxaBR4hEdc6ucqGSmH45jSvIUuhrME8Aa0YwtsUrGtr4WjP2n3mdzz+ip861ghmtP+ScQ==} + ysk-utils@1.0.72: + resolution: {integrity: sha512-Lum961KknoP/D6gOQ2vpM4qRaH7CZ8LbmHQlsZG0SKUguu09zr79UHpKBVWTem3HMxXqXSOFWSK+PVAyv9TcyQ==} snapshots: @@ -933,8 +933,8 @@ snapshots: browserslist@4.28.0: dependencies: baseline-browser-mapping: 2.8.28 - caniuse-lite: 1.0.30001754 - electron-to-chromium: 1.5.252 + caniuse-lite: 1.0.30001755 + electron-to-chromium: 1.5.254 node-releases: 2.0.27 update-browserslist-db: 1.1.4(browserslist@4.28.0) @@ -945,7 +945,7 @@ snapshots: base64-js: 1.5.1 ieee754: 1.2.1 - caniuse-lite@1.0.30001754: {} + caniuse-lite@1.0.30001755: {} chokidar@4.0.3: dependencies: @@ -978,7 +978,7 @@ snapshots: detect-libc@1.0.3: optional: true - electron-to-chromium@1.5.252: {} + electron-to-chromium@1.5.254: {} emojis-list@3.0.0: {} @@ -1300,7 +1300,7 @@ snapshots: - esbuild - uglify-js - ysk-utils@1.0.70: + ysk-utils@1.0.72: dependencies: bignumber.js: 9.3.1 loadsh: 0.0.4 diff --git a/stores/cart.js b/stores/cart.js new file mode 100644 index 0000000..3ddab8a --- /dev/null +++ b/stores/cart.js @@ -0,0 +1,15 @@ +// stores/counter.js +import { defineStore } from 'pinia'; + +export const useCounterStore = defineStore('cart', { + state: () => { + return { + selCoupon: [], + }; + }, + actions: { + setSelCoupon(coupon) { + this.selCoupon = coupon + }, + }, +});