RemarkDialog.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <el-dialog v-model="dialogVisible" title="订单备注" width="500px">
  3. <div style="margin-bottom:10px; font-size:13px; color:#909399;">
  4. <span v-if="order">订单号:{{ order.orderNo }}</span>
  5. </div>
  6. <el-input
  7. v-model="remarkForm"
  8. type="textarea"
  9. :rows="5"
  10. placeholder="请输入订单备注信息..."
  11. />
  12. <template #footer>
  13. <span class="dialog-footer">
  14. <el-button @click="dialogVisible = false">取消</el-button>
  15. <el-button type="primary" @click="handleSubmit">保存备注</el-button>
  16. </span>
  17. </template>
  18. </el-dialog>
  19. </template>
  20. <script setup>
  21. import { ref, computed, watch } from 'vue'
  22. const props = defineProps({
  23. visible: Boolean,
  24. order: Object
  25. })
  26. const emit = defineEmits(['update:visible', 'submit'])
  27. const dialogVisible = computed({
  28. get: () => props.visible,
  29. set: (val) => emit('update:visible', val)
  30. })
  31. const remarkForm = ref('')
  32. watch(() => props.visible, (val) => {
  33. if (val && props.order) {
  34. remarkForm.value = props.order.remark || ''
  35. }
  36. })
  37. const handleSubmit = () => {
  38. emit('submit', remarkForm.value)
  39. dialogVisible.value = false
  40. }
  41. </script>