巴青农资商城

DetailBottomBar.vue 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <view class="bottom-bar">
  3. <view class="bottom-bar__shop" @click="emit('shop')">
  4. <u-icon name="home" size="22" color="#666" />
  5. <text class="bottom-bar__shop-text">店铺</text>
  6. </view>
  7. <view class="bottom-bar__actions">
  8. <button class="btn btn-cart" :disabled="disabled || busy" @click="emit('cart')">加入购物车</button>
  9. <button class="btn btn-buy" :disabled="disabled || busy" @click="emit('buy')">立即购买</button>
  10. </view>
  11. </view>
  12. </template>
  13. <script setup>
  14. defineProps({
  15. disabled: {
  16. type: Boolean,
  17. default: false
  18. },
  19. /** 提交中:防抖加锁,禁止重复点击 */
  20. busy: {
  21. type: Boolean,
  22. default: false
  23. }
  24. })
  25. const emit = defineEmits(['cart', 'buy', 'shop'])
  26. </script>
  27. <style lang="scss" scoped>
  28. .bottom-bar {
  29. position: fixed;
  30. left: 0;
  31. right: 0;
  32. bottom: 0;
  33. z-index: 100;
  34. display: flex;
  35. align-items: center;
  36. padding: 12rpx 24rpx;
  37. padding-bottom: calc(12rpx + env(safe-area-inset-bottom));
  38. background: #fff;
  39. box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.06);
  40. }
  41. .bottom-bar__shop {
  42. display: flex;
  43. flex-direction: column;
  44. align-items: center;
  45. width: 100rpx;
  46. flex-shrink: 0;
  47. }
  48. .bottom-bar__shop-text {
  49. margin-top: 4rpx;
  50. font-size: 22rpx;
  51. color: #666;
  52. }
  53. .bottom-bar__actions {
  54. flex: 1;
  55. display: flex;
  56. margin-left: 16rpx;
  57. gap: 16rpx;
  58. }
  59. .btn {
  60. flex: 1;
  61. height: 80rpx;
  62. line-height: 80rpx;
  63. margin: 0;
  64. padding: 0;
  65. font-size: 28rpx;
  66. border-radius: 40rpx;
  67. border: none;
  68. }
  69. .btn-cart {
  70. background: #fff5e6;
  71. color: #ff6f00;
  72. }
  73. .btn-cart[disabled] {
  74. opacity: 0.5;
  75. }
  76. .btn-buy {
  77. background: linear-gradient(90deg, #2e7d32, #4caf50);
  78. color: #fff;
  79. }
  80. .btn-buy[disabled] {
  81. opacity: 0.5;
  82. }
  83. </style>