customer.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template name="headerNavbar">
  2. <!-- 自定义导航栏 -->
  3. <view>
  4. <view
  5. class="navbar-wrap"
  6. :class="isScroll ? opacityNav : ''"
  7. :style="{
  8. height: CustomBar + 88 + 'px',
  9. paddingTop: StatusBar + 'px'
  10. }"
  11. >
  12. <view
  13. class="navbar-text"
  14. :style="{
  15. color: navbarData.textColor ? navbarData.textColor : '',
  16. lineHeight: CustomBar - StatusBar + 'px;',
  17. fontSize: fontSizeSetting + 'px;',
  18. paddingLeft: navbarData.textLeft ? '' : 12 + 'px'
  19. }"
  20. :class="platformClass"
  21. >
  22. {{ navbarData.title ? navbarData.title : ' ' }}
  23. </view>
  24. <view class="search-input">
  25. <view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
  26. <view class="search-icon"><text class="iconfont icon-iconfonticonfontsousuo1"></text></view>
  27. <view class="search-text">{{ hotSearchText }}</view> <view class="search-btn">搜索</view>
  28. </view>
  29. <view class="gosearch-kf">
  30. <!-- #ifdef MP-WEIXIN -->
  31. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  32. <text class="iconfont icon-zixunrexian"></text>
  33. </button>
  34. <!-- #endif -->
  35. </view>
  36. </view>
  37. <view class="swiper-banner-nav">
  38. <scroll-view class="scroll-view_H" scroll-x="true">
  39. <view class="tui-goods__item active">首页</view>
  40. <view class="tui-goods__item" v-for="(navs, index) in navBarsList" @click="NavToDetailPage(navs)">
  41. {{ navs.name }}
  42. </view>
  43. </scroll-view>
  44. <view class="swiper-nav-icon" @click="showDropScreenShow">
  45. <text class="iconfont" :class="dropScreenShow ? 'icon-xiangshangjiantou':'icon-xiangxiajiantou'"></text>
  46. </view>
  47. </view>
  48. </view>
  49. <!--顶部下拉筛选弹层 属性-->
  50. <tui-top-dropdown
  51. backgroundColor="#FFFFFF"
  52. :show="dropScreenShow"
  53. :paddingbtm="10"
  54. :translatey="dropScreenH"
  55. @close="btnCloseDrop"
  56. >
  57. <scroll-view class="tui-scroll-box" scroll-y :scroll-top="scrollTop">
  58. <view class="tui-seizeaseat-24">
  59. <view class="tui-drop-item tui-icon-middle">全部分类</view>
  60. <view class="tui-drop-item tui-icon-middle active">首页</view>
  61. <view
  62. class="tui-drop-item tui-icon-middle"
  63. v-for="(item, index) in navBarsList"
  64. :key="index"
  65. @tap.stop="NavToDetailPage(item)"
  66. :data-index="index"
  67. >
  68. {{ item.name }}
  69. </view>
  70. </view>
  71. </scroll-view>
  72. </tui-top-dropdown>
  73. </view>
  74. </template>
  75. <script>
  76. var self
  77. import btSearch from '@/components/uni-search/bt-search.vue'
  78. export default {
  79. name: 'headerNavbar',
  80. components: {
  81. btSearch
  82. },
  83. props: {
  84. navbarData: {
  85. // 由父页面传递的数据
  86. type: Object
  87. },
  88. navBarsList: {
  89. type: Array
  90. },
  91. isScroll: {
  92. type: Boolean,
  93. default: () => false
  94. }
  95. },
  96. data() {
  97. return {
  98. clickPath: '/pages/search/search',
  99. hotSearchText: '搜索商品/项目仪器',
  100. CustomBar: this.CustomBar, // 顶部导航栏高度
  101. StatusBar: this.StatusBar,
  102. fontSizeSetting: this.fontSizeSetting,
  103. screenWidth: this.screenWidth,
  104. capsule: this.capsule,
  105. platformClass: this.platformClass,
  106. opacityNav: 'opacityNav', // 渐变颜色
  107. height: 64, //header高度
  108. scrollTop: 0,
  109. dropScreenH: this.CustomBar+78, //下拉筛选框距顶部距离
  110. dropScreenShow:false,
  111. }
  112. },
  113. created() {
  114. if (getCurrentPages().length === 1) {
  115. // 当只有一个页面时
  116. this.navbarData.haveBack = false
  117. } else {
  118. this.navbarData.haveBack = true
  119. }
  120. let obj = {};
  121. // #ifdef MP-WEIXIN
  122. obj = wx.getMenuButtonBoundingClientRect();
  123. // #endif
  124. uni.getSystemInfo({
  125. success: res => {
  126. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44;
  127. //略小,避免误差带来的影响
  128. this.dropScreenH = (this.height * 750) / res.windowWidth + 148;
  129. }
  130. });
  131. console.log('dropScreenH',this.dropScreenH)
  132. },
  133. onLoad() {},
  134. onPageScroll(e) {
  135. console.log(e)
  136. },
  137. methods: {
  138. BackPage: function() {
  139. this.$emit('navigateBack')
  140. },
  141. _goSearchPath: function() {
  142. this.$emit('goSearchPath')
  143. },
  144. _goHome: function() {
  145. uni.switchTab({
  146. url: '/pages/tabBar/home/index'
  147. })
  148. },
  149. NavToDetailPage(item) {
  150. //跳转
  151. this.$api.FlooryNavigateTo(item)
  152. },
  153. showDropScreenShow(){
  154. this.dropScreenShow = true
  155. },
  156. btnCloseDrop(){
  157. this.dropScreenShow = false
  158. },
  159. handleContact(e) {
  160. console.log(e.detail.path)
  161. console.log(e.detail.query)
  162. }
  163. },
  164. onShow() {}
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. .navbar-wrap {
  169. position: fixed;
  170. width: 100%;
  171. top: 0;
  172. z-index: 9999;
  173. box-sizing: border-box;
  174. background:#ffffff url(https://static.caimei365.com/app/img/bg/home_cumres_bg@2x.png);
  175. background-size: cover;
  176. border-bottom: none;
  177. }
  178. .opacityNav {
  179. }
  180. .navbar-text {
  181. font-size: 30rpx;
  182. color: #000000;
  183. font-weight: 500;
  184. }
  185. .navbar-text.center {
  186. text-align: center;
  187. }
  188. .navbar-text.left {
  189. text-align: left;
  190. padding-left: 45px;
  191. }
  192. .navbar-icon {
  193. position: fixed;
  194. display: flex;
  195. box-sizing: border-box;
  196. }
  197. .navbar-icon .iconfont {
  198. display: inline-block;
  199. overflow: hidden;
  200. font-size: 44rpx;
  201. padding-right: 40rpx;
  202. margin-top: 1px;
  203. }
  204. .navbar-icon .icon-iconfonticonfontsousuo1 {
  205. color: #000000;
  206. }
  207. .navbar-icon view {
  208. height: 18px;
  209. border-left: 0.5px solid rgba(0, 0, 0, 0.3);
  210. margin-top: 6px;
  211. }
  212. .navbar-loading {
  213. background: #fff;
  214. text-align: center;
  215. }
  216. .search-input {
  217. width: 100%;
  218. height: 90rpx;
  219. padding: 20rpx 24rpx 0rpx 24rpx;
  220. box-sizing: border-box;
  221. .gosearch-btn {
  222. width: 632rpx;
  223. height: 100%;
  224. padding: 5rpx;
  225. border-radius: 40rpx;
  226. background: #f0f0f0;
  227. color: #8a8a8a;
  228. background: #ffffff;
  229. position: relative;
  230. box-sizing: border-box;
  231. padding-left: 80rpx;
  232. border: 1px solid #ff5b00;
  233. float: left;
  234. .search-icon {
  235. width: 80rpx;
  236. height: 56rpx;
  237. position: absolute;
  238. left: 0;
  239. top: 9rpx;
  240. text-align: center;
  241. line-height: 56rpx;
  242. .icon-iconfonticonfontsousuo1 {
  243. margin: 0 6rpx;
  244. font-size: $font-size-40;
  245. color: #8a8a8a;
  246. z-index: 10;
  247. }
  248. }
  249. .search-text {
  250. font-size: $font-size-24;
  251. line-height: 56rpx;
  252. color: #8a8a8a;
  253. float: left;
  254. }
  255. .search-btn {
  256. width: 120rpx;
  257. height: 58rpx;
  258. border-radius: 30rpx;
  259. background-color: #ff5b00;
  260. line-height: 58rpx;
  261. text-align: center;
  262. font-size: $font-size-28;
  263. color: #ffffff;
  264. float: right;
  265. }
  266. }
  267. .gosearch-kf {
  268. width: 70rpx;
  269. height: 70rpx;
  270. border-radius: 50%;
  271. float: left;
  272. line-height: 70rpx;
  273. text-align: center;
  274. .contact-btn {
  275. width: 70rpx;
  276. height: 70rpx;
  277. background-color: rgba(0, 0, 0, 0);
  278. line-height: 70rpx;
  279. text-align: center;
  280. .iconfont {
  281. font-size: $font-size-48;
  282. color: #ff5b00;
  283. }
  284. }
  285. }
  286. }
  287. .swiper-banner-nav {
  288. width: 100%;
  289. height: 80rpx;
  290. box-sizing: border-box;
  291. padding: 15rpx 76rpx 15rpx 24rpx;
  292. overflow: hidden;
  293. display: flex;
  294. align-items: center;
  295. position: relative;
  296. .swiper-nav-icon {
  297. width: 76rpx;
  298. height: 80rpx;
  299. line-height: 80rpx;
  300. text-align: center;
  301. position: absolute;
  302. right: 0;
  303. top: 0;
  304. .iconfont {
  305. font-size: $font-size-28;
  306. color: #666666;
  307. }
  308. }
  309. .scroll-view_H {
  310. white-space: nowrap;
  311. width: 100%;
  312. .tui-goods__item {
  313. display: inline-block;
  314. margin: 0 10rpx;
  315. height: 50rpx;
  316. line-height: 50rpx;
  317. font-size: $font-size-26;
  318. color: #333333;
  319. text-align: center;
  320. &.active {
  321. color: #ff5b00;
  322. font-weight: bold;
  323. position: relative;
  324. &::before {
  325. content: '';
  326. width: 20rpx;
  327. height: 4rpx;
  328. border-radius: 2rpx;
  329. background: #ff5b00;
  330. position: absolute;
  331. bottom: 0;
  332. left: 50%;
  333. margin-left: -10rpx;
  334. }
  335. }
  336. }
  337. }
  338. }
  339. .tui-seizeaseat-24 {
  340. width: 100%;
  341. height: auto;
  342. box-sizing: border-box;
  343. padding: 24rpx;
  344. .tui-drop-item {
  345. padding: 0 20rpx;
  346. height: 56rpx;
  347. float: left;
  348. line-height: 56rpx;
  349. background: #f5f5f5;
  350. font-size: 24rpx;
  351. margin: 12rpx 8rpx;
  352. text-align: center;
  353. border: 1px solid #f5f5f5;
  354. color: #666666;
  355. border-radius: 28rpx;
  356. &.active {
  357. background: #ffffff;
  358. border-color: #ff5b00;
  359. color: #ff5b00;
  360. }
  361. }
  362. }
  363. </style>