weixin_52219567 преди 1 седмица
родител
ревизия
bb156ea1be
променени са 2 файла, в които са добавени 16 реда и са изтрити 6 реда
  1. 13 5
      src/views/home/pccomponents/pages/head.vue
  2. 3 1
      src/views/search/index.vue

+ 13 - 5
src/views/home/pccomponents/pages/head.vue

@@ -15,7 +15,7 @@
           <div class="search-div flex-row-start">
             <div class="search-input flex-row-center">
               <el-input class="el-input" v-model="input" placeholder="搜索商品、品牌、分类..." />
-              <div class="bnt flex-row-center" @click="onPath('/search?type=1&input=' + input)">
+              <div class="bnt flex-row-center" @click="onPath('/search?type=1&input=' + input + '&cType=' + componentData.headType)">
                 <el-icon color="#ffffff" size="20">
                   <Search />
                 </el-icon>
@@ -31,7 +31,11 @@
             </div>
           </div>
           <div class="search-text">
-            <div @click="onPath('/search?type=1&input=' + item.title)" v-for="(item, index) in componentData.toplabel" :key="index">
+            <div
+              @click="onPath('/search?type=1&input=' + item.title + '&cType=' + componentData.headType)"
+              v-for="(item, index) in componentData.toplabel"
+              :key="index"
+            >
               {{ item.title }}
             </div>
           </div>
@@ -77,7 +81,7 @@
             >
               <template v-if="componentData.leftStyle == 1">
                 <div
-                  @click="onPath('/search?type=1&topCategoryId=' + item.id)"
+                  @click="onPath('/search?type=1&topCategoryId=' + item.id + '&cType=' + componentData.headType)"
                   :style="{ 'color': componentData.leftColor1 }"
                   class="label ellipsis hover-color"
                 >
@@ -111,14 +115,18 @@
               v-for="(item, index) in classifyInfo"
               :key="index"
               class="classify-item"
-              @click="onPath('/search?type=2&mediumCategoryId=' + item.id)"
+              @click="onPath('/search?type=2&mediumCategoryId=' + item.id + '&cType=' + componentData.headType)"
             >
               <div class="two-level ellipsis">{{ item.label || '' }}</div>
               <el-icon class="classify-icon" :size="14" color="#364153">
                 <ArrowRight />
               </el-icon>
               <div class="classify-label">
-                <div @click="onPath('/search?type=3&bottomCategoryId=' + item1.id)" v-for="(item1, index1) in item.children" :key="index1">
+                <div
+                  @click="onPath('/search?type=3&bottomCategoryId=' + item1.id + '&cType=' + componentData.headType)"
+                  v-for="(item1, index1) in item.children"
+                  :key="index1"
+                >
                   {{ item1.label || '' }}
                 </div>
               </div>

+ 3 - 1
src/views/search/index.vue

@@ -201,6 +201,7 @@ const station = stationStore();
 const userStore = useUserStore();
 const route = useRoute();
 const type = ref<any>(1);
+const cType = ref<any>(1);
 const dataList = ref<any>([]);
 const checkList = ref<any>([]);
 const classifyList = ref<any>([]);
@@ -468,7 +469,7 @@ const getClassify = async () => {
       }
     });
   } else {
-    getProductCategoryTree({}).then((res) => {
+    getProductCategoryTree({ platform: cType.value }).then((res) => {
       if (res.code == 200) {
         classifyData.value = res.data;
         onClassify();
@@ -646,6 +647,7 @@ const initData = () => {
   httpObj.value.brandId = '';
   httpObj.value.pageNum = 1;
   type.value = route.query.type;
+  cType.value = route.query.cType ? route.query.cType : 0;
   if (route.query.input) {
     httpObj.value.searchKeyword = route.query.input;
   }