diff --git a/README.md b/README.md index c74fd43..432f451 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## 宝塔 - + chaozg chaozg123 diff --git a/src/api/account/points.ts b/src/api/account/points.ts index 7cc66e0..f7c5cac 100644 --- a/src/api/account/points.ts +++ b/src/api/account/points.ts @@ -6,7 +6,7 @@ const Api = { calcOrderUsablePoints(params: any) { return request({ - url: `${baseURL}/member-points/calc-usable-points`, + url: `${baseURL}/memberPoints/calcUsablePoints`, method: "get", params }); @@ -14,7 +14,7 @@ const Api = { // 004-根据抵扣金额计算所需积分 calcMoneyUsablePoints(params: any) { return request({ - url: `${baseURL}/member-points/calc-used-points`, + url: `${baseURL}/memberPoints/calcUsedPoints`, method: "get", params }); @@ -22,7 +22,7 @@ const Api = { // 003-根据积分计算可抵扣金额 calcPointsToMoney(params: any) { return request({ - url: `${baseURL}/member-points/calc-deduction-amount`, + url: `${baseURL}/memberPoints/calcDeductionAmount`, method: "get", params }); diff --git a/src/api/account/table.ts b/src/api/account/table.ts index 7db43e3..02586a5 100644 --- a/src/api/account/table.ts +++ b/src/api/account/table.ts @@ -18,11 +18,11 @@ const API = { }); }, // 获取台桌详情 - get(id: string | number) { + get(params: getRequest) { return request({ url: `${baseURL}/detail`, method: "get", - params: { id } + params }); }, edit(data: editRequest) { @@ -122,7 +122,17 @@ export interface editRequest { status?: null | string; [property: string]: any; } - +export interface getRequest { + /** + * 台桌id + */ + id?: string; + /** + * 桌码 + */ + tableCode?: string; + [property: string]: any; +} export interface getListRequest { /** * 区域id diff --git a/src/api/order/order.ts b/src/api/order/order.ts index 765bef8..9e86c8c 100644 --- a/src/api/order/order.ts +++ b/src/api/order/order.ts @@ -16,6 +16,14 @@ const OrderApi = { data }); }, + //订单详情 + get(params: any) { + return request({ + url: `${baseURL}/getOrderById`, + method: "get", + params + }); + }, // 历史订单(多次下单使用) getHistoryList(params: getHistoryListRequest) { return request({ diff --git a/src/store/modules/carts.ts b/src/store/modules/carts.ts index 54f9731..006e9d8 100644 --- a/src/store/modules/carts.ts +++ b/src/store/modules/carts.ts @@ -24,7 +24,8 @@ export const useCartsStore = defineStore("carts", () => { //台桌id const table_code = ref(''); - + //购物车是否初始化连接加载完成 + const isLinkFinshed = ref(false) //当前购物车数据 const list = useStorage("carts", []); //历史订单数据 @@ -281,7 +282,7 @@ export const useCartsStore = defineStore("carts", () => { if (table_code.value) { sendMessage('rottable', { new_table_code: newVal, - id: list.value[0].id + table_code: table_code.value }); } else { table_code.value = `${newVal}`; @@ -320,6 +321,11 @@ export const useCartsStore = defineStore("carts", () => { isSelGift.value = false list.value = []; giftList.value = []; + oldOrder.value = { + detailMap: [], + originAmount: 0 + } + vipUser.value = {} } // 寻找套餐商品sku @@ -361,6 +367,7 @@ export const useCartsStore = defineStore("carts", () => { name: goods.name, specInfo: skuData.specInfo, packFee: goods.packFee || 0, + type: goods.type, skuData } } else { @@ -386,6 +393,13 @@ export const useCartsStore = defineStore("carts", () => { } return newData } + + function setOldOrder(data: any) { + oldOrder.value = { + ...data, + detailMap: returnDetailMap(data.detailMap) + } + } /** * * @param initParams 购物车初始化参数 @@ -395,12 +409,13 @@ export const useCartsStore = defineStore("carts", () => { function init(initParams: ApifoxModel, $goodsMap: any, $oldOrder: any) { // 商品id对应的数据map - goodsMap = $goodsMap - - oldOrder.value = { - ...$oldOrder, - detailMap: returnDetailMap($oldOrder.detailMap) + if ($goodsMap) { + goodsMap = $goodsMap } + if ($oldOrder) { + setOldOrder($oldOrder) + } + console.log('oldOrder.detailMap', oldOrder.value.detailMap) table_code.value = initParams && initParams.table_code ? initParams.table_code : ''; @@ -423,6 +438,7 @@ export const useCartsStore = defineStore("carts", () => { // 初始化 if (msg.operate_type === "manage_init") { + isLinkFinshed.value = true // 设置单价 list.value = msg.data.filter((v: Record) => { if (v.is_temporary) { @@ -529,7 +545,7 @@ export const useCartsStore = defineStore("carts", () => { }); } - const delArr = ['skuData', 'coverImg', 'specInfo', 'placeNum', 'update_time', 'create_time', 'packFee', 'memberPrice'] + const delArr = ['skuData', 'coverImg', 'specInfo', 'placeNum', 'update_time', 'create_time', 'packFee', 'memberPrice', 'type'] function sendMessage(operate_type: msgType, message: any) { const msg = { ...message, operate_type: operate_type, table_code: table_code.value } if (operate_type == 'edit') { @@ -541,6 +557,8 @@ export const useCartsStore = defineStore("carts", () => { WebSocketManager.sendMessage(msg); } return { + isLinkFinshed, + setOldOrder, singleDiscount, vipDiscount, dataReset, diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index 76f222f..71ca7d8 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -24,12 +24,13 @@ export type msgType = 'add' | 'reduce' | 'remove' | 'edit' | 'init' | 'cleanup' class WebSocketManager { private client: WebSocket | null = null; private connected: boolean = false; + private shop_id = user.userInfo.shopId ? String(user.userInfo.shopId) : ''; private initParams: ApifoxModel = { type: 'manage', - account: `${user.userInfo.shopId}`, + account: this.shop_id, operate_type: 'init', table_code: '', - shop_id: `${user.userInfo.shopId}`, + shop_id: this.shop_id, }; private onMessage: (message: any) => void = function () { }; private messageHandlers: Map void)[]> = new Map(); diff --git a/src/views/application/marketing/points/index.ts b/src/views/application/marketing/points/index.ts index e1eaebe..5a7577c 100644 --- a/src/views/application/marketing/points/index.ts +++ b/src/views/application/marketing/points/index.ts @@ -1,5 +1,5 @@ import request from "@/utils/request"; -const baseURL = "/account/admin/points/basic-setting"; +const baseURL = "/account/admin/points/basicSetting"; // 积分-配置 const AuthAPI = { // 积分基本设置详情 diff --git a/src/views/application/marketing/points/pointsconfig/BasicSettings.vue b/src/views/application/marketing/points/pointsconfig/BasicSettings.vue index bb71180..e2253b9 100644 --- a/src/views/application/marketing/points/pointsconfig/BasicSettings.vue +++ b/src/views/application/marketing/points/pointsconfig/BasicSettings.vue @@ -54,7 +54,11 @@
-
+
@@ -72,7 +76,11 @@
-
+
@@ -99,37 +107,35 @@ @@ -144,7 +150,7 @@ async function onSubmit() { flex: 1; padding: 10px; border: 1px solid #ddd; - $color: #3F9EFF; + $color: #3f9eff; &:hover { cursor: pointer; @@ -159,7 +165,7 @@ async function onSubmit() { } .line { - background-color: #D9D9D9; + background-color: #d9d9d9; } &.style1 { diff --git a/src/views/order/index/components/detail.vue b/src/views/order/index/components/detail.vue index dd1c41a..9059c43 100644 --- a/src/views/order/index/components/detail.vue +++ b/src/views/order/index/components/detail.vue @@ -1,19 +1,22 @@