From 5b426486acbdd5494aea773f5a56ce173ab710d6 Mon Sep 17 00:00:00 2001 From: Chengdong Zhang Date: Wed, 23 Sep 2026 17:39:45 +0800 Subject: [PATCH] wip(freight): migration 0017 + model/column-list groundwork for add-freight-templates --- .editorconfig | 15 + .prettierignore | 32 + .prettierrc.json | 12 + apps/admin/app.vue | 24 +- apps/admin/locales-extra.ts | 9 +- apps/admin/pages/aftersales.vue | 417 +++++--- apps/admin/pages/brands.vue | 26 +- apps/admin/pages/content.vue | 130 ++- apps/admin/pages/currencies.vue | 127 ++- apps/admin/pages/index.vue | 53 +- apps/admin/pages/login.vue | 20 +- apps/admin/pages/orders.vue | 88 +- apps/admin/pages/points-orders.vue | 100 +- apps/admin/pages/points-products.vue | 113 ++- apps/admin/pages/shops.vue | 71 +- apps/admin/pages/users.vue | 140 +-- .../api/migrations/0017_freight_templates.sql | 65 ++ apps/api/src/models.rs | 15 + apps/api/src/modules/order/repo.rs | 7 +- apps/api/src/modules/product/dto.rs | 1 + apps/api/src/modules/product/repo.rs | 4 +- apps/api/src/modules/product/service.rs | 9 +- apps/mall/app.vue | 2 +- apps/mall/components/PriceText.vue | 8 +- apps/mall/components/StatusBadge.vue | 7 +- apps/mall/components/shell/CategoryMenu.vue | 22 +- apps/mall/components/shell/SiteFooter.vue | 14 +- apps/mall/components/shell/SiteHeader.vue | 90 +- apps/mall/components/shell/TopBar.vue | 92 +- apps/mall/components/ui/Breadcrumb.vue | 11 +- apps/mall/components/ui/Carousel.vue | 16 +- apps/mall/components/ui/EmptyState.vue | 2 +- apps/mall/components/ui/Modal.vue | 21 +- apps/mall/components/ui/Pagination.vue | 24 +- apps/mall/components/ui/ProductCard.vue | 20 +- apps/mall/components/ui/QtyStepper.vue | 16 +- apps/mall/components/ui/StepBar.vue | 9 +- apps/mall/components/ui/Tabs.vue | 14 +- apps/mall/composables/usePrice.ts | 27 +- apps/mall/locales-extra.ts | 7 +- apps/mall/locales/search.ts | 2 +- apps/mall/mock/api.ts | 267 +++-- apps/mall/mock/data.ts | 535 +++++++++- apps/mall/nuxt.config.ts | 21 +- apps/mall/pages/cart.vue | 80 +- apps/mall/pages/checkout/index.vue | 182 +++- apps/mall/pages/checkout/pay.vue | 99 +- apps/mall/pages/checkout/success.vue | 29 +- apps/mall/pages/collective.vue | 127 ++- apps/mall/pages/forgot-password.vue | 70 +- apps/mall/pages/goods/[id].vue | 255 ++++- apps/mall/pages/index.vue | 78 +- apps/mall/pages/integral.vue | 185 +++- apps/mall/pages/login.vue | 47 +- apps/mall/pages/register.vue | 55 +- apps/mall/pages/search.vue | 145 ++- apps/mall/pages/seckill.vue | 112 ++- apps/mall/pages/stores/[id].vue | 147 ++- apps/mall/pages/stores/index.vue | 73 +- apps/mall/pages/user.vue | 35 +- apps/mall/pages/user/addresses.vue | 44 +- apps/mall/pages/user/aftersales/[id].vue | 204 +++- apps/mall/pages/user/aftersales/apply.vue | 66 +- apps/mall/pages/user/aftersales/index.vue | 24 +- apps/mall/pages/user/coupons.vue | 9 +- apps/mall/pages/user/favorites.vue | 107 +- apps/mall/pages/user/index.vue | 153 ++- apps/mall/pages/user/invoices.vue | 5 +- apps/mall/pages/user/orders/[id].vue | 184 +++- apps/mall/pages/user/orders/index.vue | 112 ++- apps/mall/utils/product.ts | 4 +- apps/shop-admin/app.vue | 91 +- apps/shop-admin/components/ProductForm.vue | 36 +- apps/shop-admin/locales-extra.ts | 3 +- apps/shop-admin/pages/aftersales/[id].vue | 142 ++- apps/shop-admin/pages/aftersales/index.vue | 22 +- apps/shop-admin/pages/coupons.vue | 71 +- apps/shop-admin/pages/flash-sales.vue | 125 ++- apps/shop-admin/pages/group-buying.vue | 95 +- apps/shop-admin/pages/index.vue | 24 +- apps/shop-admin/pages/invoices.vue | 27 +- apps/shop-admin/pages/login.vue | 14 +- apps/shop-admin/pages/orders/[id].vue | 119 ++- apps/shop-admin/pages/orders/index.vue | 55 +- apps/shop-admin/pages/products/[id].vue | 37 +- apps/shop-admin/pages/products/index.vue | 73 +- apps/shop-admin/pages/products/new.vue | 8 +- apps/shop-admin/pages/shipments.vue | 25 +- apps/shop-admin/pages/shop-profile.vue | 15 +- openspec/MIGRATION-PLAN.md | 2 +- .../changes/add-freight-templates/tasks.md | 2 + package.json | 8 +- packages/shared/src/api.ts | 34 +- packages/shared/src/theme.css | 5 +- packages/shared/src/types.ts | 11 +- packages/ui/src/components/VBadge.vue | 14 +- packages/ui/src/components/VCard.vue | 7 +- packages/ui/src/components/VField.vue | 4 +- packages/ui/src/components/VInput.vue | 10 +- packages/ui/src/components/VPage.vue | 2 +- packages/ui/src/components/VPanel.vue | 6 +- packages/ui/src/components/VTable.vue | 4 +- packages/ui/src/composables/useAccent.ts | 3 +- pnpm-lock.yaml | 943 +++++++++++++++++- scripts/seed-demo.mjs | 386 ++++++- 105 files changed, 6193 insertions(+), 1566 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 apps/api/migrations/0017_freight_templates.sql diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..4250a32 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +indent_size = 2 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[Makefile] +indent_style = tab diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0c83652 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,32 @@ +node_modules +.nuxt +.output +dist +build +coverage +.pnpm-store + +# Auto-generated by Nuxt +**/.nuxt/** +**/.output/** + +# Lockfiles +pnpm-lock.yaml +Cargo.lock + +# Generated tsconfigs (Nuxt) +**/.nuxt/tsconfig*.json + +# env files +.env +.env.* +!.env.example + +# Don't reformat OpenSpec specs / changes / docs — these are prose where +# line breaks around `### Requirement:` / `#### Scenario:` blocks are part +# of the spec's reading layout, not cosmetic. +openspec/specs/** +openspec/changes/** +openspec/MIGRATION-PLAN.md +docs/**/*.md +docs/**/*.html diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..764ddba --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,12 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "printWidth": 100, + "tabWidth": 2, + "useTabs": false, + "endOfLine": "lf", + "arrowParens": "always", + "vueIndentScriptAndStyle": false, + "plugins": ["prettier-plugin-tailwindcss"] +} diff --git a/apps/admin/app.vue b/apps/admin/app.vue index e1afc8b..5e0c33e 100644 --- a/apps/admin/app.vue +++ b/apps/admin/app.vue @@ -25,18 +25,20 @@ const navItems = [ diff --git a/apps/admin/pages/brands.vue b/apps/admin/pages/brands.vue index fff1028..74ef238 100644 --- a/apps/admin/pages/brands.vue +++ b/apps/admin/pages/brands.vue @@ -105,7 +105,6 @@ async function save(): Promise { } } - onMounted(() => { void loadBrands(); }); @@ -113,10 +112,14 @@ onMounted(() => { \ No newline at end of file + diff --git a/apps/admin/pages/content.vue b/apps/admin/pages/content.vue index 461269c..c4820cb 100644 --- a/apps/admin/pages/content.vue +++ b/apps/admin/pages/content.vue @@ -107,7 +107,12 @@ function validate(kind: ContentKind): boolean { for (const [index, row] of list.entries()) { if (kind === "quick-links") { const link = row as QuickLinkRow; - if (!link.label.en.trim() || !link.label.zh.trim() || !link.url.trim() || !link.glyph.trim()) { + if ( + !link.label.en.trim() || + !link.label.zh.trim() || + !link.url.trim() || + !link.glyph.trim() + ) { errors[index] = t("admin.contentQuickLinkInvalid"); } } else if (kind === "floor-adverts") { @@ -150,7 +155,6 @@ async function saveKind(kind: ContentKind): Promise { } } - onMounted(() => { void loadContent(); }); @@ -158,14 +162,23 @@ onMounted(() => { \ No newline at end of file + diff --git a/apps/admin/pages/currencies.vue b/apps/admin/pages/currencies.vue index 064fe71..cfb087a 100644 --- a/apps/admin/pages/currencies.vue +++ b/apps/admin/pages/currencies.vue @@ -157,61 +157,104 @@ onMounted(() => { - + - + - + {{ creating ? $t("common.loading") : $t("admin.saveCurrency") }} -

