8 Commits e15ecad019 ... 70ffeca855

Author SHA1 Message Date
  陈雪 70ffeca855 ✨ refactor(noProduct): 优化组件代码结构,调整导入顺序并格式化 watch 函数 1 day ago
  陈雪 a655caa3cb ✨ fix(database): 修正订单退款表触发器名称为菜单商品更新时间触发器 1 day ago
  陈雪 4e518dacf4 ✨ refactor(user): 简化登录逻辑并移除请求工具函数 1 day ago
  陈雪 ad269e0ad6 ✨ feat(commands): 新增获取商品分类的命令 1 day ago
  陈雪 40835e6c04 ✨ feat(database): 新增多个表的更新时间触发器和订单退款表 1 day ago
  陈雪 abfd34408a ✨ refactor(commands): 重构命令模块,将 get_category 和 get_table 函数移至独立文件 1 day ago
  陈雪 dfeb3464e6 ✨ chore(dependencies): 更新 core-foundation 依赖,移除不必要的版本限制 1 day ago
  陈雪 09c1879afc ✨ refactor(database): 移除不必要的 Tauri 插件,重构数据库迁移逻辑 1 day ago

+ 0 - 3
package.json

@@ -18,11 +18,8 @@
     "@element-plus/icons-vue": "^2.3.1",
     "@tailwindcss/vite": "^4.0.8",
     "@tauri-apps/api": "^2",
-    "@tauri-apps/plugin-http": "~2",
-    "@tauri-apps/plugin-opener": "^2",
     "@tauri-apps/plugin-os": "~2",
     "@tauri-apps/plugin-store": "~2",
-    "@tauri-apps/plugin-upload": "~2",
     "element-plus": "^2.9.5",
     "pinia": "^3.0.1",
     "tailwindcss": "^4.0.8",

+ 0 - 30
pnpm-lock.yaml

@@ -17,21 +17,12 @@ importers:
       '@tauri-apps/api':
         specifier: ^2
         version: 2.2.0
-      '@tauri-apps/plugin-http':
-        specifier: ~2
-        version: 2.3.0
-      '@tauri-apps/plugin-opener':
-        specifier: ^2
-        version: 2.2.5
       '@tauri-apps/plugin-os':
         specifier: ~2
         version: 2.2.0
       '@tauri-apps/plugin-store':
         specifier: ~2
         version: 2.2.0
-      '@tauri-apps/plugin-upload':
-        specifier: ~2
-        version: 2.2.1
       element-plus:
         specifier: ^2.9.5
         version: 2.9.5(vue@3.5.13(typescript@5.7.3))
@@ -537,21 +528,12 @@ packages:
     engines: {node: '>= 10'}
     hasBin: true
 
-  '@tauri-apps/plugin-http@2.3.0':
-    resolution: {integrity: sha512-pigTvz+zzAqbIhCzRiR1GE98Jw7A03j2V+Eiexr9thBI8VfMiwFQMcbgON51xlwnVaI72LdbYKNajU84im8tlg==}
-
-  '@tauri-apps/plugin-opener@2.2.5':
-    resolution: {integrity: sha512-hHsJ9RPWpZvZEPVFaL+d25gABMUMOf/A6ESXnvf/ii9guTukj58WXsAE/SOysXRIhej7kseRCxnOnIMpSCdUsQ==}
-
   '@tauri-apps/plugin-os@2.2.0':
     resolution: {integrity: sha512-HszbCdbisMlu5QhCNAN8YIWyz2v33abAWha6+uvV2CKX8P5VSct/y+kEe22JeyqrxCnWlQ3DRx7s49Byg7/0EA==}
 
   '@tauri-apps/plugin-store@2.2.0':
     resolution: {integrity: sha512-hJTRtuJis4w5fW1dkcgftsYxKXK0+DbAqurZ3CURHG5WkAyyZgbxpeYctw12bbzF9ZbZREXZklPq8mocCC3Sgg==}
 
