edit-order.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <script setup lang="ts">
  2. import { computed, ref, unref, watchEffect } from "vue";
  3. import BasicDescriptions from "/@/components/BasicDescriptions";
  4. import { order_detail_columns } from "./columns";
  5. const visible = ref(false);
  6. const data = ref<Record<string, string>>({});
  7. const emit = defineEmits(["save-btn-click"]);
  8. const total = ref(0);
  9. const inv_fee = ref(0);
  10. function handleSave() {
  11. visible.value = false;
  12. emit("save-btn-click", {
  13. row: unref(data),
  14. inv_fee: unref(inv_fee),
  15. num: unref(total)
  16. });
  17. }
  18. const totalNum = computed(() => {
  19. const { winv_num } = data.value as any;
  20. return winv_num;
  21. });
  22. watchEffect(() => {
  23. total.value = totalNum.value;
  24. });
  25. defineExpose({
  26. onDisplay({ row: _data }) {
  27. visible.value = true;
  28. data.value = _data;
  29. inv_fee.value = data.value.winv_fee as any;
  30. }
  31. });
  32. </script>
  33. <template>
  34. <el-dialog
  35. v-model="visible"
  36. title="编辑销售订单"
  37. center
  38. width="1040px"
  39. :close-on-click-modal="false"
  40. >
  41. <BasicDescriptions
  42. :data="data"
  43. :col-number="2"
  44. :columns="order_detail_columns"
  45. >
  46. <template #custom>
  47. <el-row>
  48. <div class="col-item" style="width: 247px">
  49. <p class="col-label">开票数量</p>
  50. <p class="col-value">
  51. <el-input-number
  52. size="small"
  53. placeholder="开票数量"
  54. :min="0.1"
  55. style="width: 100%"
  56. :max="totalNum"
  57. v-model="total"
  58. />
  59. </p>
  60. </div>
  61. <div class="col-item" style="width: 248px">
  62. <p class="col-label">开票金额</p>
  63. <p class="col-value">
  64. <el-input-number
  65. placeholder="开票金额"
  66. :precision="2"
  67. :min="0.1"
  68. size="small"
  69. style="width: 100%"
  70. v-model="inv_fee"
  71. />
  72. </p>
  73. </div>
  74. </el-row>
  75. </template>
  76. </BasicDescriptions>
  77. <div flex w-full justify-end mt-2>
  78. <el-button size="small" type="primary" @click="handleSave"
  79. >保存</el-button
  80. >
  81. </div>
  82. </el-dialog>
  83. </template>