myInvoice.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!-- 我的发票 -->
  2. <template>
  3. <view class="invoice">
  4. <z-paging ref="paging" v-model="invoiceList" @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. class="invoice-navbar"
  14. slot="top"
  15. >
  16. <view slot="right" class="invoice-navbar-right" @click="addInvoice">开发票</view>
  17. </u-navbar>
  18. <!-- 列表 -->
  19. <view class="invoice-list">
  20. <view class="invoice-list-item" v-for="(item, index) in invoiceList" :key="index" @click="invoiceItemClick(item)">
  21. <view class="invoice-list-item-left">
  22. <view class="invoice-list-item-left-item" v-for="(child, childIndex) in invoiceObjectList" :key="childIndex">
  23. <view class="left">{{ child.label }}</view>
  24. <view class="right">
  25. <template v-if="child.type === 'money'">
  26. <text class="money">¥{{ item[child.key] }}</text>
  27. </template>
  28. <template v-else-if="child.type === 'status'">
  29. <text class="status">
  30. {{ item[child.key] }}
  31. </text>
  32. <u-tag :text="formatStatus(item['status'])" :type="formatStatusType(item['status'])" mode="dark" />
  33. </template>
  34. <template v-else>
  35. {{ item[child.key] }}
  36. </template>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="invoice-list-item-right">
  41. <u-icon name="arrow-right" color="#909399" size="28" />
  42. </view>
  43. </view>
  44. </view>
  45. </z-paging>
  46. <!-- 选择开票类型 -->
  47. <u-select v-model="chooseRecords.show" :list="chooseRecords.list" @confirm="chooseRecordsConfirm" />
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. invoiceList: [],
  55. invoiceObjectList: [
  56. { label: '', key: 'title', type: 'status' },
  57. { label: '', key: 'price', type: 'money' },
  58. { label: '申请时间:', key: 'applyTime' }
  59. ],
  60. queryParams: {
  61. pageNum: 1,
  62. pageSize: 10
  63. },
  64. chooseRecords: {
  65. show: false,
  66. list: [
  67. {
  68. value: 'parkingRecords',
  69. label: '停车记录'
  70. },
  71. {
  72. value: 'monthlyRecords',
  73. label: '包月记录'
  74. }
  75. ]
  76. }
  77. };
  78. },
  79. methods: {
  80. /**
  81. * @description: 指定返回上一页
  82. * @return {*}
  83. */
  84. customBack() {
  85. this.$u.route({
  86. type: 'switchTab',
  87. url: 'pages/center/index'
  88. });
  89. },
  90. /**
  91. * @description: 开发票
  92. * @return {*}
  93. */
  94. addInvoice() {
  95. this.chooseRecords.show = true;
  96. },
  97. /**
  98. * @description: 开发票选择确认
  99. * @param {*} val
  100. * @return {*}
  101. */
  102. chooseRecordsConfirm(list) {
  103. this.$u.route({
  104. url: '/pages/invoiceModule/availableOrder/availableOrder',
  105. params: {
  106. type: list[0].value
  107. }
  108. });
  109. },
  110. /**
  111. * @description: 分页触发
  112. * @param {*} pageNo
  113. * @param {*} pageSize
  114. * @return {*}
  115. */
  116. queryList(pageNo, pageSize) {
  117. this.queryParams.pageNum = pageNo;
  118. this.queryParams.pageSize = pageSize;
  119. // this.getInvoiceList();
  120. this.$refs.paging.complete([
  121. { id: 1, title: '停车服务', price: 0.03, applyTime: '2023-06-12 11:21:30', status: 0 },
  122. { id: 2, title: '停车服务', price: 0.03, applyTime: '2023-06-12 11:21:30', status: 1 },
  123. { id: 3, title: '停车服务', price: 0.03, applyTime: '2023-06-12 11:21:30', status: 2 },
  124. { id: 4, title: '停车服务', price: 0.03, applyTime: '2023-06-12 11:21:30', status: 1 }
  125. ]);
  126. },
  127. /**
  128. * @description: 获取发票列表
  129. * @return {*}
  130. */
  131. async getInvoiceList() {
  132. const { code, data } = await this.$u.api.invoiceModuleApi.getInvoiceListApi({ ...this.queryParams });
  133. if (code === 200) {
  134. this.$refs.paging.complete(data?.rows || []);
  135. }
  136. },
  137. /**
  138. * @description: 单条发票点击
  139. * @param {*} item
  140. * @return {*}
  141. */
  142. invoiceItemClick(item) {
  143. this.$u.route({
  144. url: '/pages/invoiceModule/invoiceDetails/invoiceDetails',
  145. params: {
  146. id: item.id
  147. }
  148. });
  149. },
  150. /**
  151. * @description: 初始化状态
  152. * @param {*} val
  153. * @return {*}
  154. */
  155. formatStatus(val) {
  156. const statusObj = {
  157. 0: '申请中',
  158. 1: '已开票',
  159. 2: '开票失败'
  160. };
  161. return statusObj[val];
  162. },
  163. /**
  164. * @description: 初始化状态按钮样式
  165. * @param {*} val
  166. * @return {*}
  167. */
  168. formatStatusType(val) {
  169. const statusTypeObj = {
  170. 0: 'info',
  171. 1: 'primary',
  172. 2: 'error'
  173. };
  174. return statusTypeObj[val];
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss" scoped>
  180. @import './myInvoice.scss';
  181. </style>