-  '@tauri-apps/plugin-upload@2.2.1':
-    resolution: {integrity: sha512-2EyVhJYLAp2mJH0UzO3QGU0vPk/YWvAfdI2wXbczyzEZY/AZVa9wConyB1TV/NGhyJRim4LwWgkmnEvcKLkECw==}
-
   '@types/estree@1.0.6':
     resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
 
@@ -1381,14 +1363,6 @@ snapshots:
       '@tauri-apps/cli-win32-ia32-msvc': 2.2.7
       '@tauri-apps/cli-win32-x64-msvc': 2.2.7
 
-  '@tauri-apps/plugin-http@2.3.0':
-    dependencies:
-      '@tauri-apps/api': 2.2.0
-
-  '@tauri-apps/plugin-opener@2.2.5':
-    dependencies:
-      '@tauri-apps/api': 2.2.0
-
   '@tauri-apps/plugin-os@2.2.0':
     dependencies:
       '@tauri-apps/api': 2.2.0
@@ -1397,10 +1371,6 @@ snapshots:
     dependencies:
       '@tauri-apps/api': 2.2.0
 
-  '@tauri-apps/plugin-upload@2.2.1':
-    dependencies:
-      '@tauri-apps/api': 2.2.0
-
   '@types/estree@1.0.6': {}
 
   '@types/lodash-es@4.17.12':

+ 5 - 279
src-tauri/Cargo.lock

