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> <template>
<div v-can="pageAccess" class="store-diary-edit"> <div v-can="pageAccess" class="store-diary-edit">
<t-form class="form" label-align="left" label-width="5rem" v-entrance-transition> <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-form-item label="日记标题" required-mark>
<t-input <t-input
v-model.trim="article.title" 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>(); 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> { async function uploadMedia(file: File): Promise<UploadResult> {
@@ -334,6 +330,7 @@ async function loadArticle(): Promise<void> {
if (isCreateMode.value) { if (isCreateMode.value) {
article.value = { article.value = {
...createEmptyArticle(), ...createEmptyArticle(),
title: getCreateTitle(),
bizId: article.value.bizId || currentStoreStore.currentStoreId bizId: article.value.bizId || currentStoreStore.currentStoreId
}; };
photoItemList.value = []; photoItemList.value = [];
+27 -7
View File
@@ -1,12 +1,13 @@
<template> <template>
<div v-can="permissionCodes.storeDiary.read" class="store-diary-list">
<t-pull-down-refresh <t-pull-down-refresh
class="list-wrapper" v-can="permissionCodes.storeDiary.read"
class="store-diary-list"
v-model="isRefreshing" v-model="isRefreshing"
:refresh-timeout="30000" :refresh-timeout="30000"
@refresh="refresh" @refresh="refresh"
@scrolltolower="loadMore" @scrolltolower="loadMore"
> >
<div class="content">
<section class="calendar" v-entrance-transition> <section class="calendar" v-entrance-transition>
<t-calendar <t-calendar
:key="calendarRenderKey" :key="calendarRenderKey"
@@ -20,6 +21,15 @@
@select="selectCalendarDate" @select="selectCalendarDate"
/> />
</section> </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-cell-group v-if="pageResult.list.length" class="items fix-last-cell-line" theme="card">
<t-swipe-cell <t-swipe-cell
v-for="(item, index) in pageResult.list" v-for="(item, index) in pageResult.list"
@@ -41,8 +51,8 @@
</t-swipe-cell> </t-swipe-cell>
</t-cell-group> </t-cell-group>
<div class="center-tips" v-text="loadStateText" /> <div class="center-tips" v-text="loadStateText" />
</t-pull-down-refresh>
</div> </div>
</t-pull-down-refresh>
<nav-bar-action-menu v-if="canShowActionMenu" :actions="actionList" /> <nav-bar-action-menu v-if="canShowActionMenu" :actions="actionList" />
<bottom-popup <bottom-popup
v-model="diaryPopupVisible" v-model="diaryPopupVisible"
@@ -343,6 +353,13 @@ async function toCreate(): Promise<void> {
await router.push({ name: "StoreDiaryCreate" }); 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> { async function toDetail(item: StoreDiary): Promise<void> {
if (!item.id) { if (!item.id) {
return; return;
@@ -417,12 +434,15 @@ onUnmounted(() => navBarStore.clearRight());
<style scoped lang="less"> <style scoped lang="less">
.store-diary-list { .store-diary-list {
padding: calc(var(--app-nav-height) + 1rem) 0 1rem; padding: calc(var(--app-nav-height) + 1rem) 0 1rem;
.list-wrapper {
min-height: 70vh; min-height: 70vh;
.content {
gap: 1rem;
display: flex;
flex-direction: column;
.calendar { .calendar {
margin: 0 1rem 1rem; margin: 0 1rem;
overflow: hidden; overflow: hidden;
background: var(--td-bg-color-container); background: var(--td-bg-color-container);
box-shadow: var(--td-shadow-1); box-shadow: var(--td-shadow-1);
@@ -460,7 +480,6 @@ onUnmounted(() => navBarStore.clearRight());
.items { .items {
overflow: hidden; overflow: hidden;
} }
}
.center-tips { .center-tips {
padding: 1rem; padding: 1rem;
@@ -469,6 +488,7 @@ onUnmounted(() => navBarStore.clearRight());
text-align: center; text-align: center;
} }
} }
}
.diary-popup { .diary-popup {
padding-bottom: .5rem; padding-bottom: .5rem;