detail.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <div class="enterPriseBillDetail">
  3. <div class="detailBody">
  4. <ul class="detailUl">
  5. <li class="detailLi">
  6. <span class="liName">企业名称</span>
  7. <span class="liInfo">{{form.companyName}}</span>
  8. </li>
  9. <li class="detailLi">
  10. <span class="liName">账单名称</span>
  11. <span class="liInfo">{{form.billName}}</span>
  12. </li>
  13. <li class="detailLi">
  14. <span class="liName">对应载体</span>
  15. <span class="liInfo">{{form.buildName}}</span>
  16. </li>
  17. <li class="detailLi">
  18. <span class="liName">账单金额</span>
  19. <span class="liInfo">{{form.invoiceAmount}}</span>
  20. </li>
  21. <li class="detailLi">
  22. <span class="liName">欠款金额</span>
  23. <span class="liInfo">{{form.restMoney}}</span>
  24. </li>
  25. <li class="detailLi">
  26. <span class="liName">发票号</span>
  27. <span @click="downLoadPdf" class="liInfo" style="color: #0365F9">{{form.invoiceNo}}</span>
  28. </li>
  29. <li class="detailLi">
  30. <span class="liName">账单逾期</span>
  31. <span class="liInfo" style="color: #F21912">{{form.overdueDays}}天</span>
  32. </li>
  33. </ul>
  34. <button class="loginbtn" @click="backClick">
  35. 返回
  36. </button>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. export default {
  42. name: "detail",
  43. data(){
  44. return{
  45. form:{
  46. companyName: '',
  47. billName: '',
  48. buildName: '',
  49. invoiceAmount: '',
  50. restMoney: '',
  51. invoiceNo: '',
  52. eInvoiceUrl: '',
  53. overdueDays: ''
  54. }
  55. }
  56. },
  57. onLoad(options){
  58. console.log('options', options)
  59. const item = JSON.parse(options.item)
  60. this.form = item
  61. },
  62. methods:{
  63. backClick(){
  64. uni.redirectTo({
  65. url: "/pages/subPackages/enterPriseBill/index",
  66. });
  67. },
  68. //签订合同下载
  69. downLoadPdf() {
  70. const url = decodeURIComponent(this.form.eInvoiceUrl)
  71. uni.downloadFile({
  72. url: url,//下载地址接口返回
  73. success: (data) => {
  74. //文件保存到本地
  75. uni.saveFile({
  76. tempFilePath: data.tempFilePath, //临时路径
  77. success: function(res) {
  78. uni.showToast({
  79. icon: 'none',
  80. mask: true,
  81. title: '文件已保存:' + res.savedFilePath, //保存路径
  82. duration: 3000,
  83. });
  84. setTimeout(() => {
  85. //打开文档查看
  86. uni.openDocument({
  87. filePath: res.savedFilePath,
  88. success: function(res) {
  89. // console.log('打开文档成功');
  90. }
  91. });
  92. }, 3000)
  93. }
  94. });
  95. },
  96. fail: (err) => {
  97. console.log(err);
  98. uni.showToast({
  99. icon: 'none',
  100. mask: true,
  101. title: '失败请重新下载',
  102. });
  103. },
  104. });
  105. },
  106. }
  107. }
  108. </script>
  109. <style lang="scss">
  110. .enterPriseBillDetail{
  111. .detailBody{
  112. background: white;
  113. margin-top: 26rpx;
  114. padding: 32rpx;
  115. height: 1424rpx;
  116. box-sizing: border-box;
  117. .detailUl{
  118. .detailLi{
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. height: 112rpx;
  123. .liName{
  124. font-size: 32rpx;
  125. color: rgba(51, 51, 51, 1);
  126. white-space: nowrap;
  127. }
  128. .liInfo{
  129. display: inline-block;
  130. text-align: right;
  131. max-width: 428rpx;
  132. color: rgba(102, 102, 102, 1);
  133. font-size: 32rpx;
  134. line-height: 38rpx;
  135. }
  136. }
  137. }
  138. .loginbtn {
  139. margin-top: 176rpx;
  140. border-radius: 8rpx !important;
  141. padding: 24rpx;
  142. background: rgba(3, 101, 249, 1);
  143. color: white;
  144. font-size: 36rpx;
  145. }
  146. }
  147. }
  148. </style>