customer.vue 12 KB

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