invoiceTitleManagement.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view>
  3. <ujp-navbar title="发票抬头管理"></ujp-navbar>
  4. <view class="main">
  5. <view class="item">
  6. <view class="title">
  7. <img src="@/assets/static/img/riFill-building-fill@1x.png" alt="">企业单位
  8. </view>
  9. <template v-if="companyTypes.length">
  10. <view class="content" v-for="(item, index) in companyTypes" :key="index" >
  11. <view class="itemlist" @click="ckBtn(item)" >
  12. <p class="text">{{item.title}}<text v-if="item.defaultHeader=='1'" class="default">默认</text></p>
  13. <p class="num">{{item.companyTaxNo}}</p>
  14. </view>
  15. <view class="edit" @click="editBtn(item)" >
  16. <img src="@/assets/static/img/riFill-edit-2-fill@1x.png" alt="">
  17. </view>
  18. </view>
  19. </template>
  20. <view class="content" v-else >
  21. <view class="">
  22. <p class="text">未添加</p>
  23. <p class="num"></p>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="item">
  28. <view class="title">
  29. <img src="@/assets/static/img/riFill-user-3-fill.svg" alt="">个人/非企业单位
  30. </view>
  31. <template v-if="personTypes.length">
  32. <view class="content name-content" v-for="(item, index) in personTypes" :key="index" >
  33. <view class="itemlist" @click="ckBtn(item)">
  34. <p class="name">{{item.title}}<text v-if="item.defaultHeader=='1'" class="default">默认</text></p>
  35. </view>
  36. <view class="edit" @click="editBtn(item)" >
  37. <img src="@/assets/static/img/riFill-edit-2-fill@1x.png" alt="">
  38. </view>
  39. </view>
  40. </template>
  41. <view class="content " v-else >
  42. <view class="">
  43. <p class="text">未添加</p>
  44. <p class="num"></p>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <u-button type="success" shape="circle" @click="gotoUrl('pages/MyInvoice/editInvoiceTitle')" >新增发票抬头</u-button>
  50. </view>
  51. </template>
  52. <script>
  53. import * as API from '@/apis/invoiceApi.js'
  54. export default {
  55. data() {
  56. return {
  57. uuid:0,
  58. invoice: false,//true 开票界面 ,可以点击更换
  59. personTypes: [],
  60. companyTypes:[]
  61. }
  62. },
  63. onLoad(op) {
  64. if(op.uuid){
  65. this.uuid=op.uuid
  66. }
  67. if(op.invoice){
  68. this.invoice=true;
  69. }
  70. },
  71. onShow() {
  72. this.getlist();
  73. },
  74. methods: {
  75. editBtn(item){
  76. var url='pages/MyInvoice/editInvoiceTitle?id='+item.id;
  77. if(this.invoice){
  78. url+="&invoice=1"
  79. }
  80. this.gotoUrl(url)
  81. },
  82. ckBtn(item){
  83. if(this.invoice){
  84. this.carhelp.set("issueInvoice",{
  85. uuid:this.uuid,
  86. selectObj:item
  87. })
  88. uni.navigateBack({
  89. })
  90. }else{
  91. this.gotoUrl('pages/MyInvoice/editInvoiceTitle?id='+item.id)
  92. }
  93. },
  94. getlist() {
  95. uni.showLoading({
  96. title: "加载中",
  97. mask: true,
  98. })
  99. API.invoiceTypes().then((res) => {
  100. uni.hideLoading()
  101. this.companyTypes = res.data.companyTypes;
  102. this.personTypes= res.data.personTypes;
  103. }).catch(error => {
  104. uni.showToast({
  105. title: error,
  106. icon: "none"
  107. })
  108. })
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. page{
  115. background-color: #fff;
  116. }
  117. .flex{
  118. display: flex;
  119. }
  120. .main{
  121. .item{
  122. margin-bottom: 12px;
  123. }
  124. .title{
  125. line-height: 44px;
  126. color: #101010;
  127. padding: 0 16px;
  128. img{
  129. vertical-align: middle;
  130. margin-right: 8px;
  131. }
  132. }
  133. .content{
  134. display: flex;
  135. justify-content: space-between;
  136. padding:16px;
  137. border: 1px solid rgba(242, 242, 242, 100);
  138. .text{
  139. font-size: 18px;
  140. line-height: 18px;
  141. margin-bottom: 8px;
  142. color: #101010;
  143. }
  144. .num{
  145. line-height: 16px;
  146. font-size: 16px;
  147. color: #666666;
  148. }
  149. .itemlist{
  150. width: 90%;
  151. // border: 1px #dbcece dashed;
  152. }
  153. .edit{
  154. //border: 1px #dbcece dashed;
  155. width: 30%;
  156. max-width: 35px;
  157. line-height: 42px;
  158. img{
  159. vertical-align: middle;
  160. }
  161. }
  162. }
  163. .name-content{
  164. line-height: 49px;
  165. padding: 0 16px;
  166. }
  167. .default{
  168. width: 48px;
  169. padding: 3px 10px;
  170. line-height: 24px;
  171. border-radius: 4px;
  172. background-color: rgba(0, 185, 98, 100);
  173. color: rgba(255, 255, 255, 100);
  174. font-size: 14px;
  175. text-align: center;
  176. margin: auto 8px;
  177. }
  178. }
  179. ::v-deep.u-btn{
  180. width: 91.4%;
  181. margin: 12px auto;
  182. position: fixed;
  183. bottom: 0;
  184. left: 0;
  185. right: 0;
  186. }
  187. </style>