Browse Source

feat: 企业搜索、采购单位搜索历史记录功能添加

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 1 year ago
parent
commit
7eb524b628

+ 17 - 2
apps/bigmember_pc/src/components/article-item/ArticleItem.vue

@@ -62,10 +62,10 @@
           >企业手动分发</span
         >
         <span class="tag"
-              v-if="article.area"
+              v-if="calcArea"
               :class="{'tag-handle': tagClickList.includes('area') && article.areaUrl}"
               @click.stop="tagClick('area')">
-          {{ article.region || article.area }}</span>
+          {{ calcArea }}</span>
         <span class="tag orange"
               :class="{'tag-handle': tagClickList.includes('subtype') && article.subtypeUrl}"
               v-if="article.type || article.subtype"
@@ -456,6 +456,21 @@ export default {
     calcBuyerclass () {
       const buyerClass = this.article.buyerclass || this.article.buyerClass
       return buyerClass && buyerClass !== '其它' && buyerClass.indexOf("登录")<0
+    },
+    calcArea() {
+      const v = this.article
+      const region = []
+      if(v.area && (v.city && v.city.indexOf(v.area) === -1)) {
+        region.push(v.area)
+      }
+      if(v.city) {
+        region.push(v.city)
+      }
+      if(v.district) {
+        region.push(v.district)
+      }
+      v.region = region.join('-')
+      return v.region || v.area
     }
   },
   data() {

+ 27 - 3
apps/bigmember_pc/src/components/filter-items/AttachmentSelector.vue

@@ -23,7 +23,11 @@
 
 <script>
 import Layout from '@/components/filter-items/Layout.vue'
-import { attachmentData } from '@/assets/js/selector.js'
+import {
+  attachmentData,
+  infoSource,
+  viewStatusData
+} from '@/assets/js/selector.js'
 export default {
   name: 'Attachment',
   props: {
@@ -43,12 +47,16 @@ export default {
       type: [String, Number, Object],
       default: null
     },
+    cname: {
+      type: String,
+      default: ''
+    },
     beforeChange: Function
   },
   components: {
     Layout
   },
-  data () {
+  data() {
     return {
       options: attachmentData,
       selected: {
@@ -76,10 +84,26 @@ export default {
       handler(n) {
         this.setState(n)
       }
+    },
+    cname: {
+      immediate: true,
+      handler(n) {
+        if (n) {
+          this.setListContent(n)
+        }
+      }
     }
   },
   methods: {
-    handleChange (item) {
+    setListContent(data) {
+      const dataListObj = {
+        'attachmentData': attachmentData,
+        'infoSource': infoSource,
+        'viewStatusData': viewStatusData
+      }
+      this.options = dataListObj[data]
+    },
+    handleChange(item) {
       const beforeChange = this.beforeChange
       if (beforeChange) {
         const pass = beforeChange(item)

+ 10 - 3
apps/bigmember_pc/src/components/filter-items/CascadeContent.vue

@@ -1,7 +1,7 @@
 <template>
    <div class="cascade-content">
     <div class="cascade-content-module">
-      <header class="module-header">一级分类</header>
+      <header class="module-header">{{ firstTitle }}</header>
       <div class="module-main">
         <ul>
           <li
@@ -28,7 +28,7 @@
       </div>
     </div>
     <div class="cascade-content-module">
-      <header class="module-header"><span>二级分类</span></header>
+      <header class="module-header"><span>{{ twoTitle }}</span></header>
       <div class="module-main">
         <ul>
           <li
@@ -70,7 +70,14 @@ export default {
         return null
       }
     },
-
+    firstTitle: {
+      type: String,
+      default: '一级分类'
+    },
+    twoTitle: {
+      type: String,
+      default: '二级分类'
+    }
   },
   data () {
     return {

+ 2 - 0
apps/bigmember_pc/src/components/filter-items/KeywordSelector.vue

@@ -8,6 +8,8 @@
     <CascadeContent
       ref="keywordContent"
       slot="empty"
+      first-title="关键词分类"
+      two-title="关键词组"
       :options="options"
       :value="value"
       @change="onChange"

+ 0 - 187
apps/bigmember_pc/src/views/subscribe/SubPush.vue

@@ -62,147 +62,6 @@
             ></span>
           </div>
         </TimeSelector>
-        <!-- <AreaSelector
-          v-if="autoVt === 'f'"
-          @onChange="changeArea"
-          :beforeTabClick="beforeSelected"
-          ref="areaSelector"
-          selectorType="line"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            选择区域:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </AreaSelector>
-        <AreaCityCountryCascader
-          v-else
-          ref="areaCityCountry"
-          :vip="!showVipTag"
-          @change="onAreaCityCountry"
-          @limit="onLimitClick"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            项目地区:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </AreaCityCountryCascader>
-        <IndustrySelector
-          @onChange="changeIndustry"
-          :beforeChange="beforeSelected"
-          selectorType="line"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            行业:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </IndustrySelector>
-        <PriceSelector
-          @onChange="onPriceChange"
-          :beforeConfirm="beforeSelected"
-          selectorType="line"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            价格区间:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </PriceSelector>
-        <IndustrySelector
-          :class="{ pdl6: this.showVipTag }"
-          @onChange="changeBuyer"
-          :beforeChange="beforeSelected"
-          dataType="buyer"
-          selectorType="line"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            采购单位类型:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </IndustrySelector>
-        <InfoTypeSelector
-          class="my-line"
-          @onChange="changeInfo"
-          :beforeChange="beforeSelected"
-          :oneLevelSelected="true"
-          selectorType="line"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            信息类型:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </InfoTypeSelector> -->
-        <!-- <PopSelector
-          @onChange="changeKeys"
-          ref="keySelector"
-          :beforeTabClick="beforeSelected"
-          selectorType="line"
-        >
-          <div
-            class="filter-label"
-            :class="{ 'label-width': showVipTag }"
-            slot="header"
-          >
-            关键词:<span class="el-icon-jy-vip" v-if="showVipTag"></span>
-          </div>
-        </PopSelector> -->
-        <!-- <selectorCard cardType="line">
-          <div
-            slot="header"
-            class="s-header filter-label"
-            :class="{ 'label-width': showVipTag }"
-          >
-            <slot name="header"
-              >附件:<span class="el-icon-jy-vip" v-if="showVipTag"></span
-            ></slot>
-          </div>
-          <RadioGroup
-            :sourceList="withFileList"
-            v-model="filters.fileExists"
-            :beforeChange="beforeSelected"
-            @onChange="onFileStateChange"
-          />
-        </selectorCard> -->
-        <!-- <selectorCard class="more-selector" cardType="line">
-          <div
-            slot="header"
-            class="s-header filter-label"
-            :class="{ 'label-width': showVipTag }"
-          >
-            <slot name="header"
-              >更多筛选:<span class="el-icon-jy-vip" v-if="showVipTag"></span
-            ></slot>
-          </div>
-          <selectGroup
-            @getInfoSource="getInfoSource"
-            :beforeChange="beforeSelected"
-            @getSelectStatus="getSelectStatus"
-            @addUserPerson="addUserPerson"
-            @onKeywordChange="onKeywordChange"
-            :person="showPerson"
-            :key-list="keyList"
-            :show-vip-tag="showVipTag"
-            :vt="vt"
-            :info-source="infoSource"
-            :view-status-list="viewStatusList"
-          ></selectGroup>
-        </selectorCard> -->
         <!--  更多筛选  -->
         <search-schema-filter
           v-model="filters"
@@ -560,52 +419,6 @@ export default {
         push: true,
         detail: true,
       },
-      withFileList: [
-        {
-          label: '全部',
-          value: ''
-        },
-        {
-          label: '有附件',
-          value: '1'
-        },
-        {
-          label: '无附件',
-          value: '-1'
-        }
-      ],
-      viewStatusList: [
-        {
-          value: '',
-          label: '全部'
-        },
-        {
-          value: '0',
-          label: '未查看'
-        },
-        {
-          value: '1',
-          label: '已查看'
-        }
-      ],
-      infoSource: [
-        {
-          value: '',
-          label: '全部'
-        },
-        {
-          value: '1',
-          label: '个人订阅'
-        },
-        {
-          value: '2',
-          label: '企业自动分发'
-        },
-        {
-          value: '3',
-          label: '企业手动分发'
-        }
-      ],
       showPerson: '',
       filters: {
         // vt: '',

+ 7 - 3
apps/bigmember_pc/src/views/subscribe/constant/search-filters.js

@@ -142,7 +142,9 @@ function createSubscribeMoreSchema() {
         component: AttachmentSelector,
         hooks: {},
         props: {
-          options: attachmentData
+          options: attachmentData,
+          placeholder: '附件',
+          cname: 'attachmentData'
         }
       }
     },
@@ -157,7 +159,8 @@ function createSubscribeMoreSchema() {
         hooks: {},
         props: {
           options: infoSource,
-          placeholder: '信息来源'
+          placeholder: '信息来源',
+          cname: 'infoSource'
         }
       }
     },
@@ -172,7 +175,8 @@ function createSubscribeMoreSchema() {
         hooks: {},
         props: {
           options: viewStatusData,
-          placeholder: '查看状态'
+          placeholder: '查看状态',
+          cname: 'viewStatusData'
         }
       }
     }

+ 145 - 0
apps/mobile/src/components/search/HistoryBrowseList.vue

@@ -0,0 +1,145 @@
+<template>
+  <div class="browse-container">
+    <div class="title-group" v-show="getList.length">
+      <slot name="header-title">
+        <span class="title">{{ title }}</span>
+      </slot>
+      <slot name="header-right">
+        <div class="delete-icon" @click="$emit('delete')">
+          <AppIcon name="dataDelete" />
+        </div>
+      </slot>
+    </div>
+    <ul class="browse-list">
+      <li
+        class="hover-css--slide jy-hairline--bottom"
+        v-for="(item, index) in getList"
+        :key="index"
+        v-html="item.html"
+        @click="$emit('click', item)"
+      ></li>
+    </ul>
+  </div>
+</template>
+
+<script>
+import { AppIcon } from '@/ui'
+export default {
+  name: 'history-browse-list',
+  components: {
+    [AppIcon.name]: AppIcon
+  },
+  /**
+   * keys 需替换的关键词或关键词组
+   * list 数据集合
+   * item.html 替换后的字符
+   * item.label 替换前字符
+   */
+  props: {
+    keys: {
+      required: true,
+      type: [String, Array],
+      default() {
+        return ''
+      }
+    },
+    searchType: {
+      type: String,
+      default: ''
+    },
+    list: {
+      type: Array,
+      default() {
+        return []
+      }
+    },
+    title: {
+      type: String,
+      default: '历史浏览'
+    }
+  },
+  computed: {
+    getList() {
+      return this.list.map((v) => {
+        console.log(v, 'v')
+        if (this.searchType === 'company') {
+          const stringItemTransform =
+            typeof v === 'string' ? { html: v.split('_')[0] } : v
+          return Object.assign(
+            {
+              html: v.label,
+              eId: v.split('_')[1]
+            },
+            stringItemTransform
+          )
+        } else {
+          const stringItemTransform = typeof v === 'string' ? { html: v } : v
+          return Object.assign(
+            {
+              html: v.label
+            },
+            stringItemTransform
+          )
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+$association-list-color: #171826;
+
+$association-list-padding: 14px;
+$association-list-size: 14px;
+$association-list-line-height: 48px;
+
+.browse-container {
+  .title-group {
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+    justify-content: space-between;
+    font-weight: 400;
+    font-size: 16px;
+    padding: 16px;
+    line-height: 24px;
+    color: #171826;
+    box-sizing: border-box;
+    .delete-icon {
+      .iconfont {
+        font-size: 20px;
+        color: #9b9ca3;
+      }
+    }
+  }
+  .browse-list {
+    margin: 0;
+    padding: 0;
+    list-style: none;
+    font-weight: 500;
+    font-size: $association-list-size;
+    line-height: $association-list-line-height;
+    color: $association-list-color;
+    li {
+      position: relative;
+      outline: none;
+      border: none;
+      z-index: 1;
+      font-size: inherit;
+      font-family: inherit;
+      color: inherit;
+      background: inherit;
+      padding: 0 $association-list-padding;
+      box-sizing: border-box;
+      overflow: hidden;
+      white-space: nowrap;
+      text-overflow: ellipsis;
+      float: unset;
+      &::after {
+        margin-left: $association-list-padding;
+      }
+    }
+  }
+}
+</style>

+ 10 - 9
apps/mobile/src/data/selector.js

@@ -21,23 +21,24 @@ export const provinceListMapExp = {
 
 // 行业
 export const industryListMapExp = {
-  建筑工程: ['勘察设计', '工程施工', '监理咨询', '材料设备', '机电安装'],
-  水利水电: ['水利工程', '发电工程', '航运工程', '其他工程'],
-  能源化工: ['原材料', '仪器仪表', '新能源', '设备物资', '化工产品', '设备'],
-  弱电安防: ['综合布线', '智能系统', '智能家居'],
+  建筑工程: ['勘察设计', '工程施工', '监理咨询', '材料设备', '机电安装', '其他'],
+  水利水电: ['水利工程', '发电工程', '航运工程', '其他工程', '其他'],
+  能源化工: ['原材料', '仪器仪表', '新能源', '设备物资', '化工产品', '设备', '其他'],
+  弱电安防: ['综合布线', '智能系统', '智能家居', '其他'],
   信息技术: ['系统集成及安全', '软件开发', '运维服务', '其他'],
-  行政办公: ['办公家具', '通用办公设备', '专业设备', '办公用品', '生活用品'],
+  行政办公: ['办公家具', '通用办公设备', '专业设备', '办公用品', '生活用品', '其他'],
   机械设备: [
     '矿山机械',
     '工程机械',
     '机械零部件',
     '机床相关',
     '车辆',
-    '其他机械设备'
+    '其他机械设备',
+    '其他'
   ],
   交通工程: ['道路', '轨道', '桥梁', '隧道', '其他'],
-  医疗卫生: ['设备', '耗材', '药品'],
-  市政设施: ['道路', '绿化', '线路管网', '综合项目'],
+  医疗卫生: ['设备', '耗材', '药品', '其他'],
+  市政设施: ['道路', '绿化', '线路管网', '综合项目', '其他'],
   服务采购: [
     '法律咨询',
     '会计',
@@ -48,7 +49,7 @@ export const industryListMapExp = {
     '广告宣传印刷',
     '其他'
   ],
-  农林牧渔: ['生产物资', '生产设备', '相关服务']
+  农林牧渔: ['生产物资', '生产设备', '相关服务', '其他']
 }
 
 // 采购单位类型数据

+ 3 - 0
apps/mobile/src/utils/format/modules/filter-history-formatter.js

@@ -756,6 +756,9 @@ export class FilterHistoryViewModel2AjaxModel {
 
     for (const key in val) {
       if (Array.isArray(val[key])) {
+        if (val[key].includes('其他')) {
+          val[key].push('其它')
+        }
         val[key].forEach((item) => {
           industryArr.push(`${key}_${item}`)
         })

+ 112 - 13
apps/mobile/src/views/search/middle/buyer/index.vue

@@ -7,28 +7,43 @@
       @click="goPage"
     ></association-list>
     <history-list
-      v-show="type === 'history' && isLogin"
+      v-if="type === 'history' && isLogin"
       :list="buyerSearchHistory"
-      @click="goPage"
-      @delete="deleteList"
+      @click="goSearch"
+      @delete="deleteList('4')"
     ></history-list>
+    <div class="divide-line" v-if="showBrowseList && showHistoryList"></div>
+    <history-browse-list
+      v-if="showBrowseList"
+      :list="buyerBrowseHistory"
+      :keys="getKeys"
+      @click="goBrowseClick"
+      @delete="deleteList('5')"
+    ></history-browse-list>
   </div>
 </template>
 
 <script>
 import { ajaxGetBuyerAssociation } from '@/api/modules'
 import { HistoryList } from '@/ui'
+import HistoryBrowseList from '@/components/search/HistoryBrowseList'
 import AssociationList from '@/components/search/AssociationList'
 import { debounce } from 'lodash'
 import { mapActions, mapGetters } from 'vuex'
 import { openLinkOfOther } from '@/utils'
+// 搜索历史业务模型
+import useSearchHistoryModel from '@jy/data-models/modules/quick-search-history/model'
+// 解构搜索历史业务数据模型
+const searchHistoryModel = useSearchHistoryModel()
+const { getHistoryQuery, clearHistoryQuery, saveViewHistoryQuery } = searchHistoryModel
 // import { LINKS } from '@/data'
 
 export default {
   name: 'SearchMiddleBuyer',
   components: {
     [AssociationList.name]: AssociationList,
-    [HistoryList.name]: HistoryList
+    [HistoryList.name]: HistoryList,
+    [HistoryBrowseList.name]: HistoryBrowseList
   },
   inject: {
     topSearch: {
@@ -39,14 +54,22 @@ export default {
     return {
       cacheSearch: '',
       type: 'history',
-      list: []
+      list: [],
+      buyerSearchHistory: [],
+      buyerBrowseHistory: []
     }
   },
   computed: {
     ...mapGetters('user', ['isNewBusiness', 'isBusiness', 'isLogin']),
-    ...mapGetters('search', ['buyerSearchHistory']),
+    // ...mapGetters('search', ['buyerSearchHistory']),
     getKeys() {
       return this.topSearch.input.split(' ').filter((v) => v.trim())
+    },
+    showHistoryList() {
+      return this.type === 'history' && this.buyerSearchHistory.length && this.isLogin
+    },
+    showBrowseList() {
+      return this.type === 'history' && this.buyerBrowseHistory.length && this.isLogin
     }
   },
   created() {
@@ -55,8 +78,20 @@ export default {
   activated() {
     this.input()
   },
+  mounted() {
+    this.getHistoryInfo()
+  },
   methods: {
     ...mapActions('search', ['removeHistory', 'setHistory']),
+    // 历史搜索、历史浏览
+    getHistoryInfo() {
+      getHistoryQuery({ type: '4,5' }).then((res) => {
+        if (res.success === true) {
+          this.buyerSearchHistory = res?.search || []
+          this.buyerBrowseHistory = res?.browse || []
+        }
+      })
+    },
     clear() {
       this.type = 'history'
       this.cacheSearch = ''
@@ -85,17 +120,33 @@ export default {
         }
       })
     },
-    deleteList() {
-      this.removeHistory({
-        type: 'buyer'
-      })
+    deleteList(data) {
+      const historyTypeMap = {
+        4: 'buyerSearchHistory',
+        5: 'buyerBrowseHistory'
+      };
+      clearHistoryQuery({ type: data })
+        .then((res) => {
+          if (res.success) {
+            const historyProperty = historyTypeMap[data]
+            if (historyProperty) {
+              this[historyProperty] = [];
+            } else {
+              console.warn(`未知的数据类型: ${data}`);
+            }
+          }
+        })
+        .catch((error) => {
+          console.error(`清除历史记录失败: ${error}`);
+        })
     },
     goPage(data) {
-      // 存入历史记录
       // 历史记录新增
-      this.setHistory({
+      saveViewHistoryQuery({
         type: 'buyer',
-        item: data
+        name: data?.label,
+      }).then((res) => {
+        console.log(res, 'res')
       })
       // 缓存定位值用于产品落地页
       sessionStorage.setItem(
@@ -126,6 +177,49 @@ export default {
       }
       openLinkOfOther(goLink)
     },
+    goSearch(data) {
+      const keyword = data.label || ''
+      this.syncInput(keyword)
+      this.$nextTick(() => {
+        this.submit()
+      })
+    },
+    syncInput(text = '') {
+      this.topSearch.input = text
+    },
+    goBrowseClick(data) {
+      if (data) {
+        data.label = data?.html
+        // 缓存定位值用于产品落地页
+        sessionStorage.setItem(
+          'landinfo',
+          JSON.stringify({
+            anchor: '采购单位全景分析',
+            landname: data.label
+          })
+        )
+        // 跳转页面
+        let goLink = ''
+        if (this.$envs.inWX) {
+          goLink =
+            '/big/wx/page/unit_portrayal?entName=' +
+            encodeURIComponent(data.label)
+        } else {
+          // 新商机管理采购单位画像
+          if (this.isNewBusiness) {
+            goLink =
+              '/jyapp/big/page/client_portrayal?entName=' +
+              encodeURIComponent(data.label) +
+              '&from=client'
+          } else {
+            goLink =
+              '/jyapp/big/page/unit_portrayal?entName=' +
+              encodeURIComponent(data.label)
+          }
+        }
+        openLinkOfOther(goLink)
+      }
+    },
     loadList: debounce(function () {
       this.clear()
       this.cacheSearch = '' + this.topSearch.input
@@ -151,5 +245,10 @@ export default {
 
 <style lang="scss" scoped>
 .page-search-buyer {
+  .divide-line{
+    width: 100%;
+    height: 12px;
+    background: #F7F9FA;
+  }
 }
 </style>

+ 94 - 25
apps/mobile/src/views/search/middle/company/index.vue

@@ -7,30 +7,47 @@
       @click="goPage"
     ></association-list>
     <history-list
-      v-show="type === 'history' && isLogin"
+      class="content-module"
+      v-if="showHistoryList"
       :list="companySearchHistory"
-      @click="goPage"
-      @delete="deleteList"
+      @click="goSearch"
+      @delete="deleteList('2')"
     ></history-list>
+    <div class="divide-line" v-show="showBrowseList && showHistoryList"></div>
+    <history-browse-list
+      v-show="showBrowseList"
+      :list="companyBrowseHistory"
+      :keys="getKeys"
+      searchType="company"
+      @click="goBrowseClick"
+      @delete="deleteList('3')"
+    ></history-browse-list>
   </div>
 </template>
 
 <script>
 import { ajaxGetCompanyAssociation } from '@/api/modules'
 import AssociationList from '@/components/search/AssociationList'
+import HistoryBrowseList from '@/components/search/HistoryBrowseList'
 import { HistoryList } from '@/ui'
 import { debounce } from 'lodash'
 import { mapActions, mapGetters } from 'vuex'
 import { openAppOrWxPage } from '@/utils'
 import { LINKS } from '@/data'
 import { mixinPoints } from '@/utils/mixins/modules/points'
+// 搜索历史业务模型
+import useSearchHistoryModel from '@jy/data-models/modules/quick-search-history/model'
+// 解构搜索历史业务数据模型
+const searchHistoryModel = useSearchHistoryModel()
+const { getHistoryQuery, clearHistoryQuery, saveViewHistoryQuery } = searchHistoryModel
 
 export default {
   name: 'SearchMiddleCompany',
   mixins: [mixinPoints],
   components: {
     [AssociationList.name]: AssociationList,
-    [HistoryList.name]: HistoryList
+    [HistoryList.name]: HistoryList,
+    [HistoryBrowseList.name]: HistoryBrowseList
   },
   inject: {
     topSearch: {
@@ -41,15 +58,23 @@ export default {
     return {
       cacheSearch: '',
       type: 'history',
-      list: []
+      list: [],
+      companySearchHistory: [],
+      companyBrowseHistory: []
     }
   },
   computed: {
     ...mapGetters('user', ['isNewBusiness', 'isBusiness', 'isLogin']),
-    ...mapGetters('search', ['companySearchHistory']),
+    // ...mapGetters('search', ['companySearchHistory']),
     getKeys() {
       return this.topSearch.input.split(' ').filter((v) => v.trim())
-    }
+    },
+    showHistoryList() {
+      return this.type === 'history' && this.companySearchHistory.length && this.isLogin
+    },
+    showBrowseList() {
+      return this.type === 'history' && this.companyBrowseHistory.length && this.isLogin
+    },
   },
   created() {
     this.input()
@@ -57,8 +82,20 @@ export default {
   activated() {
     this.input()
   },
+  mounted() {
+    this.getHistoryInfo()
+  },
   methods: {
     ...mapActions('search', ['removeHistory', 'setHistory']),
+    // 历史搜索、历史浏览
+    getHistoryInfo() {
+      getHistoryQuery({ type: '2,3' }).then((res) => {
+        if (res.success === true) {
+          this.companySearchHistory = res?.search || []
+          this.companyBrowseHistory = res?.browse || []
+        }
+      })
+    },
     clear() {
       this.type = 'history'
       this.cacheSearch = ''
@@ -75,10 +112,25 @@ export default {
         }
       })
     },
-    deleteList() {
-      this.removeHistory({
-        type: 'company'
-      })
+    deleteList(data) {
+      const historyTypeMap = {
+        2: 'companySearchHistory',
+        3: 'companyBrowseHistory'
+      };
+      clearHistoryQuery({ type: data })
+        .then((res) => {
+          if (res.success) {
+            const historyProperty = historyTypeMap[data]
+            if (historyProperty) {
+              this[historyProperty] = [];
+            } else {
+              console.warn(`未知的数据类型: ${data}`);
+            }
+          }
+        })
+        .catch((error) => {
+          console.error(`清除历史记录失败: ${error}`);
+        })
     },
     submit() {
       // if (!this.isLogin) {
@@ -98,11 +150,6 @@ export default {
       })
     },
     goPage(data) {
-      // 历史记录新增
-      this.setHistory({
-        type: 'company',
-        item: data
-      })
       // 缓存定位值用于产品落地页
       sessionStorage.setItem(
         'landinfo',
@@ -111,15 +158,12 @@ export default {
           landname: data.label
         })
       )
-      // 未登录跳至登录页将目标地址作为参数传给登录页
-      // if (!this.isLogin) {
-      //   const url = `/jyapp/big/page/ent_portrait?eId=${data?.entId || data?.id}`
-      //   return openLinkOfOther(LINKS.APP登录页.app, {
-      //     query: {
-      //       url: url
-      //     }
-      //   })
-      // }
+      saveViewHistoryQuery({
+        type: 'ent',
+        name: data?.name + '_' + data?.entId || data?.id,
+      }).then((res) => {
+        console.log(res, 'res')
+      })
       openAppOrWxPage(LINKS.企业画像页面, {
         query: {
           eId: data?.entId || data?.id,
@@ -127,6 +171,26 @@ export default {
         }
       })
     },
+    goBrowseClick(data) {
+      if (data) {
+        openAppOrWxPage(LINKS.企业画像页面, {
+          query: {
+            eId: data.eId,
+            ...this.fromPointTask
+          }
+        })
+      }
+    },
+    goSearch(data) {
+      const keyword = data.label || ''
+      this.syncInput(keyword)
+      this.$nextTick(() => {
+        this.submit()
+      })
+    },
+    syncInput(text = '') {
+      this.topSearch.input = text
+    },
     loadList: debounce(function () {
       this.clear()
       this.cacheSearch = '' + this.topSearch.input
@@ -158,5 +222,10 @@ export default {
 
 <style lang="scss" scoped>
 .page-search-company {
+  .divide-line{
+    width: 100%;
+    height: 12px;
+    background: #F7F9FA;
+  }
 }
 </style>

+ 9 - 4
apps/mobile/src/views/search/result/buyer/index.vue

@@ -152,6 +152,11 @@ import {
 } from '@/api/modules'
 import { mapGetters, mapActions } from 'vuex'
 import setPageTdk from '@/utils/mixins/modules/set-tdk'
+// 搜索历史业务模型
+import useSearchHistoryModel from '@jy/data-models/modules/quick-search-history/model'
+// 解构搜索历史业务数据模型
+const searchHistoryModel = useSearchHistoryModel()
+const { saveViewHistoryQuery } = searchHistoryModel
 
 export default {
   name: 'SearchResultBuyer',
@@ -722,11 +727,11 @@ export default {
     },
     onClickList(item) {
       // 历史记录新增
-      this.setHistory({
+      saveViewHistoryQuery({
         type: 'buyer',
-        item: {
-          label: item.title
-        }
+        name: item?.title,
+      }).then((res) => {
+        console.log(res, 'res')
       })
       this.doSave()
       // 跳转页面

+ 10 - 9
apps/mobile/src/views/search/result/company/index.vue

@@ -135,6 +135,11 @@ import { getShortName, openLinkOfOther } from '@/utils'
 import { entMoneyData, entScopeData } from '@/data'
 import { getEntCellList } from '@/api/modules'
 import { mixinPoints } from '@/utils/mixins/modules/points'
+// 搜索历史业务模型
+import useSearchHistoryModel from '@jy/data-models/modules/quick-search-history/model'
+// 解构搜索历史业务数据模型
+const searchHistoryModel = useSearchHistoryModel()
+const { saveViewHistoryQuery } = searchHistoryModel
 
 export default {
   name: 'SearchResultCompany',
@@ -468,15 +473,11 @@ export default {
     },
     goEntPage(item) {
       // 历史记录新增
-      this.setHistory({
-        type: 'company',
-        item: Object.assign(
-          {
-            label: item.name,
-            entId: item.endId
-          },
-          item
-        )
+      saveViewHistoryQuery({
+        type: 'ent',
+        name: item?.name + '_' + item?.id,
+      }).then((res) => {
+        console.log(res, 'res')
       })
       const url = this.$envs.inWX
         ? '/weixin/frontPage/collection/sess/ent_portrait'

+ 8 - 3
apps/mobile/src/views/tabbar/Subscribe.vue

@@ -466,7 +466,11 @@
       </NoticeBar>
     </footer>
     <!--    客服-->
-    <customer-corner v-show="isLogin"  :scroll-status="scrollStatus" bottom-position="12%"/>
+    <customer-corner
+      v-show="isLogin"
+      :scroll-status="scrollStatus"
+      bottom-position="12%"
+    />
     <DataReportTip
       v-model="dataReport.tip"
       :vSwitch="vSwitch"
@@ -1882,7 +1886,8 @@ export default {
       }
       // 是否有附件
       item.isFile = item?.ca_fileExists || false
-      item.leftTopBadgeText = item.site === '剑鱼信息发布平台' ? '业主委托项目' : ''
+      item.leftTopBadgeText =
+        item.site === '剑鱼信息发布平台' ? '业主委托项目' : ''
       // 拟建项目独有参数
       if (projectInfo) {
         Object.assign(item, projectInfo)
@@ -2029,7 +2034,7 @@ export default {
       })
     },
     // 设置标讯已读状态
-    async setSubReadStatus (item, callback) {
+    async setSubReadStatus(item, callback) {
       const vsId = item.ca_index
       if (!vsId) {
         callback && callback()