diff --git a/src/api/PointAPI.ts b/src/api/PointAPI.ts index 262b42f..eff4f70 100644 --- a/src/api/PointAPI.ts +++ b/src/api/PointAPI.ts @@ -78,6 +78,10 @@ async function ruleUpdate(rule: PointRule): Promise { await axios.post(`${BASE_URI}/rule/update`, withCurrentStoreId(rule)); } +async function ruleSort(idList: string[]): Promise { + await axios.post(`${BASE_URI}/rule/sort`, idList); +} + async function ruleRemove(id: string): Promise { await axios.post(`${BASE_URI}/rule/delete`, undefined, { params: { id } @@ -92,5 +96,6 @@ export default { ruleDetail, ruleCreate, ruleUpdate, + ruleSort, ruleRemove }; diff --git a/src/pages/event/EventSort.vue b/src/pages/event/EventSort.vue index d1db8b5..935e5b5 100644 --- a/src/pages/event/EventSort.vue +++ b/src/pages/event/EventSort.vue @@ -44,15 +44,6 @@
- - 保存排序 - @@ -151,6 +142,7 @@ async function loadData(): Promise { onMounted(async () => { navBarStore.clearRight(); + navBarStore.setRightText("保存", "var(--td-brand-color)", saveSort); try { await loadData(); } catch { @@ -218,12 +210,6 @@ onUnmounted(() => { text-align: center; } - .save { - left: 1rem; - right: 1rem; - bottom: calc(.75rem + env(safe-area-inset-bottom, 0)); - position: fixed; - } } :global(html.theme-dark) { diff --git a/src/pages/point/PointRuleEdit.vue b/src/pages/point/PointRuleEdit.vue index 21fd415..641a455 100644 --- a/src/pages/point/PointRuleEdit.vue +++ b/src/pages/point/PointRuleEdit.vue @@ -83,9 +83,6 @@ - - - @@ -248,7 +245,6 @@ const formModel = reactive({ tiers: [] as PointRuleTierForm[], beginAtText: "", endAtText: "", - priorityText: "0", exclusive: false, remark: "" }); @@ -696,11 +692,6 @@ function validateForm(): boolean { Toast.warning("生效结束时间不能早于开始时间"); return false; } - const priority = Number(formModel.priorityText); - if (!Number.isSafeInteger(priority) || 0 > priority) { - Toast.warning("优先级必须是大于等于 0 的整数"); - return false; - } return true; } @@ -722,7 +713,6 @@ async function saveRule(): Promise { conditionJson: buildCondition(), beginAt: resolveTimestamp(formModel.beginAtText), endAt: resolveTimestamp(formModel.endAtText), - priority: Number(formModel.priorityText), exclusive: formModel.exclusive, remark: formModel.remark.trim() }; @@ -803,7 +793,6 @@ async function fillForm(): Promise { tiers: [], beginAtText: current.beginAt ? Time.toDateTime(current.beginAt) : "", endAtText: current.endAt ? Time.toDateTime(current.endAt) : "", - priorityText: String(current.priority ?? 0), exclusive: current.exclusive ?? false, remark: current.remark || "" }); diff --git a/src/pages/point/PointRuleList.vue b/src/pages/point/PointRuleList.vue index 24fca13..f1da728 100644 --- a/src/pages/point/PointRuleList.vue +++ b/src/pages/point/PointRuleList.vue @@ -73,6 +73,7 @@ import { type DropdownValue, Toast } from "tdesign-mobile-vue"; import EventAPI from "@/api/EventAPI"; import PointAPI from "@/api/PointAPI"; import { useCurrentStoreStore } from "@/store/currentStoreStore"; +import { useNavBarStore } from "@/store/navBarStore"; import type { EventItem } from "@/types/EventItem"; import type { PointRule, PointRuleStatus } from "@/types/Point"; import { gaoRoleCodes, permissionCodes } from "@/utils/permission"; @@ -85,6 +86,7 @@ defineOptions({ }); const router = useRouter(); +const navBarStore = useNavBarStore(); const userStore = useUserStore(); const currentStoreStore = useCurrentStoreStore(); @@ -297,12 +299,20 @@ async function preparePage(): Promise { } onMounted(async () => { + navBarStore.clearRight(); + if (userStore.hasPermissions(permissionCodes.pointRule.update)) { + navBarStore.setRightText("排序", "var(--td-brand-color)", () => { + router.push("/management/points/rules/sort"); + }); + } try { await preparePage(); } catch { Toast.error("积分规则页面加载失败"); } }); + +onUnmounted(() => navBarStore.clearRight()); diff --git a/src/pages/store/StoreSort.vue b/src/pages/store/StoreSort.vue index bd7c2ce..9f0651e 100644 --- a/src/pages/store/StoreSort.vue +++ b/src/pages/store/StoreSort.vue @@ -42,15 +42,6 @@
- - 保存排序 - @@ -140,6 +131,7 @@ async function loadData(): Promise { onMounted(async () => { navBarStore.clearRight(); + navBarStore.setRightText("保存", "var(--td-brand-color)", saveSort); try { await loadData(); } catch { @@ -192,12 +184,6 @@ onUnmounted(() => { text-align: center; } - .save { - left: 1rem; - right: 1rem; - bottom: calc(.75rem + env(safe-area-inset-bottom, 0)); - position: fixed; - } } :global(html.theme-dark) { diff --git a/src/router/routes/pointRoutes.ts b/src/router/routes/pointRoutes.ts index 7ae9952..eb5a779 100644 --- a/src/router/routes/pointRoutes.ts +++ b/src/router/routes/pointRoutes.ts @@ -5,6 +5,7 @@ import PointLedgerDetail from "@/pages/point/PointLedgerDetail.vue"; import PointLedgerList from "@/pages/point/PointLedgerList.vue"; import PointRuleEdit from "@/pages/point/PointRuleEdit.vue"; import PointRuleList from "@/pages/point/PointRuleList.vue"; +import PointRuleSort from "@/pages/point/PointRuleSort.vue"; const pointRoutes: RouteRecordRaw[] = [ { @@ -21,6 +22,20 @@ const pointRoutes: RouteRecordRaw[] = [ darkBodyBackground: "#10161f" } }, + { + path: "/management/points/rules/sort", + name: "PointRuleSort", + component: PointRuleSort, + meta: { + depth: 4, + navBarVisible: true, + navBarCanBack: true, + navBarTitle: "积分规则排序", + tabBarVisible: false, + bodyBackground: "#F5F5F8", + darkBodyBackground: "#10161f" + } + }, { path: "/management/points/ledger", name: "PointLedgerList",