feat: recycle system

This commit is contained in:
Timi
2026-11-12 16:51:57 +08:00
parent b1ba681042
commit 7e221e745a
90 changed files with 5981 additions and 3542 deletions
@@ -27,7 +27,7 @@
@toggle="toggleSku"
@check="toggleProduct"
/>
<center-tips v-else :content="loading ? (props.productScope === 'all' ? '正在加载产品' : '正在加载可售产品') : emptyProductText" />
<center-tips v-else :content="loading ? '正在加载可售产品' : emptyProductText" />
</div>
</div>
</bottom-popup>
@@ -46,14 +46,12 @@ interface Props {
modelValue?: ProductSkuSelectionValue;
visible?: boolean;
selectionMode?: ProductSkuSelectionMode;
/** sellable 只列可售产品;all 连停售产品一起列,用于来源产品这类仅作识别的场景 */
productScope?: "sellable" | "all";
selectableProductIdList?: string[];
selectableSkuIdList?: string[];
selectedSkuIdList?: string[];
}
const props = withDefaults(defineProps<Props>(), { selectionMode: "single", productScope: "sellable" });
const props = withDefaults(defineProps<Props>(), { selectionMode: "single" });
const emit = defineEmits<{
"update:modelValue": [value: Props["modelValue"]];
"update:visible": [value: boolean];
@@ -97,7 +95,7 @@ const visibleProductList = computed(() => {
});
const emptyProductText = computed(() => props.selectableProductIdList?.length === 0
? "客户暂无已购可履约产品"
: (props.productScope === "all" ? "暂无产品" : "暂无可售产品"));
: "暂无可售产品");
const selectorItemList = computed<ProductSkuSelectorItem[]>(() => visibleProductList.value.map((summary, index) => {
const key = getProductKey(summary, index);
const product = productDetailMap.value[key] || (summary.skuList?.length ? summary : undefined);
@@ -136,11 +134,9 @@ watch(popupVisible, async visible => {
}
loading.value = true;
try {
productList.value = props.productScope === "all"
? (await ProductAPI.list({ index: 0, size: 1000 })).list || []
: await ProductAPI.sellableList({ index: 0, size: 1000 });
productList.value = await ProductAPI.sellableList({ index: 0, size: 1000 });
} catch (error) {
Message.error(getErrorMessage(error, props.productScope === "all" ? "产品加载失败" : "可售产品加载失败"));
Message.error(getErrorMessage(error, "可售产品加载失败"));
} finally {
loading.value = false;
}
@@ -1,7 +1,7 @@
<template>
<t-collapse
v-model="expandedProductKeyList"
class="product-sku-selector"
class="product-sku-selector fix-last-cell-line"
theme="card"
:expand-mutex="true"
@change="handleChange"