@@ -650,7 +650,7 @@ dependencies = [
  "bitflags 2.8.0",
  "block",
  "cocoa-foundation",
- "core-foundation 0.10.0",
+ "core-foundation",
  "core-graphics",
  "foreign-types",
  "libc",
@@ -665,7 +665,7 @@ checksum = "e14045fb83be07b5acf1c0884b2180461635b433455fa35d1cd6f17f1450679d"
 dependencies = [
  "bitflags 2.8.0",
  "block",
- "core-foundation 0.10.0",
+ "core-foundation",
  "core-graphics-types",
  "libc",
  "objc",
@@ -708,40 +708,11 @@ version = "0.18.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
 dependencies = [
- "percent-encoding",
  "time",
  "version_check",
 ]
 
 [[package]]
-name = "cookie_store"
-version = "0.21.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9"
-dependencies = [
- "cookie",
- "document-features",
- "idna",
- "log",
- "publicsuffix",
- "serde",
- "serde_derive",
- "serde_json",
- "time",
- "url",
-]
-
-[[package]]
-name = "core-foundation"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
 name = "core-foundation"
 version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -764,7 +735,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"
 dependencies = [
  "bitflags 2.8.0",
- "core-foundation 0.10.0",
+ "core-foundation",
  "core-graphics-types",
  "foreign-types",
  "libc",
@@ -777,7 +748,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
 dependencies = [
  "bitflags 2.8.0",
- "core-foundation 0.10.0",
+ "core-foundation",
  "libc",
 ]
 
@@ -921,12 +892,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "data-url"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
-
-[[package]]
 name = "der"
 version = "0.7.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1055,15 +1020,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "document-features"
-version = "0.2.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
-dependencies = [
- "litrs",
-]
-
-[[package]]
 name = "dotenvy"
 version = "0.15.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1135,15 +1091,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
 
 [[package]]
-name = "encoding_rs"
-version = "0.8.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
 name = "endi"
 version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1339,21 +1286,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "futures"
-version = "0.3.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
 name = "futures-channel"
 version = "0.3.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1439,7 +1371,6 @@ version = "0.3.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
 dependencies = [
- "futures-channel",
  "futures-core",
  "futures-io",
  "futures-macro",
@@ -1770,25 +1701,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "h2"
-version = "0.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2"
-dependencies = [
- "atomic-waker",
- "bytes",
- "fnv",
- "futures-core",
- "futures-sink",
- "http",
- "indexmap 2.7.1",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
-
-[[package]]
 name = "hashbrown"
 version = "0.12.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1931,7 +1843,6 @@ dependencies = [
  "bytes",
  "futures-channel",
  "futures-util",
- "h2",
  "http",
  "http-body",
  "httparse",
@@ -2206,25 +2117,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
 
 [[package]]
-name = "is-docker"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
-dependencies = [
- "once_cell",
-]
-
-[[package]]
-name = "is-wsl"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
-dependencies = [
- "is-docker",
- "once_cell",
-]
-
-[[package]]
 name = "itoa"
 version = "0.4.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2426,12 +2318,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
 
 [[package]]
-name = "litrs"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
-
-[[package]]
 name = "lock_api"
 version = "0.4.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2989,18 +2875,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
 
 [[package]]
-name = "open"
-version = "5.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95"
-dependencies = [
- "dunce",
- "is-wsl",
- "libc",
- "pathdiff",
-]
-
-[[package]]
 name = "option-ext"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3115,12 +2989,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "pathdiff"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
-
-[[package]]
 name = "pem-rfc7468"
 version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3493,12 +3361,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "psl-types"
-version = "2.0.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac"
-
-[[package]]
 name = "ptr_meta"
 version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3519,16 +3381,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "publicsuffix"
-version = "2.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf"
-dependencies = [
- "idna",
- "psl-types",
-]
-
-[[package]]
 name = "quick-xml"
 version = "0.32.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3692,17 +3544,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
 
 [[package]]
-name = "read-progress-stream"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6435842fc2fea44b528719eb8c32203bbc1bb2f5b619fbe0c0a3d8350fd8d2a8"
-dependencies = [
- "bytes",
- "futures",
- "pin-project-lite",
-]
-
-[[package]]
 name = "redox_syscall"
 version = "0.5.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3779,12 +3620,8 @@ checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da"
 dependencies = [
  "base64 0.22.1",
  "bytes",
- "cookie",
- "cookie_store",
- "encoding_rs",
  "futures-core",
  "futures-util",
- "h2",
  "http",
  "http-body",
  "http-body-util",
@@ -3806,7 +3643,6 @@ dependencies = [
  "serde_json",
  "serde_urlencoded",
  "sync_wrapper",
- "system-configuration",
  "tokio",
  "tokio-rustls",
  "tokio-util",
@@ -4699,12 +4535,9 @@ dependencies = [
  "serde_json",
  "tauri",
  "tauri-build",
- "tauri-plugin-http",
- "tauri-plugin-opener",
  "tauri-plugin-os",
  "tauri-plugin-single-instance",
  "tauri-plugin-store",
- "tauri-plugin-upload",
 ]
 
 [[package]]
@@ -4824,27 +4657,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "system-configuration"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
-dependencies = [
- "bitflags 2.8.0",
- "core-foundation 0.9.4",
- "system-configuration-sys",
-]
-
-[[package]]
-name = "system-configuration-sys"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
 name = "system-deps"
 version = "6.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -4865,7 +4677,7 @@ checksum = "3731d04d4ac210cd5f344087733943b9bfb1a32654387dad4d1c70de21aee2c9"
 dependencies = [
  "bitflags 2.8.0",
  "cocoa",
- "core-foundation 0.10.0",
+ "core-foundation",
  "core-graphics",
  "crossbeam-channel",
  "dispatch",
@@ -5049,73 +4861,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "tauri-plugin-fs"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1a1edf18000f02903a7c2e5997fb89aca455ecbc0acc15c6535afbb883be223"
-dependencies = [
- "anyhow",
- "dunce",
- "glob",
- "percent-encoding",
- "schemars",
- "serde",
- "serde_json",
- "serde_repr",
- "tauri",
- "tauri-plugin",
- "tauri-utils",
- "thiserror 2.0.11",
- "toml 0.8.20",
- "url",
- "uuid",
-]
-
-[[package]]
-name = "tauri-plugin-http"
-version = "2.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a8137a106e0741fdd357366178fc6e0597abe7d20796f53f44171a1bcec1683"
-dependencies = [
- "data-url",
- "http",
- "regex",
- "reqwest",
- "schemars",
- "serde",
- "serde_json",
- "tauri",
- "tauri-plugin",
- "tauri-plugin-fs",
- "thiserror 2.0.11",
- "tokio",
- "url",
- "urlpattern",
-]
-
-[[package]]
-name = "tauri-plugin-opener"
-version = "2.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "635ed7c580dc3cdc61c94097d38ef517d749ffc0141c806d904e68e4b0cf1c2a"
-dependencies = [
- "dunce",
- "glob",
- "objc2-app-kit 0.2.2",
- "objc2-foundation 0.2.2",
- "open",
- "schemars",
- "serde",
- "serde_json",
- "tauri",
- "tauri-plugin",
- "thiserror 2.0.11",
- "url",
- "windows",
- "zbus",
-]
-
-[[package]]
 name = "tauri-plugin-os"
 version = "2.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5165,25 +4910,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "tauri-plugin-upload"
-version = "2.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e90ac6d3a783d4406caeae8c75aa05e96346474765517fddfd1dc313ff91aa89"
-dependencies = [
- "futures-util",
- "log",
- "read-progress-stream",
- "reqwest",
- "serde",
- "serde_json",
- "tauri",
- "tauri-plugin",
- "thiserror 2.0.11",
- "tokio",
- "tokio-util",
-]
-
-[[package]]
 name = "tauri-runtime"
 version = "2.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"

+ 0 - 3
src-tauri/Cargo.toml

@@ -24,12 +24,9 @@ sea-orm = { version = "1.1.0", features = [
     "macros",
 ] }
 tauri = { version = "2", features = [] }
-tauri-plugin-opener = "2"
 serde = { version = "1", features = ["derive"] }
 serde_json = "1"
 tauri-plugin-store = "2"
-tauri-plugin-http = "2"
-tauri-plugin-upload = "2"
 tauri-plugin-os = "2"
 anyhow = "1.0.97"
 

+ 0 - 8
src-tauri/capabilities/default.json

@@ -7,15 +7,7 @@
   ],
   "permissions": [
     "core:default",
-    "opener:default",
     "store:default",
-    {
-      "identifier": "http:default",
-      "allow": [
-        "http://192.168.1.110:8080"
-      ]
-    },
-    "upload:default",
     "os:default"
   ]
 }

+ 76 - 51
src-tauri/resources/table_struct.sql

@@ -11,6 +11,17 @@ CREATE TABLE
         status INTEGER NOT NULL DEFAULT 1 -- 状态 (1-Active, 0-Inactive)
     );
 
+-- 新增菜单分类表的更新时间触发器
+CREATE TRIGGER trg_menu_cate_update_time AFTER
+UPDATE ON menu_cate FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE menu_cate
+SET
+    update_time = CURRENT_TIMESTAMP
+WHERE
+    id = OLD.id;
+
+END;
+
 -- 创建商品表
 CREATE TABLE
     menu_commodity (
@@ -31,6 +42,17 @@ CREATE TABLE
         FOREIGN KEY (cate_id) REFERENCES menu_cate (id)
     );
 
+-- 新增订单退款表的更新时间触发器
+CREATE TRIGGER trg_menu_commodity_update_time AFTER
+UPDATE ON menu_commodity FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE menu_commodity
+SET
+    update_time = CURRENT_TIMESTAMP
+WHERE
+    id = OLD.id;
+
+END;
+
 -- 创建SKU表
 CREATE TABLE
     menu_sku (
@@ -88,6 +110,17 @@ CREATE TABLE
         goods TEXT NOT NULL DEFAULT '{}' -- 订单商品信息
     );
 
+-- 新增订单表的更新时间触发器
+CREATE TRIGGER trg_order_update_time AFTER
+UPDATE ON store_order FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE store_order
+SET
+    update_time = CURRENT_TIMESTAMP
+WHERE
+    id = OLD.id;
+
+END;
+
 -- 创建店铺材料表信息
 CREATE TABLE
     store_material (
@@ -106,6 +139,17 @@ CREATE TABLE
         status INTEGER NOT NULL DEFAULT 1 -- 状态0下架1上架
     );
 
+-- 新增材料表的更新时间触发器
+CREATE TRIGGER trg_material_update_time AFTER
+UPDATE ON store_material FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE store_material
+SET
+    update_time = CURRENT_TIMESTAMP
+WHERE
+    id = OLD.id;
+
+END;
+
 -- 店铺区域表
 CREATE TABLE
     store_area (
@@ -117,6 +161,17 @@ CREATE TABLE
         status INTEGER NOT NULL DEFAULT 1 -- 状态 (1-有效, 0-无效)
     );
 
+-- 新增区域表的更新时间触发器
+CREATE TRIGGER trg_area_update_time AFTER
+UPDATE ON store_area FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE store_area
+SET
+    update_time = CURRENT_TIMESTAMP
+WHERE
+    id = OLD.id;
+
+END;
+
 -- 店铺座位表
 CREATE TABLE
     store_table (
@@ -130,43 +185,10 @@ CREATE TABLE
         FOREIGN KEY (area_id) REFERENCES store_area (id)
     );
 
--- 新增菜单分类表的更新时间触发器
-CREATE TRIGGER trg_menu_cate_update_time AFTER
-UPDATE ON menu_cate FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
-UPDATE menu_cate
-SET
-    update_time = CURRENT_TIMESTAMP
-WHERE
-    id = OLD.id;
-
-END;
-
--- 新增商品表的更新时间触发器
-CREATE TRIGGER trg_menu_commodity_update_time AFTER
-UPDATE ON menu_commodity FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
-UPDATE menu_commodity
-SET
-    update_time = CURRENT_TIMESTAMP
-WHERE
-    id = OLD.id;
-
-END;
-
--- 新增订单表的更新时间触发器
-CREATE TRIGGER trg_order_update_time AFTER
-UPDATE ON store_order FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
-UPDATE store_order
-SET
-    update_time = CURRENT_TIMESTAMP
-WHERE
-    id = OLD.id;
-
-END;
-
--- 新增材料表的更新时间触发器
-CREATE TRIGGER trg_material_update_time AFTER
-UPDATE ON store_material FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
-UPDATE store_material
+-- 新增桌子表的更新时间触发器
+CREATE TRIGGER trg_table_update_time AFTER
+UPDATE ON store_table FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE store_table
 SET
     update_time = CURRENT_TIMESTAMP
 WHERE
@@ -174,21 +196,24 @@ WHERE
 
 END;
 
--- 新增区域表的更新时间触发器
-CREATE TRIGGER trg_area_update_time AFTER
-UPDATE ON store_area FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
-UPDATE store_area
-SET
-    update_time = CURRENT_TIMESTAMP
-WHERE
-    id = OLD.id;
-
-END;
+-- 创建订单退款表
+CREATE TABLE
+    store_order_refund (
+        id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, -- 主键
+        order_id INTEGER NOT NULL, -- 关联订单ID
+        refund_amount REAL NOT NULL DEFAULT 0.00, -- 退款金额
+        refund_reason TEXT NOT NULL DEFAULT '', -- 退款原因
+        refund_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 退款时间
+        create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 创建时间
+        update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 更新时间
+        status INTEGER NOT NULL DEFAULT 1, -- 状态 (1-有效, 0-无效)
+        FOREIGN KEY (order_id) REFERENCES store_order (id)
+    );
 
--- 新增桌子表的更新时间触发器
-CREATE TRIGGER trg_table_update_time AFTER
-UPDATE ON store_table FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
-UPDATE store_table
+-- 新增订单退款表的更新时间触发器
+CREATE TRIGGER trg_order_refund_update_time AFTER
+UPDATE ON store_order_refund FOR EACH ROW WHEN NEW.update_time = OLD.update_time BEGIN
+UPDATE store_order_refund
 SET
     update_time = CURRENT_TIMESTAMP
 WHERE

+ 15 - 0
src-tauri/src/commands/category.rs

@@ -0,0 +1,15 @@
+use crate::{
+    CmdResult, CmdState,
+    service::category::{Category, CategoryWithSpu},
+};
+
+#[tauri::command]
+pub async fn get_category(app_state: CmdState<'_>) -> CmdResult<Vec<CategoryWithSpu>> {
+    let category = Category::new(app_state.conn.clone());
+    let categories = category.get_category_commodity().await;
+    match categories {
+        Ok(categories) => Ok(categories),
+        Err(e) => Err(format!("请求分类失败{:?}", e)),
+    }
+    // Ok("111".into())
+}

+ 15 - 0
src-tauri/src/commands/commodity.rs

@@ -0,0 +1,15 @@
+use crate::{
+    CmdResult, CmdState,
+    service::category::{Category, CategoryWithSpu},
+};
+
+#[tauri::command]
+pub async fn get_commodity(app_state: CmdState<'_>) -> CmdResult<Vec<CategoryWithSpu>> {
+    let category = Category::new(app_state.conn.clone());
+    let categories = category.get_category_commodity().await;
+    match categories {
+        Ok(categories) => Ok(categories),
+        Err(e) => Err(format!("请求分类失败{:?}", e)),
+    }
+    // Ok("111".into())
+}

+ 3 - 15
src-tauri/src/commands/mod.rs

@@ -1,15 +1,3 @@
-use crate::{
-    CmdResult, CmdState,
-    service::category::{Category, CategoryWithSpu},
-};
-
-#[tauri::command]
-pub async fn get_category(app_state: CmdState<'_>) -> CmdResult<Vec<CategoryWithSpu>> {
-    let category = Category::new(app_state.conn.clone());
-    let categories = category.get_category_commodity().await;
-    match categories {
-        Ok(categories) => Ok(categories),
-        Err(e) => Err(format!("请求分类失败{:?}", e)),
-    }
-    // Ok("111".into())
-}
+pub mod category;
+pub mod commodity;
+pub mod table;

+ 15 - 0
src-tauri/src/commands/table.rs

@@ -0,0 +1,15 @@
+use crate::{
+    CmdResult, CmdState,
+    service::category::{Category, CategoryWithSpu},
+};
+
+#[tauri::command]
+pub async fn get_table(app_state: CmdState<'_>) -> CmdResult<Vec<CategoryWithSpu>> {
+    let category = Category::new(app_state.conn.clone());
+    let categories = category.get_category_commodity().await;
+    match categories {
+        Ok(categories) => Ok(categories),
+        Err(e) => Err(format!("请求分类失败{:?}", e)),
+    }
+    // Ok("111".into())
+}

+ 11 - 55
src-tauri/src/lib.rs

@@ -1,12 +1,14 @@
 mod commands;
 mod models;
 mod service;
+mod utils;
 
-use sea_orm::{ConnectionTrait, DatabaseConnection, Statement, TransactionTrait};
-use std::fs::{self, File};
+use commands::{category, commodity, table};
+use sea_orm::{ConnectionTrait, DatabaseConnection};
+use std::fs::File;
 use std::sync::Arc;
 use tauri::State;
-use tauri::{AppHandle, Manager, path::BaseDirectory};
+use tauri::{AppHandle, Manager};
 
 type CmdState<'a> = State<'a, AppState>;
 type CmdResult<T> = Result<T, String>;
@@ -34,22 +36,23 @@ pub fn run() {
                 conn.execute_unprepared("PRAGMA journal_mode=WAL;")
                     .await
                     .map_err(|e| anyhow::anyhow!("Failed to set WAL mode: {}", e))?;
-                migration_db(app, &conn).await?;
+                utils::migration_db(app, &conn).await?;
                 app.manage(AppState {
                     conn: Arc::new(conn),
                 });
                 Ok(())
             })
         })
-        .invoke_handler(tauri::generate_handler![commands::get_category])
+        .invoke_handler(tauri::generate_handler![
+            table::get_table,
+            category::get_category,
+            commodity::get_commodity
+        ])
         .plugin(tauri_plugin_os::init())
         .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
             let _ = show_window(app);
         }))
