invoiceDetail.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="container">
  3. <view class="content-body">
  4. <view class="x-f info-item">
  5. <view class="label">开票类型</view><text>{{info.billType==1 ? "个人/非企业单位" : "企业单位"}}</text>
  6. </view>
  7. <view class="x-f info-item">
  8. <view class="label">购方名称</view><text>{{info.payerName}}</text>
  9. </view>
  10. <view class="x-f info-item">
  11. <view class="label">购方税号</view><text>{{info.payerTaxNo}}</text>
  12. </view>
  13. <view class="x-f info-item">
  14. <view class="label">开票金额</view><text v-show="info.orderAmount!=null">{{info.orderAmount}}元</text>
  15. </view>
  16. <view class="x-f info-item">
  17. <view class="label">相关订单</view>
  18. <!-- <text>{{info.orderNo}}</text> -->
  19. <view class="lookbtn x-ac" v-if="info.orderId" @click="handleOrder">查看</view>
  20. </view>
  21. <view class="x-start info-item">
  22. <view class="label">开票时间</view><text>{{info.invoiceTime}}</text>
  23. </view>
  24. <view class="x-start info-item">
  25. <view class="label">开票状态</view>
  26. <text class="tag tag_error" v-if="info.redStatus == '01'">作废</text>
  27. <template v-else>
  28. <text class="tag" :class="tagColor(info)">{{statusOption(info)}}</text>
  29. </template>
  30. </view>
  31. <view class="x-start info-item" v-if="info.failCause">
  32. <view class="label">失败原因</view><text>{{info.failCause}}</text>
  33. </view>
  34. <view class="info-item" v-if="info.imgUrls">
  35. <view class="x-start">
  36. <view class="label">发票图片</view>
  37. <text class="content-title">{{info.invoiceKind}}</text>
  38. </view>
  39. <image class="img" :src="info.imgUrls" mode="widthFix" @click="previewImage"></image>
  40. </view>
  41. </view>
  42. <view class="btnbox x-ac">
  43. <button class="downbtn x-c" v-if="info.imgUrls" @click="downFile(info.imgUrls)">下载图片</button>
  44. <!-- <button class="downbtn x-c" v-if="info.pdfUrl" @click="downFile(info.pdfUrl)">下载PDF</button> -->
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import {billInfo} from "@/api/store.js"
  50. export default {
  51. data() {
  52. return {
  53. id: "",
  54. info: {},
  55. }
  56. },
  57. computed: {
  58. // 开票状态0未开始2 :开票完成( 最终状 态),
  59. // 其他状态分别为: 20:开票中; 21:开票成功签章中;22:开票失败;24: 开票成功签章失败;3:发票已作废 31: 发票作废中
  60. // 备注:22、24状态时,无需再查询,请确认开票失败原因以及签章失败原因; 注:请以该状态码区分发票状态
  61. tagColor() {
  62. return (item)=> {
  63. const tagColor = {
  64. 0: 'tag_info',
  65. 2: 'tag_success',
  66. 20: 'tag_info',
  67. 21: 'tag_info',
  68. 22: 'tag_error',
  69. 24: 'tag_error',
  70. 3: 'tag_error',
  71. 31: 'tag_error',
  72. }
  73. return item ? tagColor[item.status] || 'tag_info' : 'tag_info'
  74. }
  75. },
  76. statusOption() {
  77. return (item)=> {
  78. const status = {
  79. 0: '未开始',
  80. 2: '开票完成',
  81. 20: '开票中',
  82. 21: '开票成功签章中',
  83. 22: '开票失败',
  84. 24: '开票成功签章失败',
  85. 3: '发票已作废',
  86. 31: '发票作废中',
  87. }
  88. return item&&item.statusMsg ? item.status == 2 ? status[item.status] : item.statusMsg : status[item.status]
  89. }
  90. },
  91. },
  92. onLoad(option) {
  93. this.id= option.id
  94. this.getDetail()
  95. },
  96. methods: {
  97. previewImage() {
  98. uni.previewImage({
  99. urls: this.info.imgUrls.split(','),
  100. });
  101. },
  102. getDetail() {
  103. billInfo({id: this.id}).then(res=>{
  104. if(res.code == 200) {
  105. this.info = res.data
  106. } else {
  107. uni.showToast({
  108. title: res.msg,
  109. icon: "none"
  110. })
  111. }
  112. })
  113. },
  114. handleOrder() {
  115. uni.navigateTo({
  116. url: '/pages/store/storeOrderDetail?orderId='+this.info.orderId
  117. })
  118. },
  119. downFile(file) {
  120. uni.showLoading({
  121. title: "保存中..."
  122. })
  123. uni.downloadFile({
  124. url: file,
  125. fail: function(res) {
  126. uni.showModal({
  127. title: '提示',
  128. content: '保存失败',
  129. })
  130. uni.hideLoading();
  131. },
  132. success: function(res) {
  133. var tempFilePath = res.tempFilePath;
  134. uni.saveImageToPhotosAlbum({
  135. filePath: tempFilePath,
  136. success:()=> {
  137. uni.showToast({
  138. title: "保存成功",
  139. duration: 2000
  140. })
  141. },
  142. fail:()=>{
  143. console.log("保存失败");
  144. uni.showToast({
  145. title: "保存失败",
  146. duration: 2000,
  147. icon: "error"
  148. })
  149. uni.hideLoading();
  150. },
  151. complete: function() {
  152. uni.hideLoading();
  153. }
  154. })
  155. },
  156. })
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .container {
  163. padding: 24rpx;
  164. }
  165. .content-body {
  166. padding: 24rpx;
  167. border-radius: 16rpx;
  168. background-color: #fff;
  169. font-family: PingFang SC, PingFang SC;
  170. font-weight: 400;
  171. font-size: 26rpx;
  172. word-break: break-all;
  173. .tag_info {
  174. color: #222222;
  175. }
  176. .tag_success {
  177. color: #67c23a;
  178. }
  179. .tag_error{
  180. color: #f56c6c;
  181. }
  182. }
  183. .lookbtn {
  184. min-width: 100rpx;
  185. padding: 4rpx 8rpx;
  186. // margin-left: 20rpx;
  187. box-sizing: border-box;
  188. background: #FFFFFF;
  189. border-radius: 66rpx;
  190. border: 2rpx solid #aaa;
  191. font-family: PingFang SC, PingFang SC;
  192. font-weight: 400;
  193. font-size: 22rpx;
  194. color: #aaa;
  195. }
  196. .img {
  197. margin-top: 20rpx;
  198. width: 100%;
  199. height: auto;
  200. }
  201. .btnbox {
  202. padding: 50rpx;
  203. }
  204. .info-item {
  205. padding: 16rpx 0;
  206. color: #222222;
  207. }
  208. .label {
  209. flex-shrink: 0;
  210. color: #9B9B9B;
  211. min-width: 160rpx;
  212. }
  213. .downbtn {
  214. width: 254rpx;
  215. height: 88rpx;
  216. border-radius: 44rpx 44rpx 44rpx 44rpx;
  217. border: 2rpx solid #FF5C03;
  218. font-family: PingFang SC, PingFang SC;
  219. font-weight: 400;
  220. font-size: 32rpx;
  221. color: #FF5C03;
  222. &::after {
  223. display: none;
  224. }
  225. }
  226. </style>