search.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 :style="{fontSize:(wxFontSize)+'px'}">搜索</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" :fontSize="(wxFontSize-2)" 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" :fontSize="(wxFontSize-2)" placeholder="请输入您感兴趣的产品品牌(选填)" cancelButton="none">
  20. <template v-slot:searchIcon>
  21. </template>
  22. </uni-search-bar>
  23. <uni-search-bar radius="30" v-model="prodSpec" :fontSize="(wxFontSize-2)" 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" :style="{fontSize:(wxFontSize-2)+'px'}" @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. wxFontSize: 17
  40. }
  41. },
  42. onLoad(){
  43. const appBaseInfo = wx.getAppBaseInfo();
  44. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  45. },
  46. methods: {
  47. goBack(){
  48. uni.navigateBack();
  49. },
  50. searchProd(){
  51. if(this.prodName||this.brand||this.prodSpec){
  52. uni.setStorageSync('searchProdValue',this.prodName+'/'+this.brand+'/'+this.prodSpec)
  53. }else{
  54. uni.removeStorageSync('searchProdValue');
  55. }
  56. uni.navigateBack();
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. /* 胶囊*/
  63. .tn-custom-nav-bar__back {
  64. width: 60%;
  65. height: 100%;
  66. position: relative;
  67. display: flex;
  68. justify-content: space-evenly;
  69. align-items: center;
  70. box-sizing: border-box;
  71. // background-color: rgba(0, 0, 0, 0.15);
  72. border-radius: 1000rpx;
  73. border: 1rpx solid rgba(255, 255, 255, 0.5);
  74. // color: #333;
  75. font-size: 18px;
  76. .icon {
  77. display: block;
  78. flex: 1;
  79. margin: auto;
  80. text-align: center;
  81. }
  82. }
  83. </style>