customer.vue 8.5 KB

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