{{ $t("common.loading") }}

- +

{{ $t("common.loading") }}

+ {{ $t("common.empty") }}
-
- - - {{ $t("common.currency") }} - {{ $t("admin.currencyNameEn") }} - {{ $t("admin.symbol") }} - {{ $t("admin.exponent") }} - {{ $t("admin.rate") }} - {{ $t("admin.baseCurrency") }} - {{ $t("admin.enabled") }} - {{ $t("common.actions") }} - - - - - {{ currency.code }} - {{ localizedName(currency.name) }} - {{ currency.symbol }} - {{ currency.exponent }} - - - {{ $t("admin.baseCurrency") }} - — - - {{ currency.enabled ? $t("common.yes") : $t("common.no") }} -
- - {{ savingCode === currency.code ? $t("common.loading") : $t("admin.updateRate") }} - - - {{ currency.enabled ? $t("admin.suspend") : $t("admin.activate") }} - -
- - -
+
+ + + + {{ $t("common.currency") }} + {{ $t("admin.currencyNameEn") }} + {{ $t("admin.symbol") }} + {{ $t("admin.exponent") }} + {{ $t("admin.rate") }} + {{ $t("admin.baseCurrency") }} + {{ $t("admin.enabled") }} + {{ $t("common.actions") }} + + + + + + {{ currency.code }} + + {{ localizedName(currency.name) }} + {{ currency.symbol }} + {{ currency.exponent }} + + + + + {{ $t("admin.baseCurrency") }} + — + + + {{ + currency.enabled ? $t("common.yes") : $t("common.no") + }} + + +
+ + {{ + savingCode === currency.code ? $t("common.loading") : $t("admin.updateRate") + }} + + + {{ currency.enabled ? $t("admin.suspend") : $t("admin.activate") }} + +
+ + + +
+
diff --git a/apps/admin/pages/index.vue b/apps/admin/pages/index.vue index 396911d..31f0b18 100644 --- a/apps/admin/pages/index.vue +++ b/apps/admin/pages/index.vue @@ -1,5 +1,4 @@