hotelsearch.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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 @click="choseType(1)" :class="tabIndex==1 ? 'active' : ''" class="typeItem">
  45. 综合
  46. </view>
  47. <view @click="choseType(2)" class="typeItem">
  48. <view class="iconClass">
  49. <view :class="tabIndex==2 ? 'active' : ''">上新</view>
  50. <view v-if="istopclick==0">
  51. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort.png' />
  52. </view>
  53. <view v-if="istopclick==1">
  54. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_down.png' />
  55. </view>
  56. <view v-if="istopclick==2">
  57. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_up.png' />
  58. </view>
  59. </view>
  60. </view>
  61. <view @click="choseType(3)" class="typeItem">
  62. <view class="iconClass">
  63. <view :class="tabIndex==3 ? 'active' : ''">价格</view>
  64. <view style="display: flex;flex-direction: column;margin-left: 10rpx;">
  65. <view v-if="isprice==0">
  66. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort.png' />
  67. </view>
  68. <view v-if="isprice==3">
  69. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_down.png' />
  70. </view>
  71. <view v-if="isprice==4">
  72. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_up.png' />
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. <shopList :goodId="goodId" :productList="goods_list" />
  80. </view>
  81. </template>
  82. <script>
  83. import uniIcon from '@/component/uni-icon/uni-icon.vue'
  84. import shopList from '@/component/shopList.vue' // 商品列表
  85. export default {
  86. components: {
  87. uniIcon,
  88. shopList
  89. },
  90. onLoad(a) {
  91. this.goodId = a.store_id;
  92. //this.gethotelist();
  93. },
  94. data() {
  95. return {
  96. isprice: 0,
  97. page: 1,
  98. goodId:0,
  99. tabIndex: 1,
  100. istopclick: 0,
  101. goods_price:'',
  102. goods_commonid:"",
  103. chosegoods_commonid: true,
  104. chosegoods_price: true,
  105. searchvalue:'',
  106. goods_list:[]
  107. }
  108. },
  109. methods: {
  110. search() {
  111. this.goods_list = [];
  112. this.getshopdetail();
  113. },
  114. confirm(e) {
  115. this.searchvalue = e.detail.value;
  116. // /this.getshopdetail();
  117. },
  118. // 获取商品详情
  119. getshopdetail(e) {
  120. if(this.searchvalue == '') {
  121. this.$msg("关键字不能为空")
  122. return;
  123. }
  124. this.request({
  125.                 url:"/v2/entry/storeGoods",
  126.                 method:'get',
  127. data: {
  128. store_id: this.goodId,
  129. page: this.page,
  130. goods_commonid: this.goods_commonid, // 上新排序
  131. goods_price: this.goods_price,
  132. keyword: this.searchvalue
  133. },
  134. success: (res) => {
  135. if(e == 2) {
  136. this.goods_list = [];
  137. }
  138. this.goods_list = this.goods_list.concat(res.data.data.goods_list);
  139. if(res.data.data.goods_list.length < 10) {
  140. this.isDetail = 2;
  141. }
  142. },
  143. })
  144. },
  145. choseType(e) {
  146. if(this.searchvalue == '') {
  147. this.$msg("关键字不能为空")
  148. return;
  149. }
  150. this.page = 1;
  151. this.tabIndex = e;
  152. //this.goods_list = [];
  153. if(this.tabIndex == 1) { // 服务
  154. this.istopclick = 0;
  155. this.isprice = 0;
  156. this.gc_id_2 = '';
  157. this.goods_price = '';
  158. this.goods_commonid = '';
  159. this.getshopdetail(2);
  160. }else if(this.tabIndex == 2){ //伤
  161. this.chosegoods_price = true;
  162. this.istopclick = this.chosegoods_commonid?1:2;
  163. this.isprice = 0;
  164. this.goods_price = '';
  165. this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  166. //this.gc_id_1 = '';
  167. this.chosegoods_commonid = !this.chosegoods_commonid;
  168. this.getshopdetail(2);
  169. }else if(this.tabIndex == 3){ // 价格
  170. this.chosegoods_commonid = true;
  171. this.isprice = this.chosegoods_price?3:4;
  172. this.goods_price = this.chosegoods_price?'desc':'asc';
  173. this.goods_commonid = '';
  174. this.istopclick = 0;
  175. //this.gc_id_1 = '';
  176. this.chosegoods_price = !this.chosegoods_price;
  177. this.getshopdetail(2);
  178. }
  179. // this.tabIndex = e;
  180. // if(this.searchvalue == '') {
  181. // return;
  182. // }
  183. // this.goods_list = [];
  184. // if(this.tabIndex == 1) { // 服务
  185. // this.istopclick = 0;
  186. // this.gc_id_1 = '';
  187. // this.goods_price = '';
  188. // this.goods_commonid = '';
  189. // }else if(this.tabIndex == 2){ //伤
  190. // this.chosegoods_price = true;
  191. // this.istopclick = this.chosegoods_commonid?1:2;
  192. // this.goods_price = '';
  193. // this.goods_commonid = this.chosegoods_commonid?'asc':'desc';
  194. // this.gc_id_1 = '';
  195. // this.chosegoods_commonid = !this.chosegoods_commonid;
  196. // }else if(this.tabIndex == 3){ // 价格
  197. // this.chosegoods_commonid = true;
  198. // this.istopclick = this.chosegoods_price?3:4;
  199. // this.goods_price = this.chosegoods_price?'desc':'asc';
  200. // this.goods_commonid = '';
  201. // this.gc_id_1 = '';
  202. // this.chosegoods_price = !this.chosegoods_price;
  203. // }else if(this.tabIndex ==4) { // 分类
  204. // this.istopclick = 0;
  205. // this.goods_price = '';
  206. // this.goods_commonid = '';
  207. // this.chosegoods_price = true;
  208. // this.chosegoods_commonid = true;
  209. // }
  210. },
  211. }
  212. }
  213. </script>
  214. <style>
  215. .searchType .input-view {
  216. width: 80%;
  217. display: flex;
  218. background-color: #e7e7e7;
  219. height: 30px;
  220. border-radius: 15px;
  221. padding: 0 4%;
  222. flex-wrap: nowrap;
  223. margin: 7px 0;
  224. line-height: 30px;
  225. margin: 24upx 0 24upx 32upx;
  226. }
  227. .searchType .input-view .uni-icon {
  228. line-height: 30px !important;
  229. }
  230. .searchType .input-view .input {
  231. height: 30px;
  232. line-height: 30px;
  233. width: 94%;
  234. padding: 0 3%;
  235. }
  236. .van-cell__title {
  237. flex: 6!important;
  238. }
  239. .searchclass {
  240. display: flex;
  241. align-items: center;
  242. justify-content: center;
  243. }
  244. .active {
  245. color: #F76260;
  246. }
  247. .typeItem {
  248. width: 33%;
  249. display: inline-block;
  250. text-align: center;
  251. }
  252. .iconClass {
  253. display: flex;
  254. flex-direction: row;
  255. align-items: center;
  256. justify-content: center;
  257. }
  258. </style>