invoice.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view>
  3. <view class="search-box">
  4. <view class="search ddflex">
  5. <image src="../static/mine/images/ssico.png" class="ssico"></image>
  6. <input placeholder="搜索发票抬头" placeholder-class="placeholder" v-model="title" @confirm="confirmTitle" class="ipt fflex" />
  7. </view>
  8. </view>
  9. <view class="filter ddflex">
  10. <view class="li">
  11. <picker class="picker" :range="state" range-key="label" @change="changeState">
  12. <view>{{stateName}}</view>
  13. <image src="../static/mine/images/bico.png" class="bico"></image>
  14. </picker>
  15. </view>
  16. <view class="li">
  17. <picker class="picker" :range="dateType" range-key="label" @change="changeDateType">
  18. <view>{{dateTypeName}}</view>
  19. <image src="../static/mine/images/bico.png" class="bico"></image>
  20. </picker>
  21. </view>
  22. </view>
  23. <block v-if="isShow">
  24. <view class="list" v-if="pageList && pageList.length > 0">
  25. <navigator :url="'/invoice/detail/detail?id=' + item.id" hover-class="none" class="li" v-for="(item,index) in pageList" :key="index">
  26. <image src="../static/mine/images/left.png" class="left"></image>
  27. <image src="../static/mine/images/right.png" class="right"></image>
  28. <view class="licon">
  29. <view class="lis ddflex">
  30. <label>发票抬头</label>
  31. <view class="fflex tover">{{item.title}}</view>
  32. <view class="sta ddflex" v-if="item.state == 1">待开票</view>
  33. <view class="sta ddflex" v-else><image src="../static/mine/images/fpico.png" class="fpico"></image>已开票</view>
  34. </view>
  35. <view class="lis ddflex ddflex">
  36. <label>开票金额</label>
  37. <view class="fflex">¥{{item.money}}</view>
  38. </view>
  39. <view class="lis ddflex">
  40. <label>开票内容</label>
  41. <view class="fflex tovers">{{item.content}}</view>
  42. </view>
  43. </view>
  44. </navigator>
  45. </view>
  46. <view class="no-invoice" v-else>
  47. <image src="../static/mine/images/empty.png"></image>
  48. <view class="tip">暂无开票记录~</view>
  49. <navigator url="/mine/order/order" hover-class="none" class="btn">去开票</navigator>
  50. </view>
  51. </block>
  52. </view>
  53. </template>
  54. <script>
  55. const req = require('../../utils/request.js');
  56. export default {
  57. data() {
  58. return{
  59. form: {
  60. page: 1,
  61. limit: 10
  62. },
  63. pageList: [],
  64. isLoad: true,
  65. title: '',
  66. state: [
  67. {
  68. label: '待开票',
  69. value: 1
  70. },
  71. {
  72. label: '已开票',
  73. value: 2
  74. }
  75. ],
  76. stateIndex: -1,
  77. stateName: '状态',
  78. dateType: [
  79. {
  80. label: '一周内',
  81. value: 1
  82. },
  83. {
  84. label: '一月内',
  85. value: 2
  86. },
  87. {
  88. label: '一季度内',
  89. value: 3
  90. },
  91. {
  92. label: '一年内',
  93. value: 4
  94. }
  95. ],
  96. dateTypeIndex: -1,
  97. dateTypeName: '发票日期',
  98. isShow: false
  99. }
  100. },
  101. onLoad() {
  102. uni.setNavigationBarColor({
  103. frontColor: '#ffffff',
  104. backgroundColor: req.public.titleTopBgColor
  105. });
  106. this.getPageList();
  107. },
  108. onReachBottom() {
  109. this.form.page++;
  110. this.getPageList();
  111. },
  112. methods:{
  113. confirmTitle(e){
  114. this.title = e.detail.value;
  115. this.form.page = 1;
  116. this.isLoad = true;
  117. this.getPageList()
  118. },
  119. changeState(e){
  120. this.stateIndex = e.detail.value;
  121. this.stateName = this.state[this.stateIndex].label;
  122. this.form.page = 1;
  123. this.isLoad = true;
  124. this.getPageList()
  125. },
  126. changeDateType(e){
  127. this.dateTypeIndex = e.detail.value;
  128. this.dateTypeName = this.dateType[this.dateTypeIndex].label;
  129. this.form.page = 1;
  130. this.isLoad = true;
  131. this.getPageList()
  132. },
  133. getPageList(){
  134. let isShowLoading = false;
  135. if (this.form.page == 1 && !isShowLoading) {
  136. req.loadIng('加载中');
  137. isShowLoading = true;
  138. }
  139. if (!this.isLoad) return false;
  140. this.isLoad = false;
  141. let that = this;
  142. let form = that.form;
  143. if(that.title){
  144. form.title = that.title;
  145. }else{
  146. delete form.state;
  147. }
  148. if(this.stateIndex > -1){
  149. form.state = this.state[this.stateIndex].value;
  150. }else{
  151. delete form.state;
  152. }
  153. if(this.dateTypeIndex > -1){
  154. form.dateType = this.dateType[this.dateTypeIndex].value;
  155. }else{
  156. delete form.dateType;
  157. }
  158. req.getRequest('/api/invoice/list', form, data => {
  159. if (data.list && data.list.length == 10) this.isLoad = true;
  160. if (that.form.page > 1) data.list = that.pageList.concat(data.list);
  161. that.pageList = data.list
  162. if (isShowLoading) {
  163. uni.hideLoading();
  164. isShowLoading = false;
  165. }
  166. that.isShow = true;
  167. });
  168. }
  169. }
  170. }
  171. </script>
  172. <style>
  173. @import "./invoice.css";
  174. </style>