diff --git a/package.json b/package.json
index b91e6e8..fb01304 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
"echarts-wordcloud": "^2.1.0",
"less": "^4.3.0",
"pinia": "^3.0.2",
- "tdesign-mobile-vue": "^1.16.0",
+ "tdesign-mobile-vue": "^1.16.2",
"timi-tdesign-mobile": "link:E:/WebProject/timi-tdesign-mobile",
"timi-web": "link:E:/WebProject/timi-web",
"timi-web-api": "link:E:/WebProject/timi-web-api",
diff --git a/patches/tdesign-mobile-vue@1.16.0.patch b/patches/tdesign-mobile-vue@1.16.0.patch
index 682a5dd..8e56773 100644
--- a/patches/tdesign-mobile-vue@1.16.0.patch
+++ b/patches/tdesign-mobile-vue@1.16.0.patch
@@ -1,80 +1,21 @@
-diff --git a/es/swiper/props.mjs b/es/swiper/props.mjs
---- a/es/swiper/props.mjs
-+++ b/es/swiper/props.mjs
-@@ -55,5 +55,5 @@
- },
- navigation: {
-- type: [Object, Function]
-+ type: [Boolean, Object, Function]
- },
- nextMargin: {
-diff --git a/esm/swiper/props.js b/esm/swiper/props.js
---- a/esm/swiper/props.js
-+++ b/esm/swiper/props.js
-@@ -55,5 +55,5 @@
- },
- navigation: {
-- type: [Object, Function]
-+ type: [Boolean, Object, Function]
- },
- nextMargin: {
-diff --git a/lib/swiper/props.js b/lib/swiper/props.js
---- a/lib/swiper/props.js
-+++ b/lib/swiper/props.js
-@@ -55,5 +55,5 @@
- },
- navigation: {
-- type: [Object, Function]
-+ type: [Boolean, Object, Function]
- },
- nextMargin: {
diff --git a/cjs/swiper/props.js b/cjs/swiper/props.js
+index 5615922a8c3410f703f768e363d39afa3138e7b1..b9a192a32dba34970287d0521e7e2077ac5b034c 100644
--- a/cjs/swiper/props.js
+++ b/cjs/swiper/props.js
-@@ -59,5 +59,5 @@
+@@ -57,7 +57,7 @@ var props = {
+ default: true
},
navigation: {
- type: [Object, Function]
+ type: [Boolean, Object, Function]
},
nextMargin: {
-diff --git a/es/swiper/type.d.ts b/es/swiper/type.d.ts
---- a/es/swiper/type.d.ts
-+++ b/es/swiper/type.d.ts
-@@ -10,6 +10,6 @@
- height?: string | number;
- interval?: number;
- loop?: boolean;
-- navigation?: SwiperNavigation | TNode;
-+ navigation?: boolean | SwiperNavigation | TNode;
- nextMargin?: string | number;
- previousMargin?: string | number;
-diff --git a/esm/swiper/type.d.ts b/esm/swiper/type.d.ts
---- a/esm/swiper/type.d.ts
-+++ b/esm/swiper/type.d.ts
-@@ -10,6 +10,6 @@
- height?: string | number;
- interval?: number;
- loop?: boolean;
-- navigation?: SwiperNavigation | TNode;
-+ navigation?: boolean | SwiperNavigation | TNode;
- nextMargin?: string | number;
- previousMargin?: string | number;
-diff --git a/lib/swiper/type.d.ts b/lib/swiper/type.d.ts
---- a/lib/swiper/type.d.ts
-+++ b/lib/swiper/type.d.ts
-@@ -10,6 +10,6 @@
- height?: string | number;
- interval?: number;
- loop?: boolean;
-- navigation?: SwiperNavigation | TNode;
-+ navigation?: boolean | SwiperNavigation | TNode;
- nextMargin?: string | number;
- previousMargin?: string | number;
+ type: [String, Number],
diff --git a/cjs/swiper/type.d.ts b/cjs/swiper/type.d.ts
+index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644
--- a/cjs/swiper/type.d.ts
+++ b/cjs/swiper/type.d.ts
-@@ -10,6 +10,6 @@
+@@ -10,7 +10,7 @@ export interface TdSwiperProps {
height?: string | number;
interval?: number;
loop?: boolean;
@@ -82,10 +23,14 @@ diff --git a/cjs/swiper/type.d.ts b/cjs/swiper/type.d.ts
+ navigation?: boolean | SwiperNavigation | TNode;
nextMargin?: string | number;
previousMargin?: string | number;
+ onChange?: (current: number, context: {
diff --git a/es/shared/hover.mjs b/es/shared/hover.mjs
+index 634ba6d66891d1c98d62c48d2069a0519a6633ed..20c84d3176f194afe1fa530d8db3a87b0faf2979 100644
--- a/es/shared/hover.mjs
+++ b/es/shared/hover.mjs
-@@ -50,29 +50,33 @@
+@@ -48,13 +48,15 @@ var Hover = {
+ current: state,
+ timers: [],
add: function add() {
- if (ctx.current.disabledHover || !ctx.current.className) return;
- if (!el.classList.contains(ctx.current.className)) {
@@ -103,8 +48,7 @@ diff --git a/es/shared/hover.mjs b/es/shared/hover.mjs
},
clearTimers: function clearTimers() {
ctx.timers.forEach(function (t) {
- return window.clearTimeout(t);
- });
+@@ -63,18 +65,20 @@ var Hover = {
ctx.timers = [];
},
downHandler: function downHandler() {
@@ -127,3 +71,83 @@ diff --git a/es/shared/hover.mjs b/es/shared/hover.mjs
- }, ctx.current.stayTime));
+ }, current.stayTime));
},
+ cancelHandler: function cancelHandler() {
+ ctx.clearTimers();
+diff --git a/es/swiper/props.mjs b/es/swiper/props.mjs
+index a48cee3e0abe71c2ef1f3e83303ec061cb098f8d..27511b26df36116f59a27b584120ea71451d7bf0 100644
+--- a/es/swiper/props.mjs
++++ b/es/swiper/props.mjs
+@@ -53,7 +53,7 @@ var props = {
+ default: true
+ },
+ navigation: {
+- type: [Object, Function]
++ type: [Boolean, Object, Function]
+ },
+ nextMargin: {
+ type: [String, Number],
+diff --git a/es/swiper/type.d.ts b/es/swiper/type.d.ts
+index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644
+--- a/es/swiper/type.d.ts
++++ b/es/swiper/type.d.ts
+@@ -10,7 +10,7 @@ export interface TdSwiperProps {
+ height?: string | number;
+ interval?: number;
+ loop?: boolean;
+- navigation?: SwiperNavigation | TNode;
++ navigation?: boolean | SwiperNavigation | TNode;
+ nextMargin?: string | number;
+ previousMargin?: string | number;
+ onChange?: (current: number, context: {
+diff --git a/esm/swiper/props.js b/esm/swiper/props.js
+index 1b4ac31d550b0cb1aac6cc0f4bca7590d6df16cb..c959b7eaa05bd34704bf724f77fe5be230dbb0ad 100644
+--- a/esm/swiper/props.js
++++ b/esm/swiper/props.js
+@@ -53,7 +53,7 @@ var props = {
+ default: true
+ },
+ navigation: {
+- type: [Object, Function]
++ type: [Boolean, Object, Function]
+ },
+ nextMargin: {
+ type: [String, Number],
+diff --git a/esm/swiper/type.d.ts b/esm/swiper/type.d.ts
+index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644
+--- a/esm/swiper/type.d.ts
++++ b/esm/swiper/type.d.ts
+@@ -10,7 +10,7 @@ export interface TdSwiperProps {
+ height?: string | number;
+ interval?: number;
+ loop?: boolean;
+- navigation?: SwiperNavigation | TNode;
++ navigation?: boolean | SwiperNavigation | TNode;
+ nextMargin?: string | number;
+ previousMargin?: string | number;
+ onChange?: (current: number, context: {
+diff --git a/lib/swiper/props.js b/lib/swiper/props.js
+index 1b4ac31d550b0cb1aac6cc0f4bca7590d6df16cb..c959b7eaa05bd34704bf724f77fe5be230dbb0ad 100644
+--- a/lib/swiper/props.js
++++ b/lib/swiper/props.js
+@@ -53,7 +53,7 @@ var props = {
+ default: true
+ },
+ navigation: {
+- type: [Object, Function]
++ type: [Boolean, Object, Function]
+ },
+ nextMargin: {
+ type: [String, Number],
+diff --git a/lib/swiper/type.d.ts b/lib/swiper/type.d.ts
+index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644
+--- a/lib/swiper/type.d.ts
++++ b/lib/swiper/type.d.ts
+@@ -10,7 +10,7 @@ export interface TdSwiperProps {
+ height?: string | number;
+ interval?: number;
+ loop?: boolean;
+- navigation?: SwiperNavigation | TNode;
++ navigation?: boolean | SwiperNavigation | TNode;
+ nextMargin?: string | number;
+ previousMargin?: string | number;
+ onChange?: (current: number, context: {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 2863f09..f06ec76 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -30,8 +30,8 @@ importers:
specifier: ^3.0.2
version: 3.0.4(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3))
tdesign-mobile-vue:
- specifier: ^1.16.0
- version: 1.16.0(vue@3.5.40(typescript@5.8.3))
+ specifier: ^1.16.2
+ version: 1.16.2(vue@3.5.40(typescript@5.8.3))
timi-tdesign-mobile:
specifier: link:E:/WebProject/timi-tdesign-mobile
version: link:../timi-tdesign-mobile
@@ -1735,13 +1735,13 @@ packages:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
- tdesign-icons-vue-next@0.4.7:
- resolution: {integrity: sha512-0TRVH0L9O7vAMQ7j2vU/VYBMzS5FI+OVf7bWjwAVMmWXArsAyJI8mzpNWThZok96B6hsRY+2hK/NSOFZy8hMqA==}
+ tdesign-icons-vue-next@0.4.11:
+ resolution: {integrity: sha512-lBkRUy8bdb6lQLFOOkSb1LPdl4CmZRewrc8SOUlmWkDD/DG3BTsSd/ZQ4Z767pPSlypyvxwSwcJgRv6+zjubAQ==}
peerDependencies:
vue: ^3.0.0
- tdesign-mobile-vue@1.16.0:
- resolution: {integrity: sha512-Msn9PRrOkJD22hGFqSS3l0gvoaXTB2a5CTyvzazzPTITJmkY4CnC7ySbOsGxlA2qT/HyL44v+JJYauzUycQ1Fg==}
+ tdesign-mobile-vue@1.16.2:
+ resolution: {integrity: sha512-05lOApsyGeIFzlOuJvvm+P0o3h7FeHM9HsPcslRFPwOQXIZW1AvJhnvP7aon3mdFtUEFdeja6yq7uJB8Os4haQ==}
engines: {node: '>=12.0.0'}
peerDependencies:
vue: ^3.2.6
@@ -3673,19 +3673,19 @@ snapshots:
dependencies:
has-flag: 4.0.0
- tdesign-icons-vue-next@0.4.7(vue@3.5.40(typescript@5.8.3)):
+ tdesign-icons-vue-next@0.4.11(vue@3.5.40(typescript@5.8.3)):
dependencies:
'@babel/runtime': 7.29.7
vue: 3.5.40(typescript@5.8.3)
- tdesign-mobile-vue@1.16.0(vue@3.5.40(typescript@5.8.3)):
+ tdesign-mobile-vue@1.16.2(vue@3.5.40(typescript@5.8.3)):
dependencies:
'@babel/runtime': 7.29.7
'@use-gesture/vanilla': 10.3.1
'@vueuse/core': 10.7.0(vue@3.5.40(typescript@5.8.3))
dayjs: 1.11.21
lodash-es: 4.18.1
- tdesign-icons-vue-next: 0.4.7(vue@3.5.40(typescript@5.8.3))
+ tdesign-icons-vue-next: 0.4.11(vue@3.5.40(typescript@5.8.3))
tinycolor2: 1.6.0
validator: 13.15.35
vue: 3.5.40(typescript@5.8.3)
diff --git a/src/components/EventRecordVerifyDialog.vue b/src/components/EventRecordVerifyDialog.vue
index cd6d730..ba67cb9 100644
--- a/src/components/EventRecordVerifyDialog.vue
+++ b/src/components/EventRecordVerifyDialog.vue
@@ -10,57 +10,28 @@
-
+ v-model:items="photoItemList"
+ :busy="isPhotoUploading"
+ @select="handlePhotoSelected($event.files)"
+ >
+
+
-
-
-
diff --git a/src/components/attachmentSelector/AttachmentViewerActions.vue b/src/components/attachmentSelector/AttachmentViewerActions.vue
new file mode 100644
index 0000000..79470a1
--- /dev/null
+++ b/src/components/attachmentSelector/AttachmentViewerActions.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
修改类型
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/attachmentSelector/types.ts b/src/components/attachmentSelector/types.ts
new file mode 100644
index 0000000..6e8858c
--- /dev/null
+++ b/src/components/attachmentSelector/types.ts
@@ -0,0 +1,6 @@
+export type {
+ AttachmentSelectorItem,
+ AttachmentSelectorProps,
+ AttachmentSelectorSelection,
+ AttachmentSelectorViewerItem
+} from "timi-tdesign-mobile";
diff --git a/src/components/mediaSelector/MediaSelector.vue b/src/components/mediaSelector/MediaSelector.vue
deleted file mode 100644
index 399a8c5..0000000
--- a/src/components/mediaSelector/MediaSelector.vue
+++ /dev/null
@@ -1,276 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/components/mediaSelector/MediaSelectorAdd.vue b/src/components/mediaSelector/MediaSelectorAdd.vue
deleted file mode 100644
index db84b87..0000000
--- a/src/components/mediaSelector/MediaSelectorAdd.vue
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
-
-
-
-
-
- 拍摄
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/mediaSelector/MediaSelectorItem.vue b/src/components/mediaSelector/MediaSelectorItem.vue
deleted file mode 100644
index 1ca9ab6..0000000
--- a/src/components/mediaSelector/MediaSelectorItem.vue
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/mediaSelector/MediaSelectorViewer.vue b/src/components/mediaSelector/MediaSelectorViewer.vue
deleted file mode 100644
index 8193fa5..0000000
--- a/src/components/mediaSelector/MediaSelectorViewer.vue
+++ /dev/null
@@ -1,237 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
修改类型
-
-
-
-
-
-
-
-
-
-
- 删除
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/mediaSelector/types.ts b/src/components/mediaSelector/types.ts
deleted file mode 100644
index 93d8fa4..0000000
--- a/src/components/mediaSelector/types.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import type { ButtonProps } from "tdesign-mobile-vue";
-import type { PhotoItem } from "@/types/Photo.ts";
-
-export type MediaSelectorAddAction = {
- icon?: string;
- emit: string;
- text: string;
- theme?: ButtonProps["theme"];
-};
-
-export type MediaSelectorViewerItem = PhotoItem & {
- sourceIndex: number;
-};
diff --git a/src/components/mediaSelector/utils.ts b/src/components/mediaSelector/utils.ts
deleted file mode 100644
index 184491d..0000000
--- a/src/components/mediaSelector/utils.ts
+++ /dev/null
@@ -1,55 +0,0 @@
-import type { PhotoItem } from "@/types/Photo.ts";
-import { getAttachmentReadURL } from "@/utils/attachment.ts";
-
-const ATTACH_TYPE_TEXT_MAP: Record = {
- ADDITIONAL: "附加照片",
- PHOTO: "照片",
- POINT_CARD: "积分卡",
- OTHER: "其他文件"
-};
-
-/** 缩略图宽度查询串,地址中出现即表示已带缩略图参数 */
-const THUMBNAIL_WIDTH_QUERY = "thumbWidth=";
-
-/** 缩略图兜底尺寸(像素),用于地址未带缩略图参数但可定位附件的场景 */
-const FALLBACK_THUMBNAIL_SIZE = 128;
-
-export function getAttachTypeText(attachType?: string): string {
- return ATTACH_TYPE_TEXT_MAP[attachType || "PHOTO"] || "其他文件";
-}
-
-export function getMediaPreviewURL(item: PhotoItem): string {
- return item.previewUrl || item.url;
-}
-
-/**
- * 解析媒体缩略图地址。
- *
- * 后端读附件接口只要带缩略图参数,视频附件同样返回该视频的缩略帧,
- * 因此视频在列表中统一按图片渲染;临时上传文件没有缩略图,返回空字符串由调用方降级。
- */
-export function getMediaThumbnailURL(item: PhotoItem): string {
- if (item.url.includes(THUMBNAIL_WIDTH_QUERY)) {
- return item.url;
- }
-
- const attachmentId = item.attachment?.id;
- return attachmentId ? getAttachmentReadURL(attachmentId, FALLBACK_THUMBNAIL_SIZE) : "";
-}
-
-export function isVideoItem(item: PhotoItem): boolean {
- const mimeType = (item.mimeType || item.attachment?.mimeType || "").toLowerCase();
- if (mimeType.startsWith("video/")) {
- return true;
- }
-
- return /\.(avi|m4v|mkv|mov|mp4|mpeg|mpg|ogv|webm|wmv)(?:$|[?#])/i.test(item.url);
-}
-
-export function normalizePhotoItem(item: PhotoItem): PhotoItem {
- return {
- ...item,
- attachType: item.attachType || item.attachment?.attachType || "PHOTO",
- mimeType: item.mimeType || item.attachment?.mimeType
- };
-}
diff --git a/src/pages/customer/CustomerDetail.vue b/src/pages/customer/CustomerDetail.vue
index 8c18e4b..5cc7d2c 100644
--- a/src/pages/customer/CustomerDetail.vue
+++ b/src/pages/customer/CustomerDetail.vue
@@ -79,17 +79,25 @@
-
+ >
+
+
+
+
+
+
+
(customer.value?.attachmentList || [])
previewUrl: getAttachmentReadURL(item.id || ""),
url: getAttachmentReadURL(item.id || "", 90)
})));
-const photoList = computed(() => photoItemList.value.map(item => item.url));
+const isPhotoSaving = ref(false);
async function submitPhotoItems(photoItems: PhotoItem[]): Promise {
const currentCustomer = customer.value;
@@ -297,6 +306,35 @@ async function submitPhotoItems(photoItems: PhotoItem[]): Promise {
};
}
+async function applyPhotoItems(photoItems: PhotoItem[], close: () => void): Promise {
+ if (isPhotoSaving.value) {
+ return;
+ }
+ isPhotoSaving.value = true;
+ try {
+ await submitPhotoItems(photoItems);
+ close();
+ } catch {
+ Message.error("媒体修改失败");
+ } finally {
+ isPhotoSaving.value = false;
+ }
+}
+
+async function changePhotoType(index: number, attachType: string, close: () => void): Promise {
+ if (!photoItemList.value[index] || photoItemList.value[index].attachType === attachType) {
+ return;
+ }
+ await applyPhotoItems(photoItemList.value.map((item, itemIndex) => itemIndex === index ? { ...item, attachType } : item), close);
+}
+
+async function removePhoto(index: number, close: () => void): Promise {
+ if (!photoItemList.value[index]) {
+ return;
+ }
+ await applyPhotoItems(photoItemList.value.filter((_, itemIndex) => itemIndex !== index), close);
+}
+
function buildPhotoAttachmentList(photoItems: PhotoItem[]): Attachment[] {
return photoItems.flatMap(item => {
if (item.attachment) {
@@ -621,7 +659,7 @@ onUnmounted(() => clearPageNavBarRight());
}
}
- :deep(.media-selector) {
+ :deep(.attachment-selector) {
padding: 1rem;
}
diff --git a/src/pages/customer/CustomerEdit.vue b/src/pages/customer/CustomerEdit.vue
index 4e47200..e208431 100644
--- a/src/pages/customer/CustomerEdit.vue
+++ b/src/pages/customer/CustomerEdit.vue
@@ -116,21 +116,28 @@
-
+
+
+
+
+
+
+ 拍积分卡
+
+
+
当前账户权限编辑客户需要上传照片和积分卡
@@ -219,29 +226,6 @@
/>
-
-
-
void): void {
+ isPointCardCapture.value = true;
+ capturePhoto();
+ isPointCardCapture.value = false;
}
watch(isCustomerBound, (value) => {
@@ -675,29 +633,10 @@ watch(() => formData.birthdate, (value) => {
// ---------- 照片 ----------
-const photoInputRef = ref();
-const photoCameraInputRef = ref();
-const videoInputRef = ref();
-const photoAddActions = [
- {
- icon: "cardmembership",
- text: "拍积分卡",
- emit: "add-point-card",
- theme: "primary"
- }
-] as const;
+const isPointCardCapture = ref(false);
const photoPickerTarget = ref("PHOTO");
const isPhotoUploading = ref(false);
const photoItemList = ref([]);
-const photoList = computed({
- get() {
- return photoItemList.value.map(item => item.url);
- },
- set(value) {
- const urlSet = new Set(value);
- photoItemList.value = photoItemList.value.filter(item => urlSet.has(item.url));
- }
-});
function normalizeAttachmentType(attachType?: string): CustomerAttachmentType {
if (attachType === "POINT_CARD" || attachType === "OTHER") {
@@ -724,28 +663,26 @@ function validateCustomerPhotoList(): boolean {
return true;
}
-async function handlePhotoSelected(event: Event): Promise {
- const input = event.target as HTMLInputElement;
- const file = input.files?.[0];
- if (!file) {
+async function handlePhotoSelected(files: File[]): Promise {
+ if (!files.length) {
return;
}
- saveCapturedFilesFromInput(input, [file]);
isPhotoUploading.value = true;
try {
- const compressedFile = await compressUploadImage(file);
- const [tempFile] = await AttachmentAPI.upload(compressedFile);
- if (tempFile?.id) {
+ const tempFileList = await AttachmentAPI.upload(await compressUploadImageList(files));
+ for (const [index, tempFile] of tempFileList.entries()) {
+ if (!tempFile.id) {
+ continue;
+ }
photoItemList.value.push({
attachType: photoPickerTarget.value,
- mimeType: file.type,
+ mimeType: files[index]?.type,
tempFileId: tempFile.id,
url: AttachmentAPI.getTempReadURL(tempFile.id)
});
}
} finally {
isPhotoUploading.value = false;
- input.value = "";
}
}
@@ -919,6 +856,8 @@ function buildAttachmentList(): Attachment[] {
.photo {
width: 100%;
+
+
.tips {
font-size: .875rem;
text-align: center;
diff --git a/src/pages/event/EventRecordDetail.vue b/src/pages/event/EventRecordDetail.vue
index 7f1ba3e..3a447cc 100644
--- a/src/pages/event/EventRecordDetail.vue
+++ b/src/pages/event/EventRecordDetail.vue
@@ -110,15 +110,21 @@
核销登记记录
();
const isLoading = ref(false);
const isVerifying = ref(false);
const isDeleting = ref(false);
+const isPhotoSaving = ref(false);
const verifyDialogVisible = ref(false);
const isRetiredRecord = computed(() => isRetiredEvent(record.value?.event));
@@ -222,8 +230,6 @@ const recordPhotoItemList = computed(() => (record.value?.attachmentList || [])
previewUrl: getAttachmentReadURL(item.id || ""),
url: getAttachmentReadURL(item.id || "", 64)
})));
-const recordPhotoList = computed(() => recordPhotoItemList.value.map(item => item.url));
-
async function submitPhotoItems(photoItems: PhotoItem[]): Promise {
const currentRecord = record.value;
if (!currentRecord?.id || isRetiredRecord.value) {
@@ -242,6 +248,35 @@ async function submitPhotoItems(photoItems: PhotoItem[]): Promise {
};
}
+async function applyPhotoItems(photoItems: PhotoItem[], close: () => void): Promise {
+ if (isPhotoSaving.value) {
+ return;
+ }
+ isPhotoSaving.value = true;
+ try {
+ await submitPhotoItems(photoItems);
+ close();
+ } catch (error) {
+ Message.error(getErrorMessage(error, "登记照片修改失败"));
+ } finally {
+ isPhotoSaving.value = false;
+ }
+}
+
+async function changePhotoType(index: number, attachType: string, close: () => void): Promise {
+ if (!recordPhotoItemList.value[index] || recordPhotoItemList.value[index].attachType === attachType) {
+ return;
+ }
+ await applyPhotoItems(recordPhotoItemList.value.map((item, itemIndex) => itemIndex === index ? { ...item, attachType } : item), close);
+}
+
+async function removePhoto(index: number, close: () => void): Promise {
+ if (!recordPhotoItemList.value[index]) {
+ return;
+ }
+ await applyPhotoItems(recordPhotoItemList.value.filter((_, itemIndex) => itemIndex !== index), close);
+}
+
function buildPhotoAttachmentList(photoItems: PhotoItem[]): Attachment[] {
return photoItems.flatMap(item => {
if (item.attachment) {
diff --git a/src/pages/event/EventRecordEdit.vue b/src/pages/event/EventRecordEdit.vue
index b882490..5b3851e 100644
--- a/src/pages/event/EventRecordEdit.vue
+++ b/src/pages/event/EventRecordEdit.vue
@@ -155,16 +155,12 @@
-
@@ -213,30 +209,6 @@
/>
-
-
-
();
- const recordPhotoCameraInputRef = ref();
- const videoInputRef = ref();
const photoItemList = ref([]);
const isPhotoUploading = ref(false);
- const photoList = computed({
- get() {
- return photoItemList.value.map(item => item.url);
- },
- set(value) {
- const urlSet = new Set(value);
- photoItemList.value = photoItemList.value.filter(item => urlSet.has(item.url));
- }
- });
- function capturePhoto(): void {
- recordPhotoCameraInputRef.value?.click();
- }
-
- function selectPhotoFile(): void {
- recordPhotoInputRef.value?.click();
- }
-
- function captureVideo(): void {
- videoInputRef.value?.click();
- }
-
- async function handleRecordPhotoSelected(event: Event): Promise {
- const input = event.target as HTMLInputElement;
- const fileList = Array.from(input.files || []);
+ async function handleRecordPhotoSelected(fileList: File[]): Promise {
if (!fileList.length) {
return;
}
- saveCapturedFilesFromInput(input, fileList);
isPhotoUploading.value = true;
try {
const compressedFileList = await compressUploadImageList(fileList);
@@ -56,7 +28,6 @@ export function useEventRecordPhoto() {
}
} finally {
isPhotoUploading.value = false;
- input.value = "";
}
}
@@ -93,15 +64,8 @@ export function useEventRecordPhoto() {
}
return {
- recordPhotoInputRef,
- recordPhotoCameraInputRef,
- videoInputRef,
photoItemList,
isPhotoUploading,
- photoList,
- capturePhoto,
- selectPhotoFile,
- captureVideo,
handleRecordPhotoSelected,
setExistingPhotoList,
buildTempFileIdList,
diff --git a/src/pages/followUpReminder/FollowUpReminderDetail.vue b/src/pages/followUpReminder/FollowUpReminderDetail.vue
index 8801631..edd2b8c 100644
--- a/src/pages/followUpReminder/FollowUpReminderDetail.vue
+++ b/src/pages/followUpReminder/FollowUpReminderDetail.vue
@@ -70,12 +70,8 @@
-
-
@@ -279,11 +275,9 @@
/>
-
@@ -383,7 +377,7 @@ import CodeScanner from "@/components/CodeScanner.vue";
import CustomerList from "@/components/CustomerList.vue";
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
import CustomerSelector from "@/components/CustomerSelector.vue";
-import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
+import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
import ProductSelectFormItem from "@/components/productSelector/ProductSelectFormItem.vue";
import ProductStockPreview from "@/components/ProductStockPreview.vue";
import { usePackagePurchase } from "@/pages/package/usePackagePurchase";
@@ -599,9 +593,6 @@ const photoItems = ref([]);
const paymentPhotoItems = ref([]);
const fulfillmentPhotoItems = ref([]);
const paymentAmountText = ref("0");
-const photoUrlList = computed(() => photoItems.value.map(item => item.url));
-const paymentPhotoUrlList = computed(() => paymentPhotoItems.value.map(item => item.url));
-const fulfillmentPhotoUrlList = computed(() => fulfillmentPhotoItems.value.map(item => item.url));
const receiveFullPayment = ref(false);
const fulfillAll = ref(false);
const isStockChecking = ref(false);
diff --git a/src/pages/point/PointRedemptionCreate.vue b/src/pages/point/PointRedemptionCreate.vue
index 7683e5d..2f09482 100644
--- a/src/pages/point/PointRedemptionCreate.vue
+++ b/src/pages/point/PointRedemptionCreate.vue
@@ -117,11 +117,9 @@
-
@@ -179,7 +177,7 @@ import PointAPI from "@/api/PointAPI";
import CodeScanner from "@/components/CodeScanner.vue";
import CustomerProfileCard from "@/components/CustomerProfileCard.vue";
import CustomerSelector from "@/components/CustomerSelector.vue";
-import MediaSelector from "@/components/mediaSelector/MediaSelector.vue";
+import AttachmentSelector from "@/components/attachmentSelector/AttachmentSelector.vue";
import type { Customer } from "@/types/Customer";
import type { PhotoItem } from "@/types/Photo";
import type { PointAccount, PointRedeemSku } from "@/types/Point";
@@ -245,7 +243,6 @@ const requestNo = ref("");
const saving = ref(false);
const canReadPointAccount = computed(() => userStore.hasPermissions(permissionCodes.point.accountRead));
const canAdjust = computed(() => userStore.hasPermissions(permissionCodes.pointRedemption.pointAdjust));
-const photoUrls = computed(() => photos.value.map(item => item.url));
const customerName = computed(() => customer.value?.name);
const skuName = computed(() => selectedSku.value ? `${selectedSku.value.product?.name || selectedSku.value.sku?.name || "未命名产品"} · ${selectedSku.value.unit?.name || ""}` : "");
const quantityStep = computed(() => getProductQuantityStep(selectedSku.value?.sku));
diff --git a/src/pages/point/PointRedemptionDetail.vue b/src/pages/point/PointRedemptionDetail.vue
index d26cbb0..b2dff16 100644
--- a/src/pages/point/PointRedemptionDetail.vue
+++ b/src/pages/point/PointRedemptionDetail.vue
@@ -22,11 +22,8 @@
-
@@ -69,11 +66,9 @@
-
@@ -85,13 +80,14 @@