weixin_52219567 11 часов назад
Родитель
Сommit
dfff24dba5

+ 31 - 31
src/store/modules/pcdiy.ts

@@ -144,6 +144,37 @@ const usePcdiyStore: any = defineStore('pcdiy', {
             id: Date.now()
           }
         ];
+        newItem.advertNum = 0;
+        newItem.advertList = [
+          {
+            imageUrl: '',
+            url: '',
+            imgType: 1,
+            id: Date.now(),
+            show: false
+          },
+          {
+            imageUrl: '',
+            url: '',
+            imgType: 1,
+            id: Date.now(),
+            show: false
+          },
+          {
+            imageUrl: '',
+            url: '',
+            imgType: 1,
+            id: Date.now(),
+            show: false
+          },
+          {
+            imageUrl: '',
+            url: '',
+            imgType: 1,
+            id: Date.now(),
+            show: false
+          }
+        ];
         newItem.realType = 1;
         newItem.realDataType = 1;
         newItem.realNumber = 5;
@@ -824,37 +855,6 @@ const usePcdiyStore: any = defineStore('pcdiy', {
             id: Date.now()
           }
         ];
-        newItem.advertNum = 0;
-        newItem.advertList = [
-          {
-            imageUrl: '',
-            url: '',
-            imgType: 1,
-            id: Date.now(),
-            show: false
-          },
-          {
-            imageUrl: '',
-            url: '',
-            imgType: 1,
-            id: Date.now(),
-            show: false
-          },
-          {
-            imageUrl: '',
-            url: '',
-            imgType: 1,
-            id: Date.now(),
-            show: false
-          },
-          {
-            imageUrl: '',
-            url: '',
-            imgType: 1,
-            id: Date.now(),
-            show: false
-          }
-        ];
         newItem.realType = 1;
         newItem.realDataType = 1;
         newItem.realNumber = 5;

+ 1 - 1
src/views/diy/pcEdit.vue

@@ -44,7 +44,7 @@
             <draggable v-model="diyStore.componentList" item-key="itemKey" class="drag-area" :move="onDragMove">
               <template #item="{ element, index }">
                 <div @click="diyStore.onComponent(element, index)" class="component-bos">
-                  <!-- <div class="component-box" :style="{ borderWidth: diyStore.currentIndex == index ? '2px' : '0px' }"></div> -->
+                  <div class="component-box" :style="{ borderWidth: diyStore.currentIndex == index ? '2px' : '0px' }"></div>
                   <component :is="element.components" :key="element.itemKey" :index="index"></component>
                 </div>
               </template>

+ 6 - 2
src/views/diy/pccomponents/edit/discover-edit.vue

@@ -275,7 +275,7 @@
     </div>
 
     <ImagesForm ref="ImagesFormRef" @confirmCallBack="confirmCallBack"></ImagesForm>
-    <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions"></goods-dialog>
+    <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions" :clientId="diyStore.clientId"></goods-dialog>
   </div>
 </template>
 
