invoiceDetails.vue 7.8 KB

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