search.vue 26 KB

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