invoicedetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 = res.data;
  94. if(res.data.status>2){
  95. this.detailsInfo[1].push({name:'失败原因 ',key:'errReason'});
  96. this.detailsInfo[2].push({name:'失败原因 ',key:'errReason'});
  97. }
  98. }).catch(err=>{
  99. console.log('getInvoiceInfo',err);
  100. })
  101. },
  102. submitorder(){
  103. this.formData.orderId =this.details.orderId;
  104. this.formData.invoiceAmount = this.details.invoiceAmount;
  105. this.formData.invoiceHandler.handlerType = this.details.handlerType;
  106. this.formData.invoiceHandler.name = this.details.name;
  107. this.formData.invoiceHandler.email = this.details.email;
  108. if(this.details.handlerType===2){//企业
  109. this.formData.invoiceHandler.creditCode = this.details.creditCode;
  110. }
  111. this.$u.api.submitInvoice(this.formData).then(res=>{
  112. uni.$u.toast(res.msg)
  113. // uni.navigateBack()
  114. setTimeout(()=>{
  115. uni.redirectTo({
  116. url: `/center/orderdetails?id=${this.orderId}`
  117. })
  118. },1500)
  119. }).catch(err=>{
  120. console.log('submitorder',err);
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style>
  127. page{background-color: #F7F7F9;}
  128. </style>
  129. <style lang="scss" scoped>
  130. .block-wrap{
  131. background-color: #fff;
  132. border-radius: 16rpx;
  133. padding: 30rpx 32rpx 30rpx;
  134. margin-bottom: 24rpx;
  135. .title{
  136. font-size: 28rpx;
  137. font-weight: 500;
  138. color: #363636;
  139. margin-bottom: 28rpx;
  140. }
  141. .item{
  142. margin-bottom: 12rpx;
  143. font-size: 28rpx;
  144. font-weight: 400;
  145. color: #363636;
  146. line-height: 40rpx;
  147. .left{
  148. color: #999999;
  149. width: 184rpx;
  150. }
  151. }
  152. }
  153. .page-bottom{
  154. $height:98rpx;
  155. position: relative;
  156. z-index: 1001;
  157. height: $height;
  158. padding: 24rpx 20rpx;
  159. .inner{
  160. position: fixed;
  161. background-color: transparent;
  162. height: $height;
  163. left: 0;
  164. right: 0;
  165. bottom: 0;
  166. padding: 24rpx 20rpx;
  167. // box-shadow: 0rpx -4rpx 12rpx 0rpx rgba(215,215,215,0.5);
  168. .btn{
  169. font-size: 28rpx;
  170. height: 100%;
  171. line-height: $height;
  172. border-radius: 50rpx;
  173. padding: 0 50rpx;
  174. background-color: #eee;
  175. color: #333;
  176. text-align: center;
  177. &.active{
  178. background: linear-gradient(90deg, #FF7979 0%, #ED0000 100%);
  179. color: #fff;
  180. }
  181. }
  182. }
  183. }
  184. </style>