-        .plugin(tauri_plugin_upload::init())
-        .plugin(tauri_plugin_http::init())
         .plugin(tauri_plugin_store::Builder::new().build())
-        .plugin(tauri_plugin_opener::init())
         .run(tauri::generate_context!())
         .expect("error while running tauri application");
 }
@@ -64,50 +67,3 @@ fn show_window(app: &AppHandle) {
         .set_focus()
         .expect("Can't Bring Window to Focus");
 }
-
-async fn migration_db(app: &tauri::App, conn: &DatabaseConnection) -> anyhow::Result<()> {
-    let sql_path = app
-        .path()
-        .resolve("resources/table_struct.sql", BaseDirectory::Resource)?;
-    conn.execute(Statement::from_string(
-        conn.get_database_backend(),
-        "CREATE TABLE IF NOT EXISTS seaql_migrations (
-            version VARCHAR(255) PRIMARY KEY,
-            applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
-        )"
-        .to_owned(),
-    ))
-    .await?;
-    let applied: Vec<String> = conn
-        .query_all(Statement::from_string(
-            conn.get_database_backend(),
-            "SELECT version FROM seaql_migrations".to_owned(),
-        ))
-        .await?
-        .into_iter()
-        .filter_map(|row| row.try_get("", "version").ok())
-        .collect();
-
-    if let Some(sql_path_stem) = sql_path.file_stem() {
-        if let Some(version) = sql_path_stem.to_str() {
-            if !applied.contains(&version.to_string()) {
-                let sql_str = fs::read_to_string(&sql_path)?;
-                let tx = conn.begin().await?;
-                tx.execute(Statement::from_string(conn.get_database_backend(), sql_str))
-                    .await?;
-                tx.execute(Statement::from_string(
-                    conn.get_database_backend(),
-                    format!(
-                        "INSERT INTO seaql_migrations (version) VALUES ('{}')",
-                        version
-                    ),
-                ))
-                .await?;
-                tx.commit().await?;
-                println!("✅ Applied migration: {}", version);
-            }
-        }
-    }
-
-    Ok(())
-}

