fix submit button position
This commit is contained in:
@@ -126,7 +126,6 @@
|
||||
multiple
|
||||
@change="handleRecordPhotoSelected"
|
||||
>
|
||||
<t-button theme="primary" class="save" :disabled="!canSubmit" :loading="saving" @click="saveRecord">提交</t-button>
|
||||
</div>
|
||||
<customer-selector
|
||||
v-model="selectedCustomerId"
|
||||
@@ -154,6 +153,7 @@ import { loadSourceValueConfig, type SourceValueConfig } from "@/utils/point";
|
||||
import { compressUploadImage, compressUploadImageList } from "@/utils/imageCompression";
|
||||
import EventSelector from "@/components/EventSelector.vue";
|
||||
import EventRecordAPI from "@/api/EventRecordAPI.ts";
|
||||
import { useNavBarStore } from "@/store/navBarStore";
|
||||
|
||||
defineOptions({
|
||||
name: "QuickEntryPage"
|
||||
@@ -162,7 +162,8 @@ defineOptions({
|
||||
const settingStore = useSettingStore();
|
||||
const router = useRouter();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const navBarStore = useNavBarStore();
|
||||
const hasCustomerDeletePermission = computed(() => userStore.hasPermissions(permissionCodes.customer.delete));
|
||||
|
||||
const eventList = ref<EventItem[]>([]);
|
||||
|
||||
@@ -243,7 +244,6 @@ function validateNumberValueList(): boolean {
|
||||
|
||||
const note = ref("");
|
||||
const saving = ref(false);
|
||||
const canSubmit = computed(() => !!inputCode.value && !!customerName.value.trim() && !customerPhotoUploading.value && !recordPhotoUploading.value);
|
||||
|
||||
let latestDecodedText = "";
|
||||
|
||||
@@ -539,6 +539,23 @@ function normalizeCustomerAttachmentType(attachType?: string): CustomerAttachmen
|
||||
return "PHOTO";
|
||||
}
|
||||
|
||||
function validateCustomerPhotoList(): boolean {
|
||||
if (hasCustomerDeletePermission.value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const attachTypeSet = new Set(customerPhotoItemList.value.map(item => item.attachType));
|
||||
if (!attachTypeSet.has("PHOTO")) {
|
||||
showToast("请上传客户照片", "warning");
|
||||
return false;
|
||||
}
|
||||
if (!attachTypeSet.has("POINT_CARD")) {
|
||||
showToast("请上传积分卡照片", "warning");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function handleCustomerPhotoSelected(event: Event): Promise<void> {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
@@ -611,6 +628,13 @@ async function handleRecordPhotoSelected(event: Event): Promise<void> {
|
||||
// ---------- 提交 ----------
|
||||
|
||||
async function saveRecord(): Promise<void> {
|
||||
if (saving.value) {
|
||||
return;
|
||||
}
|
||||
if (customerPhotoUploading.value || recordPhotoUploading.value) {
|
||||
showToast("照片正在上传,请稍候", "warning");
|
||||
return;
|
||||
}
|
||||
const customerCode = validateForm();
|
||||
if (!customerCode) {
|
||||
return;
|
||||
@@ -704,6 +728,9 @@ function validateForm(): string {
|
||||
showToast("请填写客户姓名", "warning");
|
||||
return "";
|
||||
}
|
||||
if (!validateCustomerPhotoList()) {
|
||||
return "";
|
||||
}
|
||||
if (!validateNumberValueList()) {
|
||||
return "";
|
||||
}
|
||||
@@ -729,9 +756,17 @@ function showToast(message: string, theme: "success" | "warning" = "success"): v
|
||||
// ---------- 初始化 ----------
|
||||
|
||||
onMounted(async () => {
|
||||
navBarStore.clearRight();
|
||||
if (userStore.hasPermissions(permissionCodes.eventRecord.create)) {
|
||||
navBarStore.setRightText("保存", "var(--td-brand-color)", saveRecord);
|
||||
}
|
||||
eventList.value = await EventAPI.listValid();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
navBarStore.clearRight();
|
||||
});
|
||||
|
||||
watch(selectedEventIdList, async () => {
|
||||
await loadSourceValueRule();
|
||||
}, { deep: true });
|
||||
@@ -797,12 +832,6 @@ watch(scanCode, (value) => {
|
||||
border-radius: 1rem;
|
||||
}
|
||||
|
||||
.save {
|
||||
left: 1rem;
|
||||
right: 1rem;
|
||||
bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
|
||||
position: fixed;
|
||||
}
|
||||
}
|
||||
|
||||
:global(html.theme-dark) {
|
||||
|
||||
Reference in New Issue
Block a user