dmSearchBar.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="searchView" :style="{'margin-top':top+'rpx', 'height': isSearchType ? '64rpx' : '', 'background-color': isSearchType ? '#fff': '', 'border-radius': isSearchType ? '20rpx' : ''}">
  3. <block v-if="isSearchType">
  4. <image class="search-img" src="../../static/icons/icon_search@2x.png" mode=""></image>
  5. <input class="input" type="text" :placeholder="placeholder" v-model="keyword" confirm-type='search' @confirm='search'/>
  6. </block>
  7. <view class="btnView" @click="exportAction" v-if="isExport">
  8. <view class="line" v-if="isSearchType"></view>
  9. <text class="title">导出</text>
  10. <image class="btn-img" src="../../static/icons/icon_export@2x.png" mode=""></image>
  11. </view>
  12. <view class="btnView" @click="screenAction" v-if="isScreen">
  13. <view class="line" v-if="isSearchType"></view>
  14. <text class="title">{{screenTitle}}</text>
  15. <image class="btn-img" src="../../static/icons/icon_screening@2x.png" mode=""></image>
  16. </view>
  17. <view class="btnView" @click="sortAction" v-if="isSort">
  18. <text class="title">{{sortString}}</text>
  19. <image class="btn-img" src="../../static/icons/icon_drop@2x.png" mode=""></image>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. props: {
  26. top:{
  27. type:Number,
  28. default:30
  29. },
  30. placeholder:{
  31. type:String,
  32. default:'搜索顾问和客户姓名、手机号'
  33. },
  34. isExport:{
  35. type:Boolean,
  36. default:true
  37. },
  38. isScreen:{
  39. type:Boolean,
  40. default:false
  41. },
  42. value:String,
  43. isSearchType: {
  44. type: Boolean,
  45. default: false
  46. },
  47. screenTitle: {
  48. type: String,
  49. default: '筛选'
  50. },
  51. isSort: {
  52. type: Boolean,
  53. default: false
  54. },
  55. sortString: {
  56. type: String,
  57. default: '降序'
  58. }
  59. },
  60. data() {
  61. return {
  62. keyword:this.value
  63. }
  64. },
  65. watch:{
  66. keyword(val){
  67. this.$emit('input',val)
  68. }
  69. },
  70. mounted() {},
  71. computed: {},
  72. methods: {
  73. search(e){
  74. this.$emit('search',e.detail.value)
  75. uni.hideKeyboard();
  76. },
  77. exportAction(){
  78. this.$emit('export')
  79. },
  80. screenAction(){
  81. this.$emit('screen')
  82. },
  83. sortAction() {
  84. this.$emit('sortAction')
  85. }
  86. },
  87. }
  88. </script>
  89. <style scoped lang="scss">
  90. .searchView {
  91. // margin-left: 20rpx;
  92. width: 710rpx;
  93. // height: 64rpx;
  94. display: flex;
  95. justify-content: flex-start;
  96. align-items: center;
  97. // background-color: #fff;
  98. // border-radius: 20rpx;
  99. .search-img {
  100. margin-left: 16rpx;
  101. width: 44rpx;
  102. height: 44rpx;
  103. }
  104. .input {
  105. flex: 1;
  106. margin-left: 8rpx;
  107. height: 100%;
  108. color: #999;
  109. font-size: 24rpx;
  110. font-family: Verdana, Verdana-Regular;
  111. font-weight: 400;
  112. text-align: left;
  113. color: #999999;
  114. }
  115. .btnView {
  116. // margin-left: 8rpx;
  117. display: flex;
  118. align-items: center;
  119. .line {
  120. width: 2rpx;
  121. height: 26rpx;
  122. background-color: #e0e0e0;
  123. }
  124. .title {
  125. margin-left: 20rpx;
  126. font-size: 24rpx;
  127. font-family: Verdana, Verdana-Regular;
  128. font-weight: 400;
  129. text-align: right;
  130. color: #333333;
  131. }
  132. .btn-img {
  133. margin-left: 8rpx;
  134. margin-right: 16rpx;
  135. width: 26rpx;
  136. height: 26rpx;
  137. }
  138. }
  139. }
  140. </style>