hotelsearch.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. console.log(a);
  59. this.goodId = a.store_id;
  60. //this.gethotelist();
  61. },
  62. data() {
  63. return {
  64. page: 1,
  65. goodId:0,
  66. tabIndex: 1,
  67. istopclick: 0,
  68. goods_price:'',
  69. goods_commonid:"",
  70. chosegoods_commonid: true,
  71. chosegoods_price: true,
  72. searchvalue:'',
  73. goods_list:[]
  74. }
  75. },
  76. methods: {
  77. search() {
  78. this.getshopdetail();
  79. },
  80. confirm(e) {
  81. this.searchvalue = e.detail.value;
  82. // /this.getshopdetail();
  83. },
  84. // 获取商品详情
  85. getshopdetail() {
  86. if(this.searchvalue == '') {
  87. this.$msg("关键字不能为空")
  88. return;
  89. }
  90. this.request({
  91.                 url:"/v2/entry/storeGoods",
  92.                 method:'get',
  93. data: {
  94. store_id: this.goodId,
  95. page: this.page,
  96. goods_commonid: this.goods_commonid, // 上新排序
  97. goods_price: this.goods_price,
  98. keyword: this.searchvalue
  99. },
  100. success: (res) => {
  101. this.goods_list = this.goods_list.concat(res.data.data.goods_list);
  102. if(res.data.data.goods_list.length < 10) {
  103. this.isDetail = 2;
  104. }
  105. },
  106. })
  107. },
  108. choseType(e) {
  109. this.tabIndex = e;
  110. if(this.searchvalue == '') {
  111. return;
  112. }
  113. this.goods_list = [];
  114. if(this.tabIndex == 1) { // 服务
  115. this.istopclick = 0;
  116. this.gc_id_1 = '';
  117. this.goods_price = '';
  118. this.goods_commonid = '';
  119. }else if(this.tabIndex == 2){ //伤
  120. this.chosegoods_price = true;
  121. console.log(this.chosegoods_commonid);
  122. this.istopclick = this.chosegoods_commonid?1:2;
  123. this.goods_price = '';
  124. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  125. this.gc_id_1 = '';
  126. this.chosegoods_commonid = !this.chosegoods_commonid;
  127. }else if(this.tabIndex == 3){ // 价格
  128. this.chosegoods_commonid = true;
  129. console.log(this.chosegoods_price);
  130. this.istopclick = this.chosegoods_price?3:4;
  131. this.goods_price = this.chosegoods_price?'desc':'asc';
  132. this.goods_commonid = '';
  133. this.gc_id_1 = '';
  134. this.chosegoods_price = !this.chosegoods_price;
  135. }else if(this.tabIndex ==4) { // 分类
  136. this.istopclick = 0;
  137. this.goods_price = '';
  138. this.goods_commonid = '';
  139. this.chosegoods_price = true;
  140. this.chosegoods_commonid = true;
  141. }
  142. this.getshopdetail();
  143. },
  144. }
  145. }
  146. </script>
  147. <style>
  148. .searchType .input-view {
  149. width: 80%;
  150. display: flex;
  151. background-color: #e7e7e7;
  152. height: 30px;
  153. border-radius: 15px;
  154. padding: 0 4%;
  155. flex-wrap: nowrap;
  156. margin: 7px 0;
  157. line-height: 30px;
  158. margin: 24upx 0 24upx 32upx;
  159. }
  160. .searchType .input-view .uni-icon {
  161. line-height: 30px !important;
  162. }
  163. .searchType .input-view .input {
  164. height: 30px;
  165. line-height: 30px;
  166. width: 94%;
  167. padding: 0 3%;
  168. }
  169. .van-cell__title {
  170. flex: 6!important;
  171. }
  172. .searchclass {
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. }
  177. .active {
  178. color: #F76260;
  179. }
  180. .typeItem {
  181. width: 33%;
  182. display: inline-block;
  183. text-align: center;
  184. }
  185. .iconClass {
  186. display: flex;
  187. flex-direction: row;
  188. align-items: center;
  189. justify-content: center;
  190. }
  191. </style>