DetailsInvoice.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <!-- 回款计划 -->
  3. <div class="invoice-container">
  4. <el-row class="mb10">
  5. <el-col class="text-right" :span="24">
  6. <el-button icon="el-icon-plus" size="mini" type="primary" @click="$refs.invoice.init()">新建发票</el-button>
  7. </el-col>
  8. </el-row>
  9. <el-table border :data="invoiceData" height="calc(100% - 50px)">
  10. <el-table-column
  11. v-for="(item, index) in columns"
  12. :key="index"
  13. align="center"
  14. :label="item.label"
  15. :min-width="item.width"
  16. :prop="item.prop"
  17. show-overflow-tooltip>
  18. <template #default="{ row }">
  19. <span v-if="item.prop == 'invoiceType'">
  20. {{ invoiceTypeData.filter((item) => item.key == row.invoiceType)[0].value || '-' }}
  21. </span>
  22. <span v-else-if="item.prop == 'approStatus'">
  23. {{ row.approStatus == '10' ? '未通过' : '已通过' }}
  24. </span>
  25. <span v-else-if="item.prop == 'contractAmount'">
  26. {{ formatPrice(row.contractAmount) }}
  27. </span>
  28. <span v-else-if="item.prop == 'invoiceAmount'">
  29. {{ formatPrice(row.invoiceAmount) }}
  30. </span>
  31. <span v-else>{{ row[item.prop] }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column align="center" label="操作">
  35. <template slot-scope="scope">
  36. <el-button type="text" @click="$refs.invoicing.init(scope.row.id)">通过</el-button>
  37. </template>
  38. </el-table-column>
  39. </el-table>
  40. <edit-invoice ref="invoice" :details="details" :invoice-type-data="invoiceTypeData" @invoiceSave="getInvoiceList" />
  41. <invoicing ref="invoicing" @invoiceSave="getInvoiceList" />
  42. </div>
  43. </template>
  44. <script>
  45. import to from 'await-to-js'
  46. import invoiceApi from '@/api/contract/invoice'
  47. import EditInvoice from './EditInvoice'
  48. import Invoicing from './Invoicing'
  49. export default {
  50. name: 'DetailsInvoice',
  51. components: { EditInvoice, Invoicing },
  52. props: {
  53. details: {
  54. type: Object,
  55. default: () => {},
  56. },
  57. },
  58. data() {
  59. return {
  60. invoiceData: [],
  61. invoiceTypeData: [], //发票类型
  62. columns: [
  63. {
  64. label: '客户名称',
  65. width: 'auto',
  66. prop: 'custName',
  67. },
  68. {
  69. label: '合同编号',
  70. width: '100px',
  71. prop: 'contractCode',
  72. },
  73. {
  74. label: '合同金额',
  75. width: '100px',
  76. prop: 'contractAmount',
  77. },
  78. {
  79. label: '开票金额(元)',
  80. width: '120px',
  81. prop: 'invoiceAmount',
  82. },
  83. {
  84. label: '开票日期',
  85. width: '100px',
  86. prop: 'invoiceDate',
  87. },
  88. {
  89. label: '实际开票日期',
  90. width: '100px',
  91. prop: 'actualInvoiceDate',
  92. },
  93. {
  94. label: '开票类型',
  95. width: '100px',
  96. prop: 'invoiceType',
  97. },
  98. {
  99. label: '发票号码',
  100. width: '100px',
  101. prop: 'invoiceCode',
  102. },
  103. {
  104. label: '快递单号',
  105. width: '100px',
  106. prop: 'courierCode',
  107. },
  108. {
  109. label: '审核状态',
  110. width: '100px',
  111. prop: 'approStatus',
  112. },
  113. {
  114. label: '备注',
  115. width: '100px',
  116. prop: 'remark',
  117. },
  118. ],
  119. }
  120. },
  121. mounted() {
  122. this.getOptions()
  123. this.getInvoiceList()
  124. },
  125. methods: {
  126. getOptions() {
  127. Promise.all([this.getDicts('invoice_type')])
  128. .then(([invoiceType]) => {
  129. this.invoiceTypeData = invoiceType.data.values || []
  130. })
  131. .catch((err) => console.log(err))
  132. },
  133. async getInvoiceList() {
  134. let params = { contractId: this.details.id, pageNum: 0 }
  135. const [err, res] = await to(invoiceApi.getList(params))
  136. if (err) return
  137. this.invoiceData = res.data.list
  138. },
  139. },
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .invoice-container {
  144. height: 100%;
  145. .mb10 {
  146. margin-bottom: 10px;
  147. }
  148. .collection {
  149. height: 100%;
  150. .el-row {
  151. height: 30px;
  152. }
  153. }
  154. .text-right {
  155. text-align: right;
  156. }
  157. }
  158. </style>