search.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view style="background-color: #f7f7f7;min-height: 100vh;">
  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%;" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  15. <uni-search-bar radius="30" bgColor="#fff" :focus="true" :fontSize="(wxFontSize-2)" v-model="prodName" placeholder="请输入您感兴趣的产品名称(选填)" cancelButton="none">
  16. <template v-slot:searchIcon>
  17. <image src="../../static/tu/search.png" style="width: 26px;height: 26px"></image>
  18. </template>
  19. </uni-search-bar>
  20. <uni-search-bar radius="30" bgColor="#fff" v-model="brand" :fontSize="(wxFontSize-2)" placeholder="请输入您感兴趣的产品品牌(选填)" cancelButton="none">
  21. <template v-slot:searchIcon>
  22. <image src="../../static/tu/search.png" style="width: 26px;height: 26px"></image>
  23. </template>
  24. </uni-search-bar>
  25. <uni-search-bar radius="30" bgColor="#fff" v-model="prodSpec" :fontSize="(wxFontSize-2)" placeholder="请输入您感兴趣的产品型号(选填)" cancelButton="none">
  26. <template v-slot:searchIcon>
  27. <image src="../../static/tu/search.png" style="width: 26px;height: 26px"></image>
  28. </template>
  29. </uni-search-bar>
  30. <button type="primary" style="background-color:#005DA6;border-radius: 8px;margin: 16px;" :style="{fontSize:(wxFontSize-2)+'px'}" @click="searchProd">搜索</button>
  31. <!-- <button type="primary" style="border-radius:30px;background-color: #3a96d7;" radius @click="searchProd">搜索</button> -->
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. brand: '',
  40. prodName:'',
  41. prodSpec: '',
  42. wxFontSize: 17
  43. }
  44. },
  45. onLoad(){
  46. const appBaseInfo = wx.getAppBaseInfo();
  47. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  48. },
  49. methods: {
  50. goBack(){
  51. uni.navigateBack();
  52. },
  53. searchProd(){
  54. if(this.prodName||this.brand||this.prodSpec){
  55. uni.setStorageSync('searchProdValue',this.prodName+'/'+this.brand+'/'+this.prodSpec)
  56. }else{
  57. uni.removeStorageSync('searchProdValue');
  58. }
  59. uni.navigateBack();
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. /* 胶囊*/
  66. .tn-custom-nav-bar__back {
  67. width: 60%;
  68. height: 100%;
  69. position: relative;
  70. display: flex;
  71. justify-content: space-evenly;
  72. align-items: center;
  73. box-sizing: border-box;
  74. // background-color: rgba(0, 0, 0, 0.15);
  75. border-radius: 1000rpx;
  76. border: 1rpx solid rgba(255, 255, 255, 0.5);
  77. // color: #333;
  78. font-size: 18px;
  79. .icon {
  80. display: block;
  81. flex: 1;
  82. margin: auto;
  83. text-align: center;
  84. }
  85. }
  86. </style>