search.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view class="home">
  3. <view class="search-area" style="margin-bottom: 20rpx;">
  4. <u-search
  5. placeholder="搜索设备"
  6. v-model="keyword"
  7. shape="square"
  8. :clearabled="true"
  9. :show-action="true"
  10. action-text="搜索"
  11. :animation="true"
  12. search-icon-color="#000"
  13. color="#000"
  14. placeholder-color="#5c5b5b"
  15. @search="search"
  16. @custom="search"></u-search>
  17. </view>
  18. <u-cell-group :border="true">
  19. <u-cell
  20. title="设备"
  21. value="状态"
  22. :title-style="{'color': '#000'}"
  23. :value-style="{'color': '#5c5b5b'}"
  24. ></u-cell>
  25. <u-cell
  26. v-for="item in dataList"
  27. :key="item.id"
  28. :title="item.name"
  29. :value="item.status | statusFilter"
  30. :label="item.number"
  31. :title-style="{'color': '#000'}"
  32. :value-style="{'color': '#5c5b5b'}"
  33. @click="toBorrow(item.number)"
  34. ></u-cell>
  35. </u-cell-group>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. keyword:"",
  43. checked:false,
  44. dataList:[
  45. {
  46. id:3,
  47. name:'xxxx3',
  48. number:'dssd3',
  49. status:3
  50. },
  51. {
  52. id:1,
  53. name:'xxxx1',
  54. status:1,
  55. number:'25262'
  56. },
  57. {
  58. id:2,
  59. name:'xxxx2',
  60. number:'dssd',
  61. status:2
  62. },
  63. {
  64. id:3,
  65. name:'xxxx3',
  66. number:'dssd3',
  67. status:3
  68. }
  69. ]
  70. };
  71. },
  72. onLoad:function(option){
  73. console.log(option.keyword)
  74. this.keyword = option.keyword
  75. },
  76. methods:{
  77. search(){
  78. uni.navigateTo({
  79. url:'/pages/search/search?keyword='+this.keyword,
  80. })
  81. },
  82. toBorrow(val){
  83. uni.navigateTo({
  84. url:'/pages/borrow/borrow?number='+val,
  85. })
  86. }
  87. },
  88. filters:{
  89. statusFilter(val){
  90. let status;
  91. switch(val){
  92. case 0:
  93. status = "故障"
  94. break;
  95. case 1:
  96. status = "正常"
  97. break;
  98. case 2:
  99. status = "报废"
  100. break;
  101. case 3:
  102. status = "已借出"
  103. break;
  104. default:
  105. status = "请联系管理员"
  106. break;
  107. }
  108. return status;
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss" scoped>
  114. .home{
  115. padding: 20rpx;
  116. display: flex;
  117. flex-direction: column;
  118. height: 100vh;
  119. box-sizing: border-box;
  120. }
  121. /deep/ .u-cell-group__wrapper{
  122. border-left: 1rpx solid #d6d7d9;
  123. border-right: 1rpx solid #d6d7d9;
  124. }
  125. </style>