瀏覽代碼

feat: 经销商角色下的产品相关需求修改

laiqi 11 月之前
父節點
當前提交
5a3e4eac5d

+ 10 - 0
apps/web-ele/src/api/product/index.ts

@@ -22,6 +22,16 @@ export async function getProductListApi(params: ProductQueryParams) {
 }
 
 /**
+ * 产品_生产企业_视图列表
+ */
+export async function getProductAndScqyListApi(params: ProductQueryParams) {
+  return requestClient.post<any>('/api/query/list?pagevalue=121', {
+    ...params,
+    'productsmerchantid.like': params.productsmerchantid || '',
+  });
+}
+
+/**
  * 产品信息_详情
  */
 export async function getProductDetailApi(data: { productsid: string }) {

+ 12 - 9
apps/web-ele/src/views/customer-manage/index.vue

@@ -19,9 +19,6 @@ import CustomerForm from './form.vue';
 // 获取用户信息
 const userStore = useUserStore();
 
-// 判断是否为代理商且非管理员
-const isDLSNotAdmin = userStore.isDLS && !userStore.isSuperAdmin;
-
 const formOptions: VbenFormProps = {
   // 默认展开
   collapsed: true,
@@ -53,9 +50,9 @@ const formOptions: VbenFormProps = {
       fieldName: 'usersnature',
       label: '用户性质',
       // 设置默认值 - 当为代理商且非管理员时默认为购机者
-      defaultValue: isDLSNotAdmin ? '购机者' : undefined,
+      defaultValue: userStore.isDLSNotAdmin ? '购机者' : undefined,
       // 如果是代理商且非管理员,禁用该字段
-      disabled: isDLSNotAdmin,
+      disabled: userStore.isDLSNotAdmin,
       componentProps: {
         placeholder: $t('ui.placeholder.select'),
         allowClear: true,
@@ -100,7 +97,7 @@ const gridOptions: VxeGridProps<any> = {
         };
 
         // 如果是代理商且非管理员,添加上级用户id查询条件
-        if (isDLSNotAdmin && userStore.userInfo?.workeruserid) {
+        if (userStore.isDLSNotAdmin && userStore.userInfo?.workeruserid) {
           queryParams['userssuperiorid.value'] =
             userStore.userInfo.workeruserid;
         }
@@ -197,7 +194,13 @@ async function handleDelete(row: any) {
   <Page auto-content-height>
     <Grid table-title="客户列表">
       <template #toolbar-tools>
-        <el-button type="primary" @click="handleCreate"> 新增 </el-button>
+        <el-button
+          type="primary"
+          @click="handleCreate"
+          v-if="!userStore.isDLSNotAdmin"
+        >
+          新增
+        </el-button>
       </template>
       <template #action="{ row }">
         <el-tooltip
@@ -218,7 +221,7 @@ async function handleDelete(row: any) {
           effect="dark"
           content="编辑"
           placement="top"
-          v-if="!isDLSNotAdmin"
+          v-if="!userStore.isDLSNotAdmin"
         >
           <el-button
             round
@@ -232,7 +235,7 @@ async function handleDelete(row: any) {
           effect="dark"
           content="删除"
           placement="top"
-          v-if="!isDLSNotAdmin"
+          v-if="!userStore.isDLSNotAdmin"
         >
           <el-button
             round

+ 2 - 5
apps/web-ele/src/views/examine-manage/examine-coupon/index.vue

@@ -25,9 +25,6 @@ import ReceiveCouponForm from './receive-coupon-form.vue';
 
 const userStore = useUserStore();
 
-// 判断是否为代理商且非管理员
-const isDLSNotAdmin = userStore.isDLS && !userStore.isSuperAdmin;
-
 const receiveCouponFormRef = ref<InstanceType<typeof ReceiveCouponForm> | null>(
   null,
 );
@@ -98,7 +95,7 @@ const gridOptions: VxeGridProps<any> = {
         };
 
         // 根据用户角色调用不同的API:代理商且非管理员调用编辑API,否则调用审核API
-        return await (isDLSNotAdmin
+        return await (userStore.isDLSNotAdmin
           ? getCoupon2EditListApi(queryParams) // editlist接口加了session,只能看自己新增的
           : getCoupon2AuditListApi(queryParams));
       },
@@ -204,7 +201,7 @@ function handleCreate() {
   const modalData: any = {};
 
   // 如果是代理商且非管理员,传入merchantId默认值
-  if (isDLSNotAdmin && userStore.userInfo?.workeruserid) {
+  if (userStore.isDLSNotAdmin && userStore.userInfo?.workeruserid) {
     modalData.merchantId = userStore.userInfo.workeruserid;
   }
 

+ 10 - 7
apps/web-ele/src/views/order-manage/index.vue

@@ -25,9 +25,6 @@ import OrdersForm from './form.vue';
 const dealerOptions = ref<Array<{ label: string; value: string }>>([]);
 const userStore = useUserStore();
 
-// 判断是否为代理商且非管理员
-const isDLSNotAdmin = userStore.isDLS && !userStore.isSuperAdmin;
-
 const fetchDealerOptions = async () => {
   try {
     const result = await getCustomerListApi({
@@ -82,7 +79,7 @@ const formOptions: VbenFormProps = {
       fieldName: 'ordersuserid1',
       label: '经销商',
       // 如果是代理商且非管理员,设置默认值为当前用户的workeruserid
-      defaultValue: isDLSNotAdmin
+      defaultValue: userStore.isDLSNotAdmin
         ? userStore.userInfo?.workeruserid
         : undefined,
       componentProps: {
@@ -91,7 +88,7 @@ const formOptions: VbenFormProps = {
         allowClear: true,
         filterable: true,
         // 如果是代理商且非管理员,禁用该字段
-        disabled: isDLSNotAdmin,
+        disabled: userStore.isDLSNotAdmin,
       },
     },
     {
@@ -282,7 +279,13 @@ function handleAudit(row: any) {
   <Page auto-content-height>
     <Grid table-title="订单列表">
       <template #toolbar-tools>
-        <el-button type="primary" @click="handleCreate"> 新增 </el-button>
+        <el-button
+          type="primary"
+          @click="handleCreate"
+          v-if="!userStore.isDLSNotAdmin"
+        >
+          新增
+        </el-button>
       </template>
       <template #action="{ row }">
         <el-tooltip
@@ -316,7 +319,7 @@ function handleAudit(row: any) {
           effect="dark"
           content="审核"
           placement="top"
-          v-if="!isDLSNotAdmin"
+          v-if="!userStore.isDLSNotAdmin"
         >
           <el-button
             round

+ 375 - 0
apps/web-ele/src/views/product-manage/add-link-modal.vue

@@ -0,0 +1,375 @@
+<script lang="ts" setup>
+import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
+
+import { ref } from 'vue';
+
+import { useVbenModal } from '@vben/common-ui';
+import { MdiMagnify } from '@vben/icons';
+import { useUserStore } from '@vben/stores';
+
+import { ElMessage } from 'element-plus';
+
+import { useVbenVxeGrid } from '#/adapter/vxe-table';
+import { editProductApi, getProductAndScqyListApi } from '#/api/product';
+
+import Form from './form.vue';
+
+const emit = defineEmits<{
+  finish: [];
+}>();
+
+// 获取用户信息
+const userStore = useUserStore();
+
+// 新增关联相关状态
+const selectedProduct = ref<any>(null);
+const addLinkLoading = ref(false);
+const searchKeyword = ref<string>('');
+const linkedProductIds = ref<string[]>([]);
+const showUnlinkedOnly = ref<boolean>(true);
+
+// 新增产品表单引用
+const formRef = ref();
+
+// 新增关联表格配置
+const addLinkGridOptions: VxeGridProps<any> = {
+  height: 350,
+  pagerConfig: {
+    currentPage: 1,
+    pageSize: 9999,
+    layouts: ['Total'],
+  },
+  rowConfig: {
+    isHover: true,
+    isCurrent: true,
+    keyField: 'productsid',
+  },
+  stripe: true,
+  radioConfig: {
+    reserve: true,
+    highlight: true,
+    checkMethod: ({ row }: any) =>
+      !linkedProductIds.value.includes(row.productsid),
+  },
+  proxyConfig: {
+    response: {
+      result: 'Data',
+      total: 'Total',
+    },
+    ajax: {
+      query: async () => {
+        const params: any = {
+          pageindex: 1,
+          rows: 9999,
+          'productsname.like': searchKeyword.value || undefined,
+        };
+
+        const response = await getProductAndScqyListApi(params);
+
+        // 如果勾选了只显示未关联,则过滤掉已关联的产品
+        if (
+          showUnlinkedOnly.value &&
+          response?.Data &&
+          Array.isArray(response.Data)
+        ) {
+          // 获取最新的已关联产品列表
+          await fetchLinkedProducts();
+
+          // 过滤掉已关联的产品
+          response.Data = response.Data.filter(
+            (item: any) => !linkedProductIds.value.includes(item.productsid),
+          );
+        }
+
+        return response;
+      },
+    },
+  },
+  columns: [
+    { type: 'radio', width: 60 },
+    {
+      title: '关联状态',
+      field: 'linkStatus',
+      width: 100,
+      slots: { default: 'linkStatus' },
+    },
+    { title: '产品名称', field: 'productsname' },
+    { title: '产品型号', field: 'productsmodel' },
+    { title: '机具类型', field: 'productsjjlx' },
+    { title: '品目', field: 'productspm' },
+    {
+      title: '生产企业',
+      field: 'scqyinfomc',
+    },
+  ],
+};
+
+const addLinkGridEvents: VxeGridListeners<any> = {
+  radioChange: ({ row }) => {
+    selectedProduct.value = row;
+    // 设置当前行高亮
+    addLinkGridApi.grid.setCurrentRow(row);
+  },
+  cellClick: ({ row }) => {
+    // 只有未关联的产品才能选中
+    if (linkedProductIds.value.includes(row.productsid)) {
+      ElMessage.warning('该产品已存在关联关系');
+    } else {
+      // 点击行时设置radio选中状态
+      addLinkGridApi.grid.setRadioRow(row);
+      selectedProduct.value = row;
+      // 设置当前行高亮
+      addLinkGridApi.grid.setCurrentRow(row);
+    }
+  },
+};
+
+const [AddLinkGrid, addLinkGridApi] = useVbenVxeGrid({
+  gridEvents: addLinkGridEvents,
+  gridOptions: addLinkGridOptions,
+});
+
+// 获取已关联的产品列表
+const fetchLinkedProducts = async () => {
+  try {
+    const currentUserId = userStore.userInfo?.workeruserid || '';
+    if (!currentUserId) return [];
+
+    const response = await getProductAndScqyListApi({
+      pageindex: 1,
+      rows: 9999,
+      productsmerchantid: currentUserId,
+    });
+
+    if (response && response.Data && Array.isArray(response.Data)) {
+      linkedProductIds.value = response.Data.map(
+        (item: any) => item.productsid,
+      );
+      return response.Data;
+    }
+    return [];
+  } catch (error) {
+    console.error('获取已关联产品列表失败', error);
+    return [];
+  }
+};
+
+// 搜索产品
+function handleSearch() {
+  addLinkGridApi.reload();
+}
+
+// 清除搜索
+function clearSearch() {
+  searchKeyword.value = '';
+  addLinkGridApi.reload();
+}
+
+// 切换关联状态过滤
+function handleToggleLinkedFilter() {
+  addLinkGridApi.reload();
+}
+
+// 重置新增关联表单
+function resetAddLinkForm() {
+  selectedProduct.value = null;
+  searchKeyword.value = '';
+  showUnlinkedOnly.value = true;
+}
+
+/* 确认新增关联 */
+async function handleConfirmAddLink() {
+  if (!selectedProduct.value) {
+    ElMessage.warning('请选择要关联的产品');
+    return;
+  }
+
+  try {
+    addLinkLoading.value = true;
+
+    // 调用API来建立关联关系
+    const currentUserId = userStore.userInfo?.workeruserid || '';
+    const currentRowIds = selectedProduct.value.productsmerchantid
+      ? selectedProduct.value.productsmerchantid.split(',')
+      : [];
+
+    // 判断当前用户是否已经关联了该产品
+    if (currentRowIds.includes(currentUserId)) {
+      ElMessage.warning('该产品已经关联了数据');
+      return;
+    }
+
+    // 如果没有关联,则在原有的基础上添加当前用户ID
+    const newIds = [...currentRowIds, currentUserId];
+    const newMerchantIds = newIds.join(',');
+
+    // 调用编辑产品API建立关联关系
+    await editProductApi({
+      'productsid.value': selectedProduct.value.productsid,
+      productsmerchantid: newMerchantIds,
+    } as any);
+
+    ElMessage.success('新增关联成功');
+    emit('finish');
+    modalApi.close();
+    resetAddLinkForm();
+  } catch (error) {
+    console.error('新增关联失败', error);
+    ElMessage.error('新增关联失败,请重试');
+  } finally {
+    addLinkLoading.value = false;
+  }
+}
+
+const [Modal, modalApi] = useVbenModal({
+  title: '新增关联',
+  class: 'w-4/5',
+  closeOnClickModal: false,
+  closeOnPressEscape: false,
+  onCancel() {
+    resetAddLinkForm();
+    modalApi.close();
+  },
+  async onConfirm() {
+    await handleConfirmAddLink();
+  },
+  async onOpenChange(isOpen) {
+    if (isOpen) {
+      resetAddLinkForm();
+      // 获取已关联的产品列表
+      await fetchLinkedProducts();
+    }
+  },
+});
+
+// 暴露打开modal的方法
+const open = () => {
+  modalApi.open();
+};
+
+defineExpose({
+  open,
+});
+
+// 新增产品
+function handleAddProduct() {
+  if (formRef.value?.modalApi) {
+    formRef.value.modalApi.setData({
+      formType: 'create',
+    });
+    formRef.value.modalApi.open();
+  }
+}
+
+// 新增产品完成后的回调
+function handleProductFinish() {
+  // 刷新产品列表
+  addLinkGridApi.reload();
+}
+</script>
+
+<template>
+  <Modal>
+    <div class="space-y-4">
+      <!-- 产品选择表格 -->
+      <div>
+        <div class="mb-3 flex items-center justify-between">
+          <div class="flex items-center space-x-3">
+            <h4 class="text-lg font-medium">选择产品</h4>
+            <el-button type="primary" size="small" @click="handleAddProduct">
+              新增产品
+            </el-button>
+          </div>
+          <div class="flex items-center space-x-3">
+            <el-checkbox
+              v-model="showUnlinkedOnly"
+              @change="handleToggleLinkedFilter"
+            >
+              只显示未关联
+            </el-checkbox>
+            <div class="flex items-center space-x-2">
+              <el-input
+                v-model="searchKeyword"
+                placeholder="搜索产品名称"
+                clearable
+                class="w-60"
+                @input="handleSearch"
+                @clear="clearSearch"
+                @keyup.enter="handleSearch"
+              >
+                <template #prefix>
+                  <MdiMagnify class="text-gray-400" />
+                </template>
+              </el-input>
+              <el-button type="primary" @click="handleSearch"> 查询 </el-button>
+            </div>
+          </div>
+        </div>
+        <AddLinkGrid>
+          <template #linkStatus="{ row }">
+            <div class="flex items-center justify-center">
+              <el-tag
+                v-if="linkedProductIds.includes(row.productsid)"
+                type="warning"
+                size="small"
+                effect="light"
+              >
+                已关联
+              </el-tag>
+              <el-tag v-else type="success" size="small" effect="light">
+                未关联
+              </el-tag>
+            </div>
+          </template>
+        </AddLinkGrid>
+      </div>
+
+      <!-- 选择信息显示 -->
+      <div v-if="selectedProduct" class="rounded bg-gray-50 p-3">
+        <h5 class="mb-2 text-sm font-medium">当前选择:</h5>
+        <div class="mb-1 text-sm text-gray-600">
+          产品:{{ selectedProduct.productsname }} ({{
+            selectedProduct.productsmodel
+          }})
+        </div>
+        <div v-if="selectedProduct.scqyinfomc" class="text-sm text-gray-600">
+          生产企业:{{ selectedProduct.scqyinfomc }}
+        </div>
+      </div>
+    </div>
+
+    <!-- 新增产品表单 -->
+    <Form
+      ref="formRef"
+      :default-merchant-id="userStore.userInfo?.workeruserid"
+      @finish="handleProductFinish"
+    />
+  </Modal>
+</template>
+
+<style scoped>
+/* 自定义选中行高亮颜色 */
+:deep(.vxe-table .vxe-body--row.row--current) {
+  background-color: #e6f3ff !important;
+}
+
+/* 自定义单选框选中行高亮颜色 */
+:deep(.vxe-table .vxe-body--row.row--radio-checked) {
+  background-color: #e6f3ff !important;
+}
+
+/* 鼠标悬停时的颜色 */
+:deep(.vxe-table .vxe-body--row:hover) {
+  background-color: #f0f8ff !important;
+}
+
+/* 已关联产品的样式 */
+:deep(.vxe-table .vxe-body--row.row--radio-disabled) {
+  color: #999 !important;
+  background-color: #f5f5f5 !important;
+}
+
+:deep(.vxe-table .vxe-body--row.row--radio-disabled .vxe-radio) {
+  cursor: not-allowed !important;
+}
+</style>

+ 50 - 13
apps/web-ele/src/views/product-manage/form.vue

@@ -16,6 +16,11 @@ import {
 import { getScqyListApi } from '#/api/scqy';
 import { getCustomerListApi } from '#/api/user';
 
+// 定义 props
+const props = defineProps<{
+  defaultMerchantId?: string | string[];
+}>();
+
 const emit = defineEmits(['finish']);
 const data = ref();
 const formType = ref<'create' | 'detail' | 'edit'>('create');
@@ -77,6 +82,18 @@ const titleMap = {
 
 const getTitle = computed(() => titleMap[formType.value]);
 
+// 判断是否有默认的渠道商ID
+const hasDefaultMerchantId = computed(() => {
+  return props.defaultMerchantId && 
+    (Array.isArray(props.defaultMerchantId) ? props.defaultMerchantId.length > 0 : props.defaultMerchantId);
+});
+
+// 获取默认渠道商ID的数组形式
+const defaultMerchantIdArray = computed(() => {
+  if (!props.defaultMerchantId) return [];
+  return Array.isArray(props.defaultMerchantId) ? props.defaultMerchantId : [props.defaultMerchantId];
+});
+
 const [BaseForm, baseFormApi] = useVbenForm({
   showDefaultActions: false,
   // 所有表单项共用,可单独在表单内覆盖
@@ -133,17 +150,6 @@ const [BaseForm, baseFormApi] = useVbenForm({
       rules: z.string().min(1, { message: '请输入产品类别' }),
     },
     {
-      component: 'InputNumber',
-      fieldName: 'productsprice',
-      label: '产品原价',
-      componentProps: {
-        placeholder: '请输入产品原价',
-        min: 0,
-        precision: 2,
-      },
-      rules: z.number().min(0, { message: '请输入正确的产品原价' }),
-    },
-    {
       component: 'Input',
       fieldName: 'productsmodel',
       label: '产品型号',
@@ -190,6 +196,11 @@ const [BaseForm, baseFormApi] = useVbenForm({
         style: { width: '100%' },
       },
       rules: z.array(z.string()).min(1, { message: '请选择关联渠道商' }),
+      // 使用dependencies控制字段显示
+      dependencies: {
+        triggerFields: ['productsname'], // 依赖产品名称字段来触发重新计算
+        show: () => !hasDefaultMerchantId.value, // 当没有默认值时才显示该字段
+      },
     },
     {
       component: 'Select',
@@ -248,8 +259,19 @@ const [BaseForm, baseFormApi] = useVbenForm({
     },
     {
       component: 'InputNumber',
+      fieldName: 'productsprice',
+      label: '产品原价',
+      componentProps: {
+        placeholder: '请输入产品原价',
+        min: 0,
+        precision: 2,
+      },
+      rules: z.number().min(0, { message: '请输入正确的产品原价' }),
+    },
+    {
+      component: 'InputNumber',
       fieldName: 'productszybt',
-      label: '中央补贴金额',
+      label: '中央补贴',
       componentProps: {
         placeholder: '请输入中央补贴金额',
         min: 0,
@@ -260,7 +282,7 @@ const [BaseForm, baseFormApi] = useVbenForm({
     {
       component: 'InputNumber',
       fieldName: 'productstsxzybt',
-      label: '特殊县中央补贴金额',
+      label: '特殊县中央补贴',
       componentProps: {
         placeholder: '请输入特殊县中央补贴金额',
         min: 0,
@@ -324,6 +346,14 @@ const [Modal, modalApi] = useVbenModal({
       // 获取渠道商列表和生产企业列表
       await Promise.all([fetchChannelOptions(), fetchScqyOptions()]);
 
+      // 如果有默认的渠道商ID,设置默认值
+      if (hasDefaultMerchantId.value && data.value.formType === 'create') {
+        // 设置默认值
+        baseFormApi.setValues({
+          productsmerchantid: '',  // 设置为空的目的,是在接下来的经销商关联时,再去选择关联,而不是直接就进行关联
+        });
+      }
+
       if (data.value.formType === 'create') {
         return;
       }
@@ -349,6 +379,13 @@ const [Modal, modalApi] = useVbenModal({
     }
   },
 });
+
+
+
+// 暴露modalApi供外部调用
+defineExpose({
+  modalApi,
+});
 </script>
 
 <template>

+ 28 - 14
apps/web-ele/src/views/product-manage/index.vue

@@ -3,7 +3,7 @@ import type { VbenFormProps } from '@vben/common-ui';
 
 import type { VxeGridListeners, VxeGridProps } from '#/adapter/vxe-table';
 
-import { computed } from 'vue';
+import { ref } from 'vue';
 
 import { Page, useVbenModal } from '@vben/common-ui';
 import { MdiDelete, MdiDetail, MdiEdit } from '@vben/icons';
@@ -15,19 +15,18 @@ import { useVbenVxeGrid } from '#/adapter/vxe-table';
 import {
   deleteProductApi,
   editProductApi,
-  getProductListApi,
+  getProductAndScqyListApi,
 } from '#/api/product';
 import { $t } from '#/locales';
 
+import AddLinkModal from './add-link-modal.vue';
 import ProductForm from './form.vue';
 
 // 获取用户信息
 const userStore = useUserStore();
 
-// 判断是否是经销商且不是管理员
-const isNonAdminMerchant = computed(() => {
-  return userStore.isDLS && !userStore.isSuperAdmin;
-});
+// 新增关联组件ref
+const addLinkModalRef = ref<InstanceType<typeof AddLinkModal>>();
 
 const formOptions: VbenFormProps = {
   // 默认展开
@@ -81,12 +80,12 @@ const gridOptions: VxeGridProps<any> = {
         };
 
         // 如果是经销商且不是管理员,添加经销商筛选条件
-        if (isNonAdminMerchant.value) {
+        if (userStore.isDLSNotAdmin) {
           queryParams.productsmerchantid =
             userStore.userInfo?.workeruserid || '';
         }
 
-        return await getProductListApi(queryParams);
+        return await getProductAndScqyListApi(queryParams);
       },
     },
   },
@@ -101,6 +100,7 @@ const gridOptions: VxeGridProps<any> = {
       width: 120,
     },
     { title: '产品型号', field: 'productsmodel', sortable: true, width: 220 },
+    { title: '生产企业', field: 'scqyinfomc', sortable: true, width: 220 },
     // { title: '产品sn号', field: 'productssn' },
     { title: '品目', field: 'productspm', sortable: true, width: 120 },
     { title: '一级分类', field: 'productsfl1', sortable: true, width: 120 },
@@ -229,23 +229,34 @@ async function handleRemoveLink(row: any) {
     gridApi.reload();
   } catch {}
 }
+
+/* 新增关联 */
+function handleAddLink() {
+  addLinkModalRef.value?.open();
+}
+
+/* 新增关联完成回调 */
+function handleAddLinkFinish() {
+  gridApi.reload();
+}
 </script>
 
 <template>
   <Page auto-content-height>
     <Grid table-title="产品列表">
       <template #toolbar-tools>
+        <!--区别: 新增- 新增产品, 新增关联-新增产品和渠道商关联 -->
         <el-button
           type="primary"
           @click="handleCreate"
-          v-if="!isNonAdminMerchant"
+          v-if="!userStore.isDLSNotAdmin"
         >
           新增
         </el-button>
         <el-button
           type="primary"
-          @click="handleCreate"
-          v-if="isNonAdminMerchant"
+          @click="handleAddLink"
+          v-if="userStore.isDLSNotAdmin"
         >
           新增关联
         </el-button>
@@ -265,7 +276,7 @@ async function handleRemoveLink(row: any) {
           />
         </el-tooltip>
         <el-tooltip
-          v-if="!isNonAdminMerchant"
+          v-if="!userStore.isDLSNotAdmin"
           class="box-item"
           effect="dark"
           content="编辑"
@@ -283,7 +294,7 @@ async function handleRemoveLink(row: any) {
           effect="dark"
           content="删除"
           placement="top"
-          v-if="!isNonAdminMerchant"
+          v-if="!userStore.isDLSNotAdmin"
         >
           <el-button
             round
@@ -297,7 +308,7 @@ async function handleRemoveLink(row: any) {
           effect="dark"
           content="移除关联"
           placement="top"
-          v-if="isNonAdminMerchant"
+          v-if="userStore.isDLSNotAdmin"
         >
           <el-button
             round
@@ -309,5 +320,8 @@ async function handleRemoveLink(row: any) {
       </template>
     </Grid>
     <Modal @finish="handleFinish" />
+
+    <!-- 新增关联弹窗组件 -->
+    <AddLinkModal ref="addLinkModalRef" @finish="handleAddLinkFinish" />
   </Page>
 </template>

+ 2 - 0
packages/icons/src/iconify/index.ts

@@ -28,3 +28,5 @@ export const MdiMinus = createIconifyIcon('mdi:minus');
 export const MdiCheckboxMultipleMarked = createIconifyIcon(
   'mdi:checkbox-multiple-marked',
 );
+
+export const MdiMagnify = createIconifyIcon('mdi:magnify');

+ 5 - 1
packages/stores/src/modules/user.ts

@@ -68,7 +68,7 @@ export const useUserStore = defineStore('core-user', {
     userRoles: [],
   }),
   getters: {
-    // 是否代理商
+    // 是否经销商/代理商
     isDLS(): boolean {
       return this.userRoles.includes('49');
     },
@@ -76,6 +76,10 @@ export const useUserStore = defineStore('core-user', {
     isSuperAdmin(): boolean {
       return this.userRoles.includes('1');
     },
+    // 是经销商,但不是管理员
+    isDLSNotAdmin(): boolean {
+      return this.isDLS && !this.isSuperAdmin;
+    },
   },
   actions: {
     setUserInfo(userInfo: BasicUserInfo | null) {