Bladeren bron

feat: 经销商帮客户领取优惠券优化;审核未通过的,可以修改绑定的购机人的信息

laiqi 11 maanden geleden
bovenliggende
commit
5572642791

+ 9 - 0
apps/web-ele/src/api/coupon/coupon2.ts

@@ -75,6 +75,15 @@ export async function getCoupon2AuditDetailApi(data: any) {
 }
 
 /**
+ * 更新购机者信息
+ */
+export async function updateCoupon2UserInfoApi(data: any) {
+  return requestClient.post<any>('/api/nlua/call?pagevalue=119', {
+    ...data,
+  });
+}
+
+/**
  * 我的优惠券信息_审核
  */
 export async function auditCoupon2Api(data: Coupon2Entity) {

+ 10 - 0
apps/web-ele/src/components/upload-file/index.vue

@@ -261,6 +261,7 @@ const handleUploadFile = async (option) => {
     if (newFileInList) {
       newFileInList.url = localPreviewUrl;
       newFileInList.status = 'uploading';
+      newFileInList.percentage = 0; // 初始化进度为0
     } else {
       // 防御性添加(通常不需要,因为el-upload会自动管理)
       const newFileItem = {
@@ -268,6 +269,7 @@ const handleUploadFile = async (option) => {
         url: localPreviewUrl,
         uid: file.uid,
         status: 'uploading',
+        percentage: 0, // 初始化进度为0
         raw: file,
       };
 
@@ -292,6 +294,7 @@ const handleUploadFile = async (option) => {
     fileList.value[existingFileIndex].url = localPreviewUrl;
     fileList.value[existingFileIndex].status = 'uploading';
     fileList.value[existingFileIndex].name = file.name;
+    fileList.value[existingFileIndex].percentage = 0; // 初始化进度为0
   }
 
   const formData = new FormData();
@@ -344,6 +347,7 @@ const handleUploadFile = async (option) => {
         }
         uploadedFileEntry.attId = fileId;
         uploadedFileEntry.status = 'success';
+        uploadedFileEntry.percentage = 100; // 上传成功时设置进度为100
         uploadedFileEntry.url = serverUrl || '';
       }
       await nextTick();
@@ -364,6 +368,8 @@ const updateFileStatusAndCleanup = (uid, status, _blobUrl) => {
   const fileEntry = fileList.value.find((f) => f.uid === uid);
   if (fileEntry) {
     fileEntry.status = status;
+    // 如果状态是失败,设置进度为0,成功则设置为100
+    fileEntry.percentage = status === 'success' ? 100 : 0;
     if (fileEntry.url && fileEntry.url.startsWith('blob:')) {
       URL.revokeObjectURL(fileEntry.url);
     }
@@ -402,6 +408,8 @@ const initializeFileList = async () => {
         url: fileUrl,
         attId,
         uid,
+        status: 'success', // 设置状态为成功
+        percentage: 100, // 已存在的文件进度设置为100
       });
     }
 
@@ -440,6 +448,8 @@ watch(
         uid: genFileId(),
         name: `File_${newAttId}`,
         url: '',
+        status: 'success', // 设置状态为成功
+        percentage: 100, // 已存在的文件进度设置为100
       };
       isInternalUpdate.value = true;
       fileIdsInternal.value = [pseudoFileId];

+ 182 - 10
apps/web-ele/src/views/examine-manage/examine-coupon/detail.vue

@@ -3,13 +3,25 @@ import { computed, ref } from 'vue';
 
 import { useVbenModal } from '@vben/common-ui';
 
-import { ElTag } from 'element-plus';
+import { ElButton, ElImage, ElTag } from 'element-plus';
 
 import { getCoupon2AuditDetailApi } from '#/api/coupon/coupon2';
+import { getDictListApi } from '#/api/dict';
+import { getAttachmentListApi } from '#/api/file';
+
+import EditBuyerInfoModal from './edit-buyer-info-modal.vue';
 
 const data = ref<any>(null);
 const loading = ref(false);
 
+// 身份证附件数据
+const certificateDataList = ref<any[]>([]);
+// 购机者照片数据
+const buyerPhotoDataList = ref<any[]>([]);
+
+// 修改购机者信息模态框引用
+const editBuyerInfoModalRef = ref<InstanceType<typeof EditBuyerInfoModal>>();
+
 // 申请人信息
 const applicantInfo = computed(() => {
   if (!data.value) return [];
@@ -22,9 +34,6 @@ const applicantInfo = computed(() => {
     { label: '用户性质', value: data.value.usersnature },
     { label: '邮箱', value: data.value.usersemail },
     { label: '地址', value: data.value.usersaddress },
-    // { label: '注册时间', value: data.value.usersdate },
-    { label: '银行名称', value: data.value.usersbankname },
-    { label: '银行账号', value: data.value.usersbanknumber },
   ];
 
   // 如果用户类型不是"个人",显示社会统一信用代码
@@ -156,6 +165,73 @@ const couponInfo = computed(() => {
   return baseInfo;
 });
 
+// 获取文件前缀地址
+const getFilePrefix = async () => {
+  const filePrefixData = await getDictListApi({
+    groupname: 'fileheadurl',
+    pageindex: 1,
+    rows: 999,
+  });
+
+  if (filePrefixData.Data.length > 0) {
+    return filePrefixData.Data[0].substance;
+  }
+
+  return '';
+};
+
+// 获取身份证附件
+const getCertificateAttachments = async (
+  coupon2sid: string,
+  filePrefix: string,
+) => {
+  try {
+    const certificateData = await getAttachmentListApi({
+      attlsh: coupon2sid,
+      attmodel: 'coupon_identity',
+      pageindex: 1,
+      rows: 10,
+    });
+
+    if (certificateData.Data.length > 0) {
+      certificateData.Data.forEach((item: any) => {
+        item.url = `${filePrefix}${item.attpath}${item.attname}.${item.atttype}`;
+      });
+    }
+
+    certificateDataList.value = certificateData.Data;
+  } catch (error) {
+    console.error('获取身份证附件失败:', error);
+    certificateDataList.value = [];
+  }
+};
+
+// 获取购机者照片附件
+const getBuyerPhotoAttachments = async (
+  coupon2sid: string,
+  filePrefix: string,
+) => {
+  try {
+    const buyerPhotoData = await getAttachmentListApi({
+      attlsh: coupon2sid,
+      attmodel: 'coupon_buyer',
+      pageindex: 1,
+      rows: 10,
+    });
+
+    if (buyerPhotoData.Data.length > 0) {
+      buyerPhotoData.Data.forEach((item: any) => {
+        item.url = `${filePrefix}${item.attpath}${item.attname}.${item.atttype}`;
+      });
+    }
+
+    buyerPhotoDataList.value = buyerPhotoData.Data;
+  } catch (error) {
+    console.error('获取购机者照片失败:', error);
+    buyerPhotoDataList.value = [];
+  }
+};
+
 const [Modal, modalApi] = useVbenModal({
   title: '优惠券详情',
   class: 'w-10/12 max-w-8xl',
@@ -171,10 +247,22 @@ const [Modal, modalApi] = useVbenModal({
       if (modalData?.row?.coupon2sid) {
         try {
           loading.value = true;
-          const detailData = await getCoupon2AuditDetailApi({
-            coupon2sid: modalData.row.coupon2sid,
-          });
-          data.value = detailData;
+
+          // 获取文件前缀
+          const filePrefix = await getFilePrefix();
+
+          // 并行执行获取详情和附件的操作
+          const [detailData] = await Promise.allSettled([
+            getCoupon2AuditDetailApi({
+              coupon2sid: modalData.row.coupon2sid,
+            }),
+            getCertificateAttachments(modalData.row.coupon2sid, filePrefix),
+            getBuyerPhotoAttachments(modalData.row.coupon2sid, filePrefix),
+          ]);
+
+          if (detailData.status === 'fulfilled') {
+            data.value = detailData.value;
+          }
         } catch (error) {
           console.error('获取优惠券详情失败:', error);
         } finally {
@@ -183,6 +271,8 @@ const [Modal, modalApi] = useVbenModal({
       }
     } else {
       data.value = null;
+      certificateDataList.value = [];
+      buyerPhotoDataList.value = [];
     }
   },
 });
@@ -192,8 +282,37 @@ function openDetailModal(rowData: any) {
   modalApi.open();
 }
 
+// 打开修改购机者信息弹窗
+function openEditBuyerInfoModal() {
+  if (!data.value) return;
+
+  editBuyerInfoModalRef.value?.openEditBuyerInfoModal({
+    coupon2sid: data.value.coupon2sid,
+    userstype: data.value.userstype,
+    usersname: data.value.usersname,
+    usersidcardnumber: data.value.usersidcardnumber,
+    usersshtyxydm: data.value.usersshtyxydm,
+    usersphone: data.value.usersphone,
+  });
+}
+
+// 修改完成后的回调
+function handleEditFinish() {
+  // 重新获取详情数据
+  const modalData = modalApi.getData();
+  if (modalData?.row?.coupon2sid) {
+    getCoupon2AuditDetailApi({
+      coupon2sid: modalData.row.coupon2sid,
+    }).then((detailData) => {
+      data.value = detailData;
+    });
+  }
+}
+
 defineExpose({
   openDetailModal,
+  openEditBuyerInfoModal,
+  handleEditFinish,
 });
 </script>
 
@@ -256,10 +375,20 @@ defineExpose({
         </el-descriptions>
       </div>
 
-      <!-- 申请人信息 -->
+      <!-- 购机者信息 -->
       <div>
         <el-divider content-position="left">
-          <span class="text-lg font-semibold text-gray-800">申请人信息</span>
+          <span class="text-lg font-semibold text-gray-800">购机者信息</span>
+          <!-- 当审核状态为2(审核不通过)时显示修改按钮 -->
+          <ElButton
+            v-if="data && data.coupon2sype === 2"
+            type="primary"
+            size="small"
+            class="ml-4"
+            @click="openEditBuyerInfoModal"
+          >
+            修改购机者信息
+          </ElButton>
         </el-divider>
         <el-descriptions :column="3" border class="mb-4" label-width="120px">
           <el-descriptions-item
@@ -270,10 +399,53 @@ defineExpose({
           >
             {{ item.value || '-' }}
           </el-descriptions-item>
+
+          <!-- 身份证正面附件 -->
+          <el-descriptions-item label="身份证正面" width="20%">
+            <div
+              v-if="certificateDataList.length > 0"
+              class="flex flex-wrap gap-3"
+            >
+              <ElImage
+                v-for="item in certificateDataList"
+                :key="item.attname"
+                :src="item.url"
+                :preview-src-list="certificateDataList.map((i) => i.url)"
+                fit="cover"
+                style="width: 100px; height: 100px"
+                class="rounded border"
+                :preview-teleported="true"
+              />
+            </div>
+            <span v-else class="text-gray-500">未上传</span>
+          </el-descriptions-item>
+
+          <!-- 购机者照片附件 -->
+          <el-descriptions-item label="购机者照片" width="20%">
+            <div
+              v-if="buyerPhotoDataList.length > 0"
+              class="flex flex-wrap gap-3"
+            >
+              <ElImage
+                v-for="item in buyerPhotoDataList"
+                :key="item.attname"
+                :src="item.url"
+                :preview-src-list="buyerPhotoDataList.map((i) => i.url)"
+                fit="cover"
+                style="width: 100px; height: 100px"
+                class="rounded border"
+                :preview-teleported="true"
+              />
+            </div>
+            <span v-else class="text-gray-500">未上传</span>
+          </el-descriptions-item>
         </el-descriptions>
       </div>
     </div>
   </Modal>
+
+  <!-- 修改购机者信息模态框 -->
+  <EditBuyerInfoModal ref="editBuyerInfoModalRef" @finish="handleEditFinish" />
 </template>
 
 <style scoped>

+ 494 - 0
apps/web-ele/src/views/examine-manage/examine-coupon/edit-buyer-info-modal.vue

@@ -0,0 +1,494 @@
+<script lang="ts" setup>
+import type { FormInstance, FormRules } from 'element-plus';
+
+import {
+  computed,
+  defineEmits,
+  defineExpose,
+  nextTick,
+  reactive,
+  ref,
+} from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { ElMessage } from 'element-plus';
+
+import { updateCoupon2UserInfoApi } from '#/api/coupon/coupon2';
+import { getDictListApi } from '#/api/dict';
+import { getAttachmentListApi } from '#/api/file';
+import UploadFile from '#/components/upload-file/index.vue';
+
+const emit = defineEmits(['finish']);
+
+const formRef = ref<FormInstance>();
+const formData = reactive({
+  coupon2sid: '', // 优惠券ID
+  userstype: '个人' as '个人' | '企业',
+  usersname: '',
+  idNumber: '',
+  phone: '',
+  idCardIds: [] as any[],
+  idCardFiles: [] as any[],
+  businessLicenseIds: [] as any[],
+  businessLicenseFiles: [] as any[],
+  buyerPhotoIds: [] as any[],
+  buyerPhotoFiles: [] as any[],
+});
+
+const submitLoading = ref(false);
+
+const usersnameLabel = computed(() =>
+  formData.userstype === '个人' ? '姓名' : '企业名称',
+);
+const idNumberLabel = computed(() =>
+  formData.userstype === '个人' ? '身份证号' : '统一社会信用代码',
+);
+const phoneNumberRule = {
+  trigger: 'blur',
+  validator: (rule: any, value: string, callback: any) => {
+    if (!value) {
+      callback(new Error('请输入手机号'));
+    } else if (/^1[3-9]\d{9}$/.test(value)) {
+      callback();
+    } else {
+      callback(new Error('请输入正确的手机号格式'));
+    }
+  },
+};
+
+// 表单验证规则
+const rules = reactive<FormRules>({
+  userstype: [{ required: true, message: '请选择用户类型', trigger: 'blur' }],
+  usersname: [
+    {
+      required: true,
+      message: `请输入${usersnameLabel.value}`,
+      trigger: 'blur',
+    },
+  ],
+  idNumber: [
+    {
+      required: true,
+      message: `请输入${idNumberLabel.value}`,
+      trigger: 'blur',
+    },
+  ],
+  idCardIds: [
+    {
+      required: true,
+      validator: (_rule, value, callback) => {
+        if (formData.userstype === '个人' && (!value || value.length === 0)) {
+          callback(new Error('请上传身份证正面照片'));
+        } else {
+          callback();
+        }
+      },
+      trigger: 'blur',
+    },
+  ],
+  businessLicenseIds: [
+    {
+      required: true,
+      validator: (_rule, value, callback) => {
+        if (formData.userstype === '企业' && (!value || value.length === 0)) {
+          callback(new Error('请上传营业执照照片'));
+        } else {
+          callback();
+        }
+      },
+      trigger: 'blur',
+    },
+  ],
+  phone: [phoneNumberRule],
+});
+
+// 获取文件前缀地址
+const getFilePrefix = async () => {
+  try {
+    const filePrefixData = await getDictListApi({
+      groupname: 'fileheadurl',
+      pageindex: 1,
+      rows: 999,
+    });
+
+    if (filePrefixData.Data.length > 0) {
+      return filePrefixData.Data[0].substance;
+    }
+  } catch (error) {
+    console.error('获取文件前缀失败:', error);
+  }
+  return '';
+};
+
+// 获取身份证附件
+const getCertificateAttachments = async (
+  coupon2sid: string,
+  filePrefix: string,
+  userstype: string,
+) => {
+  try {
+    const certificateData = await getAttachmentListApi({
+      attlsh: coupon2sid,
+      attmodel: 'coupon_identity',
+      pageindex: 1,
+      rows: 10,
+    });
+
+    if (certificateData.Data.length > 0) {
+      const attachments = certificateData.Data.map((item: any) => ({
+        id: item.attid,
+        attId: item.attid,
+        name: item.attorginname || `${item.attname}.${item.atttype}`,
+        url: `${filePrefix}${item.attpath}${item.attname}.${item.atttype}`,
+        uid: `existing_${item.attid}`,
+        status: 'success',
+        percentage: 100, // 确保已存在的文件进度为100
+      }));
+
+      if (userstype === '个人') {
+        formData.idCardIds = attachments;
+        formData.idCardFiles = attachments;
+      } else {
+        formData.businessLicenseIds = attachments;
+        formData.businessLicenseFiles = attachments;
+      }
+    }
+  } catch (error) {
+    console.error('获取身份证附件失败:', error);
+  }
+};
+
+// 获取购机者照片附件
+const getBuyerPhotoAttachments = async (
+  coupon2sid: string,
+  filePrefix: string,
+) => {
+  try {
+    const buyerPhotoData = await getAttachmentListApi({
+      attlsh: coupon2sid,
+      attmodel: 'coupon_buyer',
+      pageindex: 1,
+      rows: 10,
+    });
+
+    if (buyerPhotoData.Data.length > 0) {
+      const attachments = buyerPhotoData.Data.map((item: any) => ({
+        id: item.attid,
+        attId: item.attid,
+        name: item.attorginname || `${item.attname}.${item.atttype}`,
+        url: `${filePrefix}${item.attpath}${item.attname}.${item.atttype}`,
+        uid: `existing_${item.attid}`,
+        status: 'success',
+        percentage: 100, // 确保已存在的文件进度为100
+      }));
+
+      formData.buyerPhotoIds = attachments;
+      formData.buyerPhotoFiles = attachments;
+    }
+  } catch (error) {
+    console.error('获取购机者照片失败:', error);
+  }
+};
+
+// 用户类型切换,重置表单
+function handleUserTypeChange() {
+  formData.usersname = '';
+  formData.idNumber = '';
+  formData.idCardIds = [];
+  formData.idCardFiles = [];
+  formData.businessLicenseIds = [];
+  formData.businessLicenseFiles = [];
+  formData.buyerPhotoIds = [];
+  formData.buyerPhotoFiles = [];
+  formRef.value?.clearValidate();
+}
+
+// 确认提交
+async function handleSubmit(): Promise<boolean> {
+  if (!formRef.value) return false;
+
+  try {
+    // 验证表单
+    const valid = await formRef.value.validate();
+    if (!valid) {
+      return false;
+    }
+
+    // 验证证件照片上传
+    const hasUploadedFiles =
+      formData.userstype === '个人'
+        ? formData.idCardIds.length > 0
+        : formData.businessLicenseIds.length > 0;
+
+    if (!hasUploadedFiles) {
+      ElMessage.error(
+        `请上传${formData.userstype === '个人' ? '身份证照片' : '营业执照照片'}`,
+      );
+      return false;
+    }
+
+    submitLoading.value = true;
+
+    try {
+      // 准备提交参数
+      const submitParams: any = {
+        coupon2sid: formData.coupon2sid, // 优惠券ID
+        userstype: formData.userstype, // 用户类型
+        usersname: formData.usersname, // 姓名或企业名称
+        coupon2phone: formData.phone, // 手机号(参考uniapp参数名)
+      };
+
+      // 根据用户类型添加证件号
+      if (formData.userstype === '个人') {
+        submitParams.usersidcardnumber = formData.idNumber; // 身份证号
+      } else {
+        submitParams.usersshtyxydm = formData.idNumber; // 统一社会信用代码
+      }
+
+      // 处理文件ID
+      const fileIds: string[] = [];
+
+      // 添加身份证/营业执照文件ID
+      if (formData.userstype === '个人' && formData.idCardIds.length > 0) {
+        fileIds.push(...formData.idCardIds.map((item) => item.id));
+      } else if (
+        formData.userstype === '企业' &&
+        formData.businessLicenseIds.length > 0
+      ) {
+        fileIds.push(...formData.businessLicenseIds.map((item) => item.id));
+      }
+
+      // 添加购机者照片文件ID(可选)
+      if (formData.buyerPhotoIds.length > 0) {
+        fileIds.push(...formData.buyerPhotoIds.map((item) => item.id));
+      }
+
+      // 设置文件ID参数
+      if (fileIds.length > 0) {
+        submitParams.filesid = fileIds.filter(Boolean).join(',');
+      }
+
+      // 调用更新购机者信息API
+      const response = await updateCoupon2UserInfoApi(submitParams);
+
+      if (response && response.success !== false) {
+        ElMessage.success('购机者信息修改成功!系统将重新审核您的优惠券。');
+        return true;
+      } else {
+        ElMessage.error(response?.message || '修改失败,请重试');
+        return false;
+      }
+    } catch (error) {
+      console.error('提交修改失败:', error);
+      ElMessage.error('提交失败,请稍后重试');
+      return false;
+    }
+  } catch (error) {
+    console.error('表单验证失败或提交出错:', error);
+    ElMessage.error('请检查表单填写是否正确');
+    return false;
+  } finally {
+    submitLoading.value = false;
+  }
+}
+
+const [Modal, modalApi] = useVbenModal({
+  class: 'w-[800px]',
+  title: '修改购机者信息',
+  showCancelButton: true,
+  fullscreenButton: false,
+  closeOnClickModal: false,
+  closeOnPressEscape: false,
+  async onConfirm() {
+    const success = await handleSubmit();
+    if (success) {
+      modalApi.close();
+      emit('finish');
+    }
+  },
+  onCancel() {
+    modalApi.close();
+  },
+  async onOpenChange(isOpen: boolean) {
+    if (isOpen) {
+      const modalData = modalApi.getData() as {
+        coupon2sid?: string;
+        usersidcardnumber?: string;
+        usersname?: string;
+        usersphone?: string;
+        usersshtyxydm?: string;
+        userstype?: string;
+      };
+
+      // 填充表单数据
+      formData.coupon2sid = modalData?.coupon2sid || '';
+      formData.userstype = (modalData?.userstype as '个人' | '企业') || '个人';
+      formData.usersname = modalData?.usersname || '';
+      formData.idNumber =
+        modalData?.userstype === '个人'
+          ? modalData?.usersidcardnumber || ''
+          : modalData?.usersshtyxydm || '';
+      formData.phone = modalData?.usersphone || '';
+
+      // 首先重置文件上传数据
+      formData.idCardIds = [];
+      formData.idCardFiles = [];
+      formData.businessLicenseIds = [];
+      formData.businessLicenseFiles = [];
+      formData.buyerPhotoIds = [];
+      formData.buyerPhotoFiles = [];
+
+      formRef.value?.clearValidate();
+      submitLoading.value = false;
+
+      // 获取现有附件
+      if (modalData?.coupon2sid) {
+        try {
+          const filePrefix = await getFilePrefix();
+          const userstype = modalData?.userstype || '个人';
+
+          // 并行获取身份证和购机者照片附件
+          await Promise.allSettled([
+            getCertificateAttachments(
+              modalData.coupon2sid,
+              filePrefix,
+              userstype,
+            ),
+            getBuyerPhotoAttachments(modalData.coupon2sid, filePrefix),
+          ]);
+
+          // 使用 nextTick 确保数据设置完成后再触发组件更新
+          await nextTick();
+        } catch (error) {
+          console.error('获取附件失败:', error);
+        }
+      }
+    } else {
+      // 关闭时清理数据
+      formData.coupon2sid = '';
+      formData.userstype = '个人';
+      formData.usersname = '';
+      formData.idNumber = '';
+      formData.phone = '';
+      formData.idCardIds = [];
+      formData.idCardFiles = [];
+      formData.businessLicenseIds = [];
+      formData.businessLicenseFiles = [];
+      formData.buyerPhotoIds = [];
+      formData.buyerPhotoFiles = [];
+    }
+  },
+});
+
+// 打开修改购机者信息弹窗的方法
+function openEditBuyerInfoModal(data: {
+  coupon2sid: string;
+  usersidcardnumber?: string;
+  usersname?: string;
+  usersphone?: string;
+  usersshtyxydm?: string;
+  userstype?: string;
+}) {
+  modalApi.setData(data);
+  modalApi.open();
+}
+
+defineExpose({
+  openEditBuyerInfoModal,
+});
+</script>
+
+<template>
+  <Modal>
+    <div class="p-4">
+      <div
+        class="rounded-md border border-gray-200 bg-white px-4 py-4 shadow-sm"
+      >
+        <el-form
+          ref="formRef"
+          :model="formData"
+          :rules="rules"
+          label-width="140px"
+        >
+          <el-form-item label="用户类型" prop="userstype">
+            <el-radio-group
+              v-model="formData.userstype"
+              @change="handleUserTypeChange"
+            >
+              <el-radio value="个人">个人</el-radio>
+              <el-radio value="企业">企业</el-radio>
+            </el-radio-group>
+          </el-form-item>
+
+          <el-form-item :label="usersnameLabel" prop="usersname">
+            <el-input
+              v-model="formData.usersname"
+              :placeholder="`请输入${usersnameLabel}`"
+              clearable
+            />
+          </el-form-item>
+
+          <el-form-item :label="idNumberLabel" prop="idNumber">
+            <el-input
+              v-model="formData.idNumber"
+              :placeholder="`请输入${idNumberLabel}`"
+              clearable
+            />
+          </el-form-item>
+
+          <el-form-item
+            :label="formData.userstype === '个人' ? '身份证正面' : '营业执照'"
+            :prop="
+              formData.userstype === '个人' ? 'idCardIds' : 'businessLicenseIds'
+            "
+          >
+            <UploadFile
+              v-if="formData.userstype === '个人'"
+              v-model="formData.idCardFiles"
+              v-model:file-ids="formData.idCardIds"
+              attmodel="coupon_identity"
+              :limit="1"
+              list-type="picture-card"
+              tips="请上传身份证正面照片"
+            />
+            <UploadFile
+              v-else
+              v-model="formData.businessLicenseFiles"
+              v-model:file-ids="formData.businessLicenseIds"
+              attmodel="coupon_identity"
+              :limit="1"
+              list-type="picture-card"
+              tips="请上传营业执照"
+            />
+          </el-form-item>
+
+          <el-form-item label="购机者照片" prop="buyerPhotoIds">
+            <UploadFile
+              v-model="formData.buyerPhotoFiles"
+              v-model:file-ids="formData.buyerPhotoIds"
+              attmodel="coupon_buyer"
+              :limit="1"
+              list-type="picture-card"
+              tips="请上传购机者照片"
+            />
+          </el-form-item>
+
+          <el-form-item label="手机号" prop="phone">
+            <el-input
+              v-model="formData.phone"
+              placeholder="请输入手机号码"
+              clearable
+            />
+          </el-form-item>
+        </el-form>
+      </div>
+    </div>
+  </Modal>
+</template>
+
+<style lang="scss" scoped>
+.rules-text p {
+  margin-bottom: 0.25rem;
+}
+</style>

+ 9 - 1
apps/web-ele/src/views/examine-manage/examine-coupon/index.vue

@@ -199,7 +199,15 @@ function handleFinish() {
 
 // 领取优惠劵
 function handleCreate() {
-  receiveCouponFormRef.value?.openReceiveCouponModal({});
+  // 构建传递给弹窗的数据
+  const modalData: any = {};
+
+  // 如果是代理商且非管理员,传入merchantId默认值
+  if (isDLSNotAdmin && userStore.userInfo?.workeruserid) {
+    modalData.merchantId = userStore.userInfo.workeruserid;
+  }
+
+  receiveCouponFormRef.value?.openReceiveCouponModal(modalData);
 }
 
 // 处理领取优惠券成功后的逻辑

+ 12 - 1
apps/web-ele/src/views/examine-manage/examine-coupon/receive-coupon-form.vue

@@ -74,6 +74,11 @@ const idPhotoLabel = computed(() =>
   formData.userstype === '个人' ? '身份证正面' : '营业执照',
 );
 
+// 判断经销商字段是否禁用(当外部传入merchantId时禁用)
+const isMerchantDisabled = computed(() => {
+  return !!localMerchantId.value;
+});
+
 const submitLoading = ref(false);
 
 const formRules = computed<FormRules>(() => ({
@@ -393,7 +398,7 @@ const [Modal, modalApi] = useVbenModal({
       localMerchantId.value = modalData?.merchantId || '';
 
       // 重置表单数据
-      formData.merchantId = '';
+      formData.merchantId = modalData?.merchantId || '';
       formData.productId = '';
       formData.couponId = '';
       formData.userstype = '个人';
@@ -418,6 +423,11 @@ const [Modal, modalApi] = useVbenModal({
 
       // 初始化经销商选项
       fetchMerchantOptions();
+
+      // 如果传入了merchantId,自动获取对应的产品列表
+      if (modalData?.merchantId) {
+        fetchProductOptions(modalData.merchantId);
+      }
     }
   },
 });
@@ -456,6 +466,7 @@ onMounted(() => {});
               v-model="formData.merchantId"
               placeholder="请选择经销商"
               :loading="merchantLoading"
+              :disabled="isMerchantDisabled"
               clearable
               @change="handleMerchantChange"
             >