From ed25a9c5e6d04a39f8b49ee08a0368922ae861f9 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Mon, 17 Mar 2025 10:55:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=82=B9=E6=AD=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2,?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=AC=E6=A1=8C=E6=8A=A5=E9=94=99=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E9=A1=B5=E9=9D=A2=E6=97=A0=E5=8F=8D=E5=BA=94=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=8E=BB=E9=99=A4=E6=B7=BB=E5=8A=A0=E8=80=97?= =?UTF-8?q?=E6=9D=90=E7=9A=84=E5=BA=93=E5=AD=98=E6=95=B0=E9=87=8F=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=BC=B9=E7=AA=97=E5=85=B3=E9=97=AD=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/account/shopSong.ts | 47 +++++ src/store/modules/carts.ts | 11 +- src/utils/tools.js | 12 ++ src/views/application/list/index.vue | 2 +- .../list/song/components/add-song.vue | 169 ++++++++++++++++ src/views/application/list/song/index.vue | 190 ++++++++++++++++++ .../consumables/components/add-haocai.vue | 12 +- .../Instead/components/popup-rottable.vue | 8 +- .../Instead/components/popup-taocan-goods.vue | 4 +- src/views/tool/Instead/index.vue | 9 +- 10 files changed, 451 insertions(+), 13 deletions(-) create mode 100644 src/api/account/shopSong.ts create mode 100644 src/views/application/list/song/components/add-song.vue create mode 100644 src/views/application/list/song/index.vue diff --git a/src/api/account/shopSong.ts b/src/api/account/shopSong.ts new file mode 100644 index 0000000..ab0049d --- /dev/null +++ b/src/api/account/shopSong.ts @@ -0,0 +1,47 @@ +import request from "@/utils/request"; +import { Account_BaseUrl } from "@/api/config"; +const baseURL = Account_BaseUrl + "/admin/shopSong"; +const Api = { + // 点歌页面地址 + url() { + return request({ + url: `${baseURL}/url`, + method: "get", + }); + }, + getList(params: any) { + return request({ + url: `${baseURL}`, + method: "get", + }); + }, + get(id: Number | string) { + return request({ + url: `${baseURL}`, + method: "get", + }); + }, + add(data: any) { + return request({ + url: `${baseURL}`, + method: "post", + data + }); + }, + update(data: any) { + return request({ + url: `${baseURL}`, + method: "put", + data + }); + }, + delete(data: any) { + return request({ + url: `${baseURL}`, + method: "delete", + data + }); + } +}; + +export default Api; diff --git a/src/store/modules/carts.ts b/src/store/modules/carts.ts index 17af4e3..6b0c6ae 100644 --- a/src/store/modules/carts.ts +++ b/src/store/modules/carts.ts @@ -2,7 +2,7 @@ import { store } from "@/store"; import WebSocketManager, { type ApifoxModel, msgType } from "@/utils/websocket"; import orderApi from "@/api/order/order"; import { useUserStoreHook } from "@/store/modules/user"; - +import { customTruncateToTwoDecimals } from '@/utils/tools' const shopUser = useUserStoreHook(); export interface CartsState { id: string | number; @@ -83,6 +83,15 @@ export const useCartsStore = defineStore("carts", () => { } return selGoods.value.type == 'package' && selGoods.value.groupType == 1 }) + function returnOneGoodsTotalMoney(cur: any) { + const memberPrice = cur.memberPrice || cur.salePrice + const total = cur.number * (useVipPrice.value ? memberPrice : cur.salePrice) + if (cur.type == 'weight') { + return customTruncateToTwoDecimals(total) + } else { + return total + } + } //赠菜总价 const giftMoney = computed(() => { let oldGiftMoney = 0 diff --git a/src/utils/tools.js b/src/utils/tools.js index 53089ca..1bd48d4 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -441,3 +441,15 @@ export function swapArrayEle(arr, i1, i2) { arr[i1] = arr.splice(i2, 1, arr[i1])[0]; return arr; } +// 价格保留两位小数不四舍五入 +export function customTruncateToTwoDecimals(number) { + let stringNumber = number.toString(); + let dotIndex = stringNumber.indexOf("."); + if (dotIndex === -1) { + return number; // 如果没有小数点,直接返回原数 + } else { + let integerPart = stringNumber.substring(0, dotIndex); // 整数部分 + let decimalPart = stringNumber.substring(dotIndex + 1, dotIndex + 3); // 小数部分,取两位 + return parseFloat(integerPart + "." + decimalPart); // 重新组合并返回 + } +} diff --git a/src/views/application/list/index.vue b/src/views/application/list/index.vue index ca27a64..cd52d25 100644 --- a/src/views/application/list/index.vue +++ b/src/views/application/list/index.vue @@ -23,7 +23,7 @@ import call from "@/assets/images/application/call.png"; const list = ref([ { name: "存酒", icon: bear, path: "storingWine", desc: "用户未喝完的酒可暂存在店里" }, - { name: "点歌", icon: song, path: "", desc: "用户可以付费点歌" }, + { name: "点歌", icon: song, path: "song", desc: "用户可以付费点歌" }, { name: "广告", icon: ad, path: "advertisement", desc: "添加弹窗广告" }, { name: "叫号", icon: call, path: "lineUplist", desc: "" }, ]); diff --git a/src/views/application/list/song/components/add-song.vue b/src/views/application/list/song/components/add-song.vue new file mode 100644 index 0000000..70f0307 --- /dev/null +++ b/src/views/application/list/song/components/add-song.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/src/views/application/list/song/index.vue b/src/views/application/list/song/index.vue new file mode 100644 index 0000000..017cdea --- /dev/null +++ b/src/views/application/list/song/index.vue @@ -0,0 +1,190 @@ + + + + \ No newline at end of file diff --git a/src/views/inventory/consumables/components/add-haocai.vue b/src/views/inventory/consumables/components/add-haocai.vue index b36cc62..e2b80c6 100644 --- a/src/views/inventory/consumables/components/add-haocai.vue +++ b/src/views/inventory/consumables/components/add-haocai.vue @@ -18,9 +18,9 @@ - + @@ -90,8 +90,8 @@ const basicForm = { conName: "", consGroupId: "", conUnit: "", - price: "", - conWarning: "", + price: undefined, + conWarning: undefined, }; const forms = ref([{ ...basicForm }]); const form = reactive({ @@ -167,7 +167,9 @@ async function submitForms() { } } function reset() { - form.value = { ...basicForm }; + console.log("reset"); + Object.assign(form, basicForm); + console.log(form); } defineExpose({ open, diff --git a/src/views/tool/Instead/components/popup-rottable.vue b/src/views/tool/Instead/components/popup-rottable.vue index 4679f12..3d8a5dc 100644 --- a/src/views/tool/Instead/components/popup-rottable.vue +++ b/src/views/tool/Instead/components/popup-rottable.vue @@ -78,18 +78,22 @@ function getTableList() { tableList.value = res.records.filter((v) => v.tableCode); }); } - +const emits = defineEmits(["success"]); function confirm() { refForm.value.validate((valid, fields) => { if (valid) { console.log("submit!"); - const detailIds = refTable.value.getSelectionRows().map((v) => v.id); + const detailIds = !rottableType.value + ? refTable.value.getSelectionRows().map((v) => v.id) + : props.cartGoods.map((v) => v.id); orderApi .mergeOrder({ ...form, detailIds, }) .then((res) => { + emits("success", form.targetTableCode); + close(); ElNotification({ title: "成功", message: "合并成功", diff --git a/src/views/tool/Instead/components/popup-taocan-goods.vue b/src/views/tool/Instead/components/popup-taocan-goods.vue index 3e7b039..6e18ef5 100644 --- a/src/views/tool/Instead/components/popup-taocan-goods.vue +++ b/src/views/tool/Instead/components/popup-taocan-goods.vue @@ -5,12 +5,12 @@

{{ item.title }}

本组菜品{{ item.count }}选{{ item.number || 1 }}

- + >
- +