v1.1.0 #6
@@ -3,18 +3,19 @@
|
|||||||
<t-tag
|
<t-tag
|
||||||
v-for="tag in tagList"
|
v-for="tag in tagList"
|
||||||
:key="tag.key"
|
:key="tag.key"
|
||||||
size="small"
|
:size="props.size"
|
||||||
theme="primary"
|
theme="primary"
|
||||||
variant="light-outline"
|
variant="light-outline"
|
||||||
:content="tag.content"
|
:content="tag.content"
|
||||||
/>
|
/>
|
||||||
<t-tag v-if="unitText" size="small" :content="unitText" />
|
<t-tag v-if="unitText" :size="props.size" :content="unitText" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ProductSkuSpecSnapshot } from "@/types/Product";
|
import type { TagProps } from "tdesign-mobile-vue";
|
||||||
import { getProductSkuSnapshotText } from "@/utils/product";
|
import type { ProductSkuSpecSnapshot, ProductSkuTagSelection } from "@/types/Product";
|
||||||
|
import { getProductSkuSnapshotText, getProductSkuSpecEntries } from "@/utils/product";
|
||||||
|
|
||||||
defineOptions({ name: "ProductSkuTags" });
|
defineOptions({ name: "ProductSkuTags" });
|
||||||
|
|
||||||
@@ -23,11 +24,24 @@ interface Props {
|
|||||||
snapshot?: ProductSkuSpecSnapshot[];
|
snapshot?: ProductSkuSpecSnapshot[];
|
||||||
fallback?: string;
|
fallback?: string;
|
||||||
unit?: string | null;
|
unit?: string | null;
|
||||||
|
selection?: ProductSkuTagSelection;
|
||||||
|
size?: TagProps["size"];
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>();
|
const props = withDefaults(defineProps<Props>(), { size: "small" });
|
||||||
|
|
||||||
const tagList = computed(() => {
|
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 result = (props.snapshot || []).flatMap((item, index) => {
|
||||||
const content = item.specValueName?.trim() || item.specName?.trim();
|
const content = item.specValueName?.trim() || item.specName?.trim();
|
||||||
return content ? [{ key: `${item.specId || "spec"}-${item.specValueId || index}`, content }] : [];
|
return content ? [{ key: `${item.specId || "spec"}-${item.specValueId || index}`, content }] : [];
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
:key="item.id"
|
:key="item.id"
|
||||||
class="item"
|
class="item"
|
||||||
:order="item"
|
:order="item"
|
||||||
|
:fulfillable-sku-id="appliedFilter.fulfillableSkuId"
|
||||||
:can-receive="canReceive"
|
:can-receive="canReceive"
|
||||||
:can-fulfill="canCreateFulfillment"
|
:can-fulfill="canCreateFulfillment"
|
||||||
:can-cancel="canCancel"
|
:can-cancel="canCancel"
|
||||||
@@ -459,6 +460,7 @@ function buildPageFilter(index = pageIndex.value): SalesOrderPage {
|
|||||||
return {
|
return {
|
||||||
customerId: customerId.value || undefined,
|
customerId: customerId.value || undefined,
|
||||||
packageConfigId: currentPackageConfigId || undefined,
|
packageConfigId: currentPackageConfigId || undefined,
|
||||||
|
fulfillableSkuId: filter.fulfillableSkuId || undefined,
|
||||||
keyword: keyword.value || undefined,
|
keyword: keyword.value || undefined,
|
||||||
orderTypeList: currentPackageConfigId ? ["PACKAGE"] : getEffectiveList(filter.orderTypeList, orderTypeOptions.map(item => item.value)),
|
orderTypeList: currentPackageConfigId ? ["PACKAGE"] : getEffectiveList(filter.orderTypeList, orderTypeOptions.map(item => item.value)),
|
||||||
statusList: getEffectiveList(filter.statusList, statusOptions.map(item => item.value)),
|
statusList: getEffectiveList(filter.statusList, statusOptions.map(item => item.value)),
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
@reset="reset"
|
@reset="reset"
|
||||||
@confirm="confirm"
|
@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>
|
<template #group-date-after>
|
||||||
<t-cell-group
|
<t-cell-group
|
||||||
v-if="draftFilter.dateFilterType === 'custom'"
|
v-if="draftFilter.dateFilterType === 'custom'"
|
||||||
@@ -31,6 +40,7 @@
|
|||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
</template>
|
</template>
|
||||||
</filter-popup>
|
</filter-popup>
|
||||||
|
<product-select-popup v-model:visible="productSelectorVisible" @select="selectSku" />
|
||||||
<t-popup v-model="startVisible" placement="bottom">
|
<t-popup v-model="startVisible" placement="bottom">
|
||||||
<t-date-time-picker
|
<t-date-time-picker
|
||||||
v-if="startVisible"
|
v-if="startVisible"
|
||||||
@@ -60,6 +70,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { Time } from "timi-web";
|
import { Time } from "timi-web";
|
||||||
import FilterPopup from "@/components/filter-popup/FilterPopup.vue";
|
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 type { FilterGroup, FilterModel, FilterValueList } from "@/components/filter-popup/FilterPopup";
|
||||||
import { buildPresetDateRange } from "@/utils/date";
|
import { buildPresetDateRange } from "@/utils/date";
|
||||||
import { DATE_FILTER_OPTIONS as dateOptions } from "@/utils/dateFilter";
|
import { DATE_FILTER_OPTIONS as dateOptions } from "@/utils/dateFilter";
|
||||||
@@ -67,6 +80,7 @@ import type { GaoSalesOrderStatus, GaoSalesOrderType, GaoSalesRefundStatus } fro
|
|||||||
import {
|
import {
|
||||||
cloneSalesOrderFilter,
|
cloneSalesOrderFilter,
|
||||||
createDefaultSalesOrderFilter,
|
createDefaultSalesOrderFilter,
|
||||||
|
getFulfillableSkuSelection,
|
||||||
type SalesOrderDateFilterType,
|
type SalesOrderDateFilterType,
|
||||||
type SalesOrderFilterGroupKey,
|
type SalesOrderFilterGroupKey,
|
||||||
type SalesOrderListFilter,
|
type SalesOrderListFilter,
|
||||||
@@ -94,6 +108,7 @@ const popupVisible = computed({
|
|||||||
const draftFilter = ref<SalesOrderListFilter>(cloneSalesOrderFilter(props.modelValue));
|
const draftFilter = ref<SalesOrderListFilter>(cloneSalesOrderFilter(props.modelValue));
|
||||||
const startVisible = ref(false);
|
const startVisible = ref(false);
|
||||||
const endVisible = ref(false);
|
const endVisible = ref(false);
|
||||||
|
const productSelectorVisible = ref(false);
|
||||||
const startDraft = ref("");
|
const startDraft = ref("");
|
||||||
const endDraft = ref("");
|
const endDraft = ref("");
|
||||||
let resetRequested = false;
|
let resetRequested = false;
|
||||||
@@ -119,6 +134,13 @@ const refundOptions: Array<{ label: string; value: GaoSalesRefundStatus }> = [
|
|||||||
{ label: "已退款", value: "REFUNDED" }
|
{ label: "已退款", value: "REFUNDED" }
|
||||||
];
|
];
|
||||||
const filterGroups = computed<FilterGroup[]>(() => [
|
const filterGroups = computed<FilterGroup[]>(() => [
|
||||||
|
{
|
||||||
|
key: "fulfillableSku",
|
||||||
|
title: "可履约 SKU",
|
||||||
|
options: [],
|
||||||
|
multiple: false,
|
||||||
|
columns: 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: "date",
|
key: "date",
|
||||||
title: "下单时间",
|
title: "下单时间",
|
||||||
@@ -306,6 +328,11 @@ function reset(): void {
|
|||||||
|
|
||||||
function resetFilterGroup(target: SalesOrderListFilter, source: SalesOrderListFilter, filterKey: SalesOrderFilterGroupKey): void {
|
function resetFilterGroup(target: SalesOrderListFilter, source: SalesOrderListFilter, filterKey: SalesOrderFilterGroupKey): void {
|
||||||
switch (filterKey) {
|
switch (filterKey) {
|
||||||
|
case "fulfillableSku":
|
||||||
|
target.fulfillableSkuId = source.fulfillableSkuId;
|
||||||
|
target.fulfillableSkuName = source.fulfillableSkuName;
|
||||||
|
target.fulfillableSkuSelection = source.fulfillableSkuSelection;
|
||||||
|
break;
|
||||||
case "date":
|
case "date":
|
||||||
target.dateFilterType = source.dateFilterType;
|
target.dateFilterType = source.dateFilterType;
|
||||||
target.dateRange = [...source.dateRange];
|
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 {
|
function confirm(): void {
|
||||||
if ((!props.filterKey || props.filterKey === "date")
|
if ((!props.filterKey || props.filterKey === "date")
|
||||||
&& draftFilter.value.dateFilterType === "custom"
|
&& draftFilter.value.dateFilterType === "custom"
|
||||||
|
|||||||
@@ -7,9 +7,18 @@
|
|||||||
@click="openFilterPopup('date')"
|
@click="openFilterPopup('date')"
|
||||||
/>
|
/>
|
||||||
<t-cell v-if="props.filter.dateFilterType === 'custom'" :note="filterDateRangeText" />
|
<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>
|
<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
|
<t-tag
|
||||||
v-for="item in selectedStatusTags"
|
v-for="item in selectedStatusTags"
|
||||||
:key="item"
|
:key="item"
|
||||||
@@ -20,9 +29,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</t-cell>
|
</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>
|
<template #note>
|
||||||
<div class="filter-tags">
|
<div class="tags">
|
||||||
<t-tag
|
<t-tag
|
||||||
v-for="item in selectedOrderTypeTags"
|
v-for="item in selectedOrderTypeTags"
|
||||||
:key="item"
|
:key="item"
|
||||||
@@ -33,9 +42,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</t-cell>
|
</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>
|
<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
|
<t-tag
|
||||||
v-for="item in selectedPaymentTags"
|
v-for="item in selectedPaymentTags"
|
||||||
:key="item"
|
:key="item"
|
||||||
@@ -46,9 +69,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</t-cell>
|
</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>
|
<template #note>
|
||||||
<div class="filter-tags">
|
<div class="tags">
|
||||||
<t-tag
|
<t-tag
|
||||||
v-for="item in selectedRefundTags"
|
v-for="item in selectedRefundTags"
|
||||||
:key="item"
|
:key="item"
|
||||||
@@ -68,13 +91,18 @@
|
|||||||
:package-config-id="props.packageConfigId"
|
:package-config-id="props.packageConfigId"
|
||||||
@confirm="confirmFilter"
|
@confirm="confirmFilter"
|
||||||
/>
|
/>
|
||||||
|
<product-select-popup v-model:visible="productSelectorVisible" @select="selectSku" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import SalesOrderFilterPopup from "@/pages/salesOrder/component/SalesOrderFilterPopup.vue";
|
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 type { GaoSalesOrderStatus, GaoSalesOrderType, GaoSalesRefundStatus } from "@/types/SalesOrder";
|
||||||
import { DATE_FILTER_OPTIONS } from "@/utils/dateFilter";
|
import { DATE_FILTER_OPTIONS } from "@/utils/dateFilter";
|
||||||
import {
|
import {
|
||||||
|
getFulfillableSkuSelection,
|
||||||
type SalesOrderFilterGroupKey,
|
type SalesOrderFilterGroupKey,
|
||||||
type SalesOrderListFilter,
|
type SalesOrderListFilter,
|
||||||
type SalesOrderPaymentFilter
|
type SalesOrderPaymentFilter
|
||||||
@@ -124,8 +152,22 @@ const selectedOrderTypeTags = computed(() => getSelectedOptionLabels(props.filte
|
|||||||
const selectedPaymentTags = computed(() => getSelectedOptionLabels(props.filter.paymentStatusList, paymentOptions));
|
const selectedPaymentTags = computed(() => getSelectedOptionLabels(props.filter.paymentStatusList, paymentOptions));
|
||||||
const selectedRefundTags = computed(() => getSelectedOptionLabels(props.filter.refundStatusList, refundOptions));
|
const selectedRefundTags = computed(() => getSelectedOptionLabels(props.filter.refundStatusList, refundOptions));
|
||||||
const filterPopupVisible = ref(false);
|
const filterPopupVisible = ref(false);
|
||||||
|
const productSelectorVisible = ref(false);
|
||||||
const activeFilterKey = ref<SalesOrderFilterGroupKey>();
|
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[] {
|
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);
|
const labels = options.filter(item => valueList.includes(item.value)).map(item => item.label);
|
||||||
return labels.length ? labels : ["未选择"];
|
return labels.length ? labels : ["未选择"];
|
||||||
@@ -152,28 +194,32 @@ function confirmFilter(value: SalesOrderListFilter): void {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.t-cell__title) {
|
.cell {
|
||||||
flex: 0 0 4.5rem;
|
|
||||||
margin-right: .75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.t-cell__note) {
|
&.roll-note {
|
||||||
flex: 1 1 0;
|
|
||||||
min-width: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
text-align: right;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-cell {
|
:deep(.t-cell__title) {
|
||||||
.filter-tags {
|
flex: 0 0 4.5rem;
|
||||||
|
margin-right: .75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.t-cell__note) {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: right;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
gap: .4rem;
|
gap: .4rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
justify-content: flex-start;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
justify-content: flex-start;
|
||||||
|
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -50,13 +50,13 @@
|
|||||||
<div class="product">
|
<div class="product">
|
||||||
<div class="items">
|
<div class="items">
|
||||||
<t-tag
|
<t-tag
|
||||||
v-for="(item, index) in itemList"
|
v-for="(item, index) in displayItemList"
|
||||||
:key="item.id || `${item.skuId}-${item.skuUnitId}-${index}`"
|
:key="item.id || `${item.skuId}-${item.skuUnitId}-${index}`"
|
||||||
:content="getProductText(item)"
|
:content="getProductText(item)"
|
||||||
theme="primary"
|
:theme="props.fulfillableSkuId ? 'warning' : 'primary'"
|
||||||
variant="light"
|
variant="light"
|
||||||
/>
|
/>
|
||||||
<t-tag v-if="!itemList.length" content="暂无产品" />
|
<t-tag v-if="!displayItemList.length" :content="props.fulfillableSkuId ? '暂无可履约产品' : '暂无产品'" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
import { TimeLabel } from "timi-web";
|
import { TimeLabel } from "timi-web";
|
||||||
import type { GaoSalesPaymentStatus, SalesOrder } from "@/types/SalesOrder";
|
import type { GaoSalesPaymentStatus, SalesOrder } from "@/types/SalesOrder";
|
||||||
import { getCustomerPhotoURL } from "@/utils/customer";
|
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 { getSalesOrderStatusText, getSalesOrderTypeText, getSalesPaymentStatusText, getStatusTheme } from "@/utils/salesOrder";
|
||||||
import { getProductSkuSnapshotText } from "@/utils/product";
|
import { getProductSkuSnapshotText } from "@/utils/product";
|
||||||
|
|
||||||
@@ -150,6 +150,7 @@ defineOptions({ name: "SalesOrderListCell" });
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
order: SalesOrder;
|
order: SalesOrder;
|
||||||
|
fulfillableSkuId?: string;
|
||||||
canReceive: boolean;
|
canReceive: boolean;
|
||||||
canFulfill: boolean;
|
canFulfill: boolean;
|
||||||
canCancel: boolean;
|
canCancel: boolean;
|
||||||
@@ -166,6 +167,9 @@ const emit = defineEmits<{
|
|||||||
}>();
|
}>();
|
||||||
const moreVisible = ref(false);
|
const moreVisible = ref(false);
|
||||||
const itemList = computed(() => props.order.itemList || []);
|
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 customerName = computed(() => props.order.customer?.name || props.order.customer?.code || props.order.customerId || "未知客户");
|
||||||
const avatarText = computed(() => customerName.value.slice(0, 1) || "客");
|
const avatarText = computed(() => customerName.value.slice(0, 1) || "客");
|
||||||
const photoURL = computed(() => getCustomerPhotoURL(props.order.customer, 64));
|
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 {
|
function getProductText(item: NonNullable<SalesOrder["itemList"]>[number]): string {
|
||||||
const quantity = getPackageQuantityText(item.quantity);
|
|
||||||
const skuText = getProductSkuSnapshotText(item.productNameSnapshot, item.skuNameSnapshot, item.specSummarySnapshot);
|
const skuText = getProductSkuSnapshotText(item.productNameSnapshot, item.skuNameSnapshot, item.specSummarySnapshot);
|
||||||
const giftText = item.gifted ? "赠送 · " : "";
|
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}` : ""}`;
|
return `${giftText}${item.productNameSnapshot || "未命名产品"}${skuText ? `(${skuText})` : " "}${quantity}${item.unitSnapshot ? ` ${item.unitSnapshot}` : ""}`;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -116,6 +116,12 @@ export type ProductSelection = {
|
|||||||
unit: ProductSkuUnit;
|
unit: ProductSkuUnit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 产品 SKU 标签所需的产品与规格信息。 */
|
||||||
|
export type ProductSkuTagSelection = {
|
||||||
|
product: Pick<Product, "name" | "specList">;
|
||||||
|
sku: Pick<ProductSku, "name" | "specSummary" | "specValueIdList">;
|
||||||
|
};
|
||||||
|
|
||||||
export type ProductCategoryPage = {
|
export type ProductCategoryPage = {
|
||||||
storeId?: string;
|
storeId?: string;
|
||||||
status?: ProductCategoryStatus;
|
status?: ProductCategoryStatus;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ export type SalesOrderPage = {
|
|||||||
storeId?: string;
|
storeId?: string;
|
||||||
customerId?: string;
|
customerId?: string;
|
||||||
packageConfigId?: string;
|
packageConfigId?: string;
|
||||||
|
fulfillableSkuId?: string;
|
||||||
orderType?: GaoSalesOrderType;
|
orderType?: GaoSalesOrderType;
|
||||||
orderTypeList?: GaoSalesOrderType[];
|
orderTypeList?: GaoSalesOrderType[];
|
||||||
status?: GaoSalesOrderStatus;
|
status?: GaoSalesOrderStatus;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import type {
|
|||||||
GaoSalesRefundStatus
|
GaoSalesRefundStatus
|
||||||
} from "@/types/SalesOrder";
|
} from "@/types/SalesOrder";
|
||||||
import type { DateTimeRange } from "@/utils/date";
|
import type { DateTimeRange } from "@/utils/date";
|
||||||
|
import type { ProductSelection, ProductSkuTagSelection } from "@/types/Product";
|
||||||
import { DATE_FILTER_OPTIONS, type DateFilterType } from "@/utils/dateFilter";
|
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 SalesOrderPaymentFilter = GaoSalesPaymentStatus | "PENDING_RECEIVE";
|
||||||
|
|
||||||
/** 销售订单筛选组。 */
|
/** 销售订单筛选组。 */
|
||||||
export type SalesOrderFilterGroupKey = "date" | "orderTypeList" | "statusList" | "paymentStatusList" | "refundStatusList";
|
export type SalesOrderFilterGroupKey = "date" | "orderTypeList" | "statusList" | "paymentStatusList" | "refundStatusList" | "fulfillableSku";
|
||||||
|
|
||||||
/** 销售订单列表筛选条件。 */
|
/** 销售订单列表筛选条件。 */
|
||||||
export type SalesOrderListFilter = {
|
export type SalesOrderListFilter = {
|
||||||
@@ -24,8 +25,19 @@ export type SalesOrderListFilter = {
|
|||||||
statusList: GaoSalesOrderStatus[];
|
statusList: GaoSalesOrderStatus[];
|
||||||
paymentStatusList: SalesOrderPaymentFilter[];
|
paymentStatusList: SalesOrderPaymentFilter[];
|
||||||
refundStatusList: GaoSalesRefundStatus[];
|
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 {
|
export function createDefaultSalesOrderFilter(): SalesOrderListFilter {
|
||||||
return {
|
return {
|
||||||
@@ -34,7 +46,9 @@ export function createDefaultSalesOrderFilter(): SalesOrderListFilter {
|
|||||||
orderTypeList: ["PACKAGE", "DIRECT_PRODUCT"],
|
orderTypeList: ["PACKAGE", "DIRECT_PRODUCT"],
|
||||||
statusList: ["ACTIVE"],
|
statusList: ["ACTIVE"],
|
||||||
paymentStatusList: ["UNPAID", "PARTIALLY_PAID", "PAID"],
|
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],
|
orderTypeList: [...filter.orderTypeList],
|
||||||
statusList: [...filter.statusList],
|
statusList: [...filter.statusList],
|
||||||
paymentStatusList: [...filter.paymentStatusList],
|
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),
|
orderTypeList: normalizeList(source.orderTypeList, defaultFilter.orderTypeList),
|
||||||
statusList: normalizeList(source.statusList, defaultFilter.statusList),
|
statusList: normalizeList(source.statusList, defaultFilter.statusList),
|
||||||
paymentStatusList: normalizeList(source.paymentStatusList, defaultFilter.paymentStatusList),
|
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, [])
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user