remove name and unit

This commit is contained in:
Timi
2026-09-18 18:25:44 +08:00
parent 46ef87e86e
commit f2f990bd3b
+10 -32
View File
@@ -8,26 +8,6 @@
@click="open"
>
<span class="picker-text" v-text="selectedProductName || props.placeholder" />
<template #help>
<div v-if="selectedSku" class="selected-tags">
<t-tag
v-for="entry in selectedSkuSpecEntries"
:key="`${entry.specName}-${entry.valueName}`"
size="small"
theme="primary"
variant="light-outline"
:content="entry.valueName"
/>
<t-tag
v-if="!selectedSkuSpecEntries.length"
size="small"
theme="primary"
variant="light-outline"
:content="selectedSku.specSummary || selectedSku.name || '默认 SKU'"
/>
<t-tag v-if="selectedUnit?.name" size="small" :content="selectedUnit.name" />
</div>
</template>
</t-form-item>
<bottom-popup
v-model="visible"
@@ -123,10 +103,17 @@
<script setup lang="ts">
import { BottomPopup } from "timi-tdesign-mobile";
import ProductAPI from "@/api/ProductAPI";
import type { Product, ProductSelection, ProductSku, ProductSkuUnit, ProductSpec, ProductSpecValue } from "@/types/Product";
import type {
Product,
ProductSelection,
ProductSku,
ProductSkuUnit,
ProductSpec,
ProductSpecValue
} from "@/types/Product";
import { getErrorMessage } from "@/utils/error";
import { Message } from "@/utils/message";
import { formatProductAmount, getProductPhotoURL, getProductSkuSpecEntries } from "@/utils/product";
import { formatProductAmount, getProductPhotoURL } from "@/utils/product";
interface Props {
modelValue: { skuId: string; skuUnitId: string } | undefined;
@@ -155,10 +142,7 @@ const selectedProduct = computed(() => {
}
return props.selectedProduct || productList.value.find(item => item.skuList?.some(sku => sku.id === props.modelValue?.skuId));
});
const selectedSku = computed(() => selectedProduct.value?.skuList?.find(item => item.id === props.modelValue?.skuId));
const selectedUnit = computed(() => selectedSku.value?.unitList?.find(item => item.id === props.modelValue?.skuUnitId));
const selectedProductName = computed(() => selectedProduct.value?.name || "");
const selectedSkuSpecEntries = computed(() => getProductSkuSpecEntries(selectedSku.value || { specValueIdList: [] }, selectedProduct.value?.specList || []));
const filteredProductList = computed(() => {
const text = keyword.value.toLocaleLowerCase();
return productList.value.filter(item => !text || `${item.name}${item.code}`.toLocaleLowerCase().includes(text));
@@ -257,16 +241,10 @@ function selectUnit(sku: ProductSku, skuUnitId: string): void {
<style scoped lang="less">
.product-selector {
.picker-text {
color: var(--td-text-color-primary);
}
.selected-tags {
gap: .375rem;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
}
}
.popup {