customer.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template name="headerNavbar">
  2. <!-- 自定义导航栏 -->
  3. <view>
  4. <view class="navbar-wrap" :class="isScroll ? opacityNav : ''" :style="{
  5. height: CustomBar + 72 + 'px',
  6. paddingTop: StatusBar + 'px'
  7. }">
  8. <view class="navbar-text" :style="{
  9. color: navbarData.textColor ? navbarData.textColor : '',
  10. lineHeight: CustomBar - ( StatusBar + 4 ) + 'px;',
  11. fontSize: fontSizeSetting + 'px;',
  12. paddingLeft: navbarData.textLeft ? '' : 12 + 'px'
  13. }" :class="platformClass">
  14. {{ navbarData.title ? navbarData.title : ' ' }}
  15. </view>
  16. <view class="search-input">
  17. <view class="gosearch-btn" @click="this.$api.navigateTo(clickPath)">
  18. <view class="search-icon"><text class="iconfont icon-iconfonticonfontsousuo1"></text></view>
  19. <view class="search-text">{{ hotSearchText }}</view>
  20. <view class="search-btn">搜索</view>
  21. </view>
  22. <view class="gosearch-kf">
  23. <!-- #ifdef MP-WEIXIN -->
  24. <button class="contact-btn" open-type="contact" @bindcontact="handleContact">
  25. <text class="iconfont icon-zixunrexian"></text>
  26. </button>
  27. <!-- #endif -->
  28. </view>
  29. </view>
  30. <view class="swiper-banner-nav">
  31. <scroll-view class="scroll-view_H" scroll-x="true">
  32. <view class="tui-goods__item active">首页</view>
  33. <view class="tui-goods__item" v-for="(navs, index) in navBarsList"
  34. :key="index"
  35. @click="NavToDetailPage(navs,index)">
  36. {{ navs.name }}
  37. </view>
  38. </scroll-view>
  39. <view class="swiper-nav-icon" @click="showDropScreenShow">
  40. <text class="iconfont"
  41. :class="dropScreenShow ? 'icon-xiangshangjiantou':'icon-xiangxiajiantou'"></text>
  42. </view>
  43. </view>
  44. </view>
  45. <!--顶部下拉筛选弹层 属性-->
  46. <tui-top-dropdown backgroundColor="#FFFFFF" :show="dropScreenShow" :height="310" :paddingbtm="10"
  47. :translatey="dropScreenH" @close="btnCloseDrop">
  48. <scroll-view class="tui-scroll-box" scroll-y :scroll-top="scrollTop">
  49. <view class="tui-seizeaseat-24">
  50. <view class="tui-drop-item tui-icon-middle">全部分类</view>
  51. <view class="tui-drop-item tui-icon-middle active">首页</view>
  52. <view class="tui-drop-item tui-icon-middle" v-for="(item, index) in navBarsList" :key="index"
  53. @tap.stop="NavToDetailPage(item,index)" :data-index="index">
  54. {{ item.name }}
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </tui-top-dropdown>
  59. </view>
  60. </template>
  61. <script>
  62. var self
  63. import btSearch from '@/components/uni-search/bt-search.vue'
  64. export default {
  65. name: 'headerNavbar',
  66. components: {
  67. btSearch
  68. },
  69. props: {
  70. navbarData: {
  71. // 由父页面传递的数据
  72. type: Object
  73. },
  74. navBarsList: {
  75. type: Array
  76. },
  77. isScroll: {
  78. type: Boolean,
  79. default: () => false
  80. }
  81. },
  82. data() {
  83. return {
  84. clickPath: '/pages/search/search',
  85. hotSearchText: '搜索商品/项目仪器',
  86. CustomBar: this.CustomBar, // 顶部导航栏高度
  87. StatusBar: this.StatusBar,
  88. fontSizeSetting: this.fontSizeSetting,
  89. screenWidth: this.screenWidth,
  90. capsule: this.capsule,
  91. platformClass: this.platformClass,
  92. opacityNav: 'opacityNav', // 渐变颜色
  93. height: 64, //header高度
  94. scrollTop: 0,
  95. dropScreenH: this.CustomBar + 78, //下拉筛选框距顶部距离
  96. dropScreenShow: false,
  97. animationData: {}
  98. }
  99. },
  100. created() {
  101. if (getCurrentPages().length === 1) {
  102. // 当只有一个页面时
  103. this.navbarData.haveBack = false
  104. } else {
  105. this.navbarData.haveBack = true
  106. }
  107. let obj = {}
  108. // #ifdef MP-WEIXIN
  109. obj = wx.getMenuButtonBoundingClientRect()
  110. // #endif
  111. uni.getSystemInfo({
  112. success: res => {
  113. this.height = obj.top ? obj.top + obj.height + 8 : res.statusBarHeight + 44
  114. //略小,避免误差带来的影响
  115. this.dropScreenH = (this.height * 750) / res.windowWidth + 148
  116. }
  117. })
  118. console.log('dropScreenH', this.dropScreenH)
  119. },
  120. onLoad() {},
  121. onPageScroll(e) {
  122. console.log(e)
  123. },
  124. methods: {
  125. BackPage: function() {
  126. this.$emit('navigateBack')
  127. },
  128. _goSearchPath: function() {
  129. this.$emit('goSearchPath')
  130. },
  131. _goHome: function() {
  132. uni.switchTab({
  133. url: '/pages/tabBar/home/index'
  134. })
  135. },
  136. NavToDetailPage(item, index) { //跳转
  137. if (index === 3) {
  138. let linkPath = 'https://static.caimei365.com/app/caimei-activity-h5/html/2023/activity_02.html'
  139. this.$api.navigateTo(`/pages/h5/activity/activity?link=${linkPath}&linkId=382`)
  140. } else {
  141. /**
  142. * 页面跳转
  143. **/
  144. this.$api.FlooryNavigateTo(item)
  145. }
  146. },
  147. showDropScreenShow() {
  148. this.dropScreenShow = !this.dropScreenShow
  149. if (this.dropScreenShow) {
  150. // 禁止页面滚动
  151. uni.setScrollEnabled(false)
  152. } else {
  153. // 禁止页面滚动
  154. uni.setScrollEnabled(true)
  155. }
  156. },
  157. btnCloseDrop() {
  158. this.dropScreenShow = false
  159. },
  160. handleContact(e) {
  161. console.log(e.detail.path)
  162. console.log(e.detail.query)
  163. }
  164. },
  165. onShow() {}
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .navbar-wrap {
  170. position: fixed;
  171. width: 100%;
  172. top: 0;
  173. z-index: 9999;
  174. box-sizing: border-box;
  175. background: #ffffff url(https://static.caimei365.com/app/img/bg/home_cumres_bg@2x.png);
  176. background-size: cover;
  177. border-bottom: none;
  178. }
  179. .opacityNav {}
  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: 70rpx;
  219. padding: 0 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: $btn-confirm;
  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 20rpx;
  315. height: 50rpx;
  316. line-height: 50rpx;
  317. font-size: $font-size-24;
  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-scroll-box {
  340. height: 280rpx;
  341. overflow: hidden;
  342. }
  343. .tui-seizeaseat-24 {
  344. width: 100%;
  345. height: auto;
  346. box-sizing: border-box;
  347. padding: 24rpx;
  348. .tui-drop-item {
  349. padding: 0 20rpx;
  350. height: 56rpx;
  351. float: left;
  352. line-height: 56rpx;
  353. background: #f5f5f5;
  354. font-size: 24rpx;
  355. margin: 12rpx 8rpx;
  356. text-align: center;
  357. border: 1px solid #f5f5f5;
  358. color: #333333;
  359. border-radius: 28rpx;
  360. &.active {
  361. background: #ffffff;
  362. border-color: #ff5b00;
  363. color: #ff5b00;
  364. }
  365. }
  366. }
  367. </style>