filter.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. timeOption: [
  61. {
  62. label: '最近30天',
  63. value: 0
  64. },
  65. {
  66. label: '最近90天',
  67. value: 1
  68. },
  69. {
  70. label: '本季度',
  71. value: 2
  72. },
  73. {
  74. label: '本年度',
  75. value: 3
  76. }
  77. ],
  78. sortOption: [
  79. {
  80. label: '正序',
  81. value: 0
  82. },
  83. {
  84. label: '倒序',
  85. value: 1
  86. }
  87. ]
  88. };
  89. },
  90. methods: {
  91. handleSubmit(){
  92. uni.navigateBack()
  93. }
  94. }
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. .page-wrap {
  99. padding: 41.21rpx 27.47rpx;
  100. }
  101. .filter-item {
  102. font-size: 27.47rpx;
  103. margin-bottom: 41.21rpx;
  104. .label {
  105. color: #666;
  106. }
  107. }
  108. .tag-group {
  109. display: flex;
  110. flex-wrap: wrap;
  111. .item {
  112. min-width: 157.97rpx;
  113. box-sizing: border-box;
  114. color: #999;
  115. height: 68.68rpx;
  116. line-height: 65.93rpx;
  117. white-space: nowrap;
  118. overflow: hidden;
  119. text-overflow: ellipsis;
  120. max-width: 100%;
  121. border: 1rpx solid #dcdcdc;
  122. border-radius: 5.49rpx;
  123. text-align: center;
  124. margin: 13.74rpx 13.74rpx 0 0;
  125. background: #fff;
  126. padding: 0 20.6rpx;
  127. }
  128. .active {
  129. color: #00bcd2;
  130. border-color: #00bcd2;
  131. background: #eafffd;
  132. }
  133. }
  134. .btn-group{
  135. display: flex;
  136. justify-content: center;
  137. margin-top: 156.59rpx;
  138. .btn{
  139. width: 247.25rpx;
  140. height: 75.55rpx;
  141. background: #079eff;
  142. font-size: 27.47rpx;
  143. color: #fff;
  144. border-radius: 8.24rpx;
  145. border: none;
  146. margin: 0 13.74rpx;
  147. line-height: 75.55rpx;
  148. &-1{
  149. color: #040404;
  150. background: #ccc;
  151. }
  152. }
  153. }
  154. </style>