Merge pull request 'v1.1.0' (#6) from dev into master

Reviewed-on: #6
This commit was merged in pull request #6.
This commit is contained in:
2026-11-07 18:11:07 +00:00
20 changed files with 440 additions and 217 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
{
"name": "gao-customer-h5",
"private": true,
"version": "1.0.3",
"version": "1.1.0",
"type": "module",
"scripts": {
"dev": "vite --host",
@@ -30,9 +30,9 @@
"less": "^4.3.0",
"pinia": "^3.0.2",
"tdesign-mobile-vue": "^1.17.1",
"timi-tdesign-mobile": "^1.0.1",
"timi-tdesign-mobile": "^1.0.2",
"timi-ts": "^1.0.0",
"timi-web": "^1.0.1",
"timi-web": "^1.0.2",
"timi-web-api": "^1.0.2",
"ts-node": "^10.9.2",
"vconsole": "^3.15.1",
+16 -15
View File
@@ -47,17 +47,17 @@ importers:
specifier: ^1.17.1
version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
timi-tdesign-mobile:
specifier: ^1.0.1
version: 1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3))
specifier: ^1.0.2
version: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3))
timi-ts:
specifier: ^1.0.0
version: 1.0.0
timi-web:
specifier: ^1.0.1
version: 1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
specifier: ^1.0.2
version: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
timi-web-api:
specifier: ^1.0.2
version: 1.0.2(timi-web@1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
version: 1.0.2(timi-web@1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@24.13.3)(typescript@5.8.3)
@@ -1979,6 +1979,7 @@ packages:
image-size@0.5.5:
resolution: {integrity: sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==}
engines: {node: '>=0.10.0'}
deprecated: Please migrate to image-size@2.x
hasBin: true
import-fresh@3.3.1:
@@ -2747,8 +2748,8 @@ packages:
through2@4.0.2:
resolution: {integrity: sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw==}
timi-tdesign-mobile@1.0.1:
resolution: {integrity: sha512-HFBENjEw1+zymyaDU7u9ZNZjIqzA8J+9eZHNMGyPd8/zSSsGb9bS1a1r3zDA0Zq7g6WwqQctwaQUO4xkU4gyAw==}
timi-tdesign-mobile@1.0.2:
resolution: {integrity: sha512-7qjwUUqIjMB9TJbOWguK61JfQ15PLf3gnfUDU1gY2eS4cjbgo/PD2U/eHNV6CZ0VB/hBjPNp84xKZ0qr03tsmw==}
engines: {node: '>=20.0.0'}
peerDependencies:
vue: ^3.5.0
@@ -2765,8 +2766,8 @@ packages:
timi-web: ^1.0.0
vue: ^3.5.26
timi-web@1.0.1:
resolution: {integrity: sha512-FVPQuqTc3DurS3Gfty9ZQoNZ7vyQ0v6xj0g/iouFgxFqNuzjzUNn3PA/Tl58nJcRrUNv3S/uofMMkNRmw/cUYg==}
timi-web@1.0.2:
resolution: {integrity: sha512-CXyWEeGTjrExnrAwstdWPc3qK5Lfyp7ipD8p7+WYcm4mcnJOS48k6SkVnrAIADAImeJAr/1e5JEV8wk+8AcvxQ==}
engines: {node: '>=20.0.0'}
tinycolor2@1.6.0:
@@ -3125,7 +3126,7 @@ snapshots:
'@babel/helper-module-imports@7.29.7':
dependencies:
'@babel/traverse': 7.29.13
'@babel/types': 7.29.7
'@babel/types': 7.29.11
transitivePeerDependencies:
- supports-color
@@ -5848,10 +5849,10 @@ snapshots:
dependencies:
readable-stream: 3.6.2
timi-tdesign-mobile@1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)):
timi-tdesign-mobile@1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue-router@4.5.1(vue@3.5.40(typescript@5.8.3)))(vue@3.5.40(typescript@5.8.3)):
dependencies:
tdesign-mobile-vue: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3))
timi-web: 1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
timi-web: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
vue: 3.5.40(typescript@5.8.3)
vue-router: 4.5.1(vue@3.5.40(typescript@5.8.3))
transitivePeerDependencies:
@@ -5864,18 +5865,18 @@ snapshots:
timi-ts@1.0.0: {}
timi-web-api@1.0.2(timi-web@1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)):
timi-web-api@1.0.2(timi-web@1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)):
dependencies:
axios: 1.21.0
pinia: 3.0.4(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
timi-web: 1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
timi-web: 1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
vue: 3.5.40(typescript@5.8.3)
transitivePeerDependencies:
- debug
- supports-color
- typescript
timi-web@1.0.1(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)):
timi-web@1.0.2(@floating-ui/dom@1.8.0)(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/extensions@3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0))(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)):
dependencies:
'@marsio/vue-split-pane': 1.0.0(typescript@5.8.3)
'@tiptap/extension-code-block': 3.33.0(@tiptap/core@3.33.0(@tiptap/pm@3.33.0))(@tiptap/pm@3.33.0)
+12
View File
@@ -40,6 +40,18 @@ watch(
{ immediate: true }
);
watch(
() => globalUIStore.backdropBlur,
(enabled) => {
if (enabled) {
document.documentElement.style.removeProperty("--tui-backdrop-blur");
} else {
document.documentElement.style.setProperty("--tui-backdrop-blur", "0px");
}
},
{ immediate: true }
);
onMounted(() => {
settingStore.loadSoundPlayers();
window.addEventListener("pointerdown", unlockSoundOnUserGesture, { once: true });
+4 -4
View File
@@ -291,8 +291,8 @@ html.theme-dark body {
mask: linear-gradient(to top, transparent 0%, #000 60%);
-webkit-mask: linear-gradient(to top, transparent 0%, #000 60%);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
-webkit-backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
}
}
@@ -309,8 +309,8 @@ html.theme-dark body {
mask: linear-gradient(to bottom, transparent 0%, #000 60%);
-webkit-mask: linear-gradient(to bottom, transparent 0%, #000 60%);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
-webkit-backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
}
}
+19 -5
View File
@@ -3,18 +3,19 @@
<t-tag
v-for="tag in tagList"
:key="tag.key"
size="small"
:size="props.size"
theme="primary"
variant="light-outline"
:content="tag.content"
/>
<t-tag v-if="unitText" size="small" :content="unitText" />
<t-tag v-if="unitText" :size="props.size" :content="unitText" />
</div>
</template>
<script setup lang="ts">
import type { ProductSkuSpecSnapshot } from "@/types/Product";
import { getProductSkuSnapshotText } from "@/utils/product";
import type { TagProps } from "tdesign-mobile-vue";
import type { ProductSkuSpecSnapshot, ProductSkuTagSelection } from "@/types/Product";
import { getProductSkuSnapshotText, getProductSkuSpecEntries } from "@/utils/product";
defineOptions({ name: "ProductSkuTags" });
@@ -23,11 +24,24 @@ interface Props {
snapshot?: ProductSkuSpecSnapshot[];
fallback?: string;
unit?: string | null;
selection?: ProductSkuTagSelection;
size?: TagProps["size"];
}
const props = defineProps<Props>();
const props = withDefaults(defineProps<Props>(), { size: "small" });
const tagList = computed(() => {
if (props.selection) {
const { product, sku } = props.selection;
const entries = getProductSkuSpecEntries(sku, product.specList || []);
const name = product.name?.trim() || "未命名产品";
const skuText = getProductSkuSnapshotText(name, sku.name, sku.specSummary);
return [
{ key: "product", content: name },
...entries.map((entry, index) => ({ key: `spec-${index}`, content: entry.valueName })),
...(!entries.length && skuText ? [{ key: "sku", content: skuText }] : [])
];
}
const result = (props.snapshot || []).flatMap((item, index) => {
const content = item.specValueName?.trim() || item.specName?.trim();
return content ? [{ key: `${item.specId || "spec"}-${item.specValueId || index}`, content }] : [];
@@ -262,7 +262,7 @@ onBeforeUnmount(() => {
background: rgba(255, 255, 255, .86);
border-radius: .75rem;
box-shadow: 0 .25rem 1rem rgba(15, 23, 42, .1);
backdrop-filter: blur(8px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
flex-direction: column;
pointer-events: auto;
user-select: text;
+1 -1
View File
@@ -760,7 +760,7 @@ onMounted(() => {
position: fixed;
align-items: center;
border-radius: 1.75rem;
backdrop-filter: blur(10px);
backdrop-filter: blur(var(--tui-backdrop-blur, 10px));
justify-content: space-between;
.total {
+2
View File
@@ -82,6 +82,7 @@
:key="item.id"
class="item"
:order="item"
:fulfillable-sku-id="appliedFilter.fulfillableSkuId"
:can-receive="canReceive"
:can-fulfill="canCreateFulfillment"
:can-cancel="canCancel"
@@ -459,6 +460,7 @@ function buildPageFilter(index = pageIndex.value): SalesOrderPage {
return {
customerId: customerId.value || undefined,
packageConfigId: currentPackageConfigId || undefined,
fulfillableSkuId: filter.fulfillableSkuId || undefined,
keyword: keyword.value || undefined,
orderTypeList: currentPackageConfigId ? ["PACKAGE"] : getEffectiveList(filter.orderTypeList, orderTypeOptions.map(item => item.value)),
statusList: getEffectiveList(filter.statusList, statusOptions.map(item => item.value)),
@@ -9,6 +9,15 @@
@reset="reset"
@confirm="confirm"
>
<template #group-fulfillableSku>
<t-cell title="选择 SKU" arrow @click="productSelectorVisible = true">
<template #note>
<product-sku-tags v-if="draftFilter.fulfillableSkuId" :selection="draftFilter.fulfillableSkuSelection" :fallback="draftFilter.fulfillableSkuName" />
<span v-else>全部</span>
</template>
</t-cell>
<t-button v-if="draftFilter.fulfillableSkuId" size="small" variant="text" content="清除 SKU" @click="clearSku" />
</template>
<template #group-date-after>
<t-cell-group
v-if="draftFilter.dateFilterType === 'custom'"
@@ -31,6 +40,7 @@
</t-cell-group>
</template>
</filter-popup>
<product-select-popup v-model:visible="productSelectorVisible" @select="selectSku" />
<t-popup v-model="startVisible" placement="bottom">
<t-date-time-picker
v-if="startVisible"
@@ -60,6 +70,9 @@
<script setup lang="ts">
import { Time } from "timi-web";
import FilterPopup from "@/components/filter-popup/FilterPopup.vue";
import ProductSelectPopup from "@/components/productSelector/ProductSelectPopup.vue";
import ProductSkuTags from "@/components/ProductSkuTags.vue";
import type { ProductSelection } from "@/types/Product";
import type { FilterGroup, FilterModel, FilterValueList } from "@/components/filter-popup/FilterPopup";
import { buildPresetDateRange } from "@/utils/date";
import { DATE_FILTER_OPTIONS as dateOptions } from "@/utils/dateFilter";
@@ -67,6 +80,7 @@ import type { GaoSalesOrderStatus, GaoSalesOrderType, GaoSalesRefundStatus } fro
import {
cloneSalesOrderFilter,
createDefaultSalesOrderFilter,
getFulfillableSkuSelection,
type SalesOrderDateFilterType,
type SalesOrderFilterGroupKey,
type SalesOrderListFilter,
@@ -94,6 +108,7 @@ const popupVisible = computed({
const draftFilter = ref<SalesOrderListFilter>(cloneSalesOrderFilter(props.modelValue));
const startVisible = ref(false);
const endVisible = ref(false);
const productSelectorVisible = ref(false);
const startDraft = ref("");
const endDraft = ref("");
let resetRequested = false;
@@ -119,6 +134,13 @@ const refundOptions: Array<{ label: string; value: GaoSalesRefundStatus }> = [
{ label: "已退款", value: "REFUNDED" }
];
const filterGroups = computed<FilterGroup[]>(() => [
{
key: "fulfillableSku",
title: "可履约 SKU",
options: [],
multiple: false,
columns: 1
},
{
key: "date",
title: "下单时间",
@@ -306,6 +328,11 @@ function reset(): void {
function resetFilterGroup(target: SalesOrderListFilter, source: SalesOrderListFilter, filterKey: SalesOrderFilterGroupKey): void {
switch (filterKey) {
case "fulfillableSku":
target.fulfillableSkuId = source.fulfillableSkuId;
target.fulfillableSkuName = source.fulfillableSkuName;
target.fulfillableSkuSelection = source.fulfillableSkuSelection;
break;
case "date":
target.dateFilterType = source.dateFilterType;
target.dateRange = [...source.dateRange];
@@ -325,6 +352,18 @@ function resetFilterGroup(target: SalesOrderListFilter, source: SalesOrderListFi
}
}
function selectSku(selection: ProductSelection): void {
draftFilter.value.fulfillableSkuId = selection.sku.id || "";
draftFilter.value.fulfillableSkuName = [selection.product.name, selection.sku.specSummary || selection.sku.name].filter(Boolean).join(" · ");
draftFilter.value.fulfillableSkuSelection = getFulfillableSkuSelection(selection);
}
function clearSku(): void {
draftFilter.value.fulfillableSkuId = "";
draftFilter.value.fulfillableSkuName = "";
draftFilter.value.fulfillableSkuSelection = undefined;
}
function confirm(): void {
if ((!props.filterKey || props.filterKey === "date")
&& draftFilter.value.dateFilterType === "custom"
@@ -7,9 +7,18 @@
@click="openFilterPopup('date')"
/>
<t-cell v-if="props.filter.dateFilterType === 'custom'" :note="filterDateRangeText" />
<t-cell title="状态" class="filter-cell" arrow @click="openFilterPopup('statusList')">
<t-cell title="可履约 SKU" class="cell" arrow @click="productSelectorVisible = true">
<template #note>
<div class="filter-tags">
<div v-if="props.filter.fulfillableSkuId" class="tags">
<product-sku-tags size="medium" :selection="props.filter.fulfillableSkuSelection" :fallback="props.filter.fulfillableSkuName" />
<t-button size="extra-small" content="清除" @click.stop="clearSku" />
</div>
<span v-else>全部</span>
</template>
</t-cell>
<t-cell title="状态" class="cell roll-note" arrow @click="openFilterPopup('statusList')">
<template #note>
<div class="tags">
<t-tag
v-for="item in selectedStatusTags"
:key="item"
@@ -20,9 +29,9 @@
</div>
</template>
</t-cell>
<t-cell title="订单条件" class="filter-cell" arrow @click="openFilterPopup('orderTypeList')">
<t-cell title="订单条件" class="cell roll-note" arrow @click="openFilterPopup('orderTypeList')">
<template #note>
<div class="filter-tags">
<div class="tags">
<t-tag
v-for="item in selectedOrderTypeTags"
:key="item"
@@ -33,9 +42,23 @@
</div>
</template>
</t-cell>
<t-cell title="资金条件" class="filter-cell" arrow @click="openFilterPopup('paymentStatusList')">
<t-cell title="资金条件" class="cell roll-note" arrow @click="openFilterPopup('paymentStatusList')">
<template #note>
<div class="filter-tags">
<div class="tags">
<t-tag
v-for="item in selectedPaymentTags"
:key="item"
theme="primary"
variant="light-outline"
:content="item"
/>
<t-tag
v-for="item in selectedPaymentTags"
:key="item"
theme="primary"
variant="light-outline"
:content="item"
/>
<t-tag
v-for="item in selectedPaymentTags"
:key="item"
@@ -46,9 +69,9 @@
</div>
</template>
</t-cell>
<t-cell title="退款条件" class="filter-cell" arrow @click="openFilterPopup('refundStatusList')">
<t-cell title="退款条件" class="cell roll-note" arrow @click="openFilterPopup('refundStatusList')">
<template #note>
<div class="filter-tags">
<div class="tags">
<t-tag
v-for="item in selectedRefundTags"
:key="item"
@@ -68,13 +91,18 @@
:package-config-id="props.packageConfigId"
@confirm="confirmFilter"
/>
<product-select-popup v-model:visible="productSelectorVisible" @select="selectSku" />
</template>
<script setup lang="ts">
import SalesOrderFilterPopup from "@/pages/salesOrder/component/SalesOrderFilterPopup.vue";
import ProductSelectPopup from "@/components/productSelector/ProductSelectPopup.vue";
import ProductSkuTags from "@/components/ProductSkuTags.vue";
import type { ProductSelection } from "@/types/Product";
import type { GaoSalesOrderStatus, GaoSalesOrderType, GaoSalesRefundStatus } from "@/types/SalesOrder";
import { DATE_FILTER_OPTIONS } from "@/utils/dateFilter";
import {
getFulfillableSkuSelection,
type SalesOrderFilterGroupKey,
type SalesOrderListFilter,
type SalesOrderPaymentFilter
@@ -124,8 +152,22 @@ const selectedOrderTypeTags = computed(() => getSelectedOptionLabels(props.filte
const selectedPaymentTags = computed(() => getSelectedOptionLabels(props.filter.paymentStatusList, paymentOptions));
const selectedRefundTags = computed(() => getSelectedOptionLabels(props.filter.refundStatusList, refundOptions));
const filterPopupVisible = ref(false);
const productSelectorVisible = ref(false);
const activeFilterKey = ref<SalesOrderFilterGroupKey>();
function selectSku(selection: ProductSelection): void {
emit("confirm", {
...props.filter,
fulfillableSkuId: selection.sku.id || "",
fulfillableSkuName: [selection.product.name, selection.sku.specSummary || selection.sku.name].filter(Boolean).join(" · "),
fulfillableSkuSelection: getFulfillableSkuSelection(selection)
});
}
function clearSku(): void {
emit("confirm", { ...props.filter, fulfillableSkuId: "", fulfillableSkuName: "", fulfillableSkuSelection: undefined });
}
function getSelectedOptionLabels<T extends string>(valueList: T[], options: Array<{ label: string; value: T }>): string[] {
const labels = options.filter(item => valueList.includes(item.value)).map(item => item.label);
return labels.length ? labels : ["未选择"];
@@ -152,6 +194,10 @@ function confirmFilter(value: SalesOrderListFilter): void {
margin: 0;
}
.cell {
&.roll-note {
:deep(.t-cell__title) {
flex: 0 0 4.5rem;
margin-right: .75rem;
@@ -165,15 +211,15 @@ function confirmFilter(value: SalesOrderListFilter): void {
text-overflow: ellipsis;
white-space: nowrap;
}
}
.filter-cell {
.filter-tags {
.tags {
gap: .4rem;
display: flex;
max-width: 100%;
overflow-x: auto;
justify-content: flex-start;
white-space: nowrap;
justify-content: flex-start;
&::-webkit-scrollbar {
display: none;
@@ -50,13 +50,13 @@
<div class="product">
<div class="items">
<t-tag
v-for="(item, index) in itemList"
v-for="(item, index) in displayItemList"
:key="item.id || `${item.skuId}-${item.skuUnitId}-${index}`"
:content="getProductText(item)"
theme="primary"
:theme="props.fulfillableSkuId ? 'warning' : 'primary'"
variant="light"
/>
<t-tag v-if="!itemList.length" content="暂无产品" />
<t-tag v-if="!displayItemList.length" :content="props.fulfillableSkuId ? '暂无可履约产品' : '暂无产品'" />
</div>
</div>
<div class="summary">
@@ -142,7 +142,7 @@
import { TimeLabel } from "timi-web";
import type { GaoSalesPaymentStatus, SalesOrder } from "@/types/SalesOrder";
import { getCustomerPhotoURL } from "@/utils/customer";
import { formatPackageAmount, getPackageQuantityText } from "@/utils/package";
import { comparePackageQuantity, formatPackageAmount, getPackageQuantityText } from "@/utils/package";
import { getSalesOrderStatusText, getSalesOrderTypeText, getSalesPaymentStatusText, getStatusTheme } from "@/utils/salesOrder";
import { getProductSkuSnapshotText } from "@/utils/product";
@@ -150,6 +150,7 @@ defineOptions({ name: "SalesOrderListCell" });
const props = defineProps<{
order: SalesOrder;
fulfillableSkuId?: string;
canReceive: boolean;
canFulfill: boolean;
canCancel: boolean;
@@ -166,6 +167,9 @@ const emit = defineEmits<{
}>();
const moreVisible = ref(false);
const itemList = computed(() => props.order.itemList || []);
const displayItemList = computed(() => props.fulfillableSkuId
? itemList.value.filter(item => item.skuId === props.fulfillableSkuId && 0 < comparePackageQuantity(item.availableBaseQuantity ?? "0", "0"))
: itemList.value);
const customerName = computed(() => props.order.customer?.name || props.order.customer?.code || props.order.customerId || "未知客户");
const avatarText = computed(() => customerName.value.slice(0, 1) || "客");
const photoURL = computed(() => getCustomerPhotoURL(props.order.customer, 64));
@@ -230,9 +234,13 @@ function sumProductQuantity(field: "quantity" | "fulfilledBaseQuantity"): string
}
function getProductText(item: NonNullable<SalesOrder["itemList"]>[number]): string {
const quantity = getPackageQuantityText(item.quantity);
const skuText = getProductSkuSnapshotText(item.productNameSnapshot, item.skuNameSnapshot, item.specSummarySnapshot);
const giftText = item.gifted ? "赠送 · " : "";
if (props.fulfillableSkuId) {
const quantity = getPackageQuantityText(item.availableBaseQuantity);
return `${giftText}${item.productNameSnapshot || "未命名产品"}${skuText ? `(${skuText})` : ""} · ${quantity} ${item.baseUnitName || "基础单位"}`;
}
const quantity = getPackageQuantityText(item.quantity);
return `${giftText}${item.productNameSnapshot || "未命名产品"}${skuText ? `(${skuText})` : " "}${quantity}${item.unitSnapshot ? ` ${item.unitSnapshot}` : ""}`;
}
</script>
+14 -1
View File
@@ -12,6 +12,7 @@
<section class="brand" v-entrance-transition>
<logo @click="handleLogoClick" />
<h1 v-text="appName" />
<p v-text="`版本 ${displayVersion}`" />
<p v-text="appDescription" />
</section>
<t-cell-group v-if="agreementItemList.length" theme="card" v-entrance-transition>
@@ -32,6 +33,13 @@
v-else
:description="isLoading ? '正在加载协议配置' : '暂无可用协议'"
/>
<t-cell-group v-if="updateSupported" theme="card" v-entrance-transition>
<t-cell title="版本更新" arrow hover @click="router.push({ name: 'AppUpdate' })">
<template #leftIcon>
<t-icon name="download" size="1.75rem" />
</template>
</t-cell>
</t-cell-group>
<footer class="footer" v-entrance-transition>
<p>技术支持:夜雨</p>
<p>联系技术:imyeyu@qq.com</p>
@@ -44,6 +52,8 @@
</template>
<script setup lang="ts">
import { version } from "../../../package.json";
import { useAppUpdate } from "@/composables/useAppUpdate";
import { SettingAPI } from "timi-web-api";
import Logo from "@/pages/user/component/Logo.vue";
import { getErrorMessage } from "@/utils/error";
@@ -63,6 +73,8 @@ defineOptions({
const appName = "糕店客户管理";
const appDescription = "面向门店的客户、登记、积分与经营管理工具";
const router = useRouter();
const { supported: updateSupported, currentVersion, loadCurrent } = useAppUpdate();
const displayVersion = computed(() => currentVersion.value && currentVersion.value !== "builtin" ? currentVersion.value : version);
const agreementItemList = ref<AgreementItem[]>([]);
const isLoading = ref(false);
@@ -127,7 +139,7 @@ async function loadSettings(): Promise<void> {
}
onMounted(async () => {
await loadSettings();
await Promise.all([loadSettings(), loadCurrent()]);
});
</script>
@@ -192,3 +204,4 @@ onMounted(async () => {
}
}
</style>
+5 -151
View File
@@ -19,6 +19,11 @@
/>
</template>
</t-cell>
<t-cell title="背景模糊特效">
<template #right-icon>
<t-switch :model-value="globalUIStore.backdropBlur" @change="value => globalUIStore.setBackdropBlur(value === true)" />
</template>
</t-cell>
</t-cell-group>
<t-cell-group title="声音" theme="card" v-entrance-transition>
<t-cell title="扫码成功">
@@ -46,52 +51,6 @@
</template>
</t-cell>
</t-cell-group>
<t-cell-group v-if="updateSupported" title="版本更新" theme="card" v-entrance-transition>
<t-cell title="外壳版本" :note="nativeVersion || '—'" />
<t-cell title="系统版本" :note="currentVersion || '—'" />
<t-cell v-if="latestVersionText" title="最新版本" :note="latestVersionText" />
<t-cell title="自动更新">
<template #right-icon>
<t-switch :model-value="autoUpdate" @change="handleAutoUpdateChange" />
</template>
</t-cell>
</t-cell-group>
<div v-if="updateSupported" class="update-panel" v-entrance-transition>
<center-tips v-if="updateHint" v-text="updateHint" />
<t-button
v-if="updateStage === 'check'"
class="cell-button"
theme="primary"
size="large"
:loading="checking"
@click="handleCheck"
>
检查更新
</t-button>
<t-button
v-else-if="updateStage === 'download'"
class="cell-button"
theme="primary"
size="large"
@click="handleDownload"
>
下载更新
</t-button>
<template v-else-if="updateStage === 'downloading'">
<t-progress class="progress" stroke-width=".5rem" :percentage="percent" /> <t-button theme="primary" size="large" block disabled>
下载中 {{ percent }}%
</t-button>
</template>
<t-button
v-else-if="updateStage === 'apply'"
class="cell-button"
theme="primary"
size="large"
@click="handleApply"
>
现在更新
</t-button>
</div>
</main>
</div>
</template>
@@ -101,8 +60,6 @@ import type { ThemeMode } from "@/store/globalUI";
import { useGlobalUIStore } from "@/store/globalUI";
import SegmentedSlider from "@/components/SegmentedSlider.vue";
import { useSettingStore } from "@/store/settingStore";
import { setAutoUpdate, useAppUpdate } from "@/composables/useAppUpdate";
import { Message } from "@/utils/message";
defineOptions({
name: "AppSettings"
@@ -159,97 +116,7 @@ async function playSettingSoundPreview(type: "scanSuccess" | "registerSuccess"):
await settingStore.playRegisterSuccessSound();
}
// ---------- 版本更新 ----------
const {
supported: updateSupported,
currentVersion,
nativeVersion,
latest,
checking,
downloading,
percent,
ready,
error: updateError,
autoUpdate,
loadCurrent,
check,
hasUpdate,
download,
apply,
restorePending
} = useAppUpdate();
/** 有更新时展示目标版本号 */
const latestVersionText = computed<string>(() => (hasUpdate() ? `v${latest.value?.version ?? ""}` : ""));
/** 当前所处的更新阶段 */
const updateStage = computed<"check" | "download" | "downloading" | "apply">(() => {
if (downloading.value) {
return "downloading";
}
if (ready.value) {
return "apply";
}
if (latest.value && hasUpdate()) {
return "download";
}
return "check";
});
/** 阶段说明文案 */
const updateHint = computed<string>(() => {
if (!updateSupported) {
return "仅在 App 内可用";
}
if (ready.value) {
return `v${ready.value.version} 已下载,点击下方按钮重启生效`;
}
if (latest.value && hasUpdate()) {
return `发现新版本 v${latest.value.version}`;
}
if (latest.value && !checking.value) {
return "当前已是最新版本";
}
return "";
});
onMounted(async () => {
await loadCurrent();
await restorePending();
});
function handleAutoUpdateChange(value: boolean | string | number): void {
setAutoUpdate(value === true);
}
async function handleCheck(): Promise<void> {
const result = await check();
if (!result) {
Message.error(updateError.value || "检查更新失败");
return;
}
if (!hasUpdate()) {
Message.info("已是最新版本");
}
}
async function handleDownload(): Promise<void> {
const bundle = await download();
if (!bundle) {
Message.error(updateError.value || "下载失败");
return;
}
Message.success(`v${bundle.version} 已下载`);
}
async function handleApply(): Promise<void> {
const bundle = ready.value;
if (!bundle) {
return;
}
await apply(bundle);
}
</script>
<style scoped lang="less">
@@ -286,15 +153,6 @@ async function handleApply(): Promise<void> {
}
}
.update-panel {
gap: .75rem;
display: flex;
flex-direction: column;
.progress {
margin: 0 1rem;
}
}
}
:global(html.theme-dark) {
@@ -302,10 +160,6 @@ async function handleApply(): Promise<void> {
.volume-field span {
color: #94a3b8;
}
.update-hint {
color: #94a3b8;
}
}
}
</style>
+169
View File
@@ -0,0 +1,169 @@
<template>
<div class="tui-page-layout tui-navbar">
<t-navbar fixed :z-index="20" title="版本更新" left-arrow @left-click="$router.back()" />
<main class="tui-page-content scroll column">
<center-tips v-if="!updateSupported" content="仅在 App 内可用" />
<t-cell-group v-if="updateSupported" title="版本更新" theme="card" v-entrance-transition>
<t-cell title="外壳版本" :note="nativeVersion || '—'" />
<t-cell title="系统版本" :note="currentVersion || '—'" />
<t-cell v-if="latestVersionText" title="最新版本" :note="latestVersionText" />
<t-cell title="自动更新">
<template #right-icon>
<t-switch :model-value="autoUpdate" @change="handleAutoUpdateChange" />
</template>
</t-cell>
</t-cell-group>
<div v-if="updateSupported" class="update-panel" v-entrance-transition>
<center-tips v-if="updateHint"><span v-text="updateHint" /></center-tips>
<t-button
v-if="updateStage === 'check'"
class="cell-button"
theme="primary"
size="large"
:loading="checking"
@click="handleCheck"
>
检查更新
</t-button>
<t-button
v-else-if="updateStage === 'download'"
class="cell-button"
theme="primary"
size="large"
@click="handleDownload"
>
下载更新
</t-button>
<template v-else-if="updateStage === 'downloading'">
<t-progress class="progress" stroke-width=".5rem" :percentage="percent" />
<t-button theme="primary" size="large" block disabled>
<span v-text="`下载中 ${percent}%`" />
</t-button>
</template>
<t-button
v-else-if="updateStage === 'apply'"
class="cell-button"
theme="primary"
size="large"
@click="handleApply"
>
现在更新
</t-button>
</div>
</main>
</div>
</template>
<script setup lang="ts">
import { setAutoUpdate, useAppUpdate } from "@/composables/useAppUpdate";
import { Message } from "@/utils/message";
defineOptions({
name: "AppUpdate"
});
// ---------- 版本更新 ----------
const {
supported: updateSupported,
currentVersion,
nativeVersion,
latest,
checking,
downloading,
percent,
ready,
error: updateError,
autoUpdate,
loadCurrent,
check,
hasUpdate,
download,
apply,
restorePending
} = useAppUpdate();
/** 有更新时展示目标版本号 */
const latestVersionText = computed<string>(() => (hasUpdate() ? `v${latest.value?.version ?? ""}` : ""));
/** 当前所处的更新阶段 */
const updateStage = computed<"check" | "download" | "downloading" | "apply">(() => {
if (downloading.value) {
return "downloading";
}
if (ready.value) {
return "apply";
}
if (latest.value && hasUpdate()) {
return "download";
}
return "check";
});
/** 阶段说明文案 */
const updateHint = computed<string>(() => {
if (!updateSupported) {
return "仅在 App 内可用";
}
if (ready.value) {
return `v${ready.value.version} 已下载,点击下方按钮重启生效`;
}
if (latest.value && hasUpdate()) {
return `发现新版本 v${latest.value.version}`;
}
if (latest.value && !checking.value) {
return "当前已是最新版本";
}
return "";
});
onMounted(async () => {
await loadCurrent();
await restorePending();
});
function handleAutoUpdateChange(value: boolean | string | number): void {
setAutoUpdate(value === true);
}
async function handleCheck(): Promise<void> {
const result = await check();
if (!result) {
Message.error(updateError.value || "检查更新失败");
return;
}
if (!hasUpdate()) {
Message.info("已是最新版本");
}
}
async function handleDownload(): Promise<void> {
const bundle = await download();
if (!bundle) {
Message.error(updateError.value || "下载失败");
return;
}
Message.success(`v${bundle.version} 已下载`);
}
async function handleApply(): Promise<void> {
const bundle = ready.value;
if (!bundle) {
return;
}
await apply(bundle);
}
</script>
<style scoped lang="less">
.update-panel {
gap: .75rem;
display: flex;
flex-direction: column;
.progress {
margin: 0 1rem;
}
}
</style>
@@ -174,10 +174,14 @@ async function openAiChat(): Promise<void> {
.items {
--td-button-border-radius: 1.75rem;
// 按最小宽度铺排:手机刚好吃下 3 列,平板自动加列而不是把卡片放大
// 窄屏至少显示 3 列,宽屏按最小宽度自动增加列数
gap: .875rem;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
grid-template-columns: repeat(auto-fill, minmax(min(6.5rem, calc(33.3333% - .5834rem)), 1fr));
.item-wrap {
min-width: 0;
}
.item {
--entry-color: #0f766e;
@@ -207,7 +211,7 @@ async function openAiChat(): Promise<void> {
}
.body {
inset: 1rem;
inset: .5rem;
display: flex;
gap: .5rem;
position: absolute;
+11
View File
@@ -137,6 +137,17 @@ export const managementSettingRoutes: RouteRecordRaw[] = [
darkBodyBackground: "#10161f"
}
},
{
path: "/management/about/update",
name: "AppUpdate",
component: () => import("@/pages/setting/AppUpdate.vue"),
meta: {
depth: 4,
tabBarVisible: false,
bodyBackground: "#F5F5F8",
darkBodyBackground: "#10161f"
}
},
{
path: "/management/about/agreement/:id",
name: "Agreement",
+10 -1
View File
@@ -3,6 +3,7 @@ import { defineStore } from "pinia";
export const DEFAULT_BODY_BACKGROUND = "#FFF";
const THEME_STORAGE_KEY = "gao-customer-h5:theme-mode";
const BACKDROP_BLUR_STORAGE_KEY = "gao-customer-h5:backdrop-blur";
export type ThemeMode = "light" | "dark" | "system";
@@ -18,6 +19,7 @@ function readStoredThemeMode(): ThemeMode {
const store = defineStore("globalUI", () => {
const bodyBackground = ref<string>(DEFAULT_BODY_BACKGROUND);
const themeMode = ref<ThemeMode>(readStoredThemeMode());
const backdropBlur = ref(localStorage.getItem(BACKDROP_BLUR_STORAGE_KEY) !== "false");
function setBodyBackground(color?: string): void {
bodyBackground.value = color || DEFAULT_BODY_BACKGROUND;
@@ -28,11 +30,18 @@ const store = defineStore("globalUI", () => {
localStorage.setItem(THEME_STORAGE_KEY, mode);
}
function setBackdropBlur(enabled: boolean): void {
backdropBlur.value = enabled;
localStorage.setItem(BACKDROP_BLUR_STORAGE_KEY, String(enabled));
}
return {
bodyBackground,
themeMode,
backdropBlur,
setBodyBackground,
setThemeMode
setThemeMode,
setBackdropBlur
};
});
+6
View File
@@ -116,6 +116,12 @@ export type ProductSelection = {
unit: ProductSkuUnit;
};
/** 产品 SKU 标签所需的产品与规格信息。 */
export type ProductSkuTagSelection = {
product: Pick<Product, "name" | "specList">;
sku: Pick<ProductSku, "name" | "specSummary" | "specValueIdList">;
};
export type ProductCategoryPage = {
storeId?: string;
status?: ProductCategoryStatus;
+1
View File
@@ -78,6 +78,7 @@ export type SalesOrderPage = {
storeId?: string;
customerId?: string;
packageConfigId?: string;
fulfillableSkuId?: string;
orderType?: GaoSalesOrderType;
orderTypeList?: GaoSalesOrderType[];
status?: GaoSalesOrderStatus;
+38 -4
View File
@@ -5,6 +5,7 @@ import type {
GaoSalesRefundStatus
} from "@/types/SalesOrder";
import type { DateTimeRange } from "@/utils/date";
import type { ProductSelection, ProductSkuTagSelection } from "@/types/Product";
import { DATE_FILTER_OPTIONS, type DateFilterType } from "@/utils/dateFilter";
/** 销售订单筛选类型别名,保持现有导入路径兼容。 */
@@ -14,7 +15,7 @@ export type SalesOrderDateFilterType = DateFilterType;
export type SalesOrderPaymentFilter = GaoSalesPaymentStatus | "PENDING_RECEIVE";
/** 销售订单筛选组。 */
export type SalesOrderFilterGroupKey = "date" | "orderTypeList" | "statusList" | "paymentStatusList" | "refundStatusList";
export type SalesOrderFilterGroupKey = "date" | "orderTypeList" | "statusList" | "paymentStatusList" | "refundStatusList" | "fulfillableSku";
/** 销售订单列表筛选条件。 */
export type SalesOrderListFilter = {
@@ -24,8 +25,19 @@ export type SalesOrderListFilter = {
statusList: GaoSalesOrderStatus[];
paymentStatusList: SalesOrderPaymentFilter[];
refundStatusList: GaoSalesRefundStatus[];
fulfillableSkuId: string;
fulfillableSkuName: string;
fulfillableSkuSelection?: ProductSkuTagSelection;
};
/** 提取筛选回显需要的产品和 SKU 信息。 */
export function getFulfillableSkuSelection(selection: ProductSelection): ProductSkuTagSelection {
return {
product: { name: selection.product.name, specList: selection.product.specList },
sku: { name: selection.sku.name, specSummary: selection.sku.specSummary, specValueIdList: selection.sku.specValueIdList }
};
}
/** 创建销售订单筛选默认值。 */
export function createDefaultSalesOrderFilter(): SalesOrderListFilter {
return {
@@ -34,7 +46,9 @@ export function createDefaultSalesOrderFilter(): SalesOrderListFilter {
orderTypeList: ["PACKAGE", "DIRECT_PRODUCT"],
statusList: ["ACTIVE"],
paymentStatusList: ["UNPAID", "PARTIALLY_PAID", "PAID"],
refundStatusList: ["NOT_REQUIRED", "PENDING", "REFUNDED"]
refundStatusList: ["NOT_REQUIRED", "PENDING", "REFUNDED"],
fulfillableSkuId: "",
fulfillableSkuName: ""
};
}
@@ -46,7 +60,10 @@ export function cloneSalesOrderFilter(filter: SalesOrderListFilter): SalesOrderL
orderTypeList: [...filter.orderTypeList],
statusList: [...filter.statusList],
paymentStatusList: [...filter.paymentStatusList],
refundStatusList: [...filter.refundStatusList]
refundStatusList: [...filter.refundStatusList],
fulfillableSkuId: filter.fulfillableSkuId,
fulfillableSkuName: filter.fulfillableSkuName,
fulfillableSkuSelection: filter.fulfillableSkuSelection
};
}
@@ -73,7 +90,24 @@ export function normalizeSalesOrderFilter(value: unknown): SalesOrderListFilter
orderTypeList: normalizeList(source.orderTypeList, defaultFilter.orderTypeList),
statusList: normalizeList(source.statusList, defaultFilter.statusList),
paymentStatusList: normalizeList(source.paymentStatusList, defaultFilter.paymentStatusList),
refundStatusList: normalizeList(source.refundStatusList, defaultFilter.refundStatusList)
refundStatusList: normalizeList(source.refundStatusList, defaultFilter.refundStatusList),
fulfillableSkuId: typeof source.fulfillableSkuId === "string" ? source.fulfillableSkuId : "",
fulfillableSkuName: typeof source.fulfillableSkuName === "string" ? source.fulfillableSkuName : "",
fulfillableSkuSelection: normalizeSkuSelection(source.fulfillableSkuSelection)
};
}
function normalizeSkuSelection(value: unknown): ProductSkuTagSelection | undefined {
if (!value || typeof value !== "object") return undefined;
const selection = value as ProductSkuTagSelection;
if (!selection.product || typeof selection.product.name !== "string" || !selection.sku || typeof selection.sku.name !== "string") return undefined;
return {
product: { name: selection.product.name, specList: Array.isArray(selection.product.specList) ? selection.product.specList : [] },
sku: {
name: selection.sku.name,
specSummary: typeof selection.sku.specSummary === "string" ? selection.sku.specSummary : "",
specValueIdList: normalizeList(selection.sku.specValueIdList, [])
}
};
}