+ 51 - 0
src-tauri/src/utils.rs

@@ -0,0 +1,51 @@
+use std::fs;
+
+use sea_orm::{ConnectionTrait, DatabaseConnection, Statement, TransactionTrait};
+use tauri::{Manager, path::BaseDirectory};
+
+pub async fn migration_db(app: &tauri::App, conn: &DatabaseConnection) -> anyhow::Result<()> {
+    let sql_path = app
+        .path()
+        .resolve("resources/table_struct.sql", BaseDirectory::Resource)?;
+    conn.execute(Statement::from_string(
+        conn.get_database_backend(),
+        "CREATE TABLE IF NOT EXISTS seaql_migrations (
+            version VARCHAR(255) PRIMARY KEY,
+            applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+        )"
+        .to_owned(),
+    ))
+    .await?;
+    let applied: Vec<String> = conn
+        .query_all(Statement::from_string(
+            conn.get_database_backend(),
+            "SELECT version FROM seaql_migrations".to_owned(),
+        ))
+        .await?
+        .into_iter()
+        .filter_map(|row| row.try_get("", "version").ok())
+        .collect();
+
+    if let Some(sql_path_stem) = sql_path.file_stem() {
+        if let Some(version) = sql_path_stem.to_str() {
+            if !applied.contains(&version.to_string()) {
+                let sql_str = fs::read_to_string(&sql_path)?;
+                let tx = conn.begin().await?;
+                tx.execute(Statement::from_string(conn.get_database_backend(), sql_str))
+                    .await?;
+                tx.execute(Statement::from_string(
+                    conn.get_database_backend(),
+                    format!(
+                        "INSERT INTO seaql_migrations (version) VALUES ('{}')",
+                        version
+                    ),
+                ))
+                .await?;
+                tx.commit().await?;
+                println!("✅ Applied migration: {}", version);
+            }
+        }
+    }
+
+    Ok(())
+}

+ 21 - 17
src/components/noProduct.vue

@@ -5,21 +5,25 @@
   </div>
 </template>
 <script setup>
-import { useI18n } from 'vue-i18n'
-import { defineProps, watch } from 'vue'
-const { t } = useI18n()
-const props = defineProps({
-  img: {
-    type: String,
-    default: '@/assets/imgs/noFoods.svg',
-  },
-  text: {
-    type: String,
-    default: '还没添加菜品哦',
-  },
-})
-console.log(props)
-watch(()=>props.text, (newVal, oldVal) => {
-  console.log('text changed', newVal, oldVal)
-})
+  import { useI18n } from 'vue-i18n'
+  import { watch } from 'vue'
+
+  const { t } = useI18n()
+  const props = defineProps({
+    img: {
+      type: String,
+      default: '@/assets/imgs/noFoods.svg',
+    },
+    text: {
+      type: String,
+      default: '还没添加菜品哦',
+    },
+  })
+  console.log(props)
+  watch(
+    () => props.text,
+    (newVal, oldVal) => {
+      console.log('text changed', newVal, oldVal)
+    },
+  )
 </script>

+ 2 - 9
src/store/user.ts

@@ -1,6 +1,4 @@
 import { LoginForm } from '@/interface/user'
-import router from '@/router'
-import { request } from '@/utils/request'
 import { defineStore } from 'pinia'
 
 export const useUserStore = defineStore('user', {
@@ -9,13 +7,8 @@ export const useUserStore = defineStore('user', {
   }),
   actions: {
     async login(data: LoginForm) {
-      const { token } = await request<{ token: string }>({
-        url: '/backendApi/login/cashRegisterDoLogin',
-        method: 'POST',
-        data,
-        noAuth: true,
-      })
-      this.token = token
+      console.log('data: ', data)
+      this.token = 'token'
     },
   },
   getters: {

+ 0 - 66
src/utils/request.ts

@@ -1,66 +0,0 @@
-import { useUserStore } from '@/store/user'
-import { fetch } from '@tauri-apps/plugin-http'
-
-type CommonOption = {
-  url: string
-  query?: Record<string, string>
-  noAuth?: boolean
-  headers?: Record<string, string>
-}
-
-type GetOption = {
-  method: 'GET' | 'DELETE'
-}
-
-type PostOption = {
-  method: 'POST' | 'PUT'
-  data?: unknown
-}
-
-type RequestOptions = CommonOption & (GetOption | PostOption)
-
-type Response<T> = {
-  code: number
-  data: T
-  msg: string
-}
-
-export const request = async <T = void>(config: RequestOptions) => {
-  const { noAuth, url, headers, method, query } = config
-  if (!noAuth) {
-    const { getToken } = useUserStore()
-    headers['Access-Token'] = getToken
-  }
-  const reqPath = new URL(url, import.meta.env.VITE_BASE_URL || '')
-  if (query) Object.keys(query).forEach((key) => reqPath.searchParams.append(key, query[key]))
-
-  try {
-    console.log('reqPath.href: ', reqPath.href)
-    let body = null
-    if (config.method === 'POST' || (config.method === 'PUT' && config.data)) {
-      body = JSON.stringify(config.data)
-    }
-
-    const response = await fetch(reqPath.href, {
-      method,
-      headers: {
-        'Content-Type': 'application/json',
-        ...headers,
-      },
-      body,
-    })
-
-    if (!response.ok) {
-      throw new Error(`HTTP error! status: ${response.status}`)
-    }
-
-    const { code, data, msg } = (await response.json()) as Response<T>
-    if (code !== 200) {
-      throw new Error(msg)
-    }
-    return data
-  } catch (error) {
-    console.error('Request failed', error)
-    throw error
-  }
-}