Преглед на файлове

feat: 优化优惠券详情刷新逻辑,简化购机者信息提交处理

laiqi преди 11 месеца
родител
ревизия
56d5f8bfdf

+ 24 - 6
apps/web-ele/src/views/examine-manage/examine-coupon/detail.vue

@@ -297,15 +297,33 @@ function openEditBuyerInfoModal() {
 }
 
 // 修改完成后的回调
-function handleEditFinish() {
+async function handleEditFinish() {
   // 重新获取详情数据
   const modalData = modalApi.getData();
   if (modalData?.row?.coupon2sid) {
-    getCoupon2AuditDetailApi({
-      coupon2sid: modalData.row.coupon2sid,
-    }).then((detailData) => {
-      data.value = detailData;
-    });
+    try {
+      loading.value = true;
+
+      // 获取文件前缀
+      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 {
+      loading.value = false;
+    }
   }
 }
 

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

@@ -270,15 +270,11 @@ async function handleSubmit(): Promise<boolean> {
       }
 
       // 调用更新购机者信息API
-      const response = await updateCoupon2UserInfoApi(submitParams);
+      await updateCoupon2UserInfoApi(submitParams);
 
-      if (response && response.success !== false) {
-        ElMessage.success('购机者信息修改成功!系统将重新审核您的优惠券。');
-        return true;
-      } else {
-        ElMessage.error(response?.message || '修改失败,请重试');
-        return false;
-      }
+      ElMessage.success('购机者信息修改成功!系统将重新审核您的优惠券。');
+
+      return true;
     } catch (error) {
       console.error('提交修改失败:', error);
       ElMessage.error('提交失败,请稍后重试');

+ 55 - 12
apps/web-ele/src/views/product-manage/index.vue

@@ -3,8 +3,11 @@ import type { VbenFormProps } from '@vben/common-ui';
 
 import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
 
+import { computed } from 'vue';
+
 import { Page, useVbenModal } from '@vben/common-ui';
 import { MdiDelete, MdiDetail, MdiEdit } from '@vben/icons';
+import { useUserStore } from '@vben/stores';
 
 import { ElMessage, ElMessageBox } from 'element-plus';
 
@@ -14,6 +17,14 @@ import { $t } from '#/locales';
 
 import ProductForm from './form.vue';
 
+// 获取用户信息
+const userStore = useUserStore();
+
+// 判断是否是经销商且不是管理员
+const isNonAdminMerchant = computed(() => {
+  return userStore.isDLS && !userStore.isSuperAdmin;
+});
+
 const formOptions: VbenFormProps = {
   // 默认展开
   collapsed: true,
@@ -58,37 +69,53 @@ const gridOptions: VxeGridProps<any> = {
     },
     ajax: {
       query: async ({ page }, formValues) => {
-        return await getProductListApi({
+        // 构建查询参数
+        const queryParams: any = {
           pageindex: page.currentPage,
           rows: page.pageSize,
           ...formValues,
-        });
+        };
+
+        // 如果是经销商且不是管理员,添加经销商筛选条件
+        if (isNonAdminMerchant.value) {
+          queryParams.productsmerchantid =
+            userStore.userInfo?.workeruserid || '';
+        }
+
+        return await getProductListApi(queryParams);
       },
     },
   },
 
   columns: [
-    { title: '机具类型', field: 'productsjjlx', sortable: true },
-    { title: '产品名称', field: 'productsname', sortable: true },
-    { title: '产品类别', field: 'productscategory', sortable: true },
-    { title: '产品型号', field: 'productsmodel', sortable: true },
+    { title: '机具类型', field: 'productsjjlx', sortable: true, width: 120 },
+    { title: '产品名称', field: 'productsname', sortable: true, width: 240 },
+    {
+      title: '产品类别',
+      field: 'productscategory',
+      sortable: true,
+      width: 120,
+    },
+    { title: '产品型号', field: 'productsmodel', sortable: true, width: 220 },
     // { title: '产品sn号', field: 'productssn' },
-    { title: '品目', field: 'productspm', sortable: true },
-    { title: '一级分类', field: 'productsfl1', sortable: true },
-    { title: '二级分类', field: 'productsfl2', sortable: true },
-    { title: '分档名称', field: 'productsfdmc', sortable: true },
-    { title: '分档编号', field: 'productsfdbh', sortable: true },
+    { title: '品目', field: 'productspm', sortable: true, width: 120 },
+    { title: '一级分类', field: 'productsfl1', sortable: true, width: 120 },
+    { title: '二级分类', field: 'productsfl2', sortable: true, width: 120 },
+    { title: '分档名称', field: 'productsfdmc', sortable: true, width: 120 },
+    { title: '分档编号', field: 'productsfdbh', sortable: true, width: 120 },
     {
       title: '产品原价',
       field: 'productsprice',
       formatter: formatMoney,
       sortable: true,
+      width: 120,
     },
     {
       title: '中央补贴金额',
       field: 'productszybt',
       formatter: formatMoney,
       sortable: true,
+      width: 120,
     },
     {
       title: '特殊县中央补贴金额',
@@ -97,7 +124,7 @@ const gridOptions: VxeGridProps<any> = {
       width: 170,
       sortable: true,
     },
-    { title: '创建时间', field: 'productsdate' },
+    { title: '创建时间', field: 'productsdate', width: 180 },
     {
       title: '操作',
       field: 'action',
@@ -191,6 +218,7 @@ async function handleDelete(row: any) {
           />
         </el-tooltip>
         <el-tooltip
+          v-if="!isNonAdminMerchant"
           class="box-item"
           effect="dark"
           content="编辑"
@@ -208,6 +236,21 @@ async function handleDelete(row: any) {
           effect="dark"
           content="删除"
           placement="top"
+          v-if="!isNonAdminMerchant"
+        >
+          <el-button
+            round
+            @click="() => handleDelete(row)"
+            :icon="MdiDelete"
+            class="!p-2"
+          />
+        </el-tooltip>
+        <el-tooltip
+          class="box-item"
+          effect="dark"
+          content="移除关联"
+          placement="top"
+          v-if="isNonAdminMerchant"
         >
           <el-button
             round