selectCarNo.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="warp">
  3. <view class="content1">
  4. <u-search placeholder="输入车牌号" :show-action="false" v-model="inputKeyword"></u-search>
  5. </view>
  6. <view class="content2" v-if="!inputKeyword">
  7. <view class="title">编号{{contractNo}}可选车牌号如下:</view>
  8. <view class="item-contnet">
  9. <view class="item-list" v-for="(item,index) in newList" :key="index" @click="confirm(item)">
  10. {{item.carNo}}({{item.tranCarNo}})
  11. </view>
  12. </view>
  13. </view>
  14. <view class="content3" v-if="inputKeyword">
  15. <view class="search-item-list" v-for="(item,index) in filterNewList" :key="index" @click="confirm(item)">
  16. {{item.carNo}}
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import helper from '@/common/helper.js';
  23. export default {
  24. data() {
  25. return {
  26. inputKeyword: '',
  27. newList: [],
  28. filterNewList: [],
  29. compId: '',
  30. contractNo:''
  31. }
  32. },
  33. onShow() {
  34. this.newList = uni.getStorageSync('erpContractNoCarList')
  35. this.contractNo = uni.getStorageSync('erpContractNo').contractNo
  36. },
  37. onLoad(options) {
  38. },
  39. watch: {
  40. inputKeyword(val) {
  41. this.filterNewList = this.newList.filter(function(item) {
  42. if (item.carNo.indexOf(val) > -1) {
  43. return item
  44. }
  45. })
  46. }
  47. },
  48. methods: {
  49. confirm(item){
  50. uni.setStorageSync('erpcarNo', item);
  51. uni.setStorageSync('ContractNoCar',item.carNo);
  52. uni.setStorageSync('CarFreight',item.tranPrice);
  53. uni.navigateBack({})
  54. },
  55. }
  56. }
  57. </script>
  58. <style scoped lang="scss">
  59. .content1 {
  60. background: white;
  61. padding: 20rpx;
  62. border-radius: 0 0 20rpx 20rpx;
  63. }
  64. .content2 {
  65. background: white;
  66. margin-top: 20rpx;
  67. padding: 20rpx;
  68. border-radius: 20rpx 20rpx 0 0;
  69. .title {
  70. font-size: 28rpx;
  71. font-weight: 400;
  72. color: #AFB3BF;
  73. }
  74. .item-contnet {
  75. display: flex;
  76. flex-wrap: wrap;
  77. justify-content: space-between;
  78. }
  79. .item-list {
  80. width: 45%;
  81. background: #F5F6F9;
  82. margin: 20rpx 0;
  83. padding: 10rpx 15rpx;
  84. border-radius: 30rpx;
  85. text-align: center;
  86. }
  87. }
  88. .content3 {
  89. height: calc(100vh - 192rpx);
  90. background: white;
  91. padding: 20rpx;
  92. box-sizing: border-box;
  93. }
  94. .search-item-list {
  95. margin: 20rpx;
  96. border-bottom: 1px solid #EEEEEE;
  97. padding-bottom: 20rpx;
  98. }
  99. </style>