newkeycode.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  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 = Math.ceil(data.stock.total / 10)
  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. console.log(this.keyword)
  433. if (!this.keyword) {this.setRemindText('请输入关键字')}
  434. this.$router.push(`/mobile/search/newkeycode?choosetype=${this.ChooseTop}&keyword=${this.keyword}`)
  435. // this.setChangelistHander(this.ChooseTop)
  436. // window.location.href =
  437. },
  438. // 现货 期货切换
  439. getReloadList(_tp) {
  440. this.navType = _tp
  441. this.page = 1
  442. this.resourceList.futures.content = []
  443. this.resourceList.stock.content = []
  444. this.ReloadList()
  445. },
  446. // 刷新数据
  447. ReloadList(param) {
  448. // 如果有值,则代表 是品牌 模糊到精确
  449. // 这里发送数据请求
  450. this.isSearchSearchingMore = true
  451. this.$http.get(`/search/201819`, {params: {count: 10, page: this.page, keyword: this.displayKeyword, type: this.ChooseTop}}).then(res => {
  452. this.isSearchSearchingMore = false
  453. if (!this.brandIsAccurate && this.ChooseTop === 'brand') {
  454. // 品牌模糊查询
  455. this.resourceList.content = [...this.resourceList.content, ...res.data.content]
  456. return
  457. }
  458. if (this.navType === 'hasStore') {
  459. this.resourceList.stock.content = [...this.resourceList.stock.content, ...res.data.stock.content]
  460. this.allPage = Math.ceil(res.data.stock.total / 10) || 0
  461. } else {
  462. this.resourceList.futures.content = [...this.resourceList.futures.content, ...res.data.futures.content]
  463. this.allPage = Math.ceil(res.data.futures.total / 10) || 0
  464. }
  465. }, err => {
  466. this.isSearchSearchingMore = false
  467. })
  468. },
  469. // 模糊品牌查询结果点击
  470. goToBrandAccurate(item) {
  471. this.currentBrandItem = item
  472. this.keyword = item.nameEn
  473. this.setChangelistHander(this.ChooseTop)
  474. },
  475. // 取消返回事件
  476. cancelSearchHander() {
  477. this.$router.replace('/')
  478. },
  479. // 购买 加入购物车
  480. buy: function (item, flag, e) {
  481. this.baseUtils.buyOrCar(flag, e, this, item, '/mobile/center/user/pay/')
  482. },
  483. // 联系买卖家
  484. cancatSeller(item) {
  485. this.$http.get(`/api/store-service/stores?uuid=${item.storeid}`).then(res => {
  486. this.AlertstoreInfo = res.data
  487. this.showStoreInfo = true
  488. })
  489. },
  490. // 切换顶部一级标题
  491. setChangelistHander(str) {
  492. this.addShowPullup = false
  493. if (document.querySelector('#main-search-wrapper')) document.querySelector('#main-search-wrapper').scrollTop = 0
  494. this.ChooseTop = str
  495. this.page = 1
  496. if (!this.keyword) { this.setRemindText('请输入关键字') }
  497. this.displayKeyword = this.keyword
  498. this.brandIsAccurate = false
  499. this.isSearchSearchingMore = true
  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.cmpCode
  558. }
  559. console.log(item)
  560. console.log(product)
  561. this.currentProduct = item
  562. this.showPublishBox = true
  563. } else {
  564. this.url = this.$route.fullPath
  565. this.showLoginBox = true
  566. }
  567. },
  568. setRemindText(str) {
  569. this.timeoutCount++
  570. this.collectResult = str
  571. },
  572. onAssociateClick (word) {
  573. if (this.ChooseTop === 'component') {
  574. this.keyword = word.code
  575. } else if (this.ChooseTop === 'kind') {
  576. this.keyword = word.nameCn
  577. } else if (this.ChooseTop === 'store') {
  578. this.keyword = word.name
  579. } else if (this.ChooseTop === 'brand') {
  580. this.keyword = word.nameEn
  581. }
  582. this.associate.show = false
  583. this.setChangelistHander(this.ChooseTop)
  584. },
  585. Getsimilar(word) {
  586. if (this.ChooseTop === 'component') {
  587. return word.code
  588. } else if (this.ChooseTop === 'kind') {
  589. return word.nameCn
  590. } else if (this.ChooseTop === 'store') {
  591. return word.name
  592. } else if (this.ChooseTop === 'brand') {
  593. return word.nameEn
  594. }
  595. },
  596. onChange () {
  597. if (!this.keyword) {
  598. this.associate.show = false
  599. this.$store.dispatch('resetSearchKeywords')
  600. } else {
  601. this.searchKeywords()
  602. }
  603. },
  604. changeKeyWord() {
  605. this.associate.show = true
  606. this.onChange()
  607. },
  608. searchKeywords () {
  609. this.$store.dispatch('searchKeywords', {keyword: this.keyword, type: this.ChooseTop})
  610. },
  611. onClickTosearch(str) {
  612. this.keyword = str
  613. this.setChangelistHander(this.ChooseTop)
  614. }
  615. },
  616. components: {
  617. RemindBox,
  618. Loading,
  619. LoginBox,
  620. PublishSupplierSeek,
  621. ModalWrapper,
  622. PullUp,
  623. componentItem
  624. },
  625. watch: {
  626. '$route' (to, from) {
  627. this.keyword = to.query.keyword
  628. this.displayKeyword = to.query.keyword
  629. this.setChangelistHander(to.query.choosetype)
  630. }
  631. }
  632. }
  633. </script>
  634. <style lang="scss" scoped>
  635. @mixin overFlowHidden {
  636. overflow: hidden;
  637. text-overflow: ellipsis;
  638. white-space: nowrap;
  639. }
  640. @mixin lineHeight($value) {
  641. height: $value;
  642. line-height: $value;
  643. }
  644. .search-wrapper {
  645. background: #f1f3f6;
  646. width: 100%;
  647. position: fixed;
  648. z-index: 1000;
  649. top: 0;
  650. bottom: 0;
  651. .main-search-header {
  652. position: absolute;
  653. background: #3e82f5;
  654. padding: 0.19rem 0 0.15rem;
  655. margin-top: 0;
  656. z-index: 1;
  657. width: 100%;
  658. input {
  659. width: 6.48rem;
  660. height: .58rem;
  661. line-height: .58rem;
  662. font-size: .26rem;
  663. color: #333;
  664. margin-left: 0.11rem;
  665. /*padding-left: 1.26rem;*/
  666. border: .04rem solid #fff;
  667. background: #fff;
  668. outline: none;
  669. border-radius: 0;
  670. float: left;
  671. /*margin-top: .12rem;*/
  672. -webkit-appearance: none;
  673. border-radius: .14rem;
  674. /*border-top-left-radius: .14rem;*/
  675. /*border-bottom-left-radius: .14rem;*/
  676. }
  677. span {
  678. display: inline-block;
  679. height: .58rem;
  680. line-height: .58rem;
  681. position: relative;
  682. top: .04rem;
  683. width: .68rem;
  684. color: #376ff3;
  685. border-left: .02rem solid #376ff3;
  686. margin-left: -.68rem;
  687. text-align: center;
  688. i {
  689. font-size: .31rem;
  690. }
  691. /*margin-top: .12rem;*/
  692. }
  693. a {
  694. font-size: .28rem;
  695. color: #fff;
  696. margin-left: .2rem;
  697. }
  698. .main-search-header-controll {
  699. width: 5.48rem;
  700. margin-left: 0.21rem;
  701. transform: translateY(1px);
  702. div {
  703. div {
  704. font-size: 0.28rem;
  705. color: #fff;
  706. margin: 0;
  707. border-radius: 0;
  708. padding: 0.1rem 0.1rem;
  709. &.active {
  710. background: #fff;
  711. border-top-left-radius: 0.05rem;
  712. border-top-right-radius: 0.05rem;
  713. }
  714. &.active a {
  715. color: #2d8cf0;
  716. }
  717. a {
  718. font-size: .26rem;
  719. color: #f1f1f1;
  720. margin-left: 0 !important;
  721. }
  722. }
  723. }
  724. }
  725. }
  726. .main-search-wrapper {
  727. margin-top: 1.71rem;
  728. }
  729. .search-title {
  730. font-size: 0.26rem;
  731. text-align: center;
  732. color: #999;
  733. margin: 0 auto 0.2rem;
  734. span {
  735. color: #4290f7
  736. }
  737. }
  738. .search-nav {
  739. background: #fff;
  740. @include lineHeight(1rem);
  741. padding: 0 0.2rem;
  742. position: relative;
  743. z-index: 10;
  744. span {
  745. width: 50%;
  746. color: #666;
  747. font-size: 0.28rem;
  748. text-align: center;
  749. border-bottom: 0.04rem solid #dcdcdc;
  750. @include lineHeight(0.7rem);
  751. margin-top: 0.15rem;
  752. &.active {
  753. border-bottom: 0.04rem solid #4290f7;
  754. color: #4290f7
  755. }
  756. }
  757. }
  758. .search-content {
  759. padding-top: 0;
  760. top: 3.41rem;
  761. /*height: calc(100vh - 3.41rem);*/
  762. overflow-y: auto;
  763. position: absolute;
  764. width: 100%;
  765. bottom: 0;
  766. .middle {
  767. background: #fff;
  768. padding: 0.2rem;
  769. .lookMoreBtn {
  770. font-size: 0.28rem;
  771. color: #2d8cf0
  772. }
  773. .more_icon {
  774. font-size: 0.34rem;
  775. color: #999;
  776. }
  777. .order-tag {
  778. display: inline-block;
  779. font-size: .18rem;
  780. color: #fff;
  781. font-weight: bold;
  782. background: #ee1717;
  783. height: .27rem;
  784. width: .27rem;
  785. line-height: .27rem;
  786. text-align: center;
  787. border-radius: .05rem;
  788. position: relative;
  789. top: -.05rem;
  790. margin-right: .05rem;
  791. &.reserve-tag {
  792. background: #07bb1c;
  793. }
  794. }
  795. text-align: left;
  796. background: #fff;
  797. /*border-radius: 5px;*/
  798. margin-bottom: 0.2rem;
  799. .overHidden {
  800. @include overFlowHidden()
  801. }
  802. .pms {
  803. color: #f57710;
  804. border: 1px solid #f57710;
  805. border-radius: 0.4rem;
  806. background: #fff;
  807. font-size: 0.24rem;
  808. height: 0.4rem;
  809. line-height: 0.4rem;
  810. width: 0.8rem;
  811. text-align: center;
  812. }
  813. .list {
  814. @include overFlowHidden();
  815. width: 100%;
  816. .left {
  817. float: left;
  818. overflow: hidden;
  819. text-overflow: ellipsis;
  820. white-space: nowrap;
  821. }
  822. .textinfo {
  823. font-size: 0.18rem;
  824. margin-left: 0.1rem;
  825. display: inline-block;
  826. background: #3f84f6;
  827. color: #fff;
  828. font-weight: bold;
  829. border-radius: 3px;
  830. width: 0.8rem;
  831. height: 0.32rem;
  832. line-height: 0.32rem;
  833. text-align: center
  834. }
  835. .button {
  836. font-size: 0.3rem;
  837. color: #1a58dd;
  838. width: 0.92rem;
  839. height: 0.43rem;
  840. line-height: 0.43rem;
  841. text-align: center;
  842. border-radius: 5px;
  843. border:1px solid #1a58dd;
  844. display: inline-block;
  845. margin-right: 0.2rem;
  846. }
  847. margin-bottom: 0.18rem;
  848. &::after{
  849. clear: both;
  850. display: block;
  851. content: ' ';
  852. visibility: hidden;
  853. zoom: 1;
  854. }
  855. .fl {
  856. width: 3.5rem;
  857. float: left;
  858. }
  859. .fr {
  860. text-align: left;
  861. width: 2.6rem;
  862. overflow: hidden;
  863. text-overflow: ellipsis;
  864. white-space: nowrap;
  865. }
  866. &.list-long {
  867. .fl {
  868. width: 100% !important;
  869. }
  870. }
  871. .name {
  872. color: #666;
  873. font-size: 0.28rem;
  874. display: inline-block;
  875. }
  876. .text {
  877. display: inline-block;
  878. color: #333;
  879. font-size: 0.28rem;
  880. vertical-align: top;
  881. width: 5.5rem;
  882. @include overFlowHidden();
  883. }
  884. .table {
  885. width: 5.85rem;
  886. margin-bottom: 0;
  887. margin-top: 0;
  888. margin-left: 0.1rem;
  889. li {
  890. height: 0.43rem;
  891. line-height: 0.43rem;
  892. border-left: .01rem solid #c5c5c5;
  893. font-size: .28rem;
  894. &::after {
  895. clear: both;
  896. display: block;
  897. content: ' ';
  898. visibility: hidden;
  899. zoom: 1;
  900. }
  901. div {
  902. text-align: center;
  903. width: 50%;
  904. float: left;
  905. border-right: .01rem solid #c5c5c5;
  906. border-bottom: .01rem solid #c5c5c5;
  907. }
  908. &:nth-child(odd) {
  909. background: #ddd;
  910. color: #333;
  911. font-size: 0.28rem;
  912. }
  913. &:nth-child(even) {
  914. background: #fcfcfc;
  915. color: #333;
  916. font-size: 0.28rem;
  917. }
  918. &:nth-last-of-type(1){
  919. color: #f31919;
  920. }
  921. &.title {
  922. font-size: 0.28rem;
  923. color: #333;
  924. }
  925. }
  926. }
  927. .pull-right {
  928. div {
  929. color: #3f84f6;
  930. font-size: 0.28rem;
  931. border-radius: 0.07rem;
  932. border: 1px solid #3f84f6;
  933. background: #fff;
  934. width: 2rem;
  935. line-height: 0.56rem;
  936. height: 0.56rem;
  937. text-align: center;
  938. }
  939. div:last-child {
  940. margin-left: 0.2rem;
  941. color: #fff;
  942. background: #3f84f6;
  943. }
  944. }
  945. i {
  946. &.icon-pdf {
  947. color: #929292;
  948. font-size: 0.4rem;
  949. }
  950. &.active {
  951. color: #eb062b;
  952. }
  953. }
  954. .cancat {
  955. height: 0.56rem;
  956. line-height: 0.56rem;
  957. border: 1px solid #3f84f6;
  958. color: #3f84f6;
  959. font-size: 0.26rem;
  960. text-align: center;
  961. border-radius: 3px;
  962. padding: 0 0.1rem;
  963. overflow: hidden;
  964. width: auto;
  965. }
  966. img.pull-left {
  967. width: 1.21rem;
  968. height: 0.8rem;
  969. border: 1px solid #dcdcdc;
  970. border-radius: 0.07rem;
  971. margin-top: 0;
  972. }
  973. }
  974. .sayPriBtn {
  975. width: 2rem;
  976. @include lineHeight(0.54rem);
  977. color: #fff;
  978. font-size: 0.28rem;
  979. background: #3f84f6;
  980. border-radius: 3px;
  981. text-align: center;
  982. margin-top: -0.1rem;
  983. }
  984. .middle_bottom {
  985. .middle_bottom-left {
  986. float: left;
  987. img {
  988. width: 1.21rem;
  989. height: 1.21rem;
  990. border: 1px solid #4290f7;
  991. border-radius: 0.07rem;
  992. overflow: hidden;
  993. }
  994. div.middle_bottom-leftitem {
  995. line-height: 0.5rem;
  996. font-size: 0.28rem;
  997. div {
  998. display: inline-block;
  999. color: #666;
  1000. height: 100%;
  1001. float: left;
  1002. &.bottom-title {
  1003. display: inline-block;
  1004. text-align: justify;
  1005. vertical-align: top;
  1006. width: 1.5rem;
  1007. height: 0.5rem;
  1008. &::after {
  1009. content: "";
  1010. display: inline-block;
  1011. width: 100%;
  1012. overflow: hidden;
  1013. height: 0;
  1014. }
  1015. }
  1016. }
  1017. }
  1018. }
  1019. }
  1020. }
  1021. }
  1022. .searchContent2 {
  1023. /*height: calc(100vh - 7.3rem);*/
  1024. top: 7.3rem;
  1025. }
  1026. .searchContent3 {
  1027. /*height: calc(100vh - 2.25rem);*/
  1028. top: 2.25rem;
  1029. }
  1030. .store-info {
  1031. background: #f7f7f7;
  1032. h4{
  1033. width: 100%;
  1034. text-align: left;
  1035. font-size: 0.3rem;
  1036. line-height: 0.6rem;
  1037. height: 0.6rem;
  1038. letter-spacing: 0px;
  1039. color: #333;
  1040. font-weight: normal;
  1041. border-bottom: 1px solid #efeded;
  1042. padding-left: 0.11rem;
  1043. &:before{
  1044. content: '';
  1045. display: inline-block;
  1046. width: 0.08rem;
  1047. height: 0.26rem;
  1048. background-color: #145dee;
  1049. margin-right: 0.13rem;
  1050. position: relative;
  1051. top: 0.02rem;
  1052. }
  1053. }
  1054. .contact-info{
  1055. background: #fff;
  1056. margin: .2rem auto;
  1057. border-radius: .1rem;
  1058. ul{
  1059. padding: 0.22rem 0rem;
  1060. li{
  1061. div{
  1062. float: left;
  1063. font-size: .28rem;
  1064. color: #666;
  1065. line-height: .53rem;
  1066. width:80%;
  1067. text-align: left;
  1068. &:first-child{
  1069. width: 20%;
  1070. padding-left: 0.36rem;
  1071. text-align: justify;
  1072. }
  1073. a{
  1074. color: #145dee;
  1075. }
  1076. .click-tel, .click-phone{
  1077. color: #f44336;
  1078. }
  1079. }
  1080. /* &:last-child{
  1081. div{
  1082. width: 74%;
  1083. padding-right:.34rem;
  1084. word-wrap: break-word;
  1085. &:first-child{
  1086. text-align: left;
  1087. padding: 0rem 0rem 0rem .36rem;
  1088. width: 26%;
  1089. }
  1090. }
  1091. }*/
  1092. }
  1093. }
  1094. }
  1095. .store-description{
  1096. background: #fff;
  1097. /*width: 6.96rem;*/
  1098. margin: 0 auto .2rem;
  1099. border-radius: .1rem;
  1100. .content {
  1101. text-indent:2em;
  1102. background: #fff;
  1103. margin: .2rem auto 0;
  1104. padding: .04rem .34rem .4rem .34rem;
  1105. width: 100%;
  1106. font-size: .28rem;
  1107. color: #666;
  1108. text-align: left;
  1109. height: 95%;
  1110. /*box-shadow: 0 .03rem .01rem 0 #cdcbcb96;*/
  1111. line-height: .5rem;
  1112. word-break: break-all;
  1113. }
  1114. }
  1115. }
  1116. .none-state{
  1117. text-align: center;
  1118. padding:1.5rem 0;
  1119. background: #fff;
  1120. margin-top:.1rem;
  1121. width:100%;
  1122. img{
  1123. margin:0 auto;
  1124. width: 4.08rem;
  1125. height: 2.62rem;
  1126. }
  1127. p {
  1128. font-size: .32rem;
  1129. color: #999;
  1130. margin: 1.19rem 0 0 0;
  1131. }
  1132. a {
  1133. display: block;
  1134. font-size: .28rem;
  1135. color: #fff;
  1136. width: 1.88rem;
  1137. height: .54rem;
  1138. line-height: .54rem;
  1139. background: #418bf6;
  1140. margin: .7rem auto 0;
  1141. border-radius: .05rem;
  1142. }
  1143. }
  1144. .associate-list {
  1145. position: absolute;
  1146. width: 100%;
  1147. background: #fff;
  1148. top: 1.44rem;
  1149. border: 1px solid #dcdcdc;
  1150. z-index: 100;
  1151. height: 100%;
  1152. left: 0;
  1153. bottom: 0;
  1154. right: 0;
  1155. li {
  1156. height: 0.7rem;
  1157. line-height: .9rem;
  1158. margin: 0 .45rem;
  1159. border-bottom: .04rem solid #f1f0f0;
  1160. @include overFlowHidden();
  1161. i {
  1162. font-size: .36rem;
  1163. margin-right: .24rem;
  1164. color: #ddd;
  1165. }
  1166. span {
  1167. color: #999;
  1168. font-size: .28rem;
  1169. line-height: .58rem;
  1170. height: .58rem;
  1171. display: inline-block;
  1172. }
  1173. &:active, &:hover {
  1174. background: #eee;
  1175. }
  1176. &:last-child {
  1177. text-align: center;
  1178. font-size: .3rem;
  1179. color: #3976f4;
  1180. border-bottom: none;
  1181. &:active, &:hover {
  1182. background: #fff;
  1183. }
  1184. }
  1185. }
  1186. }
  1187. }
  1188. </style>