footer-bar.vue 2.2 KB

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