remarkModal.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. import { Message } from '@element-plus/icons-vue'
  4. import { updateOrderApi } from '@/api/model/order'
  5. const props = defineProps({
  6. orderId: {
  7. type: String,
  8. default: '',
  9. },
  10. })
  11. const visible = defineModel('visible', { type: Boolean, required: true })
  12. const product = defineModel('product', {
  13. type: Object,
  14. default: () => ({}),
  15. })
  16. function handleClose() {
  17. console.log('close')
  18. }
  19. function getFileTitle(file: string) {
  20. const fileArr = file.split('/')
  21. return fileArr[fileArr.length - 1]
  22. }
  23. async function onSave() {
  24. try {
  25. const params = {
  26. file: product.value.file,
  27. orderId: props.orderId,
  28. merchandiseId: product.value.merchandiseId,
  29. }
  30. await updateOrderApi(params)
  31. ElMessage.success('update success')
  32. visible.value = false
  33. }
  34. catch (error) {
  35. console.log(error)
  36. }
  37. }
  38. function del(i: number) {
  39. product.value.file = product.value.file.filter((item: any, index: number) => index !== i)
  40. console.log('product.value', product.value)
  41. }
  42. </script>
  43. <template>
  44. <el-dialog
  45. v-model="visible"
  46. :append-to-body="true"
  47. width="800"
  48. modal-class="custom-remark-modal"
  49. @close="handleClose"
  50. >
  51. <template #header>
  52. <div
  53. class="px-40px py-25px bg-#F5F5F5 b-rd-lt-6px b-rd-rt-6px text-18px fw-500 text-#333"
  54. >
  55. Remark
  56. </div>
  57. </template>
  58. <div class="py-24px px-40px">
  59. <div
  60. class="p-16px bg-#F7F8FA b-1px b-solid b-#E0E0E0 text-#333333 b-rd-4px"
  61. >
  62. {{ product?.remark }}
  63. </div>
  64. <div class="mt-28px">
  65. <div
  66. v-for="(items, index) in product?.file"
  67. :key="items.id"
  68. class="py-14px px-16px bg-#F7F8FA flex items-center justify-between mb-16px b-solid b-1px b-#E0E0E0 b-rd-4px"
  69. >
  70. <div class="flex items-center">
  71. <svgo-file
  72. class="!w-20px cursor-pointer !h-20px text-#333 mr-16px"
  73. />
  74. 附件{{ index }}: <a :href="items"> {{ getFileTitle(items) }}</a>
  75. </div>
  76. <div>
  77. <img
  78. src="@/assets/images/file_delete.png"
  79. class="!w-20px cursor-pointer !h-20px"
  80. alt=""
  81. srcset=""
  82. @click="del(index)"
  83. >
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <template #footer>
  89. <el-button
  90. class="!bg-#fff !text-#C58C64 !ml-0 mr-24px !w-110px !h-48px !text-14px !fw-500 !b-rd-6px"
  91. @click="visible = false"
  92. >
  93. Cancel
  94. </el-button>
  95. <el-button
  96. class="!bg-#C58C64 !text-#fff !ml-0 !w-110px !h-48px !text-14px !fw-500 !b-rd-6px"
  97. @click="onSave"
  98. >
  99. Save
  100. </el-button>
  101. </template>
  102. </el-dialog>
  103. </template>
  104. <style lang="less">
  105. .custom-remark-modal {
  106. .el-dialog {
  107. padding: unset !important;
  108. .el-dialog__header {
  109. padding: 0 !important;
  110. .el-dialog__headerbtn {
  111. right: 20px;
  112. top: 10px;
  113. }
  114. }
  115. .el-dialog__footer {
  116. padding-top: 0 !important;
  117. padding-bottom: 24px !important;
  118. padding-left: 40px !important;
  119. padding-right: 40px !important;
  120. }
  121. }
  122. }
  123. </style>