feat: recycle system
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<t-navbar
|
||||
fixed
|
||||
:z-index="20"
|
||||
:title="isCreate ? '新增兑换规则' : '编辑兑换规则'"
|
||||
:title="isCreate ? '新增兑换模板' : '编辑兑换模板'"
|
||||
left-arrow
|
||||
@left-click="exit()"
|
||||
>
|
||||
@@ -20,108 +20,88 @@
|
||||
</t-navbar>
|
||||
<main class="tui-page-content scroll column">
|
||||
<div v-can="permissionCodes.recycleExchange.configManage" class="recycle-rule-edit">
|
||||
<t-form class="form card" label-width="7.5rem" v-entrance-transition>
|
||||
<t-form-item label="回收物" required-mark content-align="right" arrow @click="openItemPicker">
|
||||
<span class="clip-text" v-text="recycleItemName || '请选择回收物'" />
|
||||
<t-form class="form card" label-width="7rem" v-entrance-transition>
|
||||
<t-form-item label="回收物" required-mark arrow content-align="right" @click="itemPickerVisible = true">
|
||||
<span v-text="recycleItemName || '请选择'" />
|
||||
</t-form-item>
|
||||
<t-form-item label="单份回收数量" required-mark>
|
||||
<t-input
|
||||
v-model.trim="form.recycleQuantity"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
:placeholder="`按${recycleUnitName || '回收单位'}填写`"
|
||||
/>
|
||||
<div class="quantity">
|
||||
<t-input
|
||||
v-model.trim="recycleQuantityText"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
:placeholder="`按${recycleUnitName || '回收单位'}填写`"
|
||||
/>
|
||||
<span class="unit" v-text="recycleUnitName" />
|
||||
</div>
|
||||
</t-form-item>
|
||||
<t-form-item label="兑换产品" required-mark content-align="right" arrow @click="productPopupVisible = true">
|
||||
<span class="clip-text" v-text="productDisplayName || '请选择兑换产品'" />
|
||||
<t-form-item v-if="itemRows.length" class="detail" label-width="0">
|
||||
<t-form class="items" label-width="0">
|
||||
<t-form-item v-for="(row, index) in itemRows" :key="row.key" class="item">
|
||||
<div class="item-content">
|
||||
<div class="photo">
|
||||
<t-image v-if="row.sku && getProductPhotoURL(row.sku)" :src="getProductPhotoURL(row.sku)" :alt="row.productName || '产品图片'" fit="cover" class="avatar" />
|
||||
<div v-else class="avatar fallback" v-text="(row.productName || '产').slice(0, 1)" />
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="head">
|
||||
<div class="title">
|
||||
<strong class="name clip-text" v-text="row.productName || '未命名产品'" />
|
||||
<product-sku-tags :product-name="row.productName" :fallback="row.skuText" />
|
||||
</div>
|
||||
<t-button
|
||||
size="extra-small"
|
||||
theme="danger"
|
||||
variant="text"
|
||||
content="移除"
|
||||
@click="removeItem(index)"
|
||||
/>
|
||||
</div>
|
||||
<div class="quantity">
|
||||
<t-stepper
|
||||
:model-value="Number(row.exchangeQuantityText) || 0"
|
||||
size="large"
|
||||
theme="outline"
|
||||
:min="0"
|
||||
:max="Number.MAX_SAFE_INTEGER"
|
||||
:step="getProductQuantityStep({ allowDecimalQuantity: row.allowDecimalQuantity })"
|
||||
:integer="!row.allowDecimalQuantity"
|
||||
@update:model-value="row.exchangeQuantityText = String($event)"
|
||||
/>
|
||||
<t-tag :content="row.unitName || '单位'" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
</t-form-item>
|
||||
<t-form-item v-if="skuDisplayText || unitDisplayText" label="产品 SKU" content-align="right">
|
||||
<product-sku-tags :fallback="skuDisplayText" :unit="unitDisplayText" />
|
||||
<t-form-item arrow content-align="right" @click="openProductPicker">
|
||||
<span>添加商品</span>
|
||||
</t-form-item>
|
||||
<t-form-item label="单份兑换数量" required-mark>
|
||||
<t-input
|
||||
v-model.trim="form.exchangeQuantity"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
:placeholder="`按${unitDisplayText || '业务单位'}填写`"
|
||||
/>
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<span class="tips" v-text="ratioTipText" />
|
||||
</t-form-item>
|
||||
<t-form-item label="规则状态" content-align="right" arrow @click="statusVisible = true">
|
||||
<span v-text="getRecycleStatusText(form.status)" />
|
||||
</t-form-item>
|
||||
<t-form-item label="排序值">
|
||||
<t-input
|
||||
v-model.trim="form.sortText"
|
||||
type="number"
|
||||
align="right"
|
||||
borderless
|
||||
placeholder="默认 0,越小越靠前"
|
||||
/>
|
||||
<t-form-item label="状态" content-align="right">
|
||||
<t-switch v-model="form.status" size="small" :custom-value="['ACTIVE', 'INACTIVE']" />
|
||||
</t-form-item>
|
||||
<t-form-item label="备注">
|
||||
<t-textarea v-model.trim="form.remark" borderless autosize maxlength="500" placeholder="可不填" />
|
||||
<t-textarea v-model="form.remark" borderless autosize maxlength="500" placeholder="选填" />
|
||||
</t-form-item>
|
||||
<t-form-item label-width="0">
|
||||
<span class="tips" v-text="footerTipText" />
|
||||
</t-form-item>
|
||||
</t-form>
|
||||
<span class="tips footer-tips" v-text="footerTipText" />
|
||||
<t-button
|
||||
v-if="!isCreate"
|
||||
class="cell-button"
|
||||
theme="default"
|
||||
v-entrance-transition
|
||||
:content="form.status === 'ACTIVE' ? '停用规则' : '启用规则'"
|
||||
@click="toggleStatus"
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
<bottom-popup
|
||||
v-model="itemPickerVisible"
|
||||
title="选择回收物"
|
||||
height="60vh"
|
||||
right-button-text=""
|
||||
@left-button-click="itemPickerVisible = false"
|
||||
>
|
||||
<div class="item-picker">
|
||||
<t-cell
|
||||
v-for="item in itemList"
|
||||
:key="item.id"
|
||||
class="item"
|
||||
:class="{ active: item.id === form.recycleItemId }"
|
||||
@click="selectItem(item)"
|
||||
>
|
||||
<template #left-icon>
|
||||
<div class="avatar fallback" v-text="(item.name || '回').slice(0, 1)" />
|
||||
</template>
|
||||
<template #title>
|
||||
<span class="clip-text" v-text="item.name || '未命名回收物'" />
|
||||
</template>
|
||||
<template #note>
|
||||
<t-tag
|
||||
size="small"
|
||||
:theme="getRecycleStatusTheme(item.status)"
|
||||
:content="getRecycleStatusText(item.status)"
|
||||
/>
|
||||
</template>
|
||||
<template #description>
|
||||
<span v-text="`按${item.unitName || '单位'}计量`" />
|
||||
</template>
|
||||
</t-cell>
|
||||
<center-tips v-if="!itemList.length" :content="itemLoading ? '正在加载回收物' : '暂无回收物,请先配置回收物'" />
|
||||
</div>
|
||||
</bottom-popup>
|
||||
<t-popup v-model="statusVisible" placement="bottom">
|
||||
<t-picker
|
||||
v-model="statusDraft"
|
||||
:columns="statusOptions"
|
||||
title="规则状态"
|
||||
@cancel="statusVisible = false"
|
||||
@confirm="confirmStatus"
|
||||
/>
|
||||
</t-popup>
|
||||
<recycle-item-picker-popup
|
||||
v-model:visible="itemPickerVisible"
|
||||
:items="itemList"
|
||||
:loading="itemLoading"
|
||||
:selected-id="form.recycleItemId"
|
||||
empty-text="暂无回收物,可点击右上角新建"
|
||||
manage
|
||||
show-status
|
||||
@select="selectItem"
|
||||
@saved="reloadItems"
|
||||
/>
|
||||
<product-select-popup
|
||||
v-model="selection"
|
||||
v-model:visible="productPopupVisible"
|
||||
@@ -131,18 +111,20 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BottomPopup, useExpandToMaster, usePane } from "timi-tdesign-mobile";
|
||||
import { useExpandToMaster, usePane } from "timi-tdesign-mobile";
|
||||
import ProductAPI from "@/api/ProductAPI";
|
||||
import RecycleAPI from "@/api/RecycleAPI";
|
||||
import ProductSelectPopup from "@/components/productSelector/ProductSelectPopup.vue";
|
||||
import ProductSkuTags from "@/components/ProductSkuTags.vue";
|
||||
import type { ProductSelection } from "@/types/Product";
|
||||
import ProductSelectPopup from "@/components/productSelector/ProductSelectPopup.vue";
|
||||
import RecycleItemPickerPopup from "@/pages/recycle/components/RecycleItemPickerPopup.vue";
|
||||
import type { ProductSelection, ProductSku } from "@/types/Product";
|
||||
import type { ProductSkuSelectionValue } from "@/types/ProductSkuSelection";
|
||||
import type { RecycleItem, RecycleStatus } from "@/types/Recycle";
|
||||
import type { RecycleExchangeRule, RecycleItem, RecycleRuleItem, RecycleStatus } from "@/types/Recycle";
|
||||
import { getErrorMessage } from "@/utils/error";
|
||||
import { Message } from "@/utils/message";
|
||||
import { normalizePackageQuantity } from "@/utils/package";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
import { getRecycleQuantityText, getRecycleStatusText, getRecycleStatusTheme } from "@/utils/recycle";
|
||||
import { getProductPhotoURL, getProductQuantityStep, getProductSkuSnapshotText } from "@/utils/product";
|
||||
|
||||
defineOptions({ name: "RecycleRuleEdit" });
|
||||
|
||||
@@ -162,8 +144,9 @@ const currentId = computed(() => props.ruleId || String(route.params.id || ""));
|
||||
const isCreate = computed(() => !currentId.value);
|
||||
|
||||
useExpandToMaster({
|
||||
path: "/management/recycle-rules",
|
||||
id: () => currentId.value
|
||||
path: "/product/recycle-rules",
|
||||
id: () => currentId.value || "__create__",
|
||||
query: currentId.value ? { view: "edit" } : {}
|
||||
});
|
||||
/** 非空说明当前被内联在主从分栏的右栏里 */
|
||||
const pane = usePane();
|
||||
@@ -182,61 +165,116 @@ function exit(saved = false): void {
|
||||
const form = reactive({
|
||||
id: "",
|
||||
recycleItemId: "",
|
||||
recycleQuantity: "",
|
||||
exchangeQuantity: "",
|
||||
status: "ACTIVE" as RecycleStatus,
|
||||
sortText: "",
|
||||
sort: undefined as number | undefined,
|
||||
remark: ""
|
||||
});
|
||||
const recycleQuantityText = ref("");
|
||||
const selection = ref<ProductSkuSelectionValue>();
|
||||
const picked = ref<ProductSelection>();
|
||||
const productPopupVisible = ref(false);
|
||||
// 规则详情自带产品与单位名称,未改选前直接用它展示,不必再查产品库
|
||||
const ruleSnapshot = reactive({ productName: "", skuText: "", unitName: "" });
|
||||
const itemPickerVisible = ref(false);
|
||||
const itemList = ref<RecycleItem[]>([]);
|
||||
const itemLoading = ref(false);
|
||||
const selectedItem = ref<RecycleItem>();
|
||||
const statusVisible = ref(false);
|
||||
const statusDraft = ref<Array<string | number>>(["ACTIVE"]);
|
||||
const saving = ref(false);
|
||||
const statusOptions = [
|
||||
{ label: "启用", value: "ACTIVE" },
|
||||
{ label: "停用", value: "INACTIVE" }
|
||||
];
|
||||
const recycleItemName = computed(() => selectedItem.value?.name || "");
|
||||
const recycleUnitName = computed(() => selectedItem.value?.unitName || "");
|
||||
const productDisplayName = computed(() => picked.value?.product?.name || ruleSnapshot.productName);
|
||||
const skuDisplayText = computed(() => {
|
||||
const sku = picked.value?.sku;
|
||||
return sku ? sku.specSummary?.trim() || sku.name?.trim() || "" : ruleSnapshot.skuText;
|
||||
});
|
||||
const unitDisplayText = computed(() => picked.value?.unit?.name || ruleSnapshot.unitName);
|
||||
const ratioTipText = computed(() => {
|
||||
const recycleText = getRecycleQuantityText(form.recycleQuantity || "0", recycleUnitName.value);
|
||||
const exchangeText = getRecycleQuantityText(form.exchangeQuantity || "0", unitDisplayText.value);
|
||||
return `创建兑换单时按倍数放大:预设 ${recycleText} 兑换 ${exchangeText}。数量最多 3 位小数。`;
|
||||
});
|
||||
const footerTipText = "启用规则要求回收物、产品和 SKU 均已启用,且所选业务单位允许销售。规则停用不影响已创建的兑换单。";
|
||||
const footerTipText = "启用模板要求回收物、产品和 SKU 均已启用,且所选业务单位允许销售。模板只是开单快捷配置,修改或删除都不影响已创建的兑换单。";
|
||||
|
||||
function openItemPicker(): void {
|
||||
itemPickerVisible.value = true;
|
||||
// ---------- 商品明细 ----------
|
||||
|
||||
/** 明细行的编辑态。key 用于 v-for 稳定,不提交给服务端。 */
|
||||
type ItemRow = {
|
||||
key: number;
|
||||
skuId: string;
|
||||
skuUnitId: string;
|
||||
productName: string;
|
||||
skuText: string;
|
||||
unitName: string;
|
||||
sku?: ProductSku;
|
||||
allowDecimalQuantity: boolean;
|
||||
exchangeQuantityText: string;
|
||||
};
|
||||
const itemRows = ref<ItemRow[]>([]);
|
||||
let rowSeed = 0;
|
||||
|
||||
function createRow(source: Partial<RecycleRuleItem> & { productName?: string | null; unitName?: string | null }): ItemRow {
|
||||
rowSeed += 1;
|
||||
return {
|
||||
key: rowSeed,
|
||||
skuId: source.skuId || "",
|
||||
skuUnitId: source.skuUnitId || "",
|
||||
productName: source.productName || "",
|
||||
skuText: getProductSkuSnapshotText(source.productName, source.skuName, source.specSummary),
|
||||
unitName: source.unitName || "",
|
||||
allowDecimalQuantity: source.allowDecimalQuantity ?? false,
|
||||
exchangeQuantityText: source.exchangeQuantity === undefined || source.exchangeQuantity === null ? "" : String(source.exchangeQuantity)
|
||||
};
|
||||
}
|
||||
|
||||
/** 同款 SKU 换单位是允许的,只有「同 SKU + 同单位」才算重复。 */
|
||||
function isDuplicate(skuId: string, skuUnitId: string, ignoreIndex = -1): boolean {
|
||||
return itemRows.value.some((row, index) => index !== ignoreIndex && row.skuId === skuId && row.skuUnitId === skuUnitId);
|
||||
}
|
||||
|
||||
function openProductPicker(): void {
|
||||
productPopupVisible.value = true;
|
||||
}
|
||||
|
||||
function handleProductSelection(value: ProductSelection): void {
|
||||
const skuId = value.sku.id || "";
|
||||
const skuUnitId = value.unit.id || "";
|
||||
if (isDuplicate(skuId, skuUnitId)) {
|
||||
Message.warning("该商品的这个单位已在模板中");
|
||||
return;
|
||||
}
|
||||
const row = createRow({
|
||||
skuId,
|
||||
skuUnitId,
|
||||
productName: value.product.name,
|
||||
skuName: value.sku.name,
|
||||
specSummary: value.sku.specSummary,
|
||||
unitName: value.unit.name,
|
||||
allowDecimalQuantity: value.sku.allowDecimalQuantity,
|
||||
exchangeQuantity: ""
|
||||
});
|
||||
row.sku = value.sku;
|
||||
itemRows.value.push(row);
|
||||
}
|
||||
|
||||
function removeItem(index: number): void {
|
||||
itemRows.value.splice(index, 1);
|
||||
}
|
||||
|
||||
/** 补充详情接口未返回的 SKU 图片,同一 SKU 只请求一次。 */
|
||||
async function loadRowSkus(rows: ItemRow[]): Promise<void> {
|
||||
const ids = [...new Set(rows.map(row => row.skuId).filter(Boolean))];
|
||||
const results = await Promise.allSettled(ids.map(async id => await ProductAPI.skuDetail(id)));
|
||||
results.forEach((result, index) => {
|
||||
if (result.status !== "fulfilled") {
|
||||
return;
|
||||
}
|
||||
for (const row of rows) {
|
||||
if (row.skuId === ids[index]) {
|
||||
row.sku = result.value;
|
||||
row.allowDecimalQuantity = result.value.allowDecimalQuantity;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------- 回收物 ----------
|
||||
|
||||
function selectItem(item: RecycleItem): void {
|
||||
form.recycleItemId = item.id || "";
|
||||
selectedItem.value = item;
|
||||
itemPickerVisible.value = false;
|
||||
}
|
||||
|
||||
function handleProductSelection(value: ProductSelection): void {
|
||||
picked.value = value;
|
||||
selection.value = { skuId: value.sku.id || "", skuUnitId: value.unit.id || "" };
|
||||
}
|
||||
|
||||
function confirmStatus(value: Array<string | number>): void {
|
||||
form.status = String(value[0]) as RecycleStatus;
|
||||
statusVisible.value = false;
|
||||
/** 回收物新建或改名后重新取列表,已选中的回收物同步最新名称 */
|
||||
async function reloadItems(): Promise<void> {
|
||||
await loadItems();
|
||||
selectedItem.value = itemList.value.find(item => item.id === form.recycleItemId);
|
||||
}
|
||||
|
||||
// ---------- 数据 ----------
|
||||
@@ -265,6 +303,17 @@ async function loadItems(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function applyRule(rule: RecycleExchangeRule): void {
|
||||
form.id = rule.id || "";
|
||||
form.recycleItemId = rule.recycleItemId || "";
|
||||
recycleQuantityText.value = String(rule.recycleQuantity ?? "");
|
||||
form.status = rule.status || "ACTIVE";
|
||||
form.sort = rule.sort ?? undefined;
|
||||
form.remark = rule.remark || "";
|
||||
selectedItem.value = itemList.value.find(item => item.id === rule.recycleItemId);
|
||||
itemRows.value = (rule.itemList || []).map(source => createRow(source));
|
||||
}
|
||||
|
||||
async function load(): Promise<void> {
|
||||
const id = currentId.value;
|
||||
try {
|
||||
@@ -272,129 +321,165 @@ async function load(): Promise<void> {
|
||||
if (!id) {
|
||||
return;
|
||||
}
|
||||
const rule = await RecycleAPI.ruleDetail(id);
|
||||
form.id = rule.id || "";
|
||||
form.recycleItemId = rule.recycleItemId || "";
|
||||
form.recycleQuantity = String(rule.recycleQuantity ?? "");
|
||||
form.exchangeQuantity = String(rule.exchangeQuantity ?? "");
|
||||
form.status = rule.status || "ACTIVE";
|
||||
form.sortText = rule.sort === null || rule.sort === undefined ? "" : String(rule.sort);
|
||||
form.remark = rule.remark || "";
|
||||
selectedItem.value = itemList.value.find(item => item.id === rule.recycleItemId);
|
||||
selection.value = { skuId: rule.skuId, skuUnitId: rule.skuUnitId };
|
||||
ruleSnapshot.productName = rule.productName || "";
|
||||
ruleSnapshot.skuText = rule.specSummary?.trim() || rule.skuName?.trim() || "";
|
||||
ruleSnapshot.unitName = rule.unitName || "";
|
||||
applyRule(await RecycleAPI.ruleDetail(id));
|
||||
await loadRowSkus(itemRows.value);
|
||||
} catch (error) {
|
||||
Message.error(getErrorMessage(error, "兑换规则加载失败"));
|
||||
Message.error(getErrorMessage(error, "兑换模板加载失败"));
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 保存 ----------
|
||||
|
||||
async function save(status?: RecycleStatus): Promise<void> {
|
||||
const recycleQuantity = normalizePackageQuantity(form.recycleQuantity);
|
||||
const exchangeQuantity = normalizePackageQuantity(form.exchangeQuantity);
|
||||
const skuId = selection.value?.skuId;
|
||||
const skuUnitId = selection.value?.skuUnitId;
|
||||
async function save(): Promise<void> {
|
||||
if (saving.value) {
|
||||
return;
|
||||
}
|
||||
if (!form.recycleItemId || !skuId || !skuUnitId) {
|
||||
Message.warning("请选择回收物和兑换产品业务单位");
|
||||
const recycleQuantity = normalizePackageQuantity(recycleQuantityText.value);
|
||||
if (!form.recycleItemId) {
|
||||
Message.warning("请选择回收物");
|
||||
return;
|
||||
}
|
||||
if (!recycleQuantity || !exchangeQuantity || recycleQuantity === "0" || exchangeQuantity === "0") {
|
||||
Message.warning("单份回收数量和兑换数量必须为大于 0 的数字,最多 3 位小数");
|
||||
if (!recycleQuantity || recycleQuantity === "0") {
|
||||
Message.warning("单份回收数量必须为大于 0 的数字,最多 3 位小数");
|
||||
return;
|
||||
}
|
||||
const sort = form.sortText ? Number(form.sortText) : 0;
|
||||
if (!Number.isSafeInteger(sort)) {
|
||||
Message.warning("排序值必须为整数");
|
||||
if (!itemRows.value.length) {
|
||||
Message.warning("请至少添加一个兑换商品");
|
||||
return;
|
||||
}
|
||||
const itemList: RecycleRuleItem[] = [];
|
||||
const seen = new Set<string>();
|
||||
for (const row of itemRows.value) {
|
||||
const quantity = normalizePackageQuantity(row.exchangeQuantityText);
|
||||
if (!row.skuId || !row.skuUnitId || !quantity || quantity === "0") {
|
||||
Message.warning(`请填写「${row.productName || "未命名产品"}」的兑换数量`);
|
||||
return;
|
||||
}
|
||||
const uniqueKey = `${row.skuId}|${row.skuUnitId}`;
|
||||
if (seen.has(uniqueKey)) {
|
||||
Message.warning("同一商品和单位不能重复");
|
||||
return;
|
||||
}
|
||||
seen.add(uniqueKey);
|
||||
itemList.push({ skuId: row.skuId, skuUnitId: row.skuUnitId, exchangeQuantity: quantity });
|
||||
}
|
||||
saving.value = true;
|
||||
try {
|
||||
await RecycleAPI.ruleSave({
|
||||
id: form.id || undefined,
|
||||
recycleItemId: form.recycleItemId,
|
||||
recycleQuantity,
|
||||
skuId,
|
||||
skuUnitId,
|
||||
exchangeQuantity,
|
||||
status: status || form.status,
|
||||
sort,
|
||||
itemList,
|
||||
status: form.status,
|
||||
sort: form.sort,
|
||||
remark: form.remark || null
|
||||
});
|
||||
Message.success("兑换规则已保存");
|
||||
form.status = status || form.status;
|
||||
Message.success("兑换模板已保存");
|
||||
emit("saved");
|
||||
exit(true);
|
||||
} catch (error) {
|
||||
Message.error(getErrorMessage(error, "兑换规则保存失败"));
|
||||
Message.error(getErrorMessage(error, "兑换模板保存失败"));
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleStatus(): Promise<void> {
|
||||
await save(form.status === "ACTIVE" ? "INACTIVE" : "ACTIVE");
|
||||
}
|
||||
|
||||
onMounted(load);
|
||||
watch(() => [props.ruleId, route.params.id], load);
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.recycle-rule-edit {
|
||||
gap: 1rem;
|
||||
display: flex;
|
||||
padding: 0 0 2rem;
|
||||
flex-direction: column;
|
||||
|
||||
.form {
|
||||
|
||||
.quantity {
|
||||
gap: .5rem;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
|
||||
.t-input {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.unit {
|
||||
color: var(--td-text-color-secondary);
|
||||
flex: 0 0 auto;
|
||||
font-size: .875rem;
|
||||
}
|
||||
}
|
||||
|
||||
.detail {
|
||||
padding: 0;
|
||||
|
||||
.items {
|
||||
--td-button-extra-small-height: 24px;
|
||||
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
|
||||
.item-content {
|
||||
gap: .5rem;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.photo .avatar {
|
||||
width: 3.5rem;
|
||||
height: 3.5rem;
|
||||
}
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.quantity {
|
||||
justify-content: end;
|
||||
}
|
||||
|
||||
.head {
|
||||
gap: .5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.title {
|
||||
gap: .25rem;
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
align-items: center;
|
||||
|
||||
.name {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:deep(.tags) {
|
||||
flex: 0 0 auto;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.tips {
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: .8125rem;
|
||||
font-size: .875rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-tips {
|
||||
padding: 0 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.item-picker {
|
||||
|
||||
.item {
|
||||
padding: .75rem 1rem;
|
||||
border-radius: 1rem;
|
||||
|
||||
&.active {
|
||||
background: var(--td-brand-color-1, rgba(0, 82, 217, .08));
|
||||
}
|
||||
|
||||
.avatar {
|
||||
font-size: 1rem;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
.item-picker {
|
||||
|
||||
.item.active {
|
||||
background: rgba(15, 118, 110, .22);
|
||||
}
|
||||
|
||||
.fallback {
|
||||
color: #ccfbf1;
|
||||
background: #115e59;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user