add button store diary list

This commit is contained in:
Timi
2026-09-02 13:21:54 +08:00
parent f3602f232d
commit ddbb7e57af
2 changed files with 45 additions and 28 deletions
+6 -9
View File
@@ -1,9 +1,6 @@
<template>
<div v-can="pageAccess" class="store-diary-edit">
<t-form class="form" label-align="left" label-width="5rem" v-entrance-transition>
<t-form-item label="所属门店">
<div class="picker-text" v-text="selectedStoreName" />
</t-form-item>
<t-form-item label="日记标题" required-mark>
<t-input
v-model.trim="article.title"
@@ -127,6 +124,11 @@ function updateArticle(value: ArticleEditorArticle): void {
};
}
function getCreateTitle(): string {
const title = route.query.title;
return Array.isArray(title) ? String(title[0] || "") : String(title || "");
}
// ---------- 附加照片 ----------
const photoInputRef = ref<HTMLInputElement>();
@@ -204,12 +206,6 @@ function buildAdditionalAttachmentList(): Attachment[] {
});
}
const selectedStoreName = computed(() => {
const store = currentStoreStore.storeList.find(item => item.id === article.value.bizId)
|| (currentStoreStore.loginStore?.id === article.value.bizId ? currentStoreStore.loginStore : undefined);
return store?.name || store?.code || "请选择门店";
});
// ---------- 媒体上传 ----------
async function uploadMedia(file: File): Promise<UploadResult> {
@@ -334,6 +330,7 @@ async function loadArticle(): Promise<void> {
if (isCreateMode.value) {
article.value = {
...createEmptyArticle(),
title: getCreateTitle(),
bizId: article.value.bizId || currentStoreStore.currentStoreId
};
photoItemList.value = [];
+27 -7
View File
@@ -1,12 +1,13 @@
<template>
<div v-can="permissionCodes.storeDiary.read" class="store-diary-list">
<t-pull-down-refresh
class="list-wrapper"
v-can="permissionCodes.storeDiary.read"
class="store-diary-list"
v-model="isRefreshing"
:refresh-timeout="30000"
@refresh="refresh"
@scrolltolower="loadMore"
>
<div class="content">
<section class="calendar" v-entrance-transition>
<t-calendar
:key="calendarRenderKey"
@@ -20,6 +21,15 @@
@select="selectCalendarDate"
/>
</section>
<t-button
v-if="canCreate"
class="cell-button"
theme="primary"
block
@click="toCreateToday"
>
新增今天日记
</t-button>
<t-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line" theme="card">
<t-swipe-cell
v-for="(item, index) in pageResult.list"
@@ -41,8 +51,8 @@
</t-swipe-cell>
</t-cell-group>
<div class="center-tips" v-text="loadStateText" />
</t-pull-down-refresh>
</div>
</t-pull-down-refresh>
<nav-bar-action-menu v-if="canShowActionMenu" :actions="actionList" />
<bottom-popup
v-model="diaryPopupVisible"
@@ -343,6 +353,13 @@ async function toCreate(): Promise<void> {
await router.push({ name: "StoreDiaryCreate" });
}
async function toCreateToday(): Promise<void> {
await router.push({
name: "StoreDiaryCreate",
query: { title: Time.formatDate(new Date()) }
});
}
async function toDetail(item: StoreDiary): Promise<void> {
if (!item.id) {
return;
@@ -417,12 +434,15 @@ onUnmounted(() => navBarStore.clearRight());
<style scoped lang="less">
.store-diary-list {
padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
.list-wrapper {
min-height: 70vh;
.content {
gap: 1rem;
display: flex;
flex-direction: column;
.calendar {
margin: 0 1rem 1rem;
margin: 0 1rem;
overflow: hidden;
background: var(--td-bg-color-container);
box-shadow: var(--td-shadow-1);
@@ -460,7 +480,6 @@ onUnmounted(() => navBarStore.clearRight());
.items {
overflow: hidden;
}
}
.center-tips {
padding: 1rem;
@@ -468,6 +487,7 @@ onUnmounted(() => navBarStore.clearRight());
font-size: .8125rem;
text-align: center;
}
}
}
.diary-popup {