From 9aaaec8c262e06ffd4f652425ec39e1323eb2ed8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com>
Date: Mon, 18 Aug 2025 00:59:26 +0800
Subject: [PATCH] =?UTF-8?q?feat(shopGift):=20=E6=B7=BB=E5=8A=A0=E7=A4=BC?=
=?UTF-8?q?=E5=93=81=E5=8D=A1=E4=BA=8C=E7=BB=B4=E7=A0=81=E6=89=B9=E9=87=8F?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增礼品卡二维码批量导出功能,支持导出为 Word 文档或 HTML 文件
- 优化搜索组件,增加关键字搜索功能
- 修改表格列配置,将 ID列改为用户 ID 列
- 优化审核状态变化逻辑,自动
---
src/api/shop/shopGift/model/index.ts | 1 +
.../components/shopDealerApplyEdit.vue | 139 ++++---
src/views/shop/shopDealerApply/index.vue | 6 +-
src/views/shop/shopDealerUser/index.vue | 6 +-
.../shop/shopGift/components/makeCard.vue | 11 -
src/views/shop/shopGift/components/search.vue | 387 +++++++++++++++++-
6 files changed, 458 insertions(+), 92 deletions(-)
diff --git a/src/api/shop/shopGift/model/index.ts b/src/api/shop/shopGift/model/index.ts
index 2f5280d..fcd2de9 100644
--- a/src/api/shop/shopGift/model/index.ts
+++ b/src/api/shop/shopGift/model/index.ts
@@ -52,5 +52,6 @@ export interface ShopGift {
*/
export interface ShopGiftParam extends PageParam {
id?: number;
+ code?: string;
keywords?: string;
}
diff --git a/src/views/shop/shopDealerApply/components/shopDealerApplyEdit.vue b/src/views/shop/shopDealerApply/components/shopDealerApplyEdit.vue
index 014069e..25da65f 100644
--- a/src/views/shop/shopDealerApply/components/shopDealerApplyEdit.vue
+++ b/src/views/shop/shopDealerApply/components/shopDealerApplyEdit.vue
@@ -28,6 +28,7 @@
@@ -38,6 +39,7 @@
@@ -48,6 +50,7 @@
@@ -57,6 +60,7 @@
@@ -64,38 +68,6 @@
-
-
- 申请设置
-
-
-
-
-
-
-
- 需要审核
- 后台人工审核
-
-
- 免审核
- 自动通过
-
-
-
-
-
-
-
-
-
-
-
审核信息
@@ -104,7 +76,7 @@
-
+
待审核
等待审核
@@ -121,10 +93,11 @@
-
+
@@ -132,15 +105,20 @@
-
-
-
+
+
+
+
+
+
+
@@ -257,14 +235,17 @@
],
rejectReason: [
{
- validator: (rule: any, value: any) => {
- if (form.applyStatus === 30 && !value) {
- return Promise.reject('驳回时必须填写驳回原因');
- }
- return Promise.resolve();
- },
+ required: true,
+ message: '驳回时必须填写驳回原因',
trigger: 'blur'
}
+ ],
+ auditTime: [
+ {
+ required: true,
+ message: '审核时请选择审核时间',
+ trigger: 'change'
+ }
]
});
@@ -272,25 +253,71 @@
const { resetFields } = useForm(form, rules);
+ /* 处理审核状态变化 */
+ const handleStatusChange = (value: number) => {
+ // 当状态改为审核通过或驳回时,自动设置审核时间为当前时间
+ if ((value === 20 || value === 30) && !form.auditTime) {
+ form.auditTime = dayjs();
+ }
+ // 当状态改为待审核时,清空审核时间和驳回原因
+ if (value === 10) {
+ form.auditTime = undefined;
+ form.rejectReason = '';
+ }
+ };
+
/* 保存编辑 */
const save = () => {
if (!formRef.value) {
return;
}
+
+ // 动态验证规则
+ const validateFields: string[] = ['userId', 'realName', 'mobile', 'applyStatus'];
+
+ // 如果是驳回状态,需要验证驳回原因
+ if (form.applyStatus === 30) {
+ validateFields.push('rejectReason');
+ }
+
+ // 如果是审核通过或驳回状态,需要验证审核时间
+ if (form.applyStatus === 20 || form.applyStatus === 30) {
+ validateFields.push('auditTime');
+ }
+
formRef.value
- .validate()
+ .validate(validateFields)
.then(() => {
loading.value = true;
const formData = {
...form
};
- // 处理时间字段转换
- if (formData.applyTime && dayjs.isDayjs(formData.applyTime)) {
- formData.applyTime = formData.applyTime.valueOf();
+ // 处理时间字段转换 - 转换为ISO字符串格式
+ if (formData.applyTime) {
+ if (dayjs.isDayjs(formData.applyTime)) {
+ formData.applyTime = formData.applyTime.format('YYYY-MM-DD HH:mm:ss');
+ } else if (typeof formData.applyTime === 'number') {
+ formData.applyTime = dayjs(formData.applyTime).format('YYYY-MM-DD HH:mm:ss');
+ }
}
- if (formData.auditTime && dayjs.isDayjs(formData.auditTime)) {
- formData.auditTime = formData.auditTime.valueOf();
+
+ if (formData.auditTime) {
+ if (dayjs.isDayjs(formData.auditTime)) {
+ formData.auditTime = formData.auditTime.format('YYYY-MM-DD HH:mm:ss');
+ } else if (typeof formData.auditTime === 'number') {
+ formData.auditTime = dayjs(formData.auditTime).format('YYYY-MM-DD HH:mm:ss');
+ }
+ }
+
+ // 当审核状态为通过或驳回时,确保有审核时间
+ if ((formData.applyStatus === 20 || formData.applyStatus === 30) && !formData.auditTime) {
+ formData.auditTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
+ }
+
+ // 当状态为待审核时,清空审核时间
+ if (formData.applyStatus === 10) {
+ formData.auditTime = undefined;
}
const saveOrUpdate = isUpdate.value ? updateShopDealerApply : addShopDealerApply;
@@ -315,7 +342,7 @@
if (visible) {
if (props.data) {
assignObject(form, props.data);
- // 处理时间字段
+ // 处理时间字段 - 确保转换为dayjs对象
if (props.data.applyTime) {
form.applyTime = dayjs(props.data.applyTime);
}
diff --git a/src/views/shop/shopDealerApply/index.vue b/src/views/shop/shopDealerApply/index.vue
index e0f92d6..830fa1d 100644
--- a/src/views/shop/shopDealerApply/index.vue
+++ b/src/views/shop/shopDealerApply/index.vue
@@ -117,9 +117,9 @@
// 表格列配置
const columns = ref([
{
- title: 'ID',
- dataIndex: 'applyId',
- key: 'applyId',
+ title: '用户ID',
+ dataIndex: 'userId',
+ key: 'userId',
align: 'center',
width: 80,
fixed: 'left'
diff --git a/src/views/shop/shopDealerUser/index.vue b/src/views/shop/shopDealerUser/index.vue
index 14d34a0..c970036 100644
--- a/src/views/shop/shopDealerUser/index.vue
+++ b/src/views/shop/shopDealerUser/index.vue
@@ -112,9 +112,9 @@ const datasource: DatasourceFunction = ({
// 表格列配置
const columns = ref([
{
- title: 'ID',
- dataIndex: 'id',
- key: 'id',
+ title: '用户ID',
+ dataIndex: 'userId',
+ key: 'userId',
align: 'center',
width: 80,
fixed: 'left'
diff --git a/src/views/shop/shopGift/components/makeCard.vue b/src/views/shop/shopGift/components/makeCard.vue
index 962797e..d96256c 100644
--- a/src/views/shop/shopGift/components/makeCard.vue
+++ b/src/views/shop/shopGift/components/makeCard.vue
@@ -22,17 +22,6 @@
-
-
-
- {{ item.name }}
-
-
-
批量生成
-
- 导出
-
+
+ 导出二维码