index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="bottom">
  3. <view class="bottom-top-div" v-if="showShyj">
  4. <up-table style="margin: 0 !important;width: 100% !important;height: 100rpx !important;">
  5. <up-tr style="height: 100%;">
  6. <up-th style="background-color: #e6e6e6 !important;color: #333333;padding: 0 32rpx;align-items: center;border: none !important;">{{ shyjTitle }}</up-th>
  7. <Td style="height: 100%;border: 1px solid #e6e6e6 !important;"><SsInput :placeholder="shyjPlaceholder" v-model="reason" @input="handleShyjInput"/></Td>
  8. </up-tr>
  9. </up-table>
  10. </view>
  11. <view class="bottom-button-div" :style="showShyj ? '' : 'border-top: 1rpx solid #e6e6e6;'">
  12. <template v-for="(button, index) in buttons" :key="index">
  13. <view
  14. class="bottom-button"
  15. @click="handleButtonClick(button, index)"
  16. >
  17. {{ button.text }}
  18. </view>
  19. <!-- 分割线,最后一个按钮不显示 -->
  20. <view v-if="index < buttons.length - 1" class="button-divider"></view>
  21. </template>
  22. </view>
  23. </view>
  24. </template>
  25. <script setup>
  26. import { ref } from 'vue'
  27. import SsInput from '@/components/SsInput/index.vue'
  28. import Td from '@/components/Td/index.vue'
  29. const reason = ref('')
  30. const props = defineProps({
  31. // 是否显示审核意见
  32. showShyj: {
  33. type: Boolean,
  34. default: false
  35. },
  36. // 审核意见标题
  37. shyjTitle: {
  38. type: String,
  39. default: '审核意见'
  40. },
  41. // 审核意见占位符
  42. shyjPlaceholder: {
  43. type: String,
  44. default: '请输入审核意见'
  45. },
  46. // 按钮配置
  47. buttons: {
  48. type: Array,
  49. default: () => [
  50. { text: '取消', action: 'cancel', },
  51. { text: '保存并提交', action: 'submit', }
  52. ]
  53. }
  54. })
  55. const emit = defineEmits(['button-click', 'update:shyjValue'])
  56. // 处理按钮点击
  57. const handleButtonClick = (button, index) => {
  58. emit('button-click', {
  59. action: button.action,
  60. button: button,
  61. index: index,
  62. shyjValue: reason.value // 传递审核意见
  63. })
  64. }
  65. // 监听审核意见变化
  66. const handleShyjInput = (value) => {
  67. emit('update:shyjValue', value)
  68. }
  69. </script>
  70. <style scoped lang="scss">
  71. .bottom {
  72. position: fixed;
  73. bottom: 0;
  74. left: 0;
  75. width: 100%;
  76. z-index: 999;
  77. }
  78. .bottom-button-div{
  79. display: flex;
  80. justify-content: space-between;
  81. align-items: center;
  82. background-color: #fff;
  83. height: 100rpx;
  84. }
  85. .bottom-button{
  86. flex: 1;
  87. height: 100%;
  88. line-height: 100rpx;
  89. text-align: center;
  90. font-size: 32rpx;
  91. color: #333;
  92. background-color: #fafafb;
  93. }
  94. .button-divider {
  95. width: 1rpx;
  96. height: 80%;
  97. background-color: #e0e0e0;
  98. }
  99. .bottom-button:active{
  100. background-color: #585e6e;
  101. color: #fff;
  102. }
  103. </style>