fix add fail

This commit is contained in:
Timi
2026-09-25 23:41:48 +08:00
parent a0beee43cb
commit e4fe775819
3 changed files with 40 additions and 30 deletions
+11 -1
View File
@@ -1,6 +1,7 @@
import { axios } from "timi-web-api";
import type { Page, PageResult } from "timi-web-api";
import type { Tag, TagApply, TagBizType } from "@/types/Tag";
import { getCurrentStoreId } from "@/utils/store";
const BASE_URI = "/gao/tag";
@@ -15,7 +16,16 @@ async function detail(id: string): Promise<Tag> {
}
async function create(tag: Tag): Promise<Tag> {
return await axios.post(`${BASE_URI}/create`, tag);
const ownerId = tag.ownerId || getCurrentStoreId();
if (!ownerId) {
throw new Error("无法确定标签所属门店");
}
return await axios.post(`${BASE_URI}/create`, {
...tag,
ownerType: tag.ownerType || "GAO_STORE",
ownerId
});
}
async function update(tag: Tag): Promise<void> {