hoteldetail.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view>
  3. <scroll-view style="height: 100vh;" class="floor-list"
  4. :scroll-top="scrollTop" scroll-y="true" @scroll="scroll" @scrolltoupper="upper" @scrolltolower="lower"
  5. refresher-enabled="true">
  6. <view style="padding: 40upx 18upx;">
  7. <view style="width: 95%;margin: 0 auto;">
  8. <view @click="choseType(1)" :class="tabIndex==1 ? 'active' : ''" class="typeItem">
  9. 综合
  10. </view>
  11. <view @click="choseType(2)" class="typeItem">
  12. <view class="iconClass">
  13. <view :class="tabIndex==2 ? 'active' : ''">上新</view>
  14. <view v-if="istopclick==0">
  15. <!-- <van-icon size="8px" name="arrow-up" :class="istopclick==1 ? 'active' : ''" /> -->
  16. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort.png' />
  17. </view>
  18. <view v-if="istopclick==1">
  19. <!-- <van-icon size="8px" name="arrow-up" :class="istopclick==1 ? 'active' : ''" /> -->
  20. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_down.png' />
  21. </view>
  22. <view v-if="istopclick==2">
  23. <!-- <van-icon :class="istopclick==2 ? 'active' : ''" size="8px" name="arrow-down" /> -->
  24. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_up.png' />
  25. </view>
  26. </view>
  27. </view>
  28. <view @click="choseType(3)" class="typeItem">
  29. <view class="iconClass">
  30. <view :class="tabIndex==3 ? 'active' : ''">价格</view>
  31. <view style="display: flex;flex-direction: column;margin-left: 10rpx;">
  32. <view v-if="isprice==0">
  33. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort.png' />
  34. </view>
  35. <view v-if="isprice==3">
  36. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_down.png' />
  37. </view>
  38. <view v-if="isprice==4">
  39. <img style="width: 36upx;height: 36upx;vertical-align: middle;" src='../../static/sort_up.png' />
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view @click.stop="choseType(4)" class="typeItem">
  45. <view :class="tabIndex==4 ? 'active' : ''">分类
  46. <img v-if="tabIndex != 4" style="width: 36upx;height: 36upx;" src='../../static/sortb.png' />
  47. <img v-if="tabIndex == 4" style="width: 36upx;height: 36upx;" src='../../static/sortb_up.png' />
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <view style="padding: 10upx 12upx;display: flex;flex-wrap: wrap;" v-if="tabIndex==4">
  53. <view style=" flex: 1;width: 20%;min-width: 20%;max-width: 20%;margin: 24rpx 0 25rpx 4%;"
  54. v-for="(item, index) in category_list" :key="index"
  55. @click.stop="confirm(item)" >
  56. {{item.gc_name}}
  57. </view>
  58. </view>
  59. <!-- 商品列表 -->
  60. <shopList :productList="goods_list" />
  61. </scroll-view>
  62. </view>
  63. </template>
  64. <script>
  65. import shopList from '@/component/shopList.vue' // 商品列表
  66. export default {
  67. components: {
  68. shopList
  69. },
  70. data() {
  71. return {
  72. isprice: 0,
  73. goods_list:[],
  74. scrollTop: 0,
  75. old: {
  76. scrollTop: 0
  77. },
  78. chosegoods_commonid: true,
  79. chosegoods_price: true,
  80. ispull: false,
  81. istopclick: 0,
  82. tabIndex: 1,
  83. title:'',
  84. store_id:'',
  85. category_list:[],
  86. page: 1,
  87. page_size: 10,
  88. gc_id_1:'',// 一级分类id
  89. gc_id_2:'',// 二级分类id
  90. goods_commonid:'',// 上新排序 desc-降序 asc-尚需
  91. goods_price :'',// 价格排序 desc-降序 asc-尚需
  92. praise :'',// 好评率排序 desc-降序 asc-尚需
  93. }
  94. },
  95. onLoad(options){
  96. console.log(options)
  97. this.title = options.gc_name;
  98. this.gc_id_1 = options.id;
  99. this.store_id = options.store_id;
  100. uni.setNavigationBarTitle({
  101. title: options.gc_name
  102. });
  103. this.getshopdetail();
  104. this.hotelsecondmenu(); // 二级菜单
  105. },
  106. methods: {
  107. choseType(e) {
  108. this.page = 1;
  109. this.tabIndex = e;
  110. this.goods_list = [];
  111. if(this.tabIndex == 1) { // 服务
  112. this.istopclick = 0;
  113. this.isprice = 0;
  114. this.gc_id_2 = '';
  115. this.goods_price = '';
  116. this.goods_commonid = '';
  117. }else if(this.tabIndex == 2){ //伤
  118. this.chosegoods_price = true;
  119. console.log(this.chosegoods_commonid);
  120. this.istopclick = this.chosegoods_commonid?1:2;
  121. this.isprice = 0;
  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. console.log(this.chosegoods_price);
  129. this.isprice = this.chosegoods_price?3:4;
  130. this.goods_price = this.chosegoods_price?'desc':'asc';
  131. this.goods_commonid = '';
  132. this.istopclick = 0;
  133. //this.gc_id_1 = '';
  134. this.chosegoods_price = !this.chosegoods_price;
  135. }else if(this.tabIndex ==4) { // 分类
  136. this.istopclick = 0;
  137. this.isprice = 0;
  138. this.goods_price = '';
  139. this.goods_commonid = '';
  140. this.chosegoods_price = true;
  141. this.chosegoods_commonid = true;
  142. }
  143. this.getshopdetail();
  144. },
  145. // 点击图标上下筛选切换
  146. changeisclick(e) {
  147. },
  148. confirm(e) {
  149. console.log(e);
  150. this.tabIndex = 0;
  151. console.log(this.tabIndex);
  152. this.gc_id_2 = e.gc_id;
  153. this.getshopdetail();
  154. },
  155. // 获取商品详情
  156. getshopdetail() {
  157. let _this = this;
  158. this.request({
  159.                 url:"/v2/entry/storeGoods",
  160.                 method:'get',
  161. data: {
  162. store_id: _this.store_id,
  163. page: _this.page,
  164. goods_commonid: _this.goods_commonid, // 上新排序
  165. goods_price: _this.goods_price,
  166. gc_id_1: _this.gc_id_1,
  167. gc_id_2: _this.gc_id_2
  168. },
  169. success: function(res) {
  170. if(res.data.data.goods_list.length>10) {
  171. _this.ispill = true;
  172. }else {
  173. _this.ispill = false;
  174. }
  175. _this.goods_list = _this.goods_list.concat(res.data.data.goods_list);
  176. },
  177. })
  178. },
  179. // 二级菜单
  180. hotelsecondmenu(){
  181. let that = this;
  182. this.request({
  183. url:'/v1/entry/storeCategory2',
  184. method:'POST',
  185. data: {
  186. store_id: this.store_id,
  187. gc_id: this.gc_id_1
  188. },
  189. success: function(res) {
  190. let { category_list } = res.data.data;
  191. let array = [{gc_id:'',gc_name:'全部'}];
  192. that.category_list = array.concat(category_list)
  193. console.log(that.category_list)
  194. }
  195. })
  196. },
  197. // 滚动到顶部
  198. upper(e) {
  199. console.log("顶部")
  200. },
  201. // 滚到底部
  202. lower(e) {
  203. if(this.ispill) {
  204. this.page = this.page + 1;
  205. this.getshopdetail();
  206. }
  207. },
  208. // 滚动时触发
  209. scroll(e) {
  210. this.old.scrollTop = e.detail.scrollTop
  211. }
  212. }
  213. }
  214. </script>
  215. <style>
  216. .active {
  217. color: #F76260;
  218. }
  219. .typeItem {
  220. width: 25%;
  221. display: inline-block;
  222. text-align: center;
  223. }
  224. .iconClass {
  225. display: flex;
  226. flex-direction: row;
  227. align-items: center;
  228. justify-content: center;
  229. }
  230. </style>