newkeycode.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. <template>
  2. <div class="search-wrapper">
  3. <!-- 头部搜索 -->
  4. <div class="main-search-header">
  5. <div class="main-search-header-controll clearfix">
  6. <div style="display: flex;align-items: center;justify-content: space-between;width:100%;">
  7. <div :class="ChooseTop === 'component' ? 'active' : ''" @click="setChangelistHander('component')"><a>型号</a></div>
  8. <div :class="ChooseTop === 'kind' ? 'active' : ''" @click="setChangelistHander('kind')"><a>物料名称</a></div>
  9. <div :class="ChooseTop === 'store' ? 'active' : ''" @click="setChangelistHander('store')"><a>卖家</a></div>
  10. <div :class="ChooseTop === 'brand' ? 'active' : ''" @click="setChangelistHander('brand')"><a>品牌</a></div>
  11. </div>
  12. </div>
  13. <input type="text" id="search-box" v-model="keyword" @keyup.13="onClickSearchHander()" :placeholder="placeholder" @input="changeKeyWord()">
  14. <span @click="onClickSearchHander()">搜索</span>
  15. <a @click="cancelSearchHander()" style="margin-top: 0.14rem;display: inline-block;">取消</a>
  16. </div>
  17. <ul class="associate-list" v-show="associate.show" @click="associate.show = false">
  18. <li @click.stop="onAssociateClick(similar)" v-for="similar in similarKeywords.result">
  19. <i class="icon-sousuo iconfont"></i>
  20. <span>{{Getsimilar(similar)}}</span>
  21. <!--<span v-if="ChooseTop === 'component'">{{similar.code}}</span>-->
  22. <!--<span v-else-if="ChooseTop === 'product'">{{similar}}</span>-->
  23. <!--<span v-else-if="ChooseTop === 'store'">{{similar}}</span>-->
  24. <!--<span v-else-if="ChooseTop === 'brand'">{{similar.nameEn}}</span>-->
  25. </li>
  26. <li @click.stop="onClickTosearch(keyword)">查找“{{baseUtils.filterStringEllipsis(keyword, 30)}}”</li>
  27. </ul>
  28. <!-- 主体内容 -->
  29. <div class="main-search-wrapper">
  30. <div class="search-title">搜索“<span>{{displayKeyword}}</span>”,为您找到{{allTotal}}条信息</div>
  31. <template>
  32. <!-- 品牌精确查找 -->
  33. <template v-if="ChooseTop === 'brand' && brandIsAccurate">
  34. <div class="search-content" style="margin-bottom: 0.2rem;height: auto;position: static">
  35. <div class="middle">
  36. <div class="list clearfix" style="border-bottom: 1px solid #dcdcdc;padding-bottom: 0.1rem;line-height: 0.8rem;">
  37. <img :src="resourceList.brand && resourceList.brand.logoUrl || '/images/component/default.png'" class="pull-left">
  38. <div class="name pull-left overHidden" style="max-width: 5rem;">{{resourceList.brand && resourceList.brand.nameEn}}</div>
  39. </div>
  40. <div class="list">
  41. <div class="name">主打产品:</div>
  42. <div class="text">
  43. {{resourceList.brand && resourceList.brand.series}}
  44. </div>
  45. </div>
  46. <div class="list">
  47. <div class="name">应用领域:</div>
  48. <div class="text">
  49. {{resourceList.brand && resourceList.brand.application}}
  50. </div>
  51. </div>
  52. <div class="list">
  53. <div class="name">品牌介绍:</div>
  54. <div class="text">
  55. {{resourceList.brand && resourceList.brand.brief}}
  56. </div>
  57. </div>
  58. <div class="list">
  59. <div class="name" style="color:#4290f7">官网地址:</div>
  60. <div class="text" style="width: 4.5rem">
  61. <a :href="resourceList.brand && resourceList.brand.url" target="_blank">{{resourceList.brand && resourceList.brand.url}}</a>
  62. </div>
  63. <div class="pull-right lookMoreBtn" @click="showBrandDetails = true" style="color:#4290f7">
  64. 查看更多
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <div class="search-nav clearfix" v-if="brandIsAccurate || (!brandIsAccurate && ChooseTop !== 'brand')">
  71. <span class="pull-left" :class="navType === 'hasStore' ? 'active' : ''" @click="getReloadList('hasStore')">
  72. {{ChooseTop === 'component' ? '现货': '现货卖家'}}({{stockallTotal}})条
  73. </span>
  74. <span class="pull-left" :class="navType === 'noHasStore' ? 'active' : ''" @click="getReloadList('noHasStore')">
  75. {{ChooseTop === 'component' ? '期货': '期货卖家'}}({{futuresallTotal}})条</span>
  76. </div>
  77. <div class="search-content" id="main-search-wrapper" :class="{'searchContent2' : ChooseTop === 'brand' && brandIsAccurate, 'searchContent3': ChooseTop === 'brand' && !brandIsAccurate}">
  78. <!-- 品牌模糊查询 -->
  79. <template v-if="!brandIsAccurate && ChooseTop === 'brand'">
  80. <div class="middle" v-for="item in resourceList.content">
  81. <div class="list clearfix" style="border-bottom: 1px solid #dcdcdc;padding-bottom: 0.1rem;line-height: 0.8rem;" @click="goToBrandAccurate(item)">
  82. <img :src="item.logoUrl || '/images/component/default.png'" class="pull-left">
  83. <div class="name pull-left overHidden" style="max-width: 5rem;">{{item.nameEn}}</div>
  84. <div class="more_icon pull-right"><i class="iconfont icon-swiper-right"></i></div>
  85. </div>
  86. <div class="list">
  87. <div class="name">主打产品:</div>
  88. <div class="text">
  89. {{item.series}}
  90. </div>
  91. </div>
  92. <div class="list">
  93. <div class="name">应用领域:</div>
  94. <div class="text">
  95. {{item.application}}
  96. </div>
  97. </div>
  98. <div class="list">
  99. <div class="name">品牌介绍:</div>
  100. <div class="text">
  101. {{item.brief}}
  102. </div>
  103. </div>
  104. <div class="list">
  105. <div class="name">官网地址:</div>
  106. <div class="text">
  107. <a :href="item.url" target="_blank">{{item.url}}</a>
  108. </div>
  109. </div>
  110. </div>
  111. </template>
  112. <!-- /end 品牌模糊查询 -->
  113. <template v-if="brandIsAccurate || (!brandIsAccurate && ChooseTop !== 'brand')">
  114. <!-- 现货 -->
  115. <template v-if="navType === 'hasStore'">
  116. <!-- 型号结果 -->
  117. <template v-if="ChooseTop === 'component'">
  118. <div v-if="resourceList&&resourceList.stock&&resourceList.stock.content.length > 0">
  119. <div v-for="(item, index) in resourceList.stock.content">
  120. <!--@click="goProductDetail(item)"-->
  121. <component-item :item="item" @cancatSeller="cancatSeller"></component-item>
  122. </div>
  123. </div>
  124. </template>
  125. <!-- 卖家 物料名称 品牌-->
  126. <template v-else-if="ChooseTop === 'kind' || ChooseTop === 'store' || ChooseTop === 'brand'">
  127. <div v-if="resourceList&&resourceList.stock&&resourceList.stock.content.length > 0">
  128. <div class="middle" v-for="(item, index) in resourceList.stock.content">
  129. <nuxt-link :to="`/mobile/shop/${item.storeUuid}`" tag="div" class="list clearfix" style="border-bottom: 1px solid #dcdcdc;padding-bottom: 0.1rem">
  130. <div class="name pull-left">{{item.enName}}</div>
  131. <div class="more_icon pull-right"><i class="iconfont icon-swiper-right"></i></div>
  132. </nuxt-link>
  133. <div class="middle_bottom clearfix">
  134. <div class="middle_bottom-left">
  135. <img :src="item.storeLogoUrl || '/images/component/default.png'">
  136. </div>
  137. <div class="middle_bottom-left">
  138. <div class="middle_bottom-leftitem clearfix">
  139. <div class="bottom-title">电话</div><label style="float: left">:</label>
  140. <div class="overHidden" style="width: 3.9rem">
  141. <a :href="'tel:' + AlertstoreInfo.enterprise.enTel" target="_blank" class="content-line" style="color: #2d8cf0">{{item.enTel}}</a>
  142. </div>
  143. </div>
  144. <!--<div class="middle_bottom-leftitem clearfix">-->
  145. <!--<div class="bottom-title">邮箱</div><label style="float: left">:</label><div class="overHidden" style="width: 3.9rem">{{item.enEmail}}</div>-->
  146. <!--</div>-->
  147. <div class="middle_bottom-leftitem clearfix">
  148. <div class="bottom-title">执照号</div><label style="float: left">:</label><div class="overHidden" style="width: 3.9rem">{{item.enBusinesscode}}</div>
  149. </div>
  150. <div class="middle_bottom-leftitem clearfix">
  151. <div class="bottom-title">地址</div><label style="float: left">:</label><div style="width: 3.9rem;">{{item.enAddress}}</div>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </template>
  158. </template>
  159. <!-- 期货 -->
  160. <template v-else>
  161. <!-- 型号结果 -->
  162. <template v-if="ChooseTop === 'component'">
  163. <div v-if="resourceList && resourceList.futures && resourceList.futures.content.length > 0">
  164. <div class="middle" v-for="(item, index) in resourceList.futures.content">
  165. <div class="list">
  166. <div class="name">品牌:</div>
  167. <div class="text overHidden">{{item.brandNameEn || item.brand || '—'}}</div>
  168. </div>
  169. <div class="list">
  170. <div class="name">物料名称:</div>
  171. <div class="text overHidden">{{item.kindNameCn || item.kind || '-'}}</div>
  172. </div>
  173. <div class="list">
  174. <div class="name">型号:</div>
  175. <div class="text overHidden">{{item.code || item.cmpCode || '-'}}</div>
  176. </div>
  177. <div class="list">
  178. <div class="name">规格:</div>
  179. <div class="text overHidden">{{item.spec || '-'}}</div>
  180. </div>
  181. <div class="list">
  182. <div class="name">单位:</div>
  183. <div class="text overHidden">{{item.unit || 'PCS'}}</div>
  184. </div>
  185. <div class="list clearfix" style="overflow: inherit;">
  186. <div class="fl">
  187. <div class="name">卖家:</div>
  188. <div class="text overHidden" style="width: 4rem">{{item.storeName || item.enName || '-'}}</div>
  189. </div>
  190. <div class="pull-right sayPriBtn" @click="publish(item)">立即询价</div>
  191. </div>
  192. </div>
  193. </div>
  194. </template>
  195. <!-- 卖家 物料名称 品牌-->
  196. <template v-else-if="ChooseTop === 'kind' || ChooseTop === 'store' || ChooseTop === 'brand'">
  197. <div v-if="resourceList&&resourceList.futures &&resourceList.futures.content.length > 0">
  198. <div class="middle" v-for="(item, index) in resourceList.futures.content" @click="goSupplierDetail(item)">
  199. <div class="list clearfix" style="border-bottom: 1px solid #dcdcdc;padding-bottom: 0.1rem">
  200. <div class="name pull-left">{{item.enName}}</div>
  201. <div class="more_icon pull-right"><i class="iconfont icon-swiper-right"></i></div>
  202. </div>
  203. <div class="middle_bottom clearfix">
  204. <div class="middle_bottom-left">
  205. <img :src="item.storeLogoUrl || item.enLogoUrl || '/images/component/default.png'">
  206. </div>
  207. <div class="middle_bottom-left">
  208. <div class="middle_bottom-leftitem clearfix">
  209. <div class="bottom-title">电话</div><label style="float: left">:</label>
  210. <div class="overHidden" style="width: 3.9rem">
  211. <a :href="'tel:' + AlertstoreInfo.enterprise.enTel" target="_blank" class="content-line" style="color: #2d8cf0">{{item.enTel}}</a>
  212. </div>
  213. </div>
  214. <!--<div class="middle_bottom-leftitem clearfix">-->
  215. <!--<div class="bottom-title">邮箱</div><label style="float: left">:</label><div class="overHidden" style="width: 3.9rem">{{item.enEmail}}</div>-->
  216. <!--</div>-->
  217. <div class="middle_bottom-leftitem clearfix">
  218. <div class="bottom-title">执照号</div><label style="float: left">:</label><div class="overHidden" style="width: 3.9rem">{{item.enBusinesscode}}</div>
  219. </div>
  220. <div class="middle_bottom-leftitem clearfix">
  221. <div class="bottom-title">地址</div><label style="float: left">:</label><div style="width: 3.9rem;word-wrap:break-word;">{{item.enAddress}}</div>
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. </template>
  228. </template>
  229. </template>
  230. </div>
  231. </template>
  232. <template v-if="allPage === 0">
  233. <div class="none-state">
  234. <img src="/images/mobile/@2x/search-empty.png">
  235. <p>暂无数据</p>
  236. <nuxt-link to="/">返回首页</nuxt-link>
  237. </div>
  238. </template>
  239. </div>
  240. <!-- 联系卖买家 -->
  241. <div class="mobile-modal" v-if="showStoreInfo" @touchmove="preventTouchMove($event)">
  242. <div class="mobile-modal-box mobile-link-en">
  243. <div class="mobile-modal-header">联系方式<i @click="showStoreInfo = false" class="icon-guanbi iconfont"></i></div>
  244. <div class="mobile-modal-content">
  245. <div v-if="AlertstoreInfo.enterprise.enTel"><span >电话:</span><a :href="'tel:' + AlertstoreInfo.enterprise.enTel" target="_blank" class="content-line link-url">{{AlertstoreInfo.enterprise.enTel}}</a></div>
  246. <div v-if="AlertstoreInfo.enterprise.enPhone"><span >手机:</span><a :href="'tel:' + AlertstoreInfo.enterprise.enPhone" target="_blank" class="content-line link-url">{{AlertstoreInfo.enterprise.enPhone}}</a></div>
  247. <div v-if="AlertstoreInfo.enterprise.enWeixin"><span >微信:</span><span class="content-line">{{AlertstoreInfo.enterprise.enWeixin}}</span></div>
  248. <div v-if="AlertstoreInfo.enterprise.enQQ"><span >Q&nbsp;Q:</span><span class="content-line">{{AlertstoreInfo.enterprise.enQQ}}</span></div>
  249. <div v-if="!empty">暂无联系方式</div>
  250. </div>
  251. </div>
  252. </div>
  253. <!-- 询价 -->
  254. <publish-supplier-seek :product="currentProduct" :showPublishBox="showPublishBox" @cancelAction="showPublishBox = false" @remindAction="setRemindText"></publish-supplier-seek>
  255. <!-- 查看品牌更多信息 -->
  256. <modal-wrapper :showModal="showBrandDetails" :title="currentBrandItem.nameEn" @closeAction="showBrandDetails=false">
  257. <div class="store-info" >
  258. <div class="store-description">
  259. <h4>主营产品</h4>
  260. <p class="content" v-if="currentBrandItem.series">
  261. {{currentBrandItem.series}}
  262. </p>
  263. <div class="com-none-state" v-else>
  264. <p>抱歉,暂无主营产品信息</p>
  265. </div>
  266. </div>
  267. <div class="store-description">
  268. <h4>应用领域</h4>
  269. <p class="content" v-if="currentBrandItem.application">
  270. {{currentBrandItem.application}}
  271. </p>
  272. <div class="com-none-state" v-else>
  273. <p>抱歉,暂无应用领域信息</p>
  274. </div>
  275. </div>
  276. <div class="store-description">
  277. <h4>品牌介绍</h4>
  278. <p class="content" v-if="currentBrandItem.brief">
  279. {{currentBrandItem.brief}}
  280. </p>
  281. <div class="com-none-state" v-else>
  282. <p>抱歉,暂无企业介绍</p>
  283. </div>
  284. </div>
  285. <div class="contact-info">
  286. <h4>联系我们</h4>
  287. <ul class="list-unstyled clearfix">
  288. <li>
  289. <div>电&nbsp;&nbsp;话:</div>
  290. <div v-if="currentBrandItem.userDefine.userTel"><a :href="'tel:' + currentBrandItem.userDefine.userTel" >{{currentBrandItem.userDefine.userTel}}</a></div>
  291. <div v-else><span>-</span></div>
  292. </li>
  293. <!-- <li>
  294. <div>店铺地址:</div>
  295. <div v-if="store.enterprise.address">{{store.enterprise.address}}</div>
  296. <div v-else><span>-</span></div>
  297. </li>-->
  298. </ul>
  299. </div>
  300. </div>
  301. </modal-wrapper>
  302. <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
  303. <!--<loading v-if="isSearchSearchingMore"></loading>-->
  304. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
  305. <pull-up v-if="addShowPullup" :fixId="'main-search-wrapper'" :searchMore="isSearchSearchingMore" :allPage="allPage" :page="page" @pullUpAction="onPullUp" :FixedEl="true"></pull-up>
  306. </div>
  307. </template>
  308. <script>
  309. import { PublishSupplierSeek } from '~components/mobile/applyPurchase'
  310. import { RemindBox, Loading, LoginBox, PullUp } from '~components/mobile/common'
  311. import { ModalWrapper } from '~components/mobile/base'
  312. import axios from '~plugins/axios'
  313. import componentItem from '~components/mobile/search/componet-item'
  314. export default {
  315. layout: 'mobile',
  316. data() {
  317. return {
  318. collectResult: '', // 提示性文字
  319. timeoutCount: 0, // 弹出框计时数
  320. isSearchSearchingMore: false, // 是否正在请求数据
  321. showLoginBox: false, // 是否显示登录弹窗
  322. url: '', // 登录后跳转回来的地址
  323. keyword: '', // 关键字搜索
  324. showStoreInfo: false, // 联系买卖家弹窗
  325. AlertstoreInfo: { // 买卖家弹窗信息
  326. enterprise: {}
  327. },
  328. navType: 'hasStore', // 现货 期货
  329. ChooseTop: 'component', // 型号, 物料名称, 卖家, 品牌
  330. page: 1,
  331. currentProduct: {},
  332. currentBrandItem: { // 查看品牌详情信息
  333. userDefine: {}
  334. }, // 存放当前点击的品牌内容
  335. showBrandDetails: false, // 是否展示品牌详情
  336. brandIsAccurate: false, // 品牌是否处于精确查找
  337. showPublishBox: false, // 询价弹窗
  338. resourceList: [],
  339. futuresallTotal: 0,
  340. stockallTotal: 0,
  341. allPage: 0, // 总页数
  342. allTotal: 0, // 总条数
  343. associate: {
  344. show: false
  345. },
  346. displayKeyword: '',
  347. addShowPullup: true
  348. }
  349. },
  350. computed: {
  351. getNowChooseType() {
  352. if (this.ChooseTop === 'component') {
  353. return '型号'
  354. } else if (this.ChooseTop === 'kind') {
  355. return '物料'
  356. } else if (this.ChooseTop === 'store') {
  357. return '卖家'
  358. } else if (this.ChooseTop === 'brand') {
  359. return '品牌'
  360. }
  361. },
  362. empty () {
  363. return this.checkInfo(this.AlertstoreInfo.enterprise.enTel) || this.checkInfo(this.AlertstoreInfo.enterprise.enPhone) || this.checkInfo(this.AlertstoreInfo.enterprise.enWeixin) || this.checkInfo(this.AlertstoreInfo.enterprise.enQQ)
  364. },
  365. placeholder() {
  366. if (this.ChooseTop === 'component') {
  367. return '请输入您要搜索的型号'
  368. } else if (this.ChooseTop === 'kind') {
  369. return '请输入您要搜索的物料名称'
  370. } else if (this.ChooseTop === 'store') {
  371. return '请输入您要搜索的卖家名称'
  372. } else if (this.ChooseTop === 'brand') {
  373. return '请输入您要搜索的品牌'
  374. }
  375. },
  376. similarKeywords () {
  377. return this.$store.state.search.keywords.data
  378. }
  379. },
  380. async asyncData({store, route}) {
  381. let ChooseTop = route.query.choosetype || 'component'
  382. let keyword = route.query.keyword || ''
  383. let brandIsAccurate = false
  384. let { data } = await axios.get(`/search/201819`, {params: {count: 10, page: 1, keyword: keyword, type: ChooseTop}})
  385. let allTotal = 0
  386. let futuresallTotal = data.futures ? data.futures.total : 0
  387. let stockallTotal = data.stock ? data.stock.total : 0
  388. let allPage = 0
  389. let currentBrandItem = {
  390. userDefine: {}
  391. }
  392. if (ChooseTop === 'brand') {
  393. if (data.futures && data.stock) {
  394. // 品牌查询 精准查找
  395. brandIsAccurate = true
  396. currentBrandItem = data.brand
  397. // 则总条数等于 现货 + 期货
  398. allTotal = stockallTotal + futuresallTotal
  399. allPage = Math.ceil(data.stock.total / 10)
  400. } else {
  401. allTotal = data.total || 0
  402. allPage = Math.ceil(data.total / 10)
  403. }
  404. } else {
  405. // 其他情况
  406. allTotal = stockallTotal + futuresallTotal
  407. allPage = Math.ceil(data.stock.total / 10)
  408. }
  409. return {
  410. ChooseTop: ChooseTop,
  411. keyword: keyword,
  412. resourceList: data,
  413. allPage: allPage,
  414. stockallTotal: stockallTotal,
  415. futuresallTotal: futuresallTotal,
  416. allTotal: allTotal,
  417. brandIsAccurate: brandIsAccurate,
  418. currentBrandItem: currentBrandItem,
  419. displayKeyword: keyword
  420. }
  421. },
  422. methods: {
  423. onPullUp() {
  424. this.page++
  425. this.ReloadList()
  426. },
  427. // 搜索点击事件
  428. onClickSearchHander() {
  429. console.log(this.keyword)
  430. if (!this.keyword) {this.setRemindText('请输入关键字')}
  431. this.$router.push(`/mobile/search/newkeycode?choosetype=${this.ChooseTop}&keyword=${this.keyword}`)
  432. // this.setChangelistHander(this.ChooseTop)
  433. // window.location.href =
  434. },
  435. // 现货 期货切换
  436. getReloadList(_tp) {
  437. this.navType = _tp
  438. this.page = 1
  439. this.resourceList.futures.content = []
  440. this.resourceList.stock.content = []
  441. this.ReloadList()
  442. },
  443. // 刷新数据
  444. ReloadList(param) {
  445. // 如果有值,则代表 是品牌 模糊到精确
  446. // 这里发送数据请求
  447. this.isSearchSearchingMore = true
  448. this.$http.get(`/search/201819`, {params: {count: 10, page: this.page, keyword: this.displayKeyword, type: this.ChooseTop}}).then(res => {
  449. this.isSearchSearchingMore = false
  450. if (!this.brandIsAccurate && this.ChooseTop === 'brand') {
  451. // 品牌模糊查询
  452. this.resourceList.content = [...this.resourceList.content, ...res.data.content]
  453. return
  454. }
  455. if (this.navType === 'hasStore') {
  456. this.resourceList.stock.content = [...this.resourceList.stock.content, ...res.data.stock.content]
  457. this.allPage = Math.ceil(res.data.stock.total / 10) || 0
  458. } else {
  459. this.resourceList.futures.content = [...this.resourceList.futures.content, ...res.data.futures.content]
  460. this.allPage = Math.ceil(res.data.futures.total / 10) || 0
  461. }
  462. }, err => {
  463. this.isSearchSearchingMore = false
  464. })
  465. },
  466. // 模糊品牌查询结果点击
  467. goToBrandAccurate(item) {
  468. this.currentBrandItem = item
  469. this.keyword = item.nameEn
  470. this.setChangelistHander(this.ChooseTop)
  471. },
  472. // 取消返回事件
  473. cancelSearchHander() {
  474. this.$router.replace('/')
  475. },
  476. // 购买 加入购物车
  477. buy: function (item, flag, e) {
  478. this.baseUtils.buyOrCar(flag, e, this, item, '/mobile/center/user/pay/')
  479. },
  480. // 联系买卖家
  481. cancatSeller(item) {
  482. this.$http.get(`/api/store-service/stores?uuid=${item.storeid}`).then(res => {
  483. this.AlertstoreInfo = res.data
  484. this.showStoreInfo = true
  485. })
  486. },
  487. // 切换顶部一级标题
  488. setChangelistHander(str) {
  489. this.addShowPullup = false
  490. if (document.querySelector('#main-search-wrapper')) document.querySelector('#main-search-wrapper').scrollTop = 0
  491. this.ChooseTop = str
  492. this.page = 1
  493. if (!this.keyword) { this.setRemindText('请输入关键字') }
  494. this.displayKeyword = this.keyword
  495. this.brandIsAccurate = false
  496. this.isSearchSearchingMore = true
  497. this.$http.get(`/search/201819`, {params: {count: 10, page: 1, keyword: this.keyword, type: this.ChooseTop}}).then(data => {
  498. data = data.data
  499. this.resourceList = data
  500. this.futuresallTotal = data.futures ? data.futures.total : 0
  501. this.stockallTotal = data.stock ? data.stock.total : 0
  502. let allTotal = 0 // 总条数
  503. if (this.ChooseTop === 'brand') {
  504. if (data.futures && data.stock) {
  505. // 品牌查询 精准查找
  506. this.brandIsAccurate = true
  507. // 则总条数等于 现货 + 期货
  508. allTotal = this.stockallTotal + this.futuresallTotal
  509. this.currentBrandItem = data.brand
  510. } else {
  511. allTotal = data.total || 0
  512. }
  513. } else {
  514. // 其他情况
  515. allTotal = this.stockallTotal + this.futuresallTotal
  516. }
  517. this.allTotal = allTotal
  518. this.isSearchSearchingMore = false
  519. if (!this.brandIsAccurate && this.ChooseTop === 'brand') {
  520. // 品牌 模糊查找
  521. this.allPage = Math.ceil(this.resourceList.total / 10) || 0
  522. } else {
  523. if (this.navType === 'hasStore') {
  524. this.allPage = this.resourceList.stock && Math.ceil(this.resourceList.stock.total / 10) || 0
  525. } else {
  526. this.allPage = this.resourceList.futures && Math.ceil(this.resourceList.futures.total / 10) || 0
  527. }
  528. }
  529. this.associate.show = false
  530. this.addShowPullup = true
  531. })
  532. },
  533. // 供应商详情
  534. goSupplierDetail: function (item) {
  535. this.$http.get('/vendor/introduction/product/count', {params: {vendUU: item.enUU}})
  536. .then(response => {
  537. if (response.data.success && response.data.count > 0) {
  538. this.$router.push(`/mobile/supplier/detail/${item.enUU}?isStore=${item.isStore}`)
  539. } else {
  540. this.setRemindText('供应商正在完善产品信息,暂时不能查看更多。')
  541. }
  542. })
  543. },
  544. checkInfo: function (str) {
  545. return str && str.trim() !== ''
  546. },
  547. publish: function (product) {
  548. if (this.user.logged) {
  549. let item = {
  550. cmpCode: product.cmpCode,
  551. pbranden: product.brand,
  552. brand: product.brand,
  553. spec: product.spec,
  554. kind: product.cmpCode
  555. }
  556. console.log(item)
  557. console.log(product)
  558. this.currentProduct = item
  559. this.showPublishBox = true
  560. } else {
  561. this.url = this.$route.fullPath
  562. this.showLoginBox = true
  563. }
  564. },
  565. setRemindText(str) {
  566. this.timeoutCount++
  567. this.collectResult = str
  568. },
  569. onAssociateClick (word) {
  570. if (this.ChooseTop === 'component') {
  571. this.keyword = word.code
  572. } else if (this.ChooseTop === 'kind') {
  573. this.keyword = word.nameCn
  574. } else if (this.ChooseTop === 'store') {
  575. this.keyword = word.name
  576. } else if (this.ChooseTop === 'brand') {
  577. this.keyword = word.nameEn
  578. }
  579. this.associate.show = false
  580. this.setChangelistHander(this.ChooseTop)
  581. },
  582. Getsimilar(word) {
  583. if (this.ChooseTop === 'component') {
  584. return word.code
  585. } else if (this.ChooseTop === 'kind') {
  586. return word.nameCn
  587. } else if (this.ChooseTop === 'store') {
  588. return word.name
  589. } else if (this.ChooseTop === 'brand') {
  590. return word.nameEn
  591. }
  592. },
  593. onChange () {
  594. if (!this.keyword) {
  595. this.associate.show = false
  596. this.$store.dispatch('resetSearchKeywords')
  597. } else {
  598. this.searchKeywords()
  599. }
  600. },
  601. changeKeyWord() {
  602. this.associate.show = true
  603. this.onChange()
  604. },
  605. searchKeywords () {
  606. this.$store.dispatch('searchKeywords', {keyword: this.keyword, type: this.ChooseTop})
  607. },
  608. onClickTosearch(str) {
  609. this.keyword = str
  610. this.setChangelistHander(this.ChooseTop)
  611. }
  612. },
  613. components: {
  614. RemindBox,
  615. Loading,
  616. LoginBox,
  617. PublishSupplierSeek,
  618. ModalWrapper,
  619. PullUp,
  620. componentItem
  621. },
  622. watch: {
  623. '$route' (to, from) {
  624. this.keyword = to.query.keyword
  625. this.displayKeyword = to.query.keyword
  626. this.setChangelistHander(to.query.choosetype)
  627. }
  628. }
  629. }
  630. </script>
  631. <style lang="scss" scoped>
  632. @mixin overFlowHidden {
  633. overflow: hidden;
  634. text-overflow: ellipsis;
  635. white-space: nowrap;
  636. }
  637. @mixin lineHeight($value) {
  638. height: $value;
  639. line-height: $value;
  640. }
  641. .search-wrapper {
  642. background: #f1f3f6;
  643. width: 100%;
  644. position: fixed;
  645. z-index: 1000;
  646. top: 0;
  647. bottom: 0;
  648. .main-search-header {
  649. position: absolute;
  650. background: #3e82f5;
  651. padding: 0.15rem 0;
  652. margin-top: 0;
  653. z-index: 1;
  654. width: 100%;
  655. input {
  656. width: 5.1rem;
  657. height: .58rem;
  658. line-height: .58rem;
  659. font-size: .26rem;
  660. color: #333;
  661. margin-left: 0.11rem;
  662. /*padding-left: 1.26rem;*/
  663. border: .04rem solid #fff;
  664. background: #fff;
  665. outline: none;
  666. border-radius: 0;
  667. float: left;
  668. /*margin-top: .12rem;*/
  669. -webkit-appearance: none;
  670. border-top-left-radius: .14rem;
  671. border-bottom-left-radius: .14rem;
  672. }
  673. span {
  674. display: inline-block;
  675. width: 1.02rem;
  676. text-align: center;
  677. height: .58rem;
  678. line-height: .58rem;
  679. color: #366df3;
  680. font-size: .28rem;
  681. margin-left: .02rem;
  682. border-top-right-radius: .14rem;
  683. border-bottom-right-radius: .14rem;
  684. background: #fff;
  685. float: left;
  686. /*margin-top: .12rem;*/
  687. }
  688. a {
  689. font-size: .28rem;
  690. color: #fff;
  691. margin-left: .2rem;
  692. }
  693. .main-search-header-controll {
  694. width: 5.48rem;
  695. margin-left: 0.21rem;
  696. transform: translateY(1px);
  697. div {
  698. div {
  699. font-size: 0.28rem;
  700. color: #fff;
  701. margin: 0;
  702. border-radius: 0;
  703. padding: 0.1rem 0.1rem;
  704. &.active {
  705. background: #fff;
  706. border-top-left-radius: 0.05rem;
  707. border-top-right-radius: 0.05rem;
  708. }
  709. &.active a {
  710. color: #2d8cf0;
  711. }
  712. a {
  713. font-size: .26rem;
  714. color: #f1f1f1;
  715. margin-left: 0 !important;
  716. }
  717. }
  718. }
  719. }
  720. }
  721. .main-search-wrapper {
  722. margin-top: 1.71rem;
  723. }
  724. .search-title {
  725. font-size: 0.26rem;
  726. text-align: center;
  727. color: #999;
  728. margin: 0 auto 0.2rem;
  729. span {
  730. color: #4290f7
  731. }
  732. }
  733. .search-nav {
  734. background: #fff;
  735. @include lineHeight(1rem);
  736. padding: 0 0.2rem;
  737. position: relative;
  738. z-index: 10;
  739. span {
  740. width: 50%;
  741. color: #666;
  742. font-size: 0.28rem;
  743. text-align: center;
  744. border-bottom: 0.04rem solid #dcdcdc;
  745. @include lineHeight(0.7rem);
  746. margin-top: 0.15rem;
  747. &.active {
  748. border-bottom: 0.04rem solid #4290f7;
  749. color: #4290f7
  750. }
  751. }
  752. }
  753. .search-content {
  754. padding-top: 0;
  755. top: 3.41rem;
  756. /*height: calc(100vh - 3.41rem);*/
  757. overflow-y: auto;
  758. position: absolute;
  759. width: 100%;
  760. bottom: 0;
  761. .middle {
  762. background: #fff;
  763. padding: 0.2rem;
  764. .lookMoreBtn {
  765. font-size: 0.28rem;
  766. color: #2d8cf0
  767. }
  768. .more_icon {
  769. font-size: 0.34rem;
  770. color: #999;
  771. }
  772. .order-tag {
  773. display: inline-block;
  774. font-size: .18rem;
  775. color: #fff;
  776. font-weight: bold;
  777. background: #ee1717;
  778. height: .27rem;
  779. width: .27rem;
  780. line-height: .27rem;
  781. text-align: center;
  782. border-radius: .05rem;
  783. position: relative;
  784. top: -.05rem;
  785. margin-right: .05rem;
  786. &.reserve-tag {
  787. background: #07bb1c;
  788. }
  789. }
  790. text-align: left;
  791. background: #fff;
  792. /*border-radius: 5px;*/
  793. margin-bottom: 0.2rem;
  794. .overHidden {
  795. @include overFlowHidden()
  796. }
  797. .pms {
  798. color: #f57710;
  799. border: 1px solid #f57710;
  800. border-radius: 0.4rem;
  801. background: #fff;
  802. font-size: 0.24rem;
  803. height: 0.4rem;
  804. line-height: 0.4rem;
  805. width: 0.8rem;
  806. text-align: center;
  807. }
  808. .list {
  809. @include overFlowHidden();
  810. width: 100%;
  811. .left {
  812. float: left;
  813. overflow: hidden;
  814. text-overflow: ellipsis;
  815. white-space: nowrap;
  816. }
  817. .textinfo {
  818. font-size: 0.18rem;
  819. margin-left: 0.1rem;
  820. display: inline-block;
  821. background: #3f84f6;
  822. color: #fff;
  823. font-weight: bold;
  824. border-radius: 3px;
  825. width: 0.8rem;
  826. height: 0.32rem;
  827. line-height: 0.32rem;
  828. text-align: center
  829. }
  830. .button {
  831. font-size: 0.3rem;
  832. color: #1a58dd;
  833. width: 0.92rem;
  834. height: 0.43rem;
  835. line-height: 0.43rem;
  836. text-align: center;
  837. border-radius: 5px;
  838. border:1px solid #1a58dd;
  839. display: inline-block;
  840. margin-right: 0.2rem;
  841. }
  842. margin-bottom: 0.18rem;
  843. &::after{
  844. clear: both;
  845. display: block;
  846. content: ' ';
  847. visibility: hidden;
  848. zoom: 1;
  849. }
  850. .fl {
  851. width: 3.5rem;
  852. float: left;
  853. }
  854. .fr {
  855. text-align: left;
  856. width: 2.6rem;
  857. overflow: hidden;
  858. text-overflow: ellipsis;
  859. white-space: nowrap;
  860. }
  861. &.list-long {
  862. .fl {
  863. width: 100% !important;
  864. }
  865. }
  866. .name {
  867. color: #666;
  868. font-size: 0.28rem;
  869. display: inline-block;
  870. }
  871. .text {
  872. display: inline-block;
  873. color: #333;
  874. font-size: 0.28rem;
  875. vertical-align: top;
  876. width: 5.5rem;
  877. @include overFlowHidden();
  878. }
  879. .table {
  880. width: 5.85rem;
  881. margin-bottom: 0;
  882. margin-top: 0;
  883. margin-left: 0.1rem;
  884. li {
  885. height: 0.43rem;
  886. line-height: 0.43rem;
  887. border-left: .01rem solid #c5c5c5;
  888. font-size: .28rem;
  889. &::after {
  890. clear: both;
  891. display: block;
  892. content: ' ';
  893. visibility: hidden;
  894. zoom: 1;
  895. }
  896. div {
  897. text-align: center;
  898. width: 50%;
  899. float: left;
  900. border-right: .01rem solid #c5c5c5;
  901. border-bottom: .01rem solid #c5c5c5;
  902. }
  903. &:nth-child(odd) {
  904. background: #ddd;
  905. color: #333;
  906. font-size: 0.28rem;
  907. }
  908. &:nth-child(even) {
  909. background: #fcfcfc;
  910. color: #333;
  911. font-size: 0.28rem;
  912. }
  913. &:nth-last-of-type(1){
  914. color: #f31919;
  915. }
  916. &.title {
  917. font-size: 0.28rem;
  918. color: #333;
  919. }
  920. }
  921. }
  922. .pull-right {
  923. div {
  924. color: #3f84f6;
  925. font-size: 0.28rem;
  926. border-radius: 0.07rem;
  927. border: 1px solid #3f84f6;
  928. background: #fff;
  929. width: 2rem;
  930. line-height: 0.56rem;
  931. height: 0.56rem;
  932. text-align: center;
  933. }
  934. div:last-child {
  935. margin-left: 0.2rem;
  936. color: #fff;
  937. background: #3f84f6;
  938. }
  939. }
  940. i {
  941. &.icon-pdf {
  942. color: #929292;
  943. font-size: 0.4rem;
  944. }
  945. &.active {
  946. color: #eb062b;
  947. }
  948. }
  949. .cancat {
  950. height: 0.56rem;
  951. line-height: 0.56rem;
  952. border: 1px solid #3f84f6;
  953. color: #3f84f6;
  954. font-size: 0.26rem;
  955. text-align: center;
  956. border-radius: 3px;
  957. padding: 0 0.1rem;
  958. overflow: hidden;
  959. width: auto;
  960. }
  961. img.pull-left {
  962. width: 1.21rem;
  963. height: 0.8rem;
  964. border: 1px solid #dcdcdc;
  965. border-radius: 0.07rem;
  966. margin-top: 0;
  967. }
  968. }
  969. .sayPriBtn {
  970. width: 2rem;
  971. @include lineHeight(0.54rem);
  972. color: #fff;
  973. font-size: 0.28rem;
  974. background: #3f84f6;
  975. border-radius: 3px;
  976. text-align: center;
  977. margin-top: -0.1rem;
  978. }
  979. .middle_bottom {
  980. .middle_bottom-left {
  981. float: left;
  982. img {
  983. width: 1.21rem;
  984. height: 1.21rem;
  985. border: 1px solid #4290f7;
  986. border-radius: 0.07rem;
  987. overflow: hidden;
  988. }
  989. div.middle_bottom-leftitem {
  990. line-height: 0.5rem;
  991. font-size: 0.28rem;
  992. div {
  993. display: inline-block;
  994. color: #666;
  995. height: 100%;
  996. float: left;
  997. &.bottom-title {
  998. display: inline-block;
  999. text-align: justify;
  1000. vertical-align: top;
  1001. width: 1.5rem;
  1002. height: 0.5rem;
  1003. &::after {
  1004. content: "";
  1005. display: inline-block;
  1006. width: 100%;
  1007. overflow: hidden;
  1008. height: 0;
  1009. }
  1010. }
  1011. }
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. .searchContent2 {
  1018. /*height: calc(100vh - 7.3rem);*/
  1019. top: 7.3rem;
  1020. }
  1021. .searchContent3 {
  1022. /*height: calc(100vh - 2.25rem);*/
  1023. top: 2.25rem;
  1024. }
  1025. .store-info {
  1026. background: #f7f7f7;
  1027. h4{
  1028. width: 100%;
  1029. text-align: left;
  1030. font-size: 0.3rem;
  1031. line-height: 0.6rem;
  1032. height: 0.6rem;
  1033. letter-spacing: 0px;
  1034. color: #333;
  1035. font-weight: normal;
  1036. border-bottom: 1px solid #efeded;
  1037. padding-left: 0.11rem;
  1038. &:before{
  1039. content: '';
  1040. display: inline-block;
  1041. width: 0.08rem;
  1042. height: 0.26rem;
  1043. background-color: #145dee;
  1044. margin-right: 0.13rem;
  1045. position: relative;
  1046. top: 0.02rem;
  1047. }
  1048. }
  1049. .contact-info{
  1050. background: #fff;
  1051. margin: .2rem auto;
  1052. border-radius: .1rem;
  1053. ul{
  1054. padding: 0.22rem 0rem;
  1055. li{
  1056. div{
  1057. float: left;
  1058. font-size: .28rem;
  1059. color: #666;
  1060. line-height: .53rem;
  1061. width:80%;
  1062. text-align: left;
  1063. &:first-child{
  1064. width: 20%;
  1065. padding-left: 0.36rem;
  1066. text-align: justify;
  1067. }
  1068. a{
  1069. color: #145dee;
  1070. }
  1071. .click-tel, .click-phone{
  1072. color: #f44336;
  1073. }
  1074. }
  1075. /* &:last-child{
  1076. div{
  1077. width: 74%;
  1078. padding-right:.34rem;
  1079. word-wrap: break-word;
  1080. &:first-child{
  1081. text-align: left;
  1082. padding: 0rem 0rem 0rem .36rem;
  1083. width: 26%;
  1084. }
  1085. }
  1086. }*/
  1087. }
  1088. }
  1089. }
  1090. .store-description{
  1091. background: #fff;
  1092. /*width: 6.96rem;*/
  1093. margin: 0 auto .2rem;
  1094. border-radius: .1rem;
  1095. .content {
  1096. text-indent:2em;
  1097. background: #fff;
  1098. margin: .2rem auto 0;
  1099. padding: .04rem .34rem .4rem .34rem;
  1100. width: 100%;
  1101. font-size: .28rem;
  1102. color: #666;
  1103. text-align: left;
  1104. height: 95%;
  1105. /*box-shadow: 0 .03rem .01rem 0 #cdcbcb96;*/
  1106. line-height: .5rem;
  1107. word-break: break-all;
  1108. }
  1109. }
  1110. }
  1111. .none-state{
  1112. text-align: center;
  1113. padding:1.5rem 0;
  1114. background: #fff;
  1115. margin-top:.1rem;
  1116. width:100%;
  1117. img{
  1118. margin:0 auto;
  1119. width: 4.08rem;
  1120. height: 2.62rem;
  1121. }
  1122. p {
  1123. font-size: .32rem;
  1124. color: #999;
  1125. margin: 1.19rem 0 0 0;
  1126. }
  1127. a {
  1128. display: block;
  1129. font-size: .28rem;
  1130. color: #fff;
  1131. width: 1.88rem;
  1132. height: .54rem;
  1133. line-height: .54rem;
  1134. background: #418bf6;
  1135. margin: .7rem auto 0;
  1136. border-radius: .05rem;
  1137. }
  1138. }
  1139. .associate-list {
  1140. position: absolute;
  1141. width: 100%;
  1142. background: #fff;
  1143. top: 1.4rem;
  1144. border: 1px solid #dcdcdc;
  1145. z-index: 100;
  1146. height: 100%;
  1147. left: 0;
  1148. bottom: 0;
  1149. right: 0;
  1150. li {
  1151. height: 0.7rem;
  1152. line-height: .9rem;
  1153. margin: 0 .45rem;
  1154. border-bottom: .04rem solid #f1f0f0;
  1155. @include overFlowHidden();
  1156. i {
  1157. font-size: .36rem;
  1158. margin-right: .24rem;
  1159. color: #ddd;
  1160. }
  1161. span {
  1162. color: #999;
  1163. font-size: .28rem;
  1164. line-height: .58rem;
  1165. height: .58rem;
  1166. display: inline-block;
  1167. }
  1168. &:active, &:hover {
  1169. background: #eee;
  1170. }
  1171. &:last-child {
  1172. text-align: center;
  1173. font-size: .3rem;
  1174. color: #3976f4;
  1175. border-bottom: none;
  1176. &:active, &:hover {
  1177. background: #fff;
  1178. }
  1179. }
  1180. }
  1181. }
  1182. }
  1183. </style>