RemarkDialog.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <el-dialog :model-value="visible" @update:model-value="updateVisible" title="订单备注" width="500px">
  3. <div style="margin-bottom:10px; font-size:13px; color:#909399;">
  4. <span v-if="data">订单号:{{ data.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="updateVisible(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, watch } from 'vue'
  22. import { ElMessage } from 'element-plus'
  23. const props = defineProps({
  24. visible: Boolean,
  25. data: Object
  26. })
  27. const emit = defineEmits(['update:visible', 'success'])
  28. const remarkForm = ref('')
  29. watch(() => props.visible, (val) => {
  30. if (val && props.data) {
  31. remarkForm.value = props.data.remark || ''
  32. }
  33. })
  34. const updateVisible = (val) => {
  35. emit('update:visible', val)
  36. }
  37. const handleSubmit = () => {
  38. if (props.data) {
  39. props.data.remark = remarkForm.value
  40. ElMessage.success('备注已更新')
  41. updateVisible(false)
  42. emit('success', remarkForm.value)
  43. }
  44. }
  45. </script>