search.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. <template>
  2. <view class="search-container">
  3. <view class="search-main">
  4. <view class="search-tab">
  5. <view class="search-tab-btn" @click="topBubble">
  6. <text>{{ tabValue }}</text> <text class="iconfont icon-xiangxiajiantou"></text>
  7. </view>
  8. <tui-bubble-popup
  9. :show="show"
  10. :mask="true"
  11. position="absolute"
  12. direction="top"
  13. @close="topBubble"
  14. width="140rpx"
  15. left="10rpx"
  16. bottom="0rpx"
  17. translateY="100%"
  18. triangleRight="60rpx"
  19. triangleTop="-22rpx"
  20. :maskBgColor="maskBgColor"
  21. >
  22. <view class="tui-menu-item" @tap="selectTabs(1)">产品</view>
  23. <!-- <view class="tui-menu-item" @tap="selectTabs(2)">供应商</view> -->
  24. <view class="tui-menu-item" @tap="selectTabs(3)">项目仪器</view>
  25. </tui-bubble-popup>
  26. </view>
  27. <view class="gosearch-btn">
  28. <text class="iconfont icon-sousuo"></text>
  29. <input
  30. class="input"
  31. maxlength="20"
  32. :focus="isFocus"
  33. type="text"
  34. value=""
  35. confirm-type="search"
  36. @focus="onFocus"
  37. @input="onShowClose"
  38. @confirm="subMitSearch()"
  39. placeholder="请输入搜索关键字"
  40. v-model.trim="listQuery.keyword"
  41. />
  42. <text class="iconfont icon-shanchu1" v-if="isShowClose" @click.stop="delInputText()"></text>
  43. </view>
  44. <view class="search-btn" @click="subMitSearch()">搜索</view>
  45. </view>
  46. <view class="search-container-history" v-if="!isShowWrapper">
  47. <view :class="'s-' + themeClass" v-if="serachRecordList.length > 0">
  48. <view class="header"> 搜索历史<text class="iconfont icon-shanchu" @click="confirmDetele"></text> </view>
  49. <view class="list">
  50. <view class="list-main">
  51. <view
  52. v-for="(item, index) in serachRecordList"
  53. :key="index"
  54. @click="keywordsClick(item.searchWord)"
  55. >{{ item.searchWord }}</view
  56. >
  57. </view>
  58. </view>
  59. </view>
  60. <view class="s-block hot clearfix">
  61. <view class="header">热门搜索</view>
  62. <view class="list">
  63. <view class="list-title">产品</view>
  64. <view class="list-main">
  65. <view
  66. v-for="(item, index) in productHotSearch"
  67. :key="index"
  68. @click="keywordsClickPath(item)"
  69. :class="item.isHot == '1' ? 'list-active' : ''"
  70. >
  71. {{ item.name }} <text class="iconfont icon-resou" v-if="item.isHot === '1'"></text>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="list">
  76. <view class="list-title">仪器</view>
  77. <view class="list-main">
  78. <view
  79. v-for="(item, index) in instrumentHotSearch"
  80. :key="index"
  81. @click="keywordsClickPath(item)"
  82. :class="item.isHot == '1' ? 'list-active' : ''"
  83. >
  84. {{ item.name }} <text class="iconfont icon-resou" v-if="item.isHot === '1'"></text>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <view
  91. v-else
  92. class="commodity-list-wrapper"
  93. :style="{ overflow: 'auto', height: listData.length > 4 ? windowHeight + 'px' : 'auto' }"
  94. >
  95. <scroll-view
  96. :style="{ height: listData.length > 4 ? scrollHeight + 'px' : 'auto' }"
  97. @scrolltolower="scrolltolower"
  98. scroll-y
  99. v-if="!showEmpty"
  100. >
  101. <view
  102. v-for="(pros, index) in listData"
  103. :key="index"
  104. :id="pros.id"
  105. class="all-type-list-content commodity-list"
  106. @click.stop="navToDetailPage(pros.productId)"
  107. >
  108. <image mode="widthFix" :src="pros.image" class="list-img" alt="list-img"></image>
  109. <view class="list-details-info">
  110. <view class="list-details-title">
  111. <text class="mclap-tag" v-if="pros.beautyActFlag == 1">美博会</text>
  112. <text class="mclap" :class="pros.beautyActFlag == 1 ? 'indent' : ''">{{
  113. isInterceptHtmlFn(pros.name)
  114. }}</text>
  115. </view>
  116. <text class="list-details-specs">规格:{{ pros.unit }}</text>
  117. <view class="list-details-specs" v-if="pros.code != '' && pros.code != null">
  118. <view>商品编码:{{ pros.code }}</view>
  119. </view>
  120. <view class="list-details-price">
  121. <template v-if="userIdentity == 3">
  122. <view class="floor-item-act">
  123. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  124. <template v-if="pros.actStatus == 1">
  125. <view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
  126. {{ pros.promotions.name }}
  127. <text v-if="hasLogin && pros.shopId == shopId && pros.priceFlag != 1"
  128. >:¥{{ pros.price | NumFormat }}</text
  129. >
  130. </view>
  131. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  132. </template>
  133. <template v-if="pros.svipProductFlag == 1">
  134. <view class="svip-tags">
  135. <view class="tags">SVIP</view>
  136. <view
  137. class="price"
  138. v-if="hasLogin && pros.shopId == shopId && pros.priceFlag != 1"
  139. >{{ pros.svipPriceTag }}</view
  140. >
  141. </view>
  142. </template>
  143. </view>
  144. </template>
  145. <template v-else-if="userIdentity == 1">
  146. <view class="floor-item-act">
  147. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  148. <template v-if="pros.actStatus == 1">
  149. <view
  150. class="floor-tags"
  151. v-if="pros.actStatus == 1 && PromotionsFormat(pros.promotions)"
  152. >
  153. {{ pros.promotions.name }} <text>:¥{{ pros.price | NumFormat }}</text>
  154. </view>
  155. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  156. </template>
  157. <template v-if="pros.svipProductFlag == 1">
  158. <view class="svip-tags"> <view class="tags none">SVIP</view> </view>
  159. </template>
  160. </view>
  161. </template>
  162. <template v-else>
  163. <view class="floor-item-act">
  164. <view class="coupon-tags" v-if="pros.couponsLogo">优惠券</view>
  165. <template v-if="pros.actStatus == 1">
  166. <view
  167. class="floor-tags"
  168. v-if="pros.actStatus == 1 && PromotionsFormat(pros.promotions)"
  169. >
  170. {{ pros.promotions.name }}
  171. <text v-if="pros.priceFlag != 1 && hasLogin && userIdentity == 2"
  172. >:¥{{ pros.price | NumFormat }}</text
  173. >
  174. </view>
  175. <view class="floor-tags" v-else>{{ pros.promotions.name }}</view>
  176. </template>
  177. <template v-if="pros.svipProductFlag == 1">
  178. <template v-if="pros.priceFlag != 1 && hasLogin && userIdentity == 2">
  179. <view class="svip-tags">
  180. <view class="tags">SVIP</view>
  181. <view class="price">{{ pros.svipPriceTag }}</view>
  182. </view>
  183. </template>
  184. <template v-else>
  185. <view class="svip-tags"> <view class="tags none">SVIP</view> </view>
  186. </template>
  187. </template>
  188. </view>
  189. </template>
  190. <view v-if="hasLogin" class="list-price">
  191. <template v-if="userIdentity == 1">
  192. <text v-if="priceLoading" class="price-larger small">正在获取价格...</text>
  193. <text
  194. v-else
  195. class="price-larger"
  196. :class="
  197. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1 ? 'none' : ''
  198. "
  199. >
  200. ¥{{
  201. (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price)
  202. | NumFormat
  203. }}
  204. </text>
  205. </template>
  206. <template v-if="userIdentity == 4">
  207. <view class="price-larger" v-if="pros.priceFlag == 1">
  208. <text class="txt">¥未公开价格</text>
  209. </view>
  210. <text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
  211. <template v-else>
  212. <view class="price-larger" v-if="pros.priceFlag == 2">
  213. <text class="txt">¥价格仅会员可见</text>
  214. </view>
  215. <text
  216. v-else
  217. class="price-larger"
  218. :class="
  219. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  220. ? 'none'
  221. : ''
  222. "
  223. >
  224. ¥{{
  225. (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price)
  226. | NumFormat
  227. }}
  228. </text>
  229. </template>
  230. </template>
  231. <template v-if="userIdentity == 3">
  232. <template v-if="pros.supplierId == shopId">
  233. <view class="price-larger" v-if="pros.priceFlag == 1">
  234. <text class="txt">¥未公开价格</text>
  235. </view>
  236. <text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
  237. <text
  238. v-else
  239. class="price-larger"
  240. :class="
  241. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1
  242. ? 'none'
  243. : ''
  244. "
  245. >
  246. ¥{{
  247. (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price)
  248. | NumFormat
  249. }}
  250. </text>
  251. </template>
  252. <template v-else>
  253. <view class="list-login-now">
  254. <text class="p-no">¥</text>
  255. <uni-grader :grade="Number(pros.priceGrade)"></uni-grader>
  256. </view>
  257. </template>
  258. </template>
  259. <template v-if="userIdentity == 2">
  260. <view class="price-larger" v-if="pros.priceFlag == 1">
  261. <text class="txt">¥未公开价格</text>
  262. </view>
  263. <text v-else-if="priceLoading" class="price-larger small">正在获取价格...</text>
  264. <text
  265. v-else
  266. class="price-larger"
  267. :class="
  268. PromotionsFormat(pros.promotions) || pros.svipProductFlag == 1 ? 'none' : ''
  269. "
  270. >
  271. ¥{{
  272. (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price)
  273. | NumFormat
  274. }}
  275. </text>
  276. </template>
  277. </view>
  278. <view v-else class="list-login-now">
  279. <text class="p-no">¥</text>
  280. <uni-grader :grade="Number(pros.priceGrade)"></uni-grader>
  281. </view>
  282. </view>
  283. </view>
  284. </view>
  285. <view v-if="showLoading && listData.length > 4">
  286. <view class="loading-wrapper loading-wrapper-now" v-if="loadingNow"
  287. >{{ loadingText }}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view
  288. >
  289. <view class="loading-wrapper loading-wrapper-btm" v-else
  290. >———<text class="btm-text">已至底部</text>———</view
  291. >
  292. </view>
  293. </scroll-view>
  294. <view class="empty-container" v-if="showEmpty">
  295. <image
  296. class="empty-container-image"
  297. src="https://img.caimei365.com/group1/M00/03/8D/Cmis215XHXWAHCoqAAELHadZ9Xg365.png"
  298. ></image>
  299. <text class="error-text">抱歉,没有相关商品!</text>
  300. </view>
  301. </view>
  302. <!-- 透明模态层 -->
  303. <modal-layer v-if="isModallayer"></modal-layer>
  304. </view>
  305. </template>
  306. <script>
  307. import { mapState, mapMutations } from 'vuex'
  308. import modalLayer from '@/components/modal-layer'
  309. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  310. import authorize from '@/common/config/authorize.js'
  311. import wxLogin from '@/common/config/wxLogin.js'
  312. export default {
  313. components: {
  314. modalLayer,
  315. uniGrader
  316. },
  317. data() {
  318. return {
  319. shopId: 0,
  320. userId: 0,
  321. tabValue: '产品',
  322. themeClass: 'block',
  323. show: false,
  324. userIdentity: '',
  325. searchKeyType: 1,
  326. isShowClose: false, //是否显示清空输入框图标
  327. isSearchHistory: false, //是都显示搜索历史
  328. serachRecordList: [], //历史搜索记录
  329. instrumentHotSearch: [],
  330. productHotSearch: [],
  331. isShowWrapper: false,
  332. isModallayer: false,
  333. isFocus: false,
  334. priceLoading: true,
  335. windowHeight: '',
  336. showEmpty: false,
  337. scrollHeight: '',
  338. listData: [],
  339. productIds: '', //查询价格的商品ID
  340. showLoading: false,
  341. loadingNow: true,
  342. loadingText: '上拉加载更多',
  343. pullFlag: true,
  344. listQuery: {
  345. identity: 0,
  346. keyword: '',
  347. sortField: '',
  348. sortType: '',
  349. pageNum: 1,
  350. pageSize: 20
  351. },
  352. total: 0
  353. }
  354. },
  355. computed: {
  356. ...mapState(['hasLogin', 'userInfo', 'isWxAuthorize', 'hasLogin', 'userInfo', 'identity'])
  357. },
  358. onLoad(option) {
  359. console.log(option)
  360. if (option.type == 'share') {
  361. wxLogin.wxLoginAuthorize()
  362. }
  363. this.$api.getStorage().then(resolve => {
  364. this.userId = resolve.userId ? resolve.userId : 0
  365. this.shopId = resolve.shopId ? resolve.shopId : 0
  366. this.userIdentity = resolve.userIdentity
  367. this.listQuery.identity = this.identity
  368. if (option.keyWord) {
  369. this.listQuery.keyword = option.keyWord
  370. this.setSearchHistoryAdd()
  371. this.getListFromServer()
  372. this.isFocus = false
  373. } else {
  374. this.isFocus = true
  375. this.initGetSerachRecord()
  376. }
  377. })
  378. },
  379. filters: {
  380. NumFormat: function(text) {
  381. //处理金额
  382. return Number(text).toFixed(2)
  383. }
  384. },
  385. methods: {
  386. GetHomeHotSearchTerms() {
  387. //金刚区分类
  388. this.CommonService.GetHomeHotSearchTerms({})
  389. .then(response => {
  390. let data = response.data
  391. console.log(data)
  392. this.instrumentHotSearch = data.instrumentHotSearch
  393. this.productHotSearch = data.productHotSearch
  394. })
  395. .catch(error => {
  396. this.$util.msg(error.msg, 2000)
  397. })
  398. },
  399. initGetSerachRecord() {
  400. //查询搜索历史记录
  401. this.ProductService.GetProductSearchHistory({ userId: this.userId }).then(response => {
  402. if (response.code == 0) {
  403. this.serachRecordList = response.data
  404. }
  405. })
  406. },
  407. subMitSearch() {
  408. //搜索
  409. if (this.listQuery.keyword == '') {
  410. this.$util.msg('请输入搜索关键词', 2000)
  411. } else {
  412. switch (this.searchKeyType) {
  413. case 1:
  414. this.listData = []
  415. this.setSearchHistoryAdd()
  416. this.getListFromServer()
  417. this.isFocus = false
  418. // 友盟埋点商品搜索点击
  419. if (process.env.NODE_ENV != 'development') {
  420. this.$uma.trackEvent('Um_Event_SearchProductSubmit', {
  421. Um_Key_Keyword: `${this.listQuery.keyword}`,
  422. Um_Key_PageName: '商品',
  423. Um_Key_SourcePage: '搜索商品'
  424. })
  425. }
  426. break
  427. case 2:
  428. this.setSearchHistoryAdd()
  429. this.$api.navigateTo(`/pages/search/search-supplier?keyWord=${this.listQuery.keyword}`)
  430. break
  431. case 3:
  432. this.setSearchHistoryAdd()
  433. this.$api.navigateTo(`/pages/search/search-instrument?keyWord=${this.listQuery.keyword}`)
  434. break
  435. }
  436. }
  437. },
  438. scrolltolower() {
  439. if (this.total > this.listData.length && this.pullFlag) {
  440. this.getListFromServer(true)
  441. }
  442. },
  443. getListFromServer(loadMore) {
  444. this.showLoading = true
  445. this.loadingNow = true
  446. this.loadingText = '加载中'
  447. this.showEmpty = false
  448. if (loadMore) {
  449. this.listQuery.pageNum += 1
  450. }
  451. this.ProductService.GetProductSearchList(this.listQuery)
  452. .then(response => {
  453. this.isShowWrapper = true
  454. const resData = JSON.parse(response.data)
  455. const resList = resData.items
  456. if (resList && resList.length > 0) {
  457. this.total = resData.total
  458. this.showEmpty = false
  459. if (loadMore) {
  460. this.listData = [...this.listData, ...resList]
  461. this.getProductPrice()
  462. } else {
  463. this.listData = [...resList]
  464. this.getProductPrice()
  465. }
  466. // 防上拉暴滑
  467. this.pullFlag = false
  468. setTimeout(() => {
  469. this.pullFlag = true
  470. }, 500)
  471. // 底部提示文案
  472. if (this.totalPage > this.listData.length) {
  473. this.loadingText = '上拉加载更多'
  474. } else {
  475. this.showLoading = true
  476. this.loadingNow = false
  477. }
  478. } else {
  479. if (!loadMore) {
  480. this.showEmpty = true
  481. }
  482. }
  483. })
  484. .catch(error => {
  485. this.$util.msg(error.msg, 2000)
  486. })
  487. },
  488. setSearchHistoryAdd() {
  489. //添加搜索记录
  490. if (!this.hasLogin) {
  491. return false
  492. }
  493. this.ProductService.GetAddProductSearchHistory({ userId: this.userId, keyword: this.listQuery.keyword })
  494. .then(response => {
  495. //此为每次搜索同时添加用户的搜索记录
  496. })
  497. .catch(error => {
  498. this.$util.msg(error.msg, 2000)
  499. })
  500. },
  501. getProductPrice() {
  502. //获取价格
  503. let productIdArr = []
  504. this.listData.map(item => {
  505. // 0公开价格 1不公开价格 2仅对资质机构公开
  506. productIdArr.push(item.productId)
  507. })
  508. this.productIds = productIdArr.join(',')
  509. this.ProductService.querySearchProductPrice({
  510. userId: this.userId,
  511. productIds: this.productIds,
  512. source: 2 // 来源 1 WWW 2 小程序
  513. })
  514. .then(response => {
  515. if (response.data) {
  516. this.listData = this.ReturnNewProducts(this.listData, response.data)
  517. }
  518. this.priceLoading = false
  519. })
  520. .catch(error => {
  521. this.$util.msg(error.msg, 2000)
  522. })
  523. },
  524. ReturnNewProducts(Array, list) {
  525. //处理对应商品ID的商品价格
  526. let NewArray = []
  527. Array.map(item => {
  528. for (let i = 0; i < list.length; i++) {
  529. if (item.productId == list[i].productId) {
  530. NewArray.push(Object.assign(item, list[i]))
  531. }
  532. }
  533. })
  534. return NewArray
  535. },
  536. PromotionsFormat(promo) {
  537. //促销活动类型数据处理
  538. if (promo != null) {
  539. if (promo.type == 1 && promo.mode == 1) {
  540. return true
  541. } else {
  542. return false
  543. }
  544. }
  545. return false
  546. },
  547. onShowClose() {
  548. //输入框输入时触发
  549. this.inputEmpty(this.listQuery.keyword)
  550. },
  551. onFocus() {
  552. //输入框获取焦点时触发
  553. this.inputEmpty(this.listQuery.keyword)
  554. this.initGetSerachRecord()
  555. },
  556. delInputText() {
  557. //清除输入框内容
  558. this.listQuery.keyword = ''
  559. this.isShowClose = false
  560. this.isShowWrapper = false
  561. this.inputEmpty(this.listQuery.keyword)
  562. this.initGetSerachRecord()
  563. },
  564. keywordsClick(item) {
  565. //关键词搜索与历史搜索
  566. this.listQuery.keyword = item
  567. this.isShowClose = true
  568. this.isFocus = false
  569. this.subMitSearch()
  570. },
  571. keywordsClickPath(item) {
  572. this.$api.FlooryNavigateTo(item)
  573. },
  574. confirmDetele() {
  575. //清空历史记录
  576. this.$util.modal('提示', '确定删除历史记录?', '确定', '取消', true, () => {
  577. this.ProductService.GetDeleteProductSearchHistory({ userId: this.userId })
  578. .then(response => {
  579. this.$util.msg('删除成功', 2000, true, 'success')
  580. this.serachRecordList = []
  581. })
  582. .catch(error => {
  583. this.$util.msg(error.msg, 2000)
  584. })
  585. })
  586. },
  587. inputEmpty(val) {
  588. this.isShowWrapper = false
  589. if (val != '') {
  590. this.isShowClose = true
  591. this.isFocus = true
  592. } else {
  593. this.isShowClose = false
  594. this.isFocus = true
  595. }
  596. },
  597. isInterceptHtmlFn(text) {
  598. let name = this.$reg.interceptHtmlFn(text)
  599. return name
  600. },
  601. navToDetailPage(id) {
  602. this.isModallayer = true
  603. this.$api.navigateTo(`/pages/goods/product?id=${id}`)
  604. this.isModallayer = false
  605. },
  606. setScrollHeight() {
  607. const { windowHeight, pixelRatio } = wx.getSystemInfoSync()
  608. this.windowHeight = windowHeight - 1
  609. this.scrollHeight = windowHeight - 1
  610. },
  611. toLoginPage() {
  612. let searchLoginType = 'search'
  613. uni.navigateTo({
  614. url: `/pages/login/login?type=${searchLoginType}`
  615. })
  616. },
  617. selectTabs(index) {
  618. //选择搜索项
  619. this.show = false
  620. this.searchKeyType = index
  621. switch (index) {
  622. case 1:
  623. this.tabValue = '产品'
  624. break
  625. case 2:
  626. this.tabValue = '供应商'
  627. break
  628. case 3:
  629. this.tabValue = '项目仪器'
  630. break
  631. }
  632. },
  633. topBubble() {
  634. //显隐搜索项
  635. this.show = !this.show
  636. }
  637. },
  638. onShareAppMessage(res) {
  639. //分享转发
  640. if (res.from === 'button') {
  641. // 来自页面内转发按钮
  642. }
  643. return {
  644. title: `点击查看“${this.listQuery.keyword}”相关的商品`,
  645. path: `pages/search/search?type=share&keyWord=${this.listQuery.keyword}`
  646. }
  647. },
  648. onShow() {
  649. this.setScrollHeight()
  650. this.GetHomeHotSearchTerms()
  651. }
  652. }
  653. </script>
  654. <style lang="scss">
  655. @import '@/uni.scss';
  656. page {
  657. background-color: #f7f7f7 !important;
  658. }
  659. .search-main {
  660. width: 100%;
  661. height: 88rpx;
  662. position: fixed;
  663. top: 0;
  664. left: 0;
  665. background: #ffffff;
  666. z-index: 1001;
  667. box-sizing: border-box;
  668. padding: 9rpx 0;
  669. .search-tab {
  670. width: 160rpx;
  671. height: 70rpx;
  672. line-height: 70rpx;
  673. color: #666666;
  674. font-size: $font-size-24;
  675. text-align: center;
  676. float: left;
  677. position: relative;
  678. .icon-xiangxiajiantou {
  679. margin-left: 10rpx;
  680. font-size: $font-size-30;
  681. }
  682. }
  683. .gosearch-btn {
  684. width: 470rpx;
  685. height: 100%;
  686. float: left;
  687. border-radius: 40rpx;
  688. background: #f0f0f0;
  689. margin: 0 auto;
  690. padding: 0 20rpx;
  691. font-size: 28rpx;
  692. line-height: 70rpx;
  693. padding-left: 70rpx;
  694. color: #8a8a8a;
  695. background: #f7f7f7;
  696. position: relative;
  697. box-sizing: border-box;
  698. .icon-sousuo {
  699. width: 70rpx;
  700. height: 70rpx;
  701. line-height: 70rpx;
  702. text-align: center;
  703. display: block;
  704. position: absolute;
  705. left: 0;
  706. top: 0;
  707. font-size: 34rpx;
  708. color: #8a8a8a;
  709. z-index: 10;
  710. }
  711. .icon-shanchu1 {
  712. font-size: 36rpx;
  713. color: #8a8a8a;
  714. position: absolute;
  715. right: 10rpx;
  716. top: 0;
  717. padding: 0 10rpx;
  718. z-index: 100;
  719. }
  720. .input {
  721. width: 400rpx;
  722. height: 100%;
  723. float: left;
  724. font-size: $font-size-24;
  725. box-sizing: border-box;
  726. padding-right: 66rpx;
  727. }
  728. }
  729. .search-btn {
  730. width: 120rpx;
  731. height: 70rpx;
  732. line-height: 70rpx;
  733. float: right;
  734. text-align: center;
  735. color: #666666;
  736. font-size: $font-size-24;
  737. }
  738. }
  739. .search-container {
  740. padding-top: 96rpx;
  741. }
  742. .s-block {
  743. background: #ffffff;
  744. &.hot {
  745. border-top: 20rpx solid #f7f7f7;
  746. }
  747. .header {
  748. font-size: 32rpx;
  749. padding: 40rpx 24rpx 22rpx 24rpx;
  750. line-height: 42rpx;
  751. font-size: 30rpx;
  752. font-weight: bold;
  753. position: relative;
  754. width: 100%;
  755. float: left;
  756. box-sizing: border-box;
  757. .icon-shanchu {
  758. font-size: 36rpx;
  759. color: #333333;
  760. float: right;
  761. padding: 0 10rpx;
  762. z-index: 10;
  763. font-weight: normal;
  764. }
  765. }
  766. .list {
  767. width: 100%;
  768. height: auot;
  769. float: left;
  770. padding: 0 24rpx 30rpx 24rpx;
  771. box-sizing: border-box;
  772. .list-title {
  773. width: 100%;
  774. height: 40rpx;
  775. font-size: $font-size-26;
  776. color: #333;
  777. }
  778. .list-main {
  779. width: 100%;
  780. float: left;
  781. display: flex;
  782. flex-wrap: wrap;
  783. view {
  784. color: #8a8a8a;
  785. font-size: 24rpx;
  786. box-sizing: border-box;
  787. text-align: center;
  788. height: 48rpx;
  789. line-height: 48rpx;
  790. border-radius: 24rpx;
  791. margin: 12rpx 12rpx 12rpx 0;
  792. padding: 0 20rpx;
  793. white-space: nowrap;
  794. text-overflow: ellipsis;
  795. background-color: #f3f3f3;
  796. .iconfont {
  797. font-size: $font-size-30;
  798. color: #e15616;
  799. margin-left: 12rpx;
  800. }
  801. &.list-active {
  802. background-color: #fef6f3;
  803. color: #e15616;
  804. }
  805. }
  806. }
  807. }
  808. }
  809. .s-circle {
  810. margin-top: 30rpx;
  811. .header {
  812. font-size: 32rpx;
  813. padding: 30rpx;
  814. border-bottom: 2rpx solid #f9f9f9;
  815. position: relative;
  816. image {
  817. width: 36rpx;
  818. height: 36rpx;
  819. padding: 10rpx;
  820. position: absolute;
  821. right: 40rpx;
  822. top: 24rpx;
  823. }
  824. }
  825. .list {
  826. display: flex;
  827. flex-wrap: wrap;
  828. padding: 0 30rpx 20rpx;
  829. view {
  830. padding: 8rpx 30rpx;
  831. margin: 20rpx 30rpx 0 0;
  832. font-size: 28rpx;
  833. color: #8a8a8a;
  834. background-color: #f7f7f7;
  835. box-sizing: border-box;
  836. text-align: center;
  837. border-radius: 20rpx;
  838. }
  839. }
  840. }
  841. .wanted-block {
  842. margin-top: 30rpx;
  843. .header {
  844. font-size: 32rpx;
  845. padding: 30rpx;
  846. }
  847. .list {
  848. display: flex;
  849. flex-wrap: wrap;
  850. view {
  851. width: 50%;
  852. color: #8a8a8a;
  853. font-size: 28rpx;
  854. box-sizing: border-box;
  855. text-align: center;
  856. padding: 20rpx 0;
  857. border-top: 2rpx solid #fff;
  858. border-left: 2rpx solid #fff;
  859. background-color: #f7f7f7;
  860. overflow: hidden;
  861. white-space: nowrap;
  862. text-overflow: ellipsis;
  863. }
  864. }
  865. }
  866. .wanted-circle {
  867. margin-top: 30rpx;
  868. .header {
  869. font-size: 32rpx;
  870. padding: 30rpx;
  871. }
  872. .list {
  873. display: flex;
  874. flex-wrap: wrap;
  875. padding: 0 30rpx 20rpx;
  876. view {
  877. padding: 8rpx 30rpx;
  878. margin: 20rpx 30rpx 0 0;
  879. font-size: 28rpx;
  880. color: #8a8a8a;
  881. background-color: #f7f7f7;
  882. box-sizing: border-box;
  883. text-align: center;
  884. border-radius: 20rpx;
  885. }
  886. }
  887. }
  888. .commodity-list-wrapper {
  889. scroll-view {
  890. height: 100%;
  891. overflow: scroll;
  892. }
  893. .empty-container-image {
  894. margin-top: -300rpx;
  895. }
  896. .toIndexPage {
  897. bottom: 390rpx;
  898. }
  899. .show-more-btn {
  900. width: 276rpx;
  901. height: 52rpx;
  902. line-height: 52rpx;
  903. border: 2rpx solid #d8d8d8;
  904. background: #f7f7f7;
  905. font-size: 26rpx;
  906. margin: 26rpx 0;
  907. position: absolute;
  908. left: 50%;
  909. margin-left: -138rpx;
  910. }
  911. }
  912. .all-type-list-content {
  913. height: 216rpx;
  914. padding: 24rpx;
  915. background: #fff;
  916. margin-bottom: 2rpx;
  917. display: flex;
  918. flex-direction: row;
  919. box-sizing: content-box;
  920. .list-img {
  921. width: 210rpx;
  922. height: 218rpx !important;
  923. margin-right: 26rpx;
  924. border-radius: 10rpx;
  925. border: 2rpx solid #f3f3f3;
  926. }
  927. }
  928. .list-details-info {
  929. width: 466rpx;
  930. display: flex;
  931. flex-direction: column;
  932. font-size: 26rpx;
  933. position: relative;
  934. .list-details-title {
  935. position: relative;
  936. .mclap {
  937. line-height: 38rpx;
  938. text-overflow: ellipsis;
  939. overflow: hidden;
  940. display: -webkit-box;
  941. -webkit-line-clamp: 2;
  942. line-clamp: 2;
  943. -webkit-box-orient: vertical;
  944. &.indent {
  945. text-indent: 95rpx;
  946. }
  947. }
  948. .mclap-tag {
  949. display: block;
  950. width: 84rpx;
  951. height: 32rpx;
  952. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  953. border-radius: 4rpx 48rpx 4px 4px;
  954. line-height: 32rpx;
  955. font-size: $font-size-22;
  956. color: #ffffff;
  957. text-align: center;
  958. position: absolute;
  959. left: 0;
  960. top: 0;
  961. }
  962. }
  963. .list-details-specs {
  964. margin-top: 8rpx;
  965. color: #666666;
  966. }
  967. .list-details-miniQuantity {
  968. margin-top: 7rpx;
  969. }
  970. }
  971. .list-details-price {
  972. width: 100%;
  973. height: 54rpx;
  974. line-height: 54rpx;
  975. position: absolute;
  976. bottom: -10rpx;
  977. right: 0;
  978. .floor-item-act {
  979. height: 54rpx;
  980. text-align: center;
  981. box-sizing: border-box;
  982. float: right;
  983. padding: 11rpx 0;
  984. }
  985. .price-icon {
  986. width: 22rpx;
  987. height: 28rpx;
  988. vertical-align: middle;
  989. margin-right: 10rpx;
  990. }
  991. .price-icon + text {
  992. font-size: 25rpx;
  993. vertical-align: middle;
  994. }
  995. .list-login-now {
  996. color: #f8c499;
  997. float: left;
  998. line-height: 54rpx;
  999. .p-no {
  1000. float: left;
  1001. font-size: $font-size-24;
  1002. color: $text-color;
  1003. }
  1004. }
  1005. .login-now {
  1006. padding: 10rpx 10rpx 10rpx 0;
  1007. }
  1008. .list-price {
  1009. color: #ff2a2a;
  1010. height: 44rpx;
  1011. float: left;
  1012. .price-larger {
  1013. width: 100%;
  1014. font-size: 32rpx;
  1015. &.none {
  1016. text-decoration: line-through;
  1017. color: #999999;
  1018. }
  1019. &.small {
  1020. font-size: $font-size-24;
  1021. }
  1022. .txt {
  1023. font-size: $font-size-24;
  1024. display: inline-block;
  1025. line-height: 44rpx;
  1026. text-align: left;
  1027. float: left;
  1028. }
  1029. }
  1030. }
  1031. }
  1032. </style>