巴青农资商城

OrderActionBar.vue 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view v-if="actions && actions.length" class="order-action-bar">
  3. <button
  4. v-for="action in actions"
  5. :key="action.code"
  6. class="order-action-bar__btn"
  7. :class="{ 'order-action-bar__btn--primary': isPrimary(action.code) }"
  8. :disabled="disabled"
  9. @click.stop="emit('action', action.code)"
  10. >
  11. {{ action.label }}
  12. </button>
  13. </view>
  14. </template>
  15. <script setup>
  16. import { ORDER_ACTION } from '@/constants/order'
  17. defineProps({
  18. actions: {
  19. type: Array,
  20. default: () => []
  21. },
  22. disabled: {
  23. type: Boolean,
  24. default: false
  25. }
  26. })
  27. const emit = defineEmits(['action'])
  28. function isPrimary(code) {
  29. return code === ORDER_ACTION.PAY || code === ORDER_ACTION.CONFIRM_RECEIVE
  30. }
  31. </script>
  32. <style lang="scss" scoped>
  33. .order-action-bar {
  34. display: flex;
  35. justify-content: flex-end;
  36. flex-wrap: wrap;
  37. gap: 16rpx;
  38. padding: 16rpx 0 0;
  39. }
  40. .order-action-bar__btn {
  41. margin: 0;
  42. min-width: 148rpx;
  43. height: 60rpx;
  44. line-height: 60rpx;
  45. padding: 0 24rpx;
  46. font-size: 26rpx;
  47. color: #333;
  48. background: #fff;
  49. border: 1rpx solid #ddd;
  50. border-radius: 30rpx;
  51. }
  52. .order-action-bar__btn--primary {
  53. color: #fff;
  54. background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
  55. border-color: transparent;
  56. }
  57. .order-action-bar__btn[disabled] {
  58. opacity: 0.5;
  59. }
  60. </style>