invoiceHeaderList.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!-- 发票抬头列表 -->
  2. <template>
  3. <view class="invoice-header">
  4. <z-paging ref="paging" v-model="invoiceHeaderList" @query="queryList">
  5. <!-- 导航栏 -->
  6. <u-navbar
  7. title-color="#fff"
  8. :custom-back="customBack"
  9. :border-bottom="false"
  10. back-icon-color="#CCE8FF"
  11. :background="{ background: '#008CFF' }"
  12. title="抬头信息"
  13. slot="top"
  14. />
  15. <view class="invoice-header-list">
  16. <view class="invoice-header-list-item" v-for="(item, index) in invoiceHeaderList" :key="index">
  17. <view class="left">
  18. <view class="left-item">{{ item.invoName }}</view>
  19. <view class="left-item">{{ item.invoCode }}</view>
  20. </view>
  21. <view class="center">
  22. {{ formatType(item.invoHeadType) }}
  23. </view>
  24. <view class="right">
  25. <u-image width="28rpx" height="28rpx" src="/static/img/edit-icon.png" @click="editInvoiceHeader(item)" />
  26. </view>
  27. </view>
  28. </view>
  29. <view class="invoice-header-bottom" slot="bottom">
  30. <u-button type="primary" @click="addInvoiceHeader">新增抬头</u-button>
  31. </view>
  32. </z-paging>
  33. <u-toast ref="uToast" />
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. invoiceHeaderList: [],
  41. queryParams: {
  42. pageNum: 1,
  43. pageSize: 10
  44. },
  45. invoType: 1
  46. };
  47. },
  48. onLoad(options) {
  49. const { invoType } = options;
  50. this.invoType = invoType;
  51. },
  52. methods: {
  53. /**
  54. * @description: 分页组件触发
  55. * @param {*} pageNo
  56. * @param {*} pageSize
  57. * @return {*}
  58. */
  59. queryList(pageNo, pageSize) {
  60. this.queryParams.pageNum = pageNo;
  61. this.queryParams.pageSize = pageSize;
  62. this.getList();
  63. },
  64. /**
  65. * @description: 返回新增抬头页面
  66. * @return {*}
  67. */
  68. customBack() {
  69. this.$u.route({
  70. url: '/pages/invoiceModule/addInvoice/addInvoice',
  71. params: {
  72. invoType: this.invoType
  73. }
  74. });
  75. },
  76. /**
  77. * @description: 获取列表
  78. * @return {*}
  79. */
  80. async getList() {
  81. const { code, data } = await this.$u.api.invoiceModuleApi.getInvoiceHeadListApi({ ...this.queryParams });
  82. if (code === 200) {
  83. this.$refs.paging.complete(data?.pageInfo?.rows || []);
  84. }
  85. },
  86. /**
  87. * @description: 新增抬头
  88. * @return {*}
  89. */
  90. addInvoiceHeader() {
  91. this.$u.route({
  92. url: '/pages/invoiceModule/addInvoiceHeader/addInvoiceHeader',
  93. params: {
  94. invoType: this.invoType
  95. }
  96. });
  97. },
  98. /**
  99. * @description: 编辑抬头
  100. * @param {*} item
  101. * @return {*}
  102. */
  103. editInvoiceHeader(item) {
  104. this.$u.route({
  105. url: '/pages/invoiceModule/addInvoiceHeader/addInvoiceHeader',
  106. params: {
  107. id: item.id,
  108. invoType: this.invoType
  109. }
  110. });
  111. },
  112. // 删除抬头
  113. async deleteInvoiceHeader(item) {
  114. const { id } = item;
  115. const { code } = await this.$u.api.invoiceModuleApi.deleteInvoiceHeaderApi({ id });
  116. if (code === 200) {
  117. this.$refs.uToast.show({
  118. title: '删除成功!',
  119. type: 'success'
  120. });
  121. this.getList();
  122. }
  123. },
  124. /**
  125. * @description: 初始化类型
  126. * @param {*} val
  127. * @return {*}
  128. */
  129. formatType(val) {
  130. const typeObj = {
  131. 1: '企业',
  132. 2: '个人'
  133. };
  134. return typeObj[val];
  135. }
  136. }
  137. };
  138. </script>
  139. <style lang="scss" scoped>
  140. @import './invoiceHeaderList.scss';
  141. </style>