hotelsearch.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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.goods_list = [];
  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. this.istopclick = this.chosegoods_commonid?1:2;
  122. this.goods_price = '';
  123. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  124. this.gc_id_1 = '';
  125. this.chosegoods_commonid = !this.chosegoods_commonid;
  126. }else if(this.tabIndex == 3){ // 价格
  127. this.chosegoods_commonid = true;
  128. this.istopclick = this.chosegoods_price?3:4;
  129. this.goods_price = this.chosegoods_price?'desc':'asc';
  130. this.goods_commonid = '';
  131. this.gc_id_1 = '';
  132. this.chosegoods_price = !this.chosegoods_price;
  133. }else if(this.tabIndex ==4) { // 分类
  134. this.istopclick = 0;
  135. this.goods_price = '';
  136. this.goods_commonid = '';
  137. this.chosegoods_price = true;
  138. this.chosegoods_commonid = true;
  139. }
  140. this.getshopdetail();
  141. },
  142. }
  143. }
  144. </script>
  145. <style>
  146. .searchType .input-view {
  147. width: 80%;
  148. display: flex;
  149. background-color: #e7e7e7;
  150. height: 30px;
  151. border-radius: 15px;
  152. padding: 0 4%;
  153. flex-wrap: nowrap;
  154. margin: 7px 0;
  155. line-height: 30px;
  156. margin: 24upx 0 24upx 32upx;
  157. }
  158. .searchType .input-view .uni-icon {
  159. line-height: 30px !important;
  160. }
  161. .searchType .input-view .input {
  162. height: 30px;
  163. line-height: 30px;
  164. width: 94%;
  165. padding: 0 3%;
  166. }
  167. .van-cell__title {
  168. flex: 6!important;
  169. }
  170. .searchclass {
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. }
  175. .active {
  176. color: #F76260;
  177. }
  178. .typeItem {
  179. width: 33%;
  180. display: inline-block;
  181. text-align: center;
  182. }
  183. .iconClass {
  184. display: flex;
  185. flex-direction: row;
  186. align-items: center;
  187. justify-content: center;
  188. }
  189. </style>