filter.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="page-wrap">
  3. <view class="filter-item">
  4. <view class="label">开票状态</view>
  5. <view class="tag-group">
  6. <view :class="{ item: true, active: filterForm.state === item.value }" v-for="(item, index) in stateOption" :key="index" @click="filterForm.state = item.value">
  7. {{ item.label }}
  8. </view>
  9. </view>
  10. </view>
  11. <view class="filter-item">
  12. <view class="label">日期范围</view>
  13. <view class="tag-group">
  14. <view :class="{ item: true, active: filterForm.timeType === item.value }" v-for="(item, index) in timeOption" :key="index" @click="filterForm.timeType = item.value">
  15. {{ item.label }}
  16. </view>
  17. <uni-datetime-picker v-model="filterForm.timeRanges" type="daterange">
  18. <view :class="{ item: true, active: filterForm.timeType === 4}" @click="filterForm.timeType = 4">
  19. 自定义 {{ filterForm.timeRanges.length ? filterForm.timeRanges[0] + ' 至 ' + filterForm.timeRanges[1] : '' }}
  20. </view>
  21. </uni-datetime-picker>
  22. </view>
  23. </view>
  24. <view class="filter-item">
  25. <view class="label">日期排序</view>
  26. <view class="tag-group">
  27. <view :class="{ item: true, active: item.value === filterForm.sort }" v-for="(item, index) in sortOption" :key="index">{{ item.label }}</view>
  28. </view>
  29. </view>
  30. <view class="btn-group">
  31. <button class="btn btn-1">重置</button>
  32. <button class="btn" @click="handleSubmit">确定</button>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. filterForm: {
  41. state: 0,
  42. timeType: 0,
  43. timeRanges: [],
  44. sort: 0
  45. },
  46. stateOption: [
  47. {
  48. label: '全部',
  49. value: 0
  50. },
  51. {
  52. label: '待申请',
  53. value: 1
  54. },
  55. {
  56. label: '申请中',
  57. value: 2
  58. },
  59. {
  60. label: '已开',
  61. value: 3
  62. }
  63. ],
  64. timeOption: [
  65. {
  66. label: '最近30天',
  67. value: 0
  68. },
  69. {
  70. label: '最近90天',
  71. value: 1
  72. },
  73. {
  74. label: '本季度',
  75. value: 2
  76. },
  77. {
  78. label: '本年度',
  79. value: 3
  80. }
  81. ],
  82. sortOption: [
  83. {
  84. label: '正序',
  85. value: 0
  86. },
  87. {
  88. label: '倒序',
  89. value: 1
  90. }
  91. ]
  92. };
  93. },
  94. methods: {
  95. handleSubmit(){
  96. uni.navigateBack()
  97. }
  98. }
  99. };
  100. </script>
  101. <style lang="scss" scoped>
  102. .page-wrap {
  103. padding: 41.21rpx 27.47rpx;
  104. }
  105. .filter-item {
  106. font-size: 27.47rpx;
  107. margin-bottom: 41.21rpx;
  108. .label {
  109. color: #666;
  110. }
  111. }
  112. .tag-group {
  113. display: flex;
  114. flex-wrap: wrap;
  115. .item {
  116. min-width: 157.97rpx;
  117. box-sizing: border-box;
  118. color: #999;
  119. height: 68.68rpx;
  120. line-height: 65.93rpx;
  121. white-space: nowrap;
  122. overflow: hidden;
  123. text-overflow: ellipsis;
  124. max-width: 100%;
  125. border: 1rpx solid #dcdcdc;
  126. border-radius: 5.49rpx;
  127. text-align: center;
  128. margin: 13.74rpx 13.74rpx 0 0;
  129. background: #fff;
  130. padding: 0 20.6rpx;
  131. }
  132. .active {
  133. color: #00bcd2;
  134. border-color: #00bcd2;
  135. background: #eafffd;
  136. }
  137. }
  138. .btn-group{
  139. display: flex;
  140. justify-content: center;
  141. margin-top: 156.59rpx;
  142. .btn{
  143. width: 247.25rpx;
  144. height: 75.55rpx;
  145. background: #079eff;
  146. font-size: 27.47rpx;
  147. color: #fff;
  148. border-radius: 8.24rpx;
  149. border: none;
  150. margin: 0 13.74rpx;
  151. line-height: 75.55rpx;
  152. &-1{
  153. color: #040404;
  154. background: #ccc;
  155. }
  156. }
  157. }
  158. </style>