sort.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view>
  3. <up-popup :show="showSort" mode="bottom" closeable @close="handleClose">
  4. <scroll-view scroll-y :style="{ height: mapHeight }" class="sort_scroll">
  5. <view class="sort_wrap" :style="{ height : mapHeight }">
  6. <view class="sort_way">
  7. <view class="title">
  8. 排序方式
  9. </view>
  10. <view class="option_item" @click="handleChangeSort('asc')"
  11. :class="{ active : valueModel.sort == 'asc' }">
  12. <text>正序排序</text>
  13. <up-icon name="checkbox-mark" color="#4c8afe"></up-icon>
  14. </view>
  15. <view class="option_item" @click="handleChangeSort('desc')"
  16. :class="{ active : valueModel.sort == 'desc' }">
  17. <text>倒序排序</text>
  18. <up-icon name="checkbox-mark" color="#4c8afe"></up-icon>
  19. </view>
  20. <view class="title" style="margin-top: 30rpx;">
  21. 排序属性
  22. </view>
  23. <view class="option_item" v-for="(item,index) in sortParams" :key="index"
  24. @click="handleChangeSortField(item.value)" :class="{ active : valueModel.sortField == item.value }">
  25. <text>{{item.text}}</text>
  26. <up-icon name="checkbox-mark" color="#4c8afe"></up-icon>
  27. </view>
  28. </view>
  29. <up-tabbar :fixed="true" inactiveColor="#ffffff" class="case_tabbar" :placeholder="true"
  30. :safeAreaInsetBottom="true">
  31. <up-tabbar-item text="重置" :customStyle="{backgroundColor : '#fff'}"
  32. class="uTabbarItem close_btn" @click="handleReset"></up-tabbar-item>
  33. <up-tabbar-item text="确定" :customStyle="{backgroundColor : '#4c8afe'}"
  34. class="uTabbarItem" @click="handleEnter"></up-tabbar-item>
  35. </up-tabbar>
  36. </view>
  37. </scroll-view>
  38. </up-popup>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. props: {
  44. modelValue: {
  45. type: Object,
  46. default: undefined,
  47. },
  48. value: {
  49. type: Object,
  50. default: () => ({}),
  51. },
  52. mapHeight : {
  53. type : String,
  54. },
  55. },
  56. emits : ["getList", "update:modelValue"],
  57. computed: {
  58. valueModel() {
  59. return this.modelValue != null ? this.modelValue : this.value;
  60. },
  61. },
  62. data() {
  63. return {
  64. showSort: false,
  65. sortParams: [{
  66. value: 1,
  67. text: '创建时间'
  68. }, {
  69. value: 2,
  70. text: '分配时间'
  71. },{
  72. value: 3,
  73. text: '跟进时间'
  74. }]
  75. }
  76. },
  77. mounted(){
  78. },
  79. methods: {
  80. handleClose(){
  81. this.showSort = false;
  82. },
  83. handleReset(){
  84. this.valueModel.sort = undefined;
  85. this.valueModel.sortField = undefined;
  86. },
  87. handleEnter(){
  88. this.$emit("update:modelValue", this.valueModel);
  89. this.$emit("getList");
  90. this.showSort = false;
  91. },
  92. handleChangeSort(sort) {
  93. this.valueModel.sort = sort;
  94. },
  95. handleChangeSortField(val){
  96. this.valueModel.sortField = val;
  97. },
  98. show() {
  99. this.showSort = true;
  100. }
  101. },
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .sort_wrap {
  106. padding: 20px;
  107. box-sizing: border-box;
  108. overflow: scroll;
  109. .title {
  110. font-size: 18px;
  111. color: #202020;
  112. }
  113. .option_item {
  114. display: flex;
  115. justify-content: space-between;
  116. align-items: center;
  117. font-size: 15px;
  118. padding: 18px 0;
  119. border-bottom: 1px solid #eeeef2;
  120. color: #606060;
  121. &:last-child{
  122. border: none;
  123. }
  124. }
  125. .active {
  126. color:#4c8afe;
  127. ::v-deep & .u-icon__icon,
  128. ::v-deep & .up-icon__icon {
  129. display: block;
  130. }
  131. }
  132. ::v-deep .u-icon__icon,
  133. ::v-deep .up-icon__icon {
  134. display: none;
  135. font-weight: bold !important;
  136. font-size: 19px !important;
  137. }
  138. }
  139. .sort_scroll {
  140. /* 去掉 touchmove.stop 后保证内部可点击,避免 H5 上事件被拦截 */
  141. }
  142. .case_tabbar {
  143. .uTabbarItem {
  144. ::v-deep .u-tabbar-item__text,
  145. ::v-deep .up-tabbar-item__text {
  146. font-size: 18px;
  147. }
  148. }
  149. .close_btn {
  150. ::v-deep .u-tabbar-item__text,
  151. ::v-deep .up-tabbar-item__text {
  152. font-size: 18px;
  153. color: #606060 !important;
  154. }
  155. }
  156. }
  157. </style>