invoiceDetail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="invoice-detail">
  3. <view class="block-item flex-center">
  4. <view>
  5. <view>
  6. {{'增值税普通发票'}}
  7. <view class="circle">
  8. <view></view>
  9. </view>
  10. </view>
  11. <view>{{order.receiptPrice | unitPrice('¥')}}</view>
  12. </view>
  13. </view>
  14. <view class="common-msg flex-center">
  15. <view>
  16. <view>抬头类型</view>
  17. <view>{{order.receiptTitle}}</view>
  18. </view>
  19. <view>
  20. <view>发票状态</view>
  21. <view class="invoice_status">{{order.receiptStatus === 1?'已开具':'暂未开具'}}</view>
  22. </view>
  23. </view>
  24. <u-cell-group :border="false">
  25. <u-cell-item title="发票类型" :border-top="false" :value="'增值税普通发票'" :arrow="false"></u-cell-item>
  26. <u-cell-item title="发票内容" :value="order.receiptContent" :arrow="false"></u-cell-item>
  27. <u-cell-item title="发票抬头" :value="order.receiptTitle" :arrow="false"></u-cell-item>
  28. <u-cell-item title="纳税人识别号" v-if="order.taxpayerId" :value="order.taxpayerId" :arrow="false"></u-cell-item>
  29. </u-cell-group>
  30. <!-- <u-cell-group :border="false" style="margin-top: 20rpx;">
  31. <u-cell-item title="订单状态" :border-top="false" :value="order.order_status_text" :arrow="false"></u-cell-item>
  32. <u-cell-item title="订单编号" :value="order.sn" :arrow="false"></u-cell-item>
  33. </u-cell-group> -->
  34. <!-- <view class="show-pic" @click="preview">
  35. <text>点击预览发票</text>
  36. </view>
  37. <button class="btn" @click="download">下载电子发票</button>
  38. <view class="block-2-view" v-for="(item,index) in order.elec_file_list" :key="index">
  39. <u-image width="300" height="150" :src="item"></u-image>
  40. </view> -->
  41. </view>
  42. </template>
  43. <script>
  44. import { getReceiptDetail } from "@/api/order.js";
  45. export default {
  46. data() {
  47. return {
  48. order: {},
  49. order: {},
  50. title_type: "",
  51. };
  52. },
  53. onLoad(options) {
  54. this.loadData(options.id);
  55. },
  56. methods: {
  57. loadData(id) {
  58. getReceiptDetail(id).then((res) => {
  59. let order = res.data.result;
  60. this.order = order;
  61. });
  62. },
  63. /**
  64. * 点击图片放大或保存
  65. */
  66. preview() {
  67. //预览发票
  68. if (this.order.elec_file_list.length) {
  69. uni.previewImage({
  70. current: 0,
  71. urls: this.order.elec_file_list,
  72. longPressActions: {
  73. itemList: ["发送给朋友", "保存图片", "收藏"],
  74. success: function (data) {},
  75. fail: function (err) {},
  76. },
  77. });
  78. } else {
  79. this.$api.msg("暂无发票可预览");
  80. }
  81. },
  82. download() {
  83. //下载发票
  84. let _this = this;
  85. if (this.order.elec_file_list.length) {
  86. this.order.elec_file_list.forEach((item) => {
  87. uni.downloadFile({
  88. url: item,
  89. success: (res) => {
  90. if (res.statusCode === 200) {
  91. let tempFilePath = res.tempFilePath;
  92. uni.saveFile({
  93. tempFilePath: tempFilePath,
  94. success: function (res) {
  95. _this.$api.msg("发票已下载到" + res.savedFilePath);
  96. },
  97. });
  98. }
  99. },
  100. });
  101. });
  102. } else {
  103. this.$api.msg("暂无发票可下载");
  104. }
  105. },
  106. },
  107. };
  108. </script>
  109. <style lang="scss" scoped>
  110. .block-item {
  111. height: 217rpx;
  112. width: 100%;
  113. position: relative;
  114. > view {
  115. color: #ff6262;
  116. }
  117. > view:first-child {
  118. text-align: center;
  119. line-height: 3em;
  120. > view:first-child {
  121. position: relative;
  122. .circle {
  123. width: 166rpx;
  124. height: 65rpx;
  125. border: 1px solid #ff6262;
  126. border-radius: 100%;
  127. position: absolute;
  128. top: 0;
  129. right: 0;
  130. left: 0;
  131. bottom: 0;
  132. margin: auto;
  133. view {
  134. width: 130rpx;
  135. height: 40rpx;
  136. border: 1px solid #ff6262;
  137. border-radius: 100%;
  138. top: 0;
  139. right: 0;
  140. left: 0;
  141. bottom: 0;
  142. margin: auto;
  143. position: absolute;
  144. }
  145. }
  146. }
  147. > view:last-child {
  148. font-size: 40rpx;
  149. }
  150. }
  151. }
  152. .common-msg {
  153. flex-direction: row;
  154. padding: 20rpx;
  155. height: 118rpx;
  156. background-color: #ffffff;
  157. margin-bottom: 20rpx;
  158. > view {
  159. width: 50%;
  160. text-align: center;
  161. color: #666666;
  162. line-height: 1.5em;
  163. view {
  164. font-size: 24rpx;
  165. }
  166. .invoice_status {
  167. color: #ff6262;
  168. }
  169. }
  170. > view:first-child {
  171. border-right: 1px solid #eee;
  172. }
  173. }
  174. .show-pic {
  175. text-align: center;
  176. margin-top: 40rpx;
  177. image {
  178. width: 27rpx;
  179. height: 27rpx;
  180. margin-right: 10rpx;
  181. vertical-align: middle;
  182. }
  183. text {
  184. color: $main-color;
  185. font-size: $font-sm;
  186. }
  187. }
  188. .btn {
  189. font-size: 34rpx;
  190. margin: 60rpx 20rpx;
  191. &::after {
  192. border: none;
  193. }
  194. }
  195. .u-cell {
  196. padding: 35rpx 20rpx;
  197. height: 110rpx;
  198. color: #333333;
  199. }
  200. </style>