invoicedetails.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="pages">
  3. <view class="" :style="{height: navHeight+'px' }"></view>
  4. <view class="navbar-box">
  5. <u-navbar title="开票详情" :safeAreaInsetTop="true" @leftClick="leftClick" :titleStyle="{color:'#fff'}" leftIconColor="#fff" bgColor="#EF1818"></u-navbar>
  6. </view>
  7. <view class="page-wrap">
  8. <view class="block-wrap">
  9. <view class="title">开票详情</view>
  10. <!-- <view class="item u-flex">
  11. <view class="left">抬头类型 </view>
  12. <view class="right">{{抬头类型 }}</view>
  13. </view> -->
  14. <view class="item u-flex" v-for="(item,index) in detailsInfo[details.handlerType]" :key="index">
  15. <view class="left">{{item.name}}</view>
  16. <view class="con">
  17. <text v-if="item.key=='handlerType'">{{details[item.key]|filterHandlerType}}</text>
  18. <text :style="{color:details.status>2?'#EF0E0E':'#6CC079'}" class="status" v-else-if="item.key=='status'">{{details[item.key]|filterInvoiceState}}</text>
  19. <text v-else-if="item.key=='invoiceAmount'">¥ {{details[item.key]}}</text>
  20. <text v-else>{{details[item.key]}}</text>
  21. </view>
  22. </view>
  23. <view class="item u-flex" v-if="details.status>2">
  24. <view class="left">失败原因</view>
  25. <view class="con">
  26. {{details.errReason}}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="page-bottom" v-if="details.status===3">
  32. <view class="inner">
  33. <view class="btn active" v-if="cansubmit" @click="submitorder">重新开票</view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import { systemInfo } from "@/mixin.js";
  40. export default {
  41. mixins: [systemInfo], // 使用mixin
  42. data() {
  43. return {
  44. staticUrl:this.$commonConfig.staticUrl,
  45. orderId:'',
  46. details:{},
  47. detailsInfo:{//1:个人,2:企业
  48. 1:[
  49. {name:'抬头类型',key:'handlerType'},
  50. {name:'抬头名称',key:'name'},
  51. // {name:'税 号',key:'creditCode'},
  52. {name:'开票金额 ',key:'invoiceAmount'},
  53. {name:'电子邮箱 ',key:'email'},
  54. {name:'开具状态 ',key:'status'},
  55. ],
  56. 2:[
  57. {name:'抬头类型',key:'handlerType'},
  58. {name:'抬头名称',key:'name'},
  59. {name:'税 号',key:'creditCode'},
  60. {name:'开票金额 ',key:'invoiceAmount'},
  61. {name:'电子邮箱 ',key:'email'},
  62. {name:'开具状态 ',key:'status'},
  63. // {name:'失败原因 ',key:'errReason'}
  64. ],
  65. },
  66. cansubmit:true,
  67. formData:{
  68. orderId:'',
  69. invoiceAmount:'',
  70. invoiceHandler:{
  71. handlerType:'',
  72. name:'',
  73. email:''
  74. }
  75. }
  76. }
  77. },
  78. onShow() {
  79. if(this.orderId){
  80. this.getInvoiceDetail();
  81. }
  82. },
  83. onLoad(page) {
  84. this.orderId = page.id;
  85. this.getSystemInfo();
  86. },
  87. methods: {
  88. leftClick(e){
  89. let pages = getCurrentPages();
  90. if(pages.length==1){
  91. uni.$u.route('/pages/index/index')
  92. }else{
  93. uni.navigateBack()
  94. };
  95. },
  96. getInvoiceDetail(){
  97. this.$u.api.getInvoiceDetail({orderId:this.orderId}).then(res=>{
  98. // console.log('res',res);
  99. this.details = res.data;
  100. }).catch(err=>{
  101. console.log('getInvoiceInfo',err);
  102. })
  103. },
  104. submitorder(){
  105. uni.redirectTo({
  106. url: `/center/invoice?id=${this.orderId}`
  107. })
  108. return
  109. // this.formData.orderId =this.details.orderId;
  110. // this.formData.invoiceAmount = this.details.invoiceAmount;
  111. // this.formData.invoiceHandler.handlerType = this.details.handlerType;
  112. // this.formData.invoiceHandler.name = this.details.name;
  113. // this.formData.invoiceHandler.email = this.details.email;
  114. // if(this.details.handlerType===2){//企业
  115. // this.formData.invoiceHandler.creditCode = this.details.creditCode;
  116. // }
  117. // this.$u.api.submitInvoice(this.formData).then(res=>{
  118. // uni.$u.toast(res.msg)
  119. // // uni.navigateBack()
  120. // setTimeout(()=>{
  121. // uni.redirectTo({
  122. // url: `/center/orderdetails?id=${this.orderId}`
  123. // })
  124. // },1500)
  125. // }).catch(err=>{
  126. // console.log('submitorder',err);
  127. // })
  128. }
  129. }
  130. }
  131. </script>
  132. <style>
  133. page{background-color: #F7F7F9;}
  134. </style>
  135. <style lang="scss" scoped>
  136. .block-wrap{
  137. background-color: #fff;
  138. border-radius: 16rpx;
  139. padding: 30rpx 32rpx 30rpx;
  140. margin-bottom: 24rpx;
  141. .title{
  142. font-size: 28rpx;
  143. font-weight: 500;
  144. color: #363636;
  145. margin-bottom: 28rpx;
  146. }
  147. .item{
  148. margin-bottom: 12rpx;
  149. font-size: 28rpx;
  150. font-weight: 400;
  151. color: #363636;
  152. line-height: 40rpx;
  153. .left{
  154. color: #999999;
  155. width: 184rpx;
  156. }
  157. }
  158. }
  159. .page-bottom{
  160. $height:98rpx;
  161. position: relative;
  162. z-index: 1001;
  163. height: $height;
  164. padding: 24rpx 20rpx;
  165. .inner{
  166. position: fixed;
  167. background-color: transparent;
  168. height: $height;
  169. left: 0;
  170. right: 0;
  171. bottom: 0;
  172. padding: 24rpx 20rpx;
  173. // box-shadow: 0rpx -4rpx 12rpx 0rpx rgba(215,215,215,0.5);
  174. .btn{
  175. font-size: 28rpx;
  176. height: 100%;
  177. line-height: $height;
  178. border-radius: 50rpx;
  179. padding: 0 50rpx;
  180. background-color: #eee;
  181. color: #333;
  182. text-align: center;
  183. &.active{
  184. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  185. color: #fff;
  186. }
  187. }
  188. }
  189. }
  190. </style>