diff --git a/package.json b/package.json index 14f1072..b3604b9 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@wangeditor-next/editor": "^5.6.31", "@wangeditor-next/editor-for-vue": "^5.1.14", "axios": "^1.7.9", + "bwip-js": "^4.5.1", "codemirror": "^5.65.18", "codemirror-editor-vue3": "^2.8.0", "dayjs": "^1.11.13", @@ -51,6 +52,7 @@ "path-browserify": "^1.0.1", "path-to-regexp": "^8.2.0", "pinia": "^2.3.1", + "qrcode": "^1.5.4", "qs": "^6.14.0", "sockjs-client": "^1.6.1", "sortablejs": "^1.15.6", diff --git a/src/api/order/order.ts b/src/api/order/order.ts index 5fec44a..def0a27 100644 --- a/src/api/order/order.ts +++ b/src/api/order/order.ts @@ -9,7 +9,13 @@ const OrderApi = { params: params, }); }, - add() { }, + add(data: addRequest) { + return request({ + url: `${baseURL}/createOrder`, + method: "post", + data + }); + }, edit() { }, delete() { }, }; @@ -214,3 +220,244 @@ export interface OrderDetailSmallVO { skuName?: string; [property: string]: any; } +export interface addRequest { + /** + * 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away + */ + dineMode: string; + /** + * 多次下单时使用 + */ + orderId?: number; + /** + * 订单原金额(包含打包费+餐位费) 不含折扣价格 + */ + originAmount?: number; + /** + * 打包费 + */ + packFee?: number; + /** + * 当前订单下单次数 + */ + placeNum?: number; + /** + * 备注 + */ + remark?: string; + /** + * 用餐人数 + */ + seatNum?: number; + /** + * 店铺Id + */ + shopId?: number; + /** + * 台桌编码 + */ + tableCode: string; + userId?: number; + /** + * 是否使用会员价 + */ + vipPrice?: boolean; + /** + * 是否等叫 0 否 1 等叫 + */ + waitCall?: boolean; + [property: string]: any; +} + + + +/** +* OrderInfo +*/ +export interface OrderInfo { + /** + * 用户使用的卡券 + */ + couponInfoList?: string; + createTime?: string; + /** + * 挂账人id + */ + creditBuyerId?: number; + /** + * 用餐模式 堂食 dine-in 外带 take-out 外卖 take-away + */ + dineMode?: string; + /** + * 折扣金额 + */ + discountAmount?: number; + /** + * 折扣信息 json + */ + discountInfo?: string; + /** + * 折扣比例 + */ + discountRatio?: number; + /** + * 满减优惠券抵扣金额 + */ + fullCouponDiscountAmount?: number; + id?: number; + /** + * 是否回收站 0-否,1回收站 + */ + isDel?: number; + /** + * 是否使用了霸王餐 + */ + isFreeDine?: number; + /** + * 是否等叫 0 否 1 等叫 + */ + isWaitCall?: number; + /** + * 订单金额 (扣除各类折扣) + */ + orderAmount?: number; + /** + * 订单编号 + * pc 收银机客户端 PC+雪花ID + * wechat 微信小程序 WX+雪花ID + * alipay 支付宝小程序 ALI+雪花ID + * admin-pc PC管理端 WEB+雪花ID + * admin-app APP管理端 APP+雪花ID + */ + orderNo?: string; + /** + * 订单类型- + * cash收银(除小程序以外 都属于收银) + * miniapp小程序 + */ + orderType?: string; + /** + * 订单原金额 不含折扣价格 + */ + originAmount?: number; + /** + * 打包费 + */ + packFee?: number; + /** + * 支付时间 + */ + paidTime?: string; + /** + * 实际支付金额 + */ + payAmount?: number; + /** + * 支付模式: + * 后付费 after-pay + * 先付费 before-pay + * 无桌码 no-table + */ + payMode?: string; + /** + * 支付订单号 + * tb_order_payment.id + * tb_shop_user_flow.id + */ + payOrderId?: number; + payOrderNo?: string; + /** + * 支付类型 + * 主扫 main-scan + * 被扫 back-scan + * 微信小程序 wechat-mini + * 支付宝小程序 alipay-mini + * 会员支付 vip-pay + * 现金支付 cash-pay + */ + payType?: string; + /** + * 当前订单下单次数 + */ + placeNum?: number; + /** + * 平台类型 pc 收银机客户端 wechat 微信小程序 alipay 支付宝小程序 admin-pc PC管理端 admin-app APP管理端 + */ + platformType?: string; + /** + * 积分抵扣金额 + */ + pointsDiscountAmount?: number; + /** + * 使用的积分数量 + */ + pointsNum?: number; + /** + * 商品优惠券抵扣金额 + */ + productCouponDiscountAmount?: number; + /** + * 是否支持退款,1支持退单, 0不支持退单 + */ + refundAble?: number; + /** + * 退单金额 + */ + refundAmount?: number; + /** + * 退款备注 + */ + refundRemark?: string; + /** + * 备注 + */ + remark?: string; + /** + * 抹零金额 减免多少钱 + */ + roundAmount?: number; + /** + * 餐位费 + */ + seatAmount?: number; + /** + * 用餐人数 + */ + seatNum?: number; + /** + * 店铺Id + */ + shopId?: number; + /** + * 员工id + */ + staffId?: number; + /** + * OrderStatusEnums 枚举类 + * 状态: unpaid-待支付;in-production 制作中;wait-out + * 待取餐;;done-订单完成;refunding-申请退单;refund-退单;part-refund 部分退单;cancelled-取消订单 + */ + status?: string; + /** + * 台桌Id + */ + tableCode?: string; + /** + * 台桌名称 + */ + tableName?: string; + /** + * 取餐码 + */ + takeCode?: string; + /** + * 交易日期 + */ + tradeDay?: string; + updateTime?: string; + /** + * 用户Id user_info表的id + */ + userId?: number; + [property: string]: any; +} \ No newline at end of file diff --git a/src/assets/icons/scan.svg b/src/assets/icons/scan.svg new file mode 100644 index 0000000..ac2a57d --- /dev/null +++ b/src/assets/icons/scan.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/ChooseAddress/index.vue b/src/components/ChooseAddress/index.vue new file mode 100644 index 0000000..a46168c --- /dev/null +++ b/src/components/ChooseAddress/index.vue @@ -0,0 +1,217 @@ + + + + + \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 6520f8f..1692abf 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -106,7 +106,7 @@ export const constantRoutes: RouteRecordRaw[] = [ children: [ { path: "index", - component: () => import("@/views/shop/index.vue"), + component: () => import("@/views/shop/config/index.vue"), name: "shopConfig", meta: { title: "店铺配置", diff --git a/src/store/modules/carts.ts b/src/store/modules/carts.ts index 760ca5a..d756524 100644 --- a/src/store/modules/carts.ts +++ b/src/store/modules/carts.ts @@ -77,7 +77,7 @@ export const useCartsStore = defineStore("carts", () => { return; } const newNumber = item.number * 1 + step * 1; - update({ ...item, number: step * 1, pack_number: newNumber < item.pack_number ? (item.pack_number * 1 + step * 1) : item.pack_number }); + update({ ...item, number: item.number * 1 + step * 1, pack_number: newNumber < item.pack_number ? (item.pack_number * 1 + step * 1) : item.pack_number }); } function changeSelCart(cart: CartsState) { @@ -95,8 +95,29 @@ export const useCartsStore = defineStore("carts", () => { selListIndex.value = list.value.findIndex((item: CartsState) => item.id === cart.id); } } + function add(data: any) { - sendMessage('add', data); + const msg = { + number: 1, + is_pack: 0, + is_gift: 0, + is_temporary: 0, + discount_sale_amount: 0, + discount_sale_note: "", + is_print: 0, + is_wait_call: 0, + product_name: "", + remark: "", + ...data + } + const hasCart = list.value.find((cartItem) => { + return cartItem.product_id == msg.product_id && cartItem.sku_id == msg.sku_id; + }); + if (hasCart) { + update({ ...hasCart, ...msg, number: hasCart.number * 1 + msg.number * 1 }) + } else { + sendMessage('add', msg); + } } function del(data: any) { @@ -108,14 +129,39 @@ export const useCartsStore = defineStore("carts", () => { sendMessage('edit', data); } function updateTag(key: string, val: any, cart: CartsState) { - sendMessage('edit', { ...cart || selCart.value, number: 0, [key]: val }); + sendMessage('edit', { ...cart || selCart.value, [key]: val }); } function clear() { sendMessage('cleanup', {}); } + + // 寻找套餐商品sku + interface GroupSnap { + goods: { [key: string]: any }[]; + } + + function findInGroupSnapSku(groupSnap: GroupSnap[], sku_id: string | number) { + for (let i in groupSnap) { + const sku = groupSnap[i].goods.find(v => v.sku_id == sku_id) + if (sku) { + return sku + } + } + } + function getProductDetails(v: { product_id: string, sku_id: string }) { const goods = goodsMap[v.product_id] - const skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id); + if (!goods) { + return undefined + } + let skuData = undefined; + if (goods.type == 'package') { + //套餐商品 + const SnapSku = findInGroupSnapSku(goods.groupSnap, v.sku_id) + skuData = { ...SnapSku, salePrice: SnapSku ? SnapSku.price : 0 } + } else { + skuData = goods?.skuList.find((sku: { id: string, salePrice: number }) => sku.id == v.sku_id); + } if (skuData) { return { salePrice: skuData ? skuData.salePrice : 0, @@ -136,8 +182,10 @@ export const useCartsStore = defineStore("carts", () => { if (msg.hasOwnProperty('status') && msg.status != 1) { return ElMessage.error(msg.message || '操作失败') } - if (msg && msg.data && msg.data[0]) { - table_code.value = table_code.value ? table_code.value : msg.data[0].table_code + if (msg && msg.data) { + const tableCode = Array.isArray(msg.data) ? msg.data[0].table_code : msg.data.table_code + table_code.value = table_code.value ? table_code.value : tableCode + console.log(table_code.value) } // 初始化 if (msg.operate_type === "manage_init") { @@ -158,17 +206,21 @@ export const useCartsStore = defineStore("carts", () => { }); console.log(giftList.value) } + //广播 + if (msg.type === "bc") { + msg.operate_type = 'manage_' + msg.operate_type + } if (msg.operate_type === "manage_add") { - const skuData = getProductDetails({ product_id: msg.data[0].product_id, sku_id: msg.data[0].sku_id }) - list.value.push({ ...skuData, ...msg.data[0] }) + const skuData = getProductDetails({ product_id: msg.data.product_id, sku_id: msg.data.sku_id }) + list.value.push({ ...skuData, ...msg.data }) return ElMessage.success(msg.message || '添加成功') } if (msg.operate_type === "manage_edit") { - const newCart = msg.data[0] + const newCart = msg.data const index = list.value.findIndex((item) => item.id === newCart.id) const giftIndex = giftList.value.findIndex((item) => item.id === newCart.id) - const cartItem = list.value[index]; + const cartItem = list.value[index] || { is_gift: false }; const giftItem = giftList.value[giftIndex]; if (isSelGift.value) { //操作赠菜 @@ -227,10 +279,11 @@ export const useCartsStore = defineStore("carts", () => { }); } function sendMessage(operate_type: msgType, message: any) { - console.log({ ...message, operate_type: operate_type, table_code: table_code.value }) - WebSocketManager.sendMessage({ ...message, operate_type: operate_type, table_code: table_code.value }); + const msg = { ...message, operate_type: operate_type, table_code: table_code.value } + WebSocketManager.sendMessage(msg); } return { + table_code, updateTag, list, add, diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index fadbc52..d3889da 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -53,7 +53,6 @@ export const useUserStore = defineStore("user", () => { return; } localStorage.setItem("shopId", "" + userInfo.value.shopId); - console.log("获取用户信息", data); Object.assign(userInfo.value, { ...data, roles: [], promissionList: [], shopId: userInfo.value.shopId }); resolve(userInfo.value); }) diff --git a/src/styles/reset.scss b/src/styles/reset.scss index a20f04a..afe1de0 100644 --- a/src/styles/reset.scss +++ b/src/styles/reset.scss @@ -25,8 +25,8 @@ body { width: 100%; height: 100%; margin: 0; - font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", - "Microsoft YaHei", "微软雅黑", Arial, sans-serif; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", + "微软雅黑", Arial, sans-serif; line-height: inherit; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; @@ -74,3 +74,7 @@ a:active, div:focus { outline: none; } +p { + margin: 0; + line-height: 1; +} diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index a7fba09..97a9ba9 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -53,7 +53,6 @@ class WebSocketManager { return this.client; } const url = qs.stringify(this.initParams) - console.log(this.initParams) this.client = new WebSocket(endpoint + '?' + url); this.client.onopen = () => { this.connected = true; @@ -108,8 +107,6 @@ class WebSocketManager { // 订阅主题 public subscribeToTopic(initParams: ApifoxModel, onMessage: (message: any) => void) { console.log(`正在订阅主题: `); - console.log(initParams); - this.initParams = { ...this.initParams, ...initParams } if (this.client && this.connected) { this.disconnect(); diff --git a/src/views/shop/config/components/safe.vue b/src/views/shop/config/components/safe.vue new file mode 100644 index 0000000..d14ad67 --- /dev/null +++ b/src/views/shop/config/components/safe.vue @@ -0,0 +1,129 @@ + + \ No newline at end of file diff --git a/src/views/shop/config/components/shopInfo.vue b/src/views/shop/config/components/shopInfo.vue new file mode 100644 index 0000000..7684661 --- /dev/null +++ b/src/views/shop/config/components/shopInfo.vue @@ -0,0 +1,562 @@ + + + + + diff --git a/src/views/shop/config/index.vue b/src/views/shop/config/index.vue new file mode 100644 index 0000000..5ad2593 --- /dev/null +++ b/src/views/shop/config/index.vue @@ -0,0 +1,27 @@ + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/carts/item.vue b/src/views/tool/Instead/components/carts/item.vue index 7e85a99..6da8314 100644 --- a/src/views/tool/Instead/components/carts/item.vue +++ b/src/views/tool/Instead/components/carts/item.vue @@ -82,18 +82,18 @@ @@ -161,7 +161,9 @@ const props = defineProps({ default: 0, }, }); - +function to2(n) { + return n.toFixed(2); +} let number = ref(0); const currentPrice = computed(() => { diff --git a/src/views/tool/Instead/components/carts/list.vue b/src/views/tool/Instead/components/carts/list.vue index c9720b5..112b987 100644 --- a/src/views/tool/Instead/components/carts/list.vue +++ b/src/views/tool/Instead/components/carts/list.vue @@ -35,9 +35,9 @@
- 微信/支付宝 - 现金 - 更多支付 + 微信/支付宝 + 现金 + 更多支付
@@ -58,11 +58,14 @@ const props = defineProps({ }, }); -const emits = defineEmits(["editNote"]); +const emits = defineEmits(["editNote", "createOrder"]); function editNote() { emits("editNote"); } +function createOrder() { + emits("createOrder"); +} const selCartId = ref(null); const carts = useCartsStore(); @@ -74,7 +77,12 @@ watch( for (let goods of props.goodsList) { goodsMap[goods.id] = goods; } - carts.init({}, goodsMap); + carts.init( + { + table_code: "", + }, + goodsMap + ); } } ); @@ -86,7 +94,6 @@ function itemClick(item) { function changeNumber(step, item) { carts.changeNumber(step * 1, item); } - defineExpose({ carts, }); diff --git a/src/views/tool/Instead/components/choose-user.vue b/src/views/tool/Instead/components/choose-user.vue new file mode 100644 index 0000000..8ffc52e --- /dev/null +++ b/src/views/tool/Instead/components/choose-user.vue @@ -0,0 +1,242 @@ + + + + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/control.vue b/src/views/tool/Instead/components/control.vue index cf6f5ad..e1a4c16 100644 --- a/src/views/tool/Instead/components/control.vue +++ b/src/views/tool/Instead/components/control.vue @@ -1,12 +1,12 @@ + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/keyboard.vue b/src/views/tool/Instead/components/keyboard.vue index 64ddcf2..98da27d 100644 --- a/src/views/tool/Instead/components/keyboard.vue +++ b/src/views/tool/Instead/components/keyboard.vue @@ -93,8 +93,9 @@ const props = defineProps({ }, }); -let number = ref(0); - +const number = defineModel({ + default: 0, +}); watch( () => props.value, (newval) => { @@ -102,12 +103,6 @@ watch( } ); const emits = defineEmits(["input", "confirm"]); -watch( - () => number.value, - (newval) => { - emits("input", newval); - } -); function clearFunction() { if (props.isFloat) { @@ -127,6 +122,7 @@ function keyboradAdd(n) { if (newval * 1 > props.max * 1) { return ElMessage.error(this.maxTips); } + console.log(number.value); number.value = newval; } function keyboradReduce() { diff --git a/src/views/tool/Instead/components/order.vue b/src/views/tool/Instead/components/order.vue new file mode 100644 index 0000000..c8f848a --- /dev/null +++ b/src/views/tool/Instead/components/order.vue @@ -0,0 +1,190 @@ + + + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/popup-taocan-goods.vue b/src/views/tool/Instead/components/popup-taocan-goods.vue new file mode 100644 index 0000000..7c07034 --- /dev/null +++ b/src/views/tool/Instead/components/popup-taocan-goods.vue @@ -0,0 +1,124 @@ + + + + + \ No newline at end of file diff --git a/src/views/tool/Instead/components/popup-weight-goods.vue b/src/views/tool/Instead/components/popup-weight-goods.vue index 9da8301..befe10a 100644 --- a/src/views/tool/Instead/components/popup-weight-goods.vue +++ b/src/views/tool/Instead/components/popup-weight-goods.vue @@ -106,13 +106,12 @@ function confirm() { emits("confirm", item.value, (number.value * 1).toFixed(2)); close(); } -function open(item) { - console.log(item); - item.value = item; +function open(data) { + item.value = data; show.value = true; } function close() { - show.valuie = false; + show.value = false; number.value = ""; item.value = ""; } @@ -131,10 +130,6 @@ defineExpose({ border: none; } -::v-deep .select_desk_dialog .el-input__inner { - // border: none; -} - ::v-deep .el-input__inner::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index f86d095..031828d 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -5,8 +5,29 @@
代客下单
- 选择用户 - +
+ 选择用户 + +
+ +
+ +
+
+
+
{{ user.nickName }}
+
VIP{{ user.isVip }}
+
+
余额:{{ user.amount }}
+
+
+
+
扫码验券 @@ -52,10 +73,12 @@
+ {{ item.label }} @@ -75,6 +98,7 @@
-
-
-
-
- -
- {{ category.showAll ? "收起" : "展开" }} -
-
-
+ + + +
@@ -146,14 +175,24 @@ + + + + + +