InvoiceInfo.vue 5.8 KB

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