invoiceHeaderList.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!-- 发票抬头列表 -->
  2. <template>
  3. <view class="invoice-header">
  4. <z-paging ref="paging" v-model="invoiceHeaderList" @query="queryList">
  5. <view class="invoice-header-list">
  6. <u-swipe-action
  7. v-for="(item, index) in invoiceHeaderList"
  8. :key="index"
  9. :index="index"
  10. :show="item.show"
  11. :options="options"
  12. btn-width="120"
  13. @click="invoiceHeaderClick"
  14. bg-color="#fff"
  15. >
  16. <view class="invoice-header-list-item" @click="addInvoiceHeader(item)">
  17. <view class="left">
  18. <view class="left-item">{{ item.companyName }}</view>
  19. <view class="left-item">{{ item.dutyNum }}</view>
  20. </view>
  21. <view class="center">
  22. {{ formatType(item.type) }}
  23. </view>
  24. <view class="right">
  25. <u-icon name="arrow-right" color="#909399" size="30"></u-icon>
  26. </view>
  27. </view>
  28. </u-swipe-action>
  29. </view>
  30. <view class="invoice-header-bottom" slot="bottom">
  31. <u-button type="primary" @click="addInvoiceHeader">新增抬头</u-button>
  32. </view>
  33. </z-paging>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. invoiceHeaderList: [],
  41. options: [
  42. {
  43. text: '删除',
  44. style: {
  45. backgroundColor: '#dd524d'
  46. }
  47. }
  48. ]
  49. };
  50. },
  51. methods: {
  52. queryList(pageNo, pageSize) {
  53. this.$refs.paging.complete([
  54. { id: 1, companyName: '企业11111111111111111111111111', dutyNum: '1541564564165465', type: 1 },
  55. { id: 2, companyName: '企业2', dutyNum: '1541564564165465', type: 1 },
  56. { id: 3, companyName: '企业3', dutyNum: '1541564564165465', type: 1 },
  57. { id: 4, companyName: '个人1', dutyNum: '1541564564165465', type: 2 }
  58. ]);
  59. },
  60. /**
  61. * @description: 滑动按钮点击
  62. * @param {*} index
  63. * @param {*} btnIndex
  64. * @return {*}
  65. */
  66. invoiceHeaderClick(index, btnIndex) {
  67. if (btnIndex === 0) {
  68. uni.showModal({
  69. title: '提示',
  70. content: '你确认删除该条发票抬头信息吗?',
  71. success: function (res) {
  72. if (res.confirm) {
  73. console.log('确认删除');
  74. }
  75. if (res.cancel) {
  76. console.log('取消删除');
  77. }
  78. }
  79. });
  80. }
  81. },
  82. /**
  83. * @description: 新增抬头
  84. * @return {*}
  85. */
  86. addInvoiceHeader(item) {
  87. this.$u.route({
  88. url: '/pages/invoiceModule/addInvoiceHeader/addInvoiceHeader',
  89. params: {
  90. id: item.id
  91. }
  92. });
  93. },
  94. /**
  95. * @description: 初始化类型
  96. * @param {*} val
  97. * @return {*}
  98. */
  99. formatType(val) {
  100. const typeObj = {
  101. 1: '企业',
  102. 2: '个人'
  103. };
  104. return typeObj[val];
  105. }
  106. }
  107. };
  108. </script>
  109. <style lang="scss" scoped>
  110. @import './invoiceHeaderList.scss';
  111. </style>