invoiceRecord.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="mobile-invoice mobile-content mobile-content-long invoice-record" @click="showFilterInvoiceType = false">
  3. <div class="order-nav">
  4. <nuxt-link to="/mobile/center/user/invoice" tag="div"><span>发票信息</span></nuxt-link>
  5. <nuxt-link to="/mobile/center/user/invoice/waitinvoice" tag="div"><span>待开票订单</span></nuxt-link>
  6. <div class="active"><span>开票记录</span></div>
  7. </div>
  8. <div class="search-content mi-search-content">
  9. <input type="text" v-model="filterParams.keyword" @keyup.13="onFilter" placeholder="订单号/发票抬头/收票人/联系电话">
  10. <span @click="onFilter"><i class="iconfont icon-sousuo"></i></span>
  11. </div>
  12. <div class="mi-list-content">
  13. <div class="mi-lc-filters clearfix">
  14. <span class="multi-check inline-block" :class="{active: filterParams.status === 101}" @click="setFilter('status', 101)">待开票</span>
  15. <span class="multi-check inline-block" :class="{active: filterParams.status === 102}" @click="setFilter('status', 102)">已开票</span>
  16. <div class="com-select-wrap fr" @click.stop="showFilterInvoiceType = !showFilterInvoiceType">{{filterParams.invoicetype === 1206 ? '普票' : filterParams.invoicetype === 1205 ? '专票' : '全部'}}
  17. <ul class="select-list" v-show="showFilterInvoiceType">
  18. <li @click.stop="setFilter('invoicetype', null)" v-show="filterParams.invoicetype">全部</li>
  19. <li @click.stop="setFilter('invoicetype', 1206)" v-show="filterParams.invoicetype != 1206">普票</li>
  20. <li @click.stop="setFilter('invoicetype', 1205)" v-show="filterParams.invoicetype != 1205">专票</li>
  21. </ul>
  22. </div>
  23. </div>
  24. <ul class="mi-list" v-if="invoiceList.length">
  25. <li v-for="inv in invoiceList">
  26. <div class="line">
  27. <span class="inline-block title">
  28. 类型:
  29. </span>
  30. <span class="inline-block content">
  31. <i class="inv" :class="{'spec-inv' : inv.invoicetype === 1205}">{{inv.invoicetype === 1206 ? '普票' : '专票'}}</i>
  32. </span>
  33. </div>
  34. <div class="line">
  35. <span class="inline-block title">
  36. 申请时间:
  37. </span>
  38. <span class="inline-block content">{{inv.createTime | date}}</span>
  39. </div>
  40. <div class="line">
  41. <span class="inline-block title">
  42. 状态:
  43. </span>
  44. <span class="inline-block content">{{inv.status == 101 ? '待开票' : '已开票'}}</span>
  45. </div>
  46. <div class="line">
  47. <span class="inline-block title">
  48. 商家名称:
  49. </span>
  50. <nuxt-link :to="`/mobile/shop/${inv.storeid}`" class="inline-block content link">{{inv.sellername}}</nuxt-link>
  51. </div>
  52. <div class="line">
  53. <span class="inline-block title">
  54. 订单号:
  55. </span>
  56. <span class="inline-block content link">
  57. <nuxt-link class="block" :key="id" :to="`/mobile/order/details?uuid=${baseUtils.enidfilter(id)}&type=buyer`" v-for="id in inv.orderids.split(',')">
  58. {{id}}
  59. </nuxt-link>
  60. </span>
  61. </div>
  62. <div class="line">
  63. <span class="inline-block title">
  64. 可开票金额:
  65. </span>
  66. <span class="inline-block content price">¥{{inv.price || 0}}</span>
  67. </div>
  68. <div class="line">
  69. <span class="inline-block title">
  70. 发票抬头:
  71. </span>
  72. <span class="inline-block content">{{inv.invoicetitle}}</span>
  73. </div>
  74. <div class="line">
  75. <span class="inline-block title">
  76. 收票人:
  77. </span>
  78. <span class="inline-block content">{{inv.receiverName}}</span>
  79. </div>
  80. <div class="line">
  81. <span class="inline-block title">
  82. 联系电话:
  83. </span>
  84. <span class="inline-block content">{{inv.recTel}}</span>
  85. </div>
  86. <div class="line">
  87. <span class="inline-block title">
  88. 收票地址:
  89. </span>
  90. <span class="inline-block content">{{inv.invoiceAddress}}</span>
  91. </div>
  92. </li>
  93. </ul>
  94. <empty-status
  95. :text="'暂无开票信息'"
  96. :showLink="false"
  97. v-else></empty-status>
  98. </div>
  99. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  100. <pull-up :searchMore="fetching" :allPage="invoices.data.totalPages" :page="page" @pullUpAction="onPullUp"></pull-up>
  101. </div>
  102. </template>
  103. <script>
  104. import { RemindBox, PullUp, EmptyStatus } from '~components/mobile/common'
  105. export default {
  106. layout: 'mobile',
  107. middleware: 'authenticated',
  108. data () {
  109. return {
  110. remindText: '',
  111. timeoutCount: '',
  112. invoiceList: [],
  113. isChange: false,
  114. page: 1,
  115. count: 10,
  116. filterParams: {
  117. invoicetype: '',
  118. keyword: '',
  119. // 101为待开票, 102为已开票
  120. status: null
  121. },
  122. showFilterInvoiceType: false
  123. }
  124. },
  125. components: {
  126. RemindBox,
  127. PullUp,
  128. EmptyStatus
  129. },
  130. fetch ({store}) {
  131. return Promise.all([
  132. store.dispatch('invoice/getInvoices', {count: 10, page: 1, role: 'BUYER', sorting: {'createTime': 'DESC'}})
  133. ])
  134. },
  135. watch: {
  136. '$store.state.invoice.data.invoices.data': {
  137. handler: function (val) {
  138. if (val && val.content) {
  139. if (this.isChange) {
  140. this.invoiceList = []
  141. this.isChange = false
  142. }
  143. this.invoiceList = [...this.invoiceList, ...val.content]
  144. }
  145. },
  146. immediate: true
  147. }
  148. },
  149. computed: {
  150. invoices () {
  151. return this.$store.state.invoice.data.invoices
  152. },
  153. fetching () {
  154. return this.invoices.fetching
  155. }
  156. },
  157. methods: {
  158. setRemindText: function (str) {
  159. this.remindText = str
  160. this.timeoutCount++
  161. },
  162. initParams () {
  163. this.page = 1
  164. this.filterParams.invoicetype = null
  165. this.filterParams.keyword = null
  166. },
  167. reloadList () {
  168. return this.$store.dispatch('invoice/getInvoices',
  169. {count: this.count,
  170. page: this.page,
  171. role: 'BUYER',
  172. sorting: {'createTime': 'DESC'},
  173. invoicetype: this.filterParams.invoicetype,
  174. keyword: this.filterParams.keyword,
  175. status: this.filterParams.status
  176. })
  177. },
  178. onPullUp () {
  179. this.page++
  180. this.reloadList()
  181. },
  182. onFilter () {
  183. this.isChange = true
  184. this.page = 1
  185. return this.reloadList()
  186. },
  187. setInvoiceType (type) {
  188. this.filterParams.invoicetype = type
  189. this.showFilterInvoiceType = false
  190. this.onFilter()
  191. },
  192. setFilter (type, val) {
  193. if (type === 'invoicetype') {
  194. this.showFilterInvoiceType = false
  195. this.filterParams.invoicetype = val
  196. } else if (type === 'status') {
  197. this.filterParams.status = val === this.filterParams.status ? null : val
  198. }
  199. this.onFilter()
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. @import '~assets/scss/mobileInvoice';
  206. .order-nav {
  207. background: #fff;
  208. div {
  209. height: 0.82rem;
  210. line-height: 0.82rem;
  211. display: inline-block;
  212. width: 33.3%;
  213. text-align: center;
  214. font-size: .28rem;
  215. color: #666;
  216. &.active span{
  217. color: #3f84f6;
  218. border-bottom: 0.04rem solid #3f84f6;
  219. padding-bottom: 0.2rem;
  220. }
  221. }
  222. }
  223. </style>