Invoicing.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!--
  2. * @Author: liuzl 461480418@qq.com
  3. * @Date: 2023-01-09 15:34:20
  4. * @LastEditors: liuzhenlin
  5. * @LastEditTime: 2023-01-10 10:03:40
  6. * @Description: file content
  7. * @FilePath: \订单全流程管理系统\src\views\contract\components\Invoicing.vue
  8. -->
  9. <template>
  10. <el-dialog :title="title" :visible.sync="editVisible" width="500px" @close="handleClose">
  11. <el-form ref="editForm" :model="editForm" :rules="editRules">
  12. <el-row :gutter="20">
  13. <el-col :span="24">
  14. <el-form-item label="发票号码" prop="invoiceCode">
  15. <el-input v-model="editForm.invoiceCode" placeholder="请输入发票号码" />
  16. </el-form-item>
  17. </el-col>
  18. </el-row>
  19. <el-row :gutter="20">
  20. <el-col :span="24">
  21. <el-form-item label="实际开票日期" prop="actualInvoiceDate">
  22. <el-date-picker
  23. v-model="editForm.actualInvoiceDate"
  24. placeholder="选择实际开票日期"
  25. style="width: 100%"
  26. type="date"
  27. value-format="yyyy-MM-dd" />
  28. </el-form-item>
  29. </el-col>
  30. </el-row>
  31. <el-row :gutter="20">
  32. <el-col :span="24">
  33. <el-form-item label="物流单号" prop="courierCode">
  34. <el-input v-model="editForm.courierCode" clearable placeholder="请输入物流单号" />
  35. </el-form-item>
  36. </el-col>
  37. </el-row>
  38. </el-form>
  39. <span slot="footer">
  40. <el-button type="primary" @click="invoiceSave">保存</el-button>
  41. <el-button @click="editVisible = false">取消</el-button>
  42. </span>
  43. </el-dialog>
  44. </template>
  45. <script>
  46. import to from 'await-to-js'
  47. import invoiceApi from '@/api/contract/invoice'
  48. export default {
  49. props: {
  50. details: {
  51. type: Object,
  52. default: () => {},
  53. },
  54. },
  55. data() {
  56. return {
  57. title: '新建发票',
  58. editVisible: false,
  59. editForm: {
  60. id: 0,
  61. approStatus: '20',
  62. actualInvoiceDate: '', //实际开票日期
  63. invoiceCode: '', //发票号码
  64. courierCode: '', //快递单号
  65. },
  66. editRules: {
  67. invoiceCode: [{ required: true, trigger: 'blur', message: '请输入发票号码' }],
  68. actualInvoiceDate: [{ required: true, trigger: 'change', message: '请选择实际开票日期' }],
  69. courierCode: [{ required: true, trigger: 'blur', message: '请输入快递单号' }],
  70. },
  71. }
  72. },
  73. mounted() {},
  74. methods: {
  75. async init(id) {
  76. this.title = '发票审核'
  77. this.editForm.id = id
  78. this.editVisible = true
  79. },
  80. // 审核通过
  81. async invoiceSave() {
  82. let params = { ...this.editForm }
  83. const [valid] = await to(this.$refs.editForm.validate())
  84. if (valid == false) return
  85. const [err, res] = await to(invoiceApi.updateInvoice(params))
  86. if (err) return
  87. if (res.code == 200) this.$message.success(res.msg)
  88. else return
  89. this.editVisible = false
  90. this.$emit('invoiceSave')
  91. },
  92. handleClose() {
  93. this.editForm = {
  94. id: 0,
  95. approStatus: '20',
  96. actualInvoiceDate: '', //实际开票日期
  97. invoiceCode: '', //发票号码
  98. courierCode: '', //快递单号
  99. }
  100. this.$refs.editForm.resetFields()
  101. },
  102. },
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .mb10 {
  107. margin-bottom: 10px;
  108. }
  109. .proj-col {
  110. text-align: right;
  111. }
  112. </style>