hotelsearch.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="searchType" style="background: #fff;height: 100vh;">
  3. <van-cell value-class="searchclass">
  4. <template slot="title">
  5. <view class="input-view">
  6. <uni-icon type="search" size="22" color="#666666" />
  7. <input confirm-type="search" class="input" type="text" placeholder="输入搜索关键词"
  8. @input="confirm" />
  9. </view>
  10. </template>
  11. <template>
  12. <view @click="search">搜索</view>
  13. </template>
  14. </van-cell>
  15. <view style="padding: 30upx 18upx;">
  16. <view style="width: 95%;margin: 0 auto;">
  17. <view @click="choseType(1)" :class="tabIndex==1 ? 'active' : ''" class="typeItem">
  18. 综合
  19. </view>
  20. <view @click="choseType(2)" class="typeItem">
  21. <view class="iconClass">
  22. <view :class="tabIndex==2 ? 'active' : ''">上新</view>
  23. <view style="display: flex;flex-direction: column;margin-left: 10rpx;">
  24. <view ><van-icon size="8px" name="arrow-up" :class="istopclick==1 ? 'active' : ''" /></view>
  25. <view>
  26. <van-icon :class="istopclick==2 ? 'active' : ''" size="8px" name="arrow-down" />
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view @click="choseType(3)" class="typeItem">
  32. <view class="iconClass">
  33. <view :class="tabIndex==3 ? 'active' : ''">价格</view>
  34. <view style="display: flex;flex-direction: column;margin-left: 10rpx;">
  35. <view>
  36. <van-icon :class="istopclick==3 ? 'active' : ''" size="8px" name="arrow-up" />
  37. </view>
  38. <view>
  39. <van-icon :class="istopclick==4 ? 'active' : ''" size="8px" name="arrow-down" />
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <shopList :productList="goods_list" />
  47. </view>
  48. </template>
  49. <script>
  50. import uniIcon from '@/component/uni-icon/uni-icon.vue'
  51. import shopList from '@/component/shopList.vue' // 商品列表
  52. export default {
  53. components: {
  54. uniIcon,
  55. shopList
  56. },
  57. onLoad(a) {
  58. this.goodId = a.store_id;
  59. //this.gethotelist();
  60. },
  61. data() {
  62. return {
  63. page: 1,
  64. goodId:0,
  65. tabIndex: 1,
  66. istopclick: 0,
  67. goods_price:'',
  68. goods_commonid:"",
  69. chosegoods_commonid: true,
  70. chosegoods_price: true,
  71. searchvalue:'',
  72. goods_list:[]
  73. }
  74. },
  75. methods: {
  76. search() {
  77. this.getshopdetail();
  78. },
  79. confirm(e) {
  80. this.searchvalue = e.detail.value;
  81. // /this.getshopdetail();
  82. },
  83. // 获取商品详情
  84. getshopdetail() {
  85. if(this.searchvalue == '') {
  86. this.$msg("关键字不能为空")
  87. return;
  88. }
  89. this.request({
  90.                 url:"/v2/entry/storeGoods",
  91.                 method:'get',
  92. data: {
  93. store_id: this.goodId,
  94. page: this.page,
  95. goods_commonid: this.goods_commonid, // 上新排序
  96. goods_price: this.goods_price,
  97. keyword: this.searchvalue
  98. },
  99. success: (res) => {
  100. this.goods_list = this.goods_list.concat(res.data.data.goods_list);
  101. if(res.data.data.goods_list.length < 10) {
  102. this.isDetail = 2;
  103. }
  104. },
  105. })
  106. },
  107. choseType(e) {
  108. this.tabIndex = e;
  109. if(this.searchvalue == '') {
  110. return;
  111. }
  112. this.goods_list = [];
  113. if(this.tabIndex == 1) { // 服务
  114. this.istopclick = 0;
  115. this.gc_id_1 = '';
  116. this.goods_price = '';
  117. this.goods_commonid = '';
  118. }else if(this.tabIndex == 2){ //伤
  119. this.chosegoods_price = true;
  120. this.istopclick = this.chosegoods_commonid?1:2;
  121. this.goods_price = '';
  122. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  123. this.gc_id_1 = '';
  124. this.chosegoods_commonid = !this.chosegoods_commonid;
  125. }else if(this.tabIndex == 3){ // 价格
  126. this.chosegoods_commonid = true;
  127. this.istopclick = this.chosegoods_price?3:4;
  128. this.goods_price = this.chosegoods_price?'desc':'asc';
  129. this.goods_commonid = '';
  130. this.gc_id_1 = '';
  131. this.chosegoods_price = !this.chosegoods_price;
  132. }else if(this.tabIndex ==4) { // 分类
  133. this.istopclick = 0;
  134. this.goods_price = '';
  135. this.goods_commonid = '';
  136. this.chosegoods_price = true;
  137. this.chosegoods_commonid = true;
  138. }
  139. this.getshopdetail();
  140. },
  141. }
  142. }
  143. </script>
  144. <style>
  145. .searchType .input-view {
  146. width: 80%;
  147. display: flex;
  148. background-color: #e7e7e7;
  149. height: 30px;
  150. border-radius: 15px;
  151. padding: 0 4%;
  152. flex-wrap: nowrap;
  153. margin: 7px 0;
  154. line-height: 30px;
  155. margin: 24upx 0 24upx 32upx;
  156. }
  157. .searchType .input-view .uni-icon {
  158. line-height: 30px !important;
  159. }
  160. .searchType .input-view .input {
  161. height: 30px;
  162. line-height: 30px;
  163. width: 94%;
  164. padding: 0 3%;
  165. }
  166. .van-cell__title {
  167. flex: 6!important;
  168. }
  169. .searchclass {
  170. display: flex;
  171. align-items: center;
  172. justify-content: center;
  173. }
  174. .active {
  175. color: #F76260;
  176. }
  177. .typeItem {
  178. width: 33%;
  179. display: inline-block;
  180. text-align: center;
  181. }
  182. .iconClass {
  183. display: flex;
  184. flex-direction: row;
  185. align-items: center;
  186. justify-content: center;
  187. }
  188. </style>