customer.vue 12 KB

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