filter.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.type === item }" v-for="(item, index) in typeOption" :key="index" @click="filterForm.type = item">
  7. {{ item }}
  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.date === item }" v-for="(item, index) in dateOption" :key="index" @click="filterForm.date = item">
  15. {{ item }}
  16. </view>
  17. <uni-datetime-picker v-model="filterForm.dateRanges" type="daterange">
  18. <view :class="{ item: true, active: filterForm.date === '自定义' }" @click="filterForm.date = '自定义'">
  19. 自定义 {{ filterForm.dateRanges.length ? filterForm.dateRanges[0] + ' 至 ' + filterForm.dateRanges[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. type: '',
  42. dateType: '最近30天',
  43. dateRanges: [],
  44. sort: 'desc'
  45. },
  46. typeOption: ['全部', '应付账单', '应收账单'],
  47. dateOption: ['最近30天', '最近90天', '本季度', '本年度'],
  48. sortOption: [
  49. {
  50. label: '正序',
  51. value: 'asc'
  52. },
  53. {
  54. label: '倒序',
  55. value: 'desc'
  56. }
  57. ]
  58. };
  59. },
  60. onLoad(option) {
  61. const eventChannel = this.getOpenerEventChannel();
  62. eventChannel.on('updateData', (data) => {
  63. console.log(data);
  64. // filterForm.
  65. });
  66. },
  67. methods: {
  68. handleSubmit() {
  69. uni.navigateBack();
  70. }
  71. }
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .page-wrap {
  76. padding: 41.21rpx 27.47rpx;
  77. }
  78. .filter-item {
  79. font-size: 27.47rpx;
  80. margin-bottom: 41.21rpx;
  81. .label {
  82. color: #666;
  83. }
  84. }
  85. .tag-group {
  86. display: flex;
  87. flex-wrap: wrap;
  88. .item {
  89. min-width: 157.97rpx;
  90. box-sizing: border-box;
  91. color: #999;
  92. height: 68.68rpx;
  93. line-height: 65.93rpx;
  94. white-space: nowrap;
  95. overflow: hidden;
  96. text-overflow: ellipsis;
  97. max-width: 100%;
  98. border: 1rpx solid #dcdcdc;
  99. border-radius: 5.49rpx;
  100. text-align: center;
  101. margin: 13.74rpx 13.74rpx 0 0;
  102. background: #fff;
  103. padding: 0 20.6rpx;
  104. }
  105. .active {
  106. color: #00bcd2;
  107. border-color: #00bcd2;
  108. background: #eafffd;
  109. }
  110. }
  111. .btn-group {
  112. display: flex;
  113. justify-content: center;
  114. margin-top: 156.59rpx;
  115. .btn {
  116. width: 247.25rpx;
  117. height: 75.55rpx;
  118. background: #079eff;
  119. font-size: 27.47rpx;
  120. color: #fff;
  121. border-radius: 8.24rpx;
  122. border: none;
  123. margin: 0 13.74rpx;
  124. line-height: 75.55rpx;
  125. &-1 {
  126. color: #040404;
  127. background: #ccc;
  128. }
  129. }
  130. }
  131. </style>