goods-navbar.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="goods-navbar">
  3. <simple-safe-view>
  4. <view class="navbar">
  5. <view class="navbar-left">
  6. <view class="item" @click="$emit('leftClick', 0)">
  7. <!-- 首页 -->
  8. <view class="iconfont icon-fanhuishouye"></view>
  9. <view class="label">首页</view>
  10. </view>
  11. <button class="item contact" @click="$emit('leftClick', 1)" open-type="contact">
  12. <!-- 客服 -->
  13. <view class="iconfont icon-kefu"></view>
  14. <view class="label">客服</view>
  15. </button>
  16. <view class="item cart" @click="$emit('leftClick', 2)">
  17. <!-- 购物车 -->
  18. <view class="iconfont icon-gouwuche"></view>
  19. <view class="label">购物车</view>
  20. <view class="badge" v-text="kindCount" v-if="kindCount > 0"></view>
  21. </view>
  22. </view>
  23. <view class="navbar-right">
  24. <view class="control" @click="$emit('rightClick', 0)"><slot name="left"></slot></view>
  25. <view class="control" @click="$emit('rightClick', 1)"><slot name="right"></slot></view>
  26. </view>
  27. </view>
  28. </simple-safe-view>
  29. </view>
  30. </template>
  31. <script>
  32. import { mapGetters } from 'vuex'
  33. export default {
  34. name: 'goods-navbar',
  35. data() {
  36. return {}
  37. },
  38. computed: {
  39. ...mapGetters(['kindCount'])
  40. }
  41. }
  42. </script>
  43. <style lang="scss" scoped>
  44. .goods-navbar {
  45. @extend .fixed-bottom;
  46. background-color: #fff;
  47. border-top: 1rpx solid #efefef;
  48. .navbar {
  49. width: 100%;
  50. min-height: 100rpx;
  51. padding: 0 24rpx;
  52. box-sizing: border-box;
  53. @extend .cm-flex-between;
  54. .navbar-left {
  55. flex: 1;
  56. @extend .cm-flex-around;
  57. margin-right: 16rpx;
  58. .item {
  59. flex: 1;
  60. @extend .cm-flex-center;
  61. flex-direction: column;
  62. color: #333333;
  63. .iconfont {
  64. font-size: 36rpx;
  65. }
  66. .label {
  67. margin-top: 4rpx;
  68. font-size: 22rpx;
  69. }
  70. &.contact {
  71. margin: 0;
  72. padding: 0;
  73. line-height: inherit;
  74. background: #fff;
  75. &::after {
  76. display: none;
  77. }
  78. }
  79. &.cart {
  80. position: relative;
  81. .badge {
  82. top: -8rpx;
  83. right: 0;
  84. position: absolute;
  85. width: 36rpx;
  86. height: 36rpx;
  87. background-color: #ff457b;
  88. border-radius: 18rpx;
  89. @extend .cm-flex-center;
  90. font-size: 22rpx;
  91. color: #fff;
  92. }
  93. }
  94. }
  95. }
  96. .navbar-right {
  97. width: 420rpx;
  98. @extend .cm-flex-between;
  99. .control {
  100. width: 210rpx;
  101. height: 84rpx;
  102. &:first-child {
  103. @extend .cm-flex-center;
  104. flex-direction: column;
  105. border-radius: 40rpx 0 0 40rpx;
  106. background-color: #ffeff4;
  107. }
  108. &:last-child {
  109. @extend .cm-flex-center;
  110. flex-direction: column;
  111. border-radius: 0 40rpx 40rpx 0;
  112. background: linear-gradient(92deg, #fc32b4 0%, #f83c6c 100%);
  113. }
  114. }
  115. }
  116. }
  117. }
  118. </style>