feat: recycle system
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user