@@ -344,7 +344,11 @@ const confirmCallBack = (res: any, type: any) => {
 /** 查询分类树 */
 const getCategoryTree = async () => {
   categoryOptions.value = [];
-  const res = await categoryTree();
+  const res = await categoryTree({
+    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 4 : 0,
+    pageNum: 1,
+    pageSize: 9999
+  });
   const list = res.data || [];
   categoryOptions.value = [...list];
   categoryOptions.value.unshift({

+ 2 - 2
src/views/diy/pccomponents/edit/floor-edit.vue

@@ -218,7 +218,7 @@
     </el-dialog>
 
     <ImagesForm ref="ImagesFormRef" @confirmCallBack="confirmCallBack"></ImagesForm>
-    <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions"></goods-dialog>
+    <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions" :clientId="diyStore.clientId"></goods-dialog>
   </div>
 </template>
 
@@ -290,7 +290,7 @@ const confirmCallBack = (res: any, type: any) => {
 const getCategoryTree = async () => {
   categoryOptions.value = [];
   const res = await categoryTree({
-    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 0 : 0,
+    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 4 : 0,
     pageNum: 1,
     pageSize: 9999
   });

+ 1 - 1
src/views/diy/pccomponents/edit/goods-edit.vue

@@ -204,7 +204,7 @@ const getCategoryTree = async () => {
   categoryOptions.value = [];
   categoryOptions1.value = [];
   const res = await categoryTree({
-    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 0 : 0,
+    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 4 : 0,
     pageNum: 1,
     pageSize: 9999
   });

+ 2 - 2
src/views/diy/pccomponents/edit/goodsList-edit.vue

@@ -198,7 +198,7 @@
       <!-- 组件样式 -->
       <slot name="style"></slot>
     </div>
-    <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions" :navIndex="navIndex"></goods-dialog>
+    <goods-dialog ref="goodsDialogRef" :categoryOptions="categoryOptions" :navIndex="navIndex" :clientId="diyStore.clientId"></goods-dialog>
   </div>
 </template>
 
@@ -255,7 +255,7 @@ const getCategoryTree = async () => {
   categoryOptions.value = [];
   categoryOptions1.value = [];
   const res = await categoryTree({
-    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 0 : 0,
+    platform: diyStore.type == 1 ? 0 : diyStore.type == 2 ? 1 : diyStore.type == 3 ? 2 : diyStore.type == 4 ? 4 : 0,
     pageNum: 1,
     pageSize: 9999
   });

+ 2 - 11
src/views/diy/pccomponents/edit/headData-edit.vue

@@ -133,12 +133,12 @@
                 <el-radio :value="2">在下</el-radio>
               </el-radio-group>
             </el-form-item> -->
-            <el-form-item label="数据来源">
+            <!-- <el-form-item label="数据来源">
               <el-radio-group v-model="diyStore.editComponent.realDataType">
                 <el-radio :value="1">默认</el-radio>
                 <el-radio :value="2">手动</el-radio>
               </el-radio-group>
-            </el-form-item>
+            </el-form-item> -->
             <el-form-item label="文章数量" v-if="diyStore.editComponent.realDataType == 1">
               <el-slider v-model="diyStore.editComponent.realNumber" show-input :min="1" :max="5" />
             </el-form-item>
@@ -367,15 +367,6 @@ const onDel = (res: any, index: any) => {
   }
 };
 
-const onAdvertNum = (res: any) => {
-  diyStore.editComponent.advertList.forEach((item: any, index: any) => {
-    item.show = false;
-    if (index < res) {
-      item.show = true;
-    }
-  });
-};
-
 // 打开图片类型
 const openImageType = (element: any, type: any) => {
   const datas = JSON.parse(JSON.stringify(element));

+ 14 - 1
src/views/diy/pccomponents/pages/discover.vue

@@ -117,6 +117,7 @@
 import figure from '@/assets/images/figure.png';
 import usePcdiyStore from '@/store/modules/pcdiy';
 import { listBase } from '@/api/pmsProduct/base';
+import { getCustomerProductPage } from '@/api/diy/index';
 const diyStore = usePcdiyStore();
 
 const props = defineProps<{
@@ -133,7 +134,19 @@ onMounted(() => {
 const getDataList = () => {
   dataList.value = [{}, {}, {}, {}];
   if (componentData.goodsIds.length > 0) {
-    listBase({ pageNum: 1, pageSize: 10, ids: componentData.goodsIds.join(',') }).then((res) => {
+    const apiFunc = diyStore.clientId && diyStore.clientId !== 'undefined' ? getCustomerProductPage : listBase;
+    const queryParams = {
+      pageNum: 1,
+      pageSize: 10,
+      ids: componentData.goodsIds.join(','),
+      customerId: ''
+    };
+    if (diyStore.clientId && diyStore.clientId != 'undefined') {
+      queryParams.customerId = diyStore.clientId;
+    } else {
+      delete queryParams.customerId;
+    }
+    apiFunc(queryParams).then((res) => {
       if (res.code == 200) {
         dataList.value = res.rows;
       }

+ 14 - 1
src/views/diy/pccomponents/pages/floor.vue

@@ -59,6 +59,7 @@
 import figure from '@/assets/images/figure.png';
 import usePcdiyStore from '@/store/modules/pcdiy';
 import { listBase } from '@/api/pmsProduct/base';
+import { getCustomerProductPage } from '@/api/diy/index';
 const diyStore = usePcdiyStore();
 
 const props = defineProps<{
@@ -84,7 +85,19 @@ const getDataList = () => {
   dataList.value = [{}, {}, {}, {}, {}, {}, {}, {}];
   //手动选择
   if (componentData.goodsIds.length > 0) {
-    listBase({ pageNum: 1, pageSize: 20, ids: componentData.goodsIds.join(',') }).then((res) => {
+    const apiFunc = diyStore.clientId && diyStore.clientId !== 'undefined' ? getCustomerProductPage : listBase;
+    const queryParams = {
+      pageNum: 1,
+      pageSize: 20,
+      ids: componentData.goodsIds.join(','),
+      customerId: ''
+    };
+    if (diyStore.clientId && diyStore.clientId != 'undefined') {
+      queryParams.customerId = diyStore.clientId;
+    } else {
+      delete queryParams.customerId;
+    }
+    apiFunc(queryParams).then((res) => {
       if (res.code == 200) {
         dataList.value = res.rows;
       }

+ 17 - 7
src/views/diy/pccomponents/pages/goods.vue

@@ -69,6 +69,7 @@
 import figure from '@/assets/images/figure.png';
 import usePcdiyStore from '@/store/modules/pcdiy';
 import { listBase } from '@/api/pmsProduct/base';
+import { getCustomerProductPage } from '@/api/diy/index';
 const diyStore = usePcdiyStore();
 
 const props = defineProps<{
@@ -84,10 +85,21 @@ onMounted(() => {
 
 const getDataList = () => {
   original.value = [{}, {}, {}, {}, {}];
+  const apiFunc = diyStore.clientId && diyStore.clientId !== 'undefined' ? getCustomerProductPage : listBase;
+  const queryParams = {
+    pageNum: 1,
+    pageSize: componentData.goodsType == 1 ? 20 : componentData.goodsNumber == 0 ? 9999 : componentData.goodsNumber,
+    customerId: ''
+  };
+  if (diyStore.clientId && diyStore.clientId != 'undefined') {
+    queryParams.customerId = diyStore.clientId;
+  } else {
+    delete queryParams.customerId;
+  }
   //手动选择
   if (componentData.goodsType == 1) {
     if (componentData.goodsIds.length > 0) {
-      listBase({ pageNum: 1, pageSize: 20, ids: componentData.goodsIds.join(',') }).then((res) => {
+      apiFunc({ ...queryParams, ids: componentData.goodsIds.join(',') }).then((res) => {
         if (res.code == 200) {
           original.value = res.rows;
         }
@@ -97,9 +109,8 @@ const getDataList = () => {
     //分类查询
     if (componentData.categoryIds && componentData.categoryIds.length > 0) {
       const categoryIds = componentData.categoryIds.map((item: any) => item[2]);
-      listBase({
-        pageNum: 1,
-        pageSize: componentData.goodsNumber == 0 ? 9999 : componentData.goodsNumber,
+      apiFunc({
+        ...queryParams,
         categoryIds: categoryIds.join(',')
       }).then((res) => {
         if (res.code == 200) {
@@ -112,9 +123,8 @@ const getDataList = () => {
   } else if (componentData.goodsType == 3) {
     //品牌查询
     if (componentData.brandIds && componentData.brandIds.length > 0) {
-      listBase({
-        pageNum: 1,
-        pageSize: componentData.goodsNumber == 0 ? 9999 : componentData.goodsNumber,
+      apiFunc({
+        ...queryParams,
         brandIds: componentData.brandIds.join(',')
       }).then((res) => {
         if (res.code == 200) {

+ 14 - 3
src/views/diy/pccomponents/pages/goodsList.vue

@@ -44,6 +44,7 @@
 import figure from '@/assets/images/figure.png';
 import usePcdiyStore from '@/store/modules/pcdiy';
 import { listBase } from '@/api/pmsProduct/base';
+import { getCustomerProductPage } from '@/api/diy/index';
 const diyStore = usePcdiyStore();
 
 const props = defineProps<{
@@ -59,12 +60,23 @@ onMounted(() => {
 
 const getDataList = () => {
   dataList.value = [{}, {}, {}, {}, {}];
+  const apiFunc = diyStore.clientId && diyStore.clientId !== 'undefined' ? getCustomerProductPage : listBase;
+  const queryParams = {
+    pageNum: 1,
+    pageSize: componentData.goodsType == 1 ? 20 : componentData.goodsNumber == 0 ? 9999 : componentData.goodsNumber,
+    customerId: ''
+  };
+  if (diyStore.clientId && diyStore.clientId != 'undefined') {
+    queryParams.customerId = diyStore.clientId;
+  } else {
+    delete queryParams.customerId;
+  }
   if (componentData.tabList && componentData.tabList.length > 0) {
     const datas = componentData.tabList[componentData.tabIndex];
     //手动选择
     if (datas.goodsType == 1) {
       if (datas.goodsIds.length > 0) {
-        listBase({ pageNum: 1, pageSize: 20, ids: datas.goodsIds.join(',') }).then((res) => {
+        listBase({ ...queryParams, ids: datas.goodsIds.join(',') }).then((res) => {
           if (res.code == 200) {
             dataList.value = res.rows;
           }
@@ -74,8 +86,7 @@ const getDataList = () => {
       //分类查询
       if (datas.categoryIds && datas.categoryIds.length > 0) {
         listBase({
-          pageNum: 1,
-          pageSize: componentData.goodsNumber == 0 ? 9999 : componentData.goodsNumber,
+          ...queryParams,
           categoryIds: datas.categoryIds.join(',')
         }).then((res) => {
           if (res.code == 200) {

+ 74 - 22
src/views/diy/pccomponents/pages/headData.vue

@@ -75,11 +75,10 @@
               'styleType' + componentData.carouselStyleType
             ]"
             :style="{
-              height: componentData.advertNum == 0 ? '540px' : '400px',
               borderRadius: componentData.carouselRadius + 'px'
             }"
           >
-            <el-carousel :height="componentData.advertNum == 0 ? '540px' : '400px'" arrow="always">
+            <el-carousel height="540px" arrow="always">
               <template v-if="componentData.carouselList && componentData.carouselList.length > 0">
                 <el-carousel-item v-for="item in componentData.carouselList" :key="item">
                   <el-image
@@ -164,7 +163,7 @@
             </div>
             <div class="real-box">
               <template v-for="(item, index) in realList" :key="index">
-                <div class="real-list ellipsis" v-if="componentData.realDataType == 2 ? true : Number(index) < componentData.realNumber">
+                <div class="real-list ellipsis" v-if="Number(index) < componentData.realNumber">
                   {{ item.announcementTitle }}
                 </div>
               </template>
@@ -183,7 +182,6 @@ import logo2 from '@/assets/images/pcdiy/logo2.png';
 import logo3 from '@/assets/images/pcdiy/logo3.png';
 import code from '@/assets/images/pcdiy/code.png';
 import usePcdiyStore from '@/store/modules/pcdiy';
-import { listAnnouncement } from '@/api/system/announcement';
 const diyStore = usePcdiyStore();
 const props = defineProps<{
   index: number; // 确保声明 index 为可选属性
@@ -196,24 +194,78 @@ onMounted(() => {
 });
 
 const getDataList = () => {
-  realList.value = [];
-  // 默认
-  if (componentData.realDataType == 1) {
-    listAnnouncement({ pageSize: 20 }).then((res) => {
-      if (res.code == 200) {
-        realList.value = res.rows;
-      }
-    });
-  } else {
-    //手动选择
-    listAnnouncement({ pageSize: 20, ids: componentData.realIds.join(',') }).then((res) => {
-      if (res.code == 200) {
-        const result = res.rows.filter((item: any) => componentData.realIds.includes(item.id));
-        realList.value = result;
-        console.log('result', result);
-      }
-    });
-  }
+  realList.value = [
+    {
+      'id': 1,
+      'announcementNo': '00067',
+      'announcementTitle': '喜讯丨中标"中国中车2026-2027年福利类供应商集中采购项目"',
+      'announcementContent': '热烈祝贺我司成功中标中国中车2026-2027年福利类供应商集中采购项目!',
+      'coverImage': '2005561851424944130',
+      'coverImageUrl': '',
+      'isShow': 0,
+      'viewCount': 128,
+      'sort': 1,
+      'status': '0',
+      'remark': null,
+      'createTime': '2025-12-17 09:42:28'
+    },
+    {
+      'id': 2,
+      'announcementNo': '00066',
+      'announcementTitle': '喜讯丨中标"2025年深圳阳光采购平台员工商城供应商采购项目"',
+      'announcementContent': '我司成功中标深圳阳光采购平台员工商城供应商采购项目!',
+      'coverImage': '2005561920278638594',
+      'coverImageUrl': '',
+      'isShow': 1,
+      'viewCount': 96,
+      'sort': 2,
+      'status': '0',
+      'remark': null,
+      'createTime': '2025-12-15 17:41:12'
+    },
+    {
+      'id': 3,
+      'announcementNo': '00065',
+      'announcementTitle': '喜讯丨中标"吉林大学通用办公用品、电子耗材采购项目"',
+      'announcementContent': '我司成功中标吉林大学通用办公用品、电子耗材采购项目!',
+      'coverImage': '2005561949982699522',
+      'coverImageUrl': '',
+      'isShow': 1,
+      'viewCount': 85,
+      'sort': 3,
+      'status': '0',
+      'remark': null,
+      'createTime': '2025-12-15 16:54:06'
+    },
+    {
+      'id': 4,
+      'announcementNo': '00064',
+      'announcementTitle': '喜讯丨中标"杭银消费金融公司2025年-2026年年度节日福利供应商遴选入库项目"',
+      'announcementContent': '我司成功中标杭银消费金融公司年度节日福利供应商遴选入库项目!',
+      'coverImage': '2005561989685981185',
+      'coverImageUrl': '',
+      'isShow': 1,
+      'viewCount': 72,
+      'sort': 4,
+      'status': '0',
+      'remark': null,
+      'createTime': '2025-12-15 16:54:11'
+    },
+    {
+      'id': 5,
+      'announcementNo': '00063',
+      'announcementTitle': '喜讯丨成功中标"华中科技大学同济医学院附属同济医院等单位物资采购平台电商服务采购项目"!',
+      'announcementContent': '我司成功中标华中科技大学同济医学院附属同济医院物资采购平台电商服务采购项目!',
+      'coverImage': '2005562052403408897',
+      'coverImageUrl': '',
+      'isShow': 1,
+      'viewCount': 156,
+      'sort': 5,
+      'status': '0',
+      'remark': null,
+      'createTime': '2025-12-15 16:54:30'
+    }
+  ];
 };
 
 // 监听 componentData 变化,重新请求数据