newkeycode.vue 43 KB

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