InvoiceInfo.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="invoice-info">
  3. <info-card title="开票概览">
  4. <div class="invoice-info-content">
  5. <div class="invoice-info-item">
  6. 开票状态:{{ getInvoiceStatus(orderDetail?.orderData?.invoiced_status) }}
  7. </div>
  8. <div class="invoice-info-item">
  9. 已开票金额:¥{{ formatNumber(invoiceData?.invoiceMoney || 0) }}
  10. </div>
  11. <div class="invoice-info-item">
  12. 未开票金额:¥{{ formatNumber(invoiceData?.remainingMoney || 0) }}
  13. </div>
  14. </div>
  15. </info-card>
  16. <info-card title="开票详情" :length="invoiceList.length || 0" :is-show-length="true">
  17. <div class="invoice-info-detail">
  18. <TableCard
  19. class="invoice-info-content-table"
  20. :table-data="invoiceList"
  21. :columns="invoiceColumns"
  22. width="1108px"
  23. >
  24. <template #code_url-header>
  25. <div class="column-label-cell">
  26. <div class="column-label-cell-title">开票二维码</div>
  27. <div class="column-label-cell-tip">支持客户换开或查看发票</div>
  28. </div>
  29. </template>
  30. <template v-slot:code_url="{ row }">
  31. <span class="column-cell" @click="getInvoiceInfo(row.row)">查看</span>
  32. </template>
  33. <template v-slot:invoice_money="{ row }">
  34. <span>¥{{ formatNumber(row.row.invoice_money) }}</span>
  35. </template>
  36. <template v-slot:invoice_status="{ row }">
  37. <span>{{ backInvoiceStatus(row.row.invoice_status) }}</span>
  38. </template>
  39. </TableCard>
  40. </div>
  41. </info-card>
  42. <new-set-order-info
  43. ref="invoiceRef"
  44. :show-content="4"
  45. :show-dialog="showInvoiceDialog"
  46. :orderInfo="orderData"
  47. title="开票二维码"
  48. @close="showInvoiceDialog = false"
  49. >
  50. <div style="display:flex;flex-direction:column;" slot="content">
  51. <span>订单编号:{{selectInvoice.invoice_order_code}}</span>
  52. <span>开票金额合计:{{selectInvoice.invoice_money / 100}}元</span>
  53. </div>
  54. </new-set-order-info>
  55. </div>
  56. </template>
  57. <script>
  58. import InfoCard from '../../ui/InfoCard.vue';
  59. import TableCard from '../../ui/TableCard.vue';
  60. import newSetOrderInfo from '../newSetOrderInfo.vue';
  61. export default {
  62. name: 'InvoiceInfo',
  63. components: {
  64. InfoCard,
  65. TableCard,
  66. newSetOrderInfo
  67. },
  68. props: {
  69. orderDetail: {
  70. type: Object,
  71. default: () => {
  72. return {}
  73. }
  74. }
  75. },
  76. data() {
  77. return {
  78. invoiceColumns: [
  79. { prop: 'invoice_number', label: '发票号', width: 160 },
  80. { prop: 'invoice_code', label: '发票代码', width: 160 },
  81. { prop: 'invoice_money', label: '关联订单开票金额', width: 160 },
  82. { prop: 'invoice_status', label: '发票状态', width: 120 },
  83. { prop: 'code_url', label: '开票二维码', width: 188 },
  84. { prop: 'operable_time', label: '操作时间', width: 160 },
  85. { prop: 'operator', label: '操作人', width: 160 }
  86. ],
  87. invoiceList: [{
  88. invoice_number: '20231231',
  89. invoice_code: '20231231',
  90. invoice_money: 100022.00,
  91. invoice_status: '已申请',
  92. code_url: '查看',
  93. operable_time: '2023-12-31 13:21:32',
  94. operator: '张三'
  95. }],
  96. invoiceData: {},
  97. invoiceSta: [
  98. {v: 0, n: '未开票'},
  99. {v: 2, n: '全额开票'},
  100. {v: 3, n: '部分开票'}
  101. ],
  102. showInvoiceDialog: false,
  103. selectInvoice: {},
  104. orderData: {}
  105. }
  106. },
  107. mounted() {
  108. this.invoiceData = this.orderDetail?.invoiceData || {}
  109. this.invoiceList = this.invoiceData?.invoiceInfo || []
  110. this.orderData = this.orderDetail?.orderData || {}
  111. },
  112. methods: {
  113. formatNumber(num, x = 2) {
  114. num = Number(num) || 0
  115. return (num / 100).toFixed(x)
  116. },
  117. backInvoiceStatus(val) {
  118. if (val == 0) {
  119. return '未申请'
  120. } else if (val == 1) {
  121. return '已申请'
  122. } else if (val == 2) {
  123. return '已开具'
  124. } else {
  125. return '未申请'
  126. }
  127. },
  128. getInvoiceStatus(val) {
  129. const item = this.invoiceSta.find(item => item.v === val) || {};
  130. return item.n || '-';
  131. },
  132. getInvoiceInfo(item) {
  133. this.selectInvoice = item
  134. this.$nextTick(() => {
  135. this.$refs.invoiceRef.QrCodeImage = item.code_url;
  136. });
  137. this.showInvoiceDialog = true;
  138. },
  139. },
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .invoice-info {
  144. .invoice-info-content {
  145. display: flex;
  146. align-items: center;
  147. .invoice-info-item {
  148. min-width: 255px;
  149. margin-right: 32px;
  150. font-size: 14px;
  151. line-height: 22px;
  152. color: $gray_10;
  153. }
  154. }
  155. // margin-top: 20px;
  156. .invoice-info-content-table {
  157. border-radius: 4px;
  158. ::v-deep {
  159. .cell {
  160. text-align: center;
  161. font-size: 14px;
  162. color: $gray_10;
  163. }
  164. .has-gutter {
  165. th {
  166. background: #F9FAFB;
  167. .cell {
  168. padding: 0;
  169. color: #686868;
  170. font-weight: 400;
  171. .column-label-cell-tip {
  172. color: #2ABED1;
  173. }
  174. }
  175. }
  176. }
  177. .column-cell {
  178. color: $color_main;
  179. cursor: pointer;
  180. }
  181. }
  182. }
  183. .num-active {
  184. color: $color_main;
  185. }
  186. }
  187. </style>