invoiceRecord.vue 7.5 KB

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