search.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <view>
  3. <tn-nav-bar fixed alpha customBack>
  4. <view slot="back" class='tn-custom-nav-bar__back'
  5. @click="goBack">
  6. <text class='icon tn-icon-left'></text>
  7. </view>
  8. <view slot="default">
  9. <view>
  10. <text>搜索</text>
  11. </view>
  12. </view>
  13. </tn-nav-bar>
  14. <view style="width: 100%;padding:16px" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  15. <uni-search-bar radius="30" :focus="true" v-model="prodName" placeholder="请输入您感兴趣的产品名称(选填)" cancelButton="none">
  16. <template v-slot:searchIcon>
  17. </template>
  18. </uni-search-bar>
  19. <uni-search-bar radius="30" v-model="brand" placeholder="请输入您感兴趣的产品品牌(选填)" cancelButton="none">
  20. <template v-slot:searchIcon>
  21. </template>
  22. </uni-search-bar>
  23. <uni-search-bar radius="30" v-model="prodSpec" placeholder="请输入您感兴趣的产品型号(选填)" cancelButton="none">
  24. <template v-slot:searchIcon>
  25. </template>
  26. </uni-search-bar>
  27. <button type="primary" style="background-color:#1d60b1;border-radius: 23px" @click="searchProd">搜索</button>
  28. <!-- <button type="primary" style="border-radius:30px;background-color: #3a96d7;" radius @click="searchProd">搜索</button> -->
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. brand: '',
  37. prodName:'',
  38. prodSpec: '',
  39. }
  40. },
  41. methods: {
  42. goBack(){
  43. uni.navigateBack();
  44. },
  45. searchProd(){
  46. if(this.prodName||this.brand||this.prodSpec){
  47. uni.setStorageSync('searchProdValue',this.prodName+'/'+this.brand+'/'+this.prodSpec)
  48. }else{
  49. uni.removeStorageSync('searchProdValue');
  50. }
  51. uni.navigateBack();
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss" scoped>
  57. /* 胶囊*/
  58. .tn-custom-nav-bar__back {
  59. width: 60%;
  60. height: 100%;
  61. position: relative;
  62. display: flex;
  63. justify-content: space-evenly;
  64. align-items: center;
  65. box-sizing: border-box;
  66. // background-color: rgba(0, 0, 0, 0.15);
  67. border-radius: 1000rpx;
  68. border: 1rpx solid rgba(255, 255, 255, 0.5);
  69. // color: #333;
  70. font-size: 18px;
  71. .icon {
  72. display: block;
  73. flex: 1;
  74. margin: auto;
  75. text-align: center;
  76. }
  77. }
  78. </style>