invoiceDetails.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <!-- 发票详情 -->
  2. <template>
  3. <view class="details">
  4. <!-- 发票信息 -->
  5. <view class="details-invoice">
  6. <view class="details-invoice-title">发票信息</view>
  7. <view class="details-invoice-list">
  8. <view class="details-invoice-list-item">
  9. <view class="details-invoice-list-item-label">抬头类型:</view>
  10. <view class="details-invoice-list-item-content">{{ formatInvoiceType(invoiceInfo.invoType) }}</view>
  11. </view>
  12. <view class="details-invoice-list-item">
  13. <view class="details-invoice-list-item-label">抬头名称:</view>
  14. <view class="details-invoice-list-item-content">{{ invoiceInfo.invoName }}</view>
  15. </view>
  16. <view class="details-invoice-list-item" v-if="invoiceInfo.invoType === 1">
  17. <view class="details-invoice-list-item-label">企业税号:</view>
  18. <view class="details-invoice-list-item-content">{{ invoiceInfo.invoCode }}</view>
  19. </view>
  20. <view class="details-invoice-list-item">
  21. <view class="details-invoice-list-item-label">发票状态:</view>
  22. <view class="details-invoice-list-item-content" :class="formatStatusType(invoiceInfo.status)">{{ formatStatus(invoiceInfo.status) }}</view>
  23. </view>
  24. <view class="details-invoice-list-item">
  25. <view class="details-invoice-list-item-label">申请时间:</view>
  26. <view class="details-invoice-list-item-content">{{ invoiceInfo.askTime }}</view>
  27. </view>
  28. <view class="details-invoice-list-item">
  29. <view class="details-invoice-list-item-label">更多内容:</view>
  30. <view class="details-invoice-list-item-content view-text" @click="viewMore">查看</view>
  31. </view>
  32. <view class="details-invoice-list-item bottom-top view-btn">
  33. <text @click="viewPdf">查看电子发票</text>
  34. </view>
  35. </view>
  36. </view>
  37. <!-- 订单信息 -->
  38. <view class="details-order" v-if="invoiceInfo.orderInvoExes && invoiceInfo.orderInvoExes.length">
  39. <view class="details-order-title">订单信息:共{{ invoiceInfo.orderInvoExes.length }}个订单</view>
  40. <view class="details-order-list">
  41. <view class="details-order-list-item" v-for="(item, index) in invoiceInfo.orderInvoExes" :key="index">
  42. <view class="details-order-list-item-left">
  43. <view class="money">¥{{ item.amount }}</view>
  44. <view>{{ item.name || '-' }}</view>
  45. <view class="time">{{ item.payTime || '-' }}</view>
  46. </view>
  47. <view class="details-order-list-item-right">{{ item.vehicleNo || '-' }}</view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 查看更多弹框 -->
  52. <u-popup v-model="viewMorePop.show" mode="center" width="600" border-radius="14" :closeable="true">
  53. <view class="details-pop">
  54. <view class="details-pop-title">更多内容</view>
  55. <view class="details-pop-list">
  56. <view class="details-pop-list-item">
  57. <view class="details-pop-list-item-label">开户银行:</view>
  58. <view class="details-pop-list-item-content">{{ invoiceInfo.openBank }}</view>
  59. </view>
  60. <view class="details-pop-list-item">
  61. <view class="details-pop-list-item-label">银行账号:</view>
  62. <view class="details-pop-list-item-content">{{ invoiceInfo.numBank }}</view>
  63. </view>
  64. <view class="details-pop-list-item">
  65. <view class="details-pop-list-item-label">抬头地址:</view>
  66. <view class="details-pop-list-item-content">{{ invoiceInfo.mapCom }}</view>
  67. </view>
  68. <view class="details-pop-list-item">
  69. <view class="details-pop-list-item-label">企业电话:</view>
  70. <view class="details-pop-list-item-content">{{ invoiceInfo.phoneCom }}</view>
  71. </view>
  72. <view class="details-pop-list-item">
  73. <view class="details-pop-list-item-label">电子邮箱:</view>
  74. <view class="details-pop-list-item-content">{{ invoiceInfo.invoMail }}</view>
  75. </view>
  76. <view class="details-pop-list-item">
  77. <view class="details-pop-list-item-label">手机号码:</view>
  78. <view class="details-pop-list-item-content">{{ invoiceInfo.invoPhone }}</view>
  79. </view>
  80. </view>
  81. </view>
  82. </u-popup>
  83. </view>
  84. </template>
  85. <script>
  86. export default {
  87. data() {
  88. return {
  89. invoiceInfo: {},
  90. chooseRecords: {
  91. show: false,
  92. list: []
  93. },
  94. invoiceStatusList: [],
  95. viewMorePop: {
  96. show: false
  97. }
  98. };
  99. },
  100. onLoad(options) {
  101. const { id, orderType } = options;
  102. if (id) {
  103. this.getDict();
  104. this.getInvoiceDetails(id);
  105. }
  106. },
  107. methods: {
  108. /**
  109. * @description: 获取字典
  110. * @return {*}
  111. */
  112. async getDict() {
  113. // 发票类型
  114. const typeRes = await this.$u.api.getDictApi({ type: 'invoice_type' });
  115. if (typeRes.code === 200) {
  116. this.chooseRecords.list = typeRes.data;
  117. }
  118. // 开票状态
  119. const statusRes = await this.$u.api.getDictApi({ type: 'invoice_status' });
  120. if (statusRes.code === 200) {
  121. this.invoiceStatusList = statusRes.data;
  122. }
  123. },
  124. /**
  125. * @description: 获取发票详情
  126. * @param {*} id
  127. * @return {*}
  128. */
  129. async getInvoiceDetails(id) {
  130. const { code, data } = await this.$u.api.invoiceModuleApi.getInvoiceDetailsApi({ id });
  131. if (code === 200) {
  132. this.invoiceInfo = data;
  133. }
  134. },
  135. /**
  136. * @description: 预览图片
  137. * @param {*} url
  138. * @return {*}
  139. */
  140. previewImage(url) {
  141. uni.previewImage({
  142. urls: [url]
  143. });
  144. },
  145. viewPdf() {
  146. this.$u.route({
  147. url: '/pages/previewPdf/previewPdf',
  148. params: {
  149. fileUrl: this.invoiceInfo.fileUrl
  150. }
  151. });
  152. },
  153. viewMore() {
  154. this.viewMorePop.show = true;
  155. },
  156. /**
  157. * @description: 初始化状态
  158. * @param {*} val
  159. * @return {*}
  160. */
  161. formatStatus(val) {
  162. if (!val && val !== 0) return;
  163. if (this.invoiceStatusList.length) return this.invoiceStatusList.find((v) => Number(v.dictValue) === Number(val)).dictLabel;
  164. },
  165. /**
  166. * @description: 初始化状态按钮样式
  167. * @param {*} val
  168. * @return {*}
  169. */
  170. formatStatusType(val) {
  171. const statusTypeObj = {
  172. 0: 'info',
  173. 1: 'primary',
  174. 2: 'error'
  175. };
  176. return statusTypeObj[val];
  177. },
  178. /**
  179. * @description: 初始化发票类型
  180. * @param {*} val
  181. * @return {*}
  182. */
  183. formatInvoiceType(val) {
  184. if (!val) return;
  185. if (this.chooseRecords.list.length) return this.chooseRecords.list.find((item) => Number(item.dictValue) === Number(val)).dictLabel;
  186. }
  187. }
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. @import './invoiceDetails.scss';
  192. </style>