invoicedetails.vue 5.0 KB

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