footer-bar.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <view class="footer-bar safe-area-inset-bottom">
  3. <view class="icons-area">
  4. <view class="icon-item">
  5. <image src="/pages-sell/static/goods/icon-home.png" class="bar-icon" mode="widthFix" style="width: 36rpx;"></image>
  6. <text>首页</text>
  7. </view>
  8. <view class="icon-item">
  9. <image src="/pages-sell/static/goods/icon-star.png" class="bar-icon" mode="aspectFit"></image>
  10. <text>收藏</text>
  11. </view>
  12. <view class="icon-item">
  13. <image src="/pages-sell/static/goods/icon-car.png" class="bar-icon" mode="aspectFit"></image>
  14. <text>购物车</text>
  15. </view>
  16. </view>
  17. <view class="action-btn-area">
  18. <view v-if="hasStock" class="action-btn in-stock" @click="onAddCart">
  19. <text>加入购物车</text>
  20. </view>
  21. <view v-else class="action-btn no-stock" @click="onNotify">
  22. <text>到货通知</text>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. name: 'FooterBar',
  30. props: {
  31. hasStock: {
  32. type: Boolean,
  33. default: true
  34. }
  35. },
  36. methods: {
  37. onAddCart() {
  38. this.$emit('addCart');
  39. },
  40. onNotify() {
  41. this.$emit('notify');
  42. }
  43. }
  44. }
  45. </script>
  46. <style lang="scss" scoped>
  47. .footer-bar {
  48. position: fixed;
  49. bottom: 0;
  50. left: 0;
  51. width: 100%;
  52. height: 200rpx;
  53. background: #fff;
  54. display: flex;
  55. align-items: center;
  56. justify-content: space-between;
  57. padding: 0 20rpx;
  58. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  59. z-index: 100;
  60. padding-bottom: env(safe-area-inset-bottom);
  61. .icons-area {
  62. display: flex;
  63. margin-right: 20rpx;
  64. .icon-item {
  65. display: flex;
  66. flex-direction: column;
  67. align-items: center;
  68. justify-content: center;
  69. width: 80rpx;
  70. margin-right: 10rpx;
  71. .bar-icon {
  72. width: 40rpx;
  73. height: 40rpx;
  74. margin-bottom: 6rpx;
  75. }
  76. text {
  77. font-size: 20rpx;
  78. color: #666;
  79. text-align: center;
  80. }
  81. }
  82. }
  83. .action-btn-area {
  84. flex: 1;
  85. display: flex;
  86. height: 80rpx;
  87. max-width: 360rpx;
  88. .action-btn {
  89. flex: 1;
  90. display: flex;
  91. align-items: center;
  92. justify-content: center;
  93. border-radius: 40rpx;
  94. font-size: 30rpx;
  95. color: #fff;
  96. font-weight: bold;
  97. background: linear-gradient(0deg, #38C248 0%, #5FEA6F 100%);
  98. }
  99. }
  100. }
  101. </style>