add store auto closed day
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
</div>
|
||||
</header>
|
||||
<div class="calendar-card">
|
||||
<card-title description="设置门店休息日,该日无任何登记记录不视为中断连续登记事件" />
|
||||
<t-calendar
|
||||
:key="calendarRenderKey"
|
||||
class="calendar"
|
||||
@@ -39,19 +40,19 @@
|
||||
</div>
|
||||
<t-form label-align="left">
|
||||
<t-form-item label="状态">
|
||||
<t-radio-group v-model="formModel.openStatus" variant="default-filled">
|
||||
<t-radio-group v-model="formModel.status" variant="default-filled">
|
||||
<t-radio :block="false" borderless value="OPEN">营业</t-radio>
|
||||
<t-radio :block="false" borderless value="CLOSED">休息</t-radio>
|
||||
</t-radio-group>
|
||||
</t-form-item>
|
||||
<t-form-item
|
||||
class="reason"
|
||||
:class="{ 'is-hidden': formModel.openStatus !== 'CLOSED' }"
|
||||
:class="{ 'is-hidden': formModel.status !== 'CLOSED' }"
|
||||
label="原因"
|
||||
>
|
||||
<t-input
|
||||
v-model.trim="formModel.reason"
|
||||
:disabled="formModel.openStatus !== 'CLOSED'"
|
||||
:disabled="formModel.status !== 'CLOSED'"
|
||||
placeholder="休息原因或备注"
|
||||
borderless
|
||||
/>
|
||||
@@ -84,7 +85,7 @@
|
||||
import { DialogPlugin, Toast, type CalendarProps, type TDate } from "tdesign-mobile-vue";
|
||||
import { useUserStore } from "timi-web";
|
||||
import StoreAPI from "@/api/StoreAPI";
|
||||
import type { Store, StoreBusinessDay, StoreBusinessDayOpenStatus } from "@/types/Store";
|
||||
import type { Store, StoreBusinessDay, StoreBusinessDayStatus } from "@/types/Store";
|
||||
import { gaoRoleCodes, permissionCodes } from "@/utils/permission";
|
||||
|
||||
defineOptions({
|
||||
@@ -130,8 +131,8 @@ const calendarFormat = computed<NonNullable<CalendarProps["format"]>>(() => {
|
||||
}
|
||||
return {
|
||||
...dateItem,
|
||||
className: `business-day-${day.openStatus!.toLowerCase()}`,
|
||||
suffix: day.openStatus === "OPEN" ? "营" : "休"
|
||||
className: `business-day-${day.status!.toLowerCase()}`,
|
||||
suffix: day.status === "OPEN" ? "营" : "休"
|
||||
};
|
||||
};
|
||||
});
|
||||
@@ -176,7 +177,7 @@ const isDeleting = ref(false);
|
||||
const editingId = ref("");
|
||||
const formModel = reactive({
|
||||
dateText: "",
|
||||
openStatus: "OPEN" as StoreBusinessDayOpenStatus,
|
||||
status: "OPEN" as StoreBusinessDayStatus,
|
||||
reason: "正常休息"
|
||||
});
|
||||
const savePermissionCode = computed(() => {
|
||||
@@ -192,7 +193,7 @@ function openDayEditor(day?: StoreBusinessDay, dateValue = toDateValue(new Date(
|
||||
editingId.value = day?.id || "";
|
||||
Object.assign(formModel, {
|
||||
dateText: formatDateValue(day?.dateValue || dateValue),
|
||||
openStatus: day?.openStatus || "OPEN",
|
||||
status: day?.status || "OPEN",
|
||||
reason: day ? day.reason : "正常休息"
|
||||
});
|
||||
editorVisible.value = true;
|
||||
@@ -215,8 +216,8 @@ async function saveDay(): Promise<void> {
|
||||
id: editingId.value || undefined,
|
||||
storeId: storeId.value,
|
||||
dateValue: parseDateValue(formModel.dateText),
|
||||
openStatus: formModel.openStatus,
|
||||
reason: formModel.openStatus === "CLOSED" ? formModel.reason || undefined : undefined
|
||||
status: formModel.status,
|
||||
reason: formModel.status === "CLOSED" ? formModel.reason || undefined : undefined
|
||||
};
|
||||
if (editingId.value) {
|
||||
await StoreAPI.updateBusinessDay(day);
|
||||
@@ -317,10 +318,11 @@ onMounted(async () => {
|
||||
.store-business-day-calendar {
|
||||
gap: .75rem;
|
||||
display: grid;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 1rem 6rem;
|
||||
padding: calc(var(--app-nav-height) + 1rem) 0 6rem;
|
||||
|
||||
.summary {
|
||||
gap: .75rem;
|
||||
margin: 0 1rem;
|
||||
display: flex;
|
||||
padding: .75rem;
|
||||
border-radius: .75rem;
|
||||
@@ -350,6 +352,7 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
:deep(.t-calendar) {
|
||||
margin: 0 1rem;
|
||||
z-index: 1;
|
||||
overflow: hidden;
|
||||
border-radius: .75rem;
|
||||
|
||||
Reference in New Issue
Block a user