use Message instead of Toast
This commit is contained in:
@@ -143,7 +143,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import { Message } from "@/utils/message";
|
||||
import { AttachmentAPI, PassTimeLabel, Text, useUserStore } from "timi-web";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import PointAPI from "@/api/PointAPI";
|
||||
@@ -264,7 +264,7 @@ async function loadCustomer(): Promise<void> {
|
||||
customerTagList.value = [];
|
||||
selectedTagIdList.value = [];
|
||||
console.warn("客户详情加载失败", err);
|
||||
Toast.warning("客户详情加载失败");
|
||||
Message.warning("客户详情加载失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ async function handleTagSelected(tagList: Tag[]): Promise<void> {
|
||||
});
|
||||
customerTagList.value = tagList;
|
||||
selectedTagIdList.value = tagList.map(item => item.id || "").filter(Boolean);
|
||||
Toast.success("客户标签已保存");
|
||||
Message.success("客户标签已保存");
|
||||
}
|
||||
|
||||
const inviter = computed(() => customer.value?.introducerCustomer);
|
||||
@@ -346,7 +346,7 @@ async function removeCustomer(id: string): Promise<void> {
|
||||
isRemoving.value = true;
|
||||
try {
|
||||
await CustomerAPI.remove(id);
|
||||
Toast.success("客户已删除");
|
||||
Message.success("客户已删除");
|
||||
await router.replace("/management/customers");
|
||||
} finally {
|
||||
isRemoving.value = false;
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { type Attachment, AttachmentAPI, useUserStore } from "timi-web";
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import { Message } from "@/utils/message";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import TagAPI from "@/api/TagAPI";
|
||||
import BodyAreaSelector from "@/components/BodyAreaSelector.vue";
|
||||
@@ -266,7 +266,7 @@ async function applyIntroducer(code: string): Promise<void> {
|
||||
formData.introducerCustomer = undefined;
|
||||
introducerCustomerId.value = "";
|
||||
scannerVisible.value = false;
|
||||
Toast.warning(`未匹配到 ${code} 编码介绍人,请选择或扫码已有客户`);
|
||||
Message.warning(`未匹配到 ${code} 编码介绍人,请选择或扫码已有客户`);
|
||||
return;
|
||||
}
|
||||
formData.introducerCustomerId = matched.id;
|
||||
@@ -394,7 +394,7 @@ async function loadDetail() {
|
||||
introducerCustomerId.value = customer.introducerCustomerId || customer.introducerCustomer?.id || "";
|
||||
} catch (err) {
|
||||
console.warn("客户详情加载失败", err);
|
||||
Toast.error("客户详情加载失败");
|
||||
Message.error("客户详情加载失败");
|
||||
}
|
||||
}
|
||||
onMounted(loadDetail);
|
||||
@@ -480,11 +480,11 @@ function validateCustomerPhotoList(): boolean {
|
||||
|
||||
const attachTypeSet = new Set(photoItemList.value.map(item => item.attachType));
|
||||
if (!attachTypeSet.has("PHOTO")) {
|
||||
Toast.warning("请上传客户照片");
|
||||
Message.warning("请上传客户照片");
|
||||
return false;
|
||||
}
|
||||
if (!attachTypeSet.has("POINT_CARD")) {
|
||||
Toast.warning("请上传积分卡照片");
|
||||
Message.warning("请上传积分卡照片");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -523,10 +523,10 @@ async function doSubmit(): Promise<void> {
|
||||
}
|
||||
if (!canSubmit.value) {
|
||||
if (!formData.name?.trim()) {
|
||||
Toast.warning("请填写姓名");
|
||||
Message.warning("请填写姓名");
|
||||
return;
|
||||
}
|
||||
Toast.warning("当前门店未设置");
|
||||
Message.warning("当前门店未设置");
|
||||
return;
|
||||
}
|
||||
if (!validateCustomerPhotoList()) {
|
||||
@@ -552,13 +552,13 @@ async function doSubmit(): Promise<void> {
|
||||
|
||||
if (isCreateMode.value) {
|
||||
await CustomerAPI.create(payload);
|
||||
Toast.success("创建成功");
|
||||
Message.success("创建成功");
|
||||
const redirect = String(route.query.redirect || "");
|
||||
await router.replace(redirect || "/management/customers");
|
||||
return;
|
||||
} else {
|
||||
await CustomerAPI.update(payload);
|
||||
Toast.success("保存成功");
|
||||
Message.success("保存成功");
|
||||
const redirect = String(route.query.redirect || "");
|
||||
if (redirect) {
|
||||
await router.replace(redirect);
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import { Message } from "@/utils/message";
|
||||
import { useUserStore } from "timi-web";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import CodeScanner from "@/components/CodeScanner.vue";
|
||||
@@ -147,7 +147,7 @@ async function loadCustomer(): Promise<void> {
|
||||
customer.value = undefined;
|
||||
invitees.value = [];
|
||||
console.warn("邀请客户加载失败", err);
|
||||
Toast.warning("邀请客户加载失败");
|
||||
Message.warning("邀请客户加载失败");
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ function handleScanStatusChange(value: string): void {
|
||||
|
||||
async function confirmScannedInvitee(): Promise<void> {
|
||||
if (!pendingInvitee.value) {
|
||||
Toast.warning("请先扫码识别客户");
|
||||
Message.warning("请先扫码识别客户");
|
||||
return;
|
||||
}
|
||||
if (await addInvitee(pendingInvitee.value)) {
|
||||
@@ -224,17 +224,17 @@ async function addInvitee(invitee: Customer): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
if (invitee.id === customer.value.id) {
|
||||
Toast.warning("不能把客户本人添加为邀请客户");
|
||||
Message.warning("不能把客户本人添加为邀请客户");
|
||||
return false;
|
||||
}
|
||||
if (isCustomerAncestor(invitee)) {
|
||||
Toast.warning("不能把上级邀请人添加为邀请客户");
|
||||
Message.warning("不能把上级邀请人添加为邀请客户");
|
||||
return false;
|
||||
}
|
||||
|
||||
await CustomerAPI.saveInvite(customer.value.id, invitee.id);
|
||||
await loadInvitees();
|
||||
Toast.success(`已添加 ${invitee.name || invitee.code}`);
|
||||
Message.success(`已添加 ${invitee.name || invitee.code}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ async function removeInvitee(item: Customer): Promise<void> {
|
||||
|
||||
await CustomerAPI.deleteInvite(item.id);
|
||||
await loadInvitees();
|
||||
Toast.success("已删除邀请关系");
|
||||
Message.success("已删除邀请关系");
|
||||
}
|
||||
|
||||
// ---------- 导航 ----------
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import { Message } from "@/utils/message";
|
||||
import { type Page, type PageResult, Time, Toolkit, useUserStore } from "timi-web";
|
||||
import CustomerAPI from "@/api/CustomerAPI";
|
||||
import GenderIcon from "@/components/GenderIcon.vue";
|
||||
@@ -236,7 +236,7 @@ async function doExport(): Promise<void> {
|
||||
try {
|
||||
const blob = await CustomerAPI.exportXSSF(page);
|
||||
Toolkit.downloadBlob(blob, `客户列表-${Time.formatDate(new Date())}.xlsx`);
|
||||
Toast.success("导出已开始");
|
||||
Message.success("导出已开始");
|
||||
} finally {
|
||||
isExporting.value = false;
|
||||
}
|
||||
|
||||
@@ -63,13 +63,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Toast } from "tdesign-mobile-vue";
|
||||
import {
|
||||
calculateQrCodeGrid,
|
||||
downloadQrCodeImages,
|
||||
printQrCodeImages,
|
||||
splitQrCodePages
|
||||
} from "@/utils/qrCode";
|
||||
import { Message } from "@/utils/message";
|
||||
import { calculateQrCodeGrid, downloadQrCodeImages, printQrCodeImages, splitQrCodePages } from "@/utils/qrCode";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
|
||||
defineOptions({
|
||||
@@ -220,11 +215,7 @@ async function printQrCode(): Promise<void> {
|
||||
title: `${finalStartCode.value}-${finalEndCode.value}`
|
||||
});
|
||||
} catch (err) {
|
||||
Toast({
|
||||
theme: "warning",
|
||||
direction: "row",
|
||||
message: err instanceof Error ? err.message : "打印失败"
|
||||
});
|
||||
Message.warning(err instanceof Error ? err.message : "打印失败");
|
||||
} finally {
|
||||
printing.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user