shopList.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="shopList">
  3. <view class="sub-title">
  4. 自助餐厅,不支持外卖
  5. </view>
  6. <view class="step-box">
  7. <view class="step-item" v-for="(item,index) in iconList" :key="index">
  8. <view class="step-content">
  9. <image class="icon" :src="item.icon" mode=""></image>
  10. <view class="title">
  11. {{item.title}}
  12. </view>
  13. </view>
  14. <image v-if="index<3" class="arrow" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/raTdgnQlHfUu9455bbfe63b68d3de6aac3f0ace0f0fa.png/1.png" mode=""></image>
  15. </view>
  16. </view>
  17. <view class="search-box">
  18. <view class="city" @click="chooseCity">
  19. {{city}}
  20. <image class="arrow" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/zxcYhNinF6bA08f2a8a2c1cfcf4953f9f58d9e01fb65.png/1.png" mode=""></image>
  21. </view>
  22. <input class="search-input" @input="input" type="text" placeholder="请输入关键字搜索" v-model="query.jsonString['shop.shopName']" />
  23. </view>
  24. <view class="tab-box">
  25. <view class="tab-item" :class="[active == 1?'active':'']" @click="handleTab(1)">
  26. <view class="title">
  27. 附近餐厅
  28. </view>
  29. <view class="num">
  30. {{total}}
  31. </view>
  32. </view>
  33. <!-- <view class="tab-item" :class="[active == 2?'active':'']" @click="handleTab(2)">
  34. <view class="title">
  35. 收藏的餐厅
  36. </view>
  37. <view class="num">
  38. 99
  39. </view>
  40. </view> -->
  41. </view>
  42. <zs-list mt="0" @load="loadMore" :status="status">
  43. <view class="shop-item" v-for="item in list" :key="item.id" @click="handleItem(item.pid)">
  44. <view class="title">
  45. {{item.title}}
  46. </view>
  47. <view class="address">
  48. {{item.address}}
  49. </view>
  50. <view class="distance-box">
  51. <image class="icon" src="https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/dcVu4aDpGqtEb448adf2015d6df676865bae8811712f.png/1.png" mode=""></image>
  52. <view class="distance">
  53. {{item.distance.toFixed(2)}}km
  54. </view>
  55. </view>
  56. </view>
  57. </zs-list>
  58. </view>
  59. </template>
  60. <script>
  61. import {debounce} from '@/utils/tool.js'
  62. import {getFoodShopList} from '@/api/orderFood';
  63. export default {
  64. data() {
  65. return {
  66. query:{
  67. latitude: 30.57447,
  68. longitude: 103.92377,
  69. distance: 1000000000,
  70. regionCode:'',
  71. productType:'Restaurant',
  72. jsonString:{ot:"XBK",'shop.shopName': ""},
  73. page:0,
  74. size:10
  75. },
  76. total:0,
  77. search:'',
  78. city:uni.getStorageSync('HomeCity')||uni.getStorageSync('city'),
  79. status: 'more',
  80. active:1,
  81. list:[],
  82. iconList:[
  83. {
  84. icon:'https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/i2UtMJa19SdPa7c5a75ed573099d17655f14438bca4a.png/1.png',
  85. title:'选择门店'
  86. },
  87. {
  88. icon:'https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/0z35goC7xh0k36fdd6deed90b8d46f37f4a28c399c48.png/1.png',
  89. title:'选择饮品'
  90. },
  91. {
  92. icon:'https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/GouemYUdFFqx399dd566771ccef15fe744ad8629b19c.png/1.png',
  93. title:'等待取餐码'
  94. },
  95. {
  96. icon:'https://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/zsWQBVQJo8DOe5778c87a4e22e574ad51e9c4a3ac0ed.png/1.png',
  97. title:'到点取餐'
  98. }
  99. ]
  100. }
  101. },
  102. methods: {
  103. input:debounce(function(val) {
  104. this.status = 'more'
  105. this.query.page = 0
  106. this.list = []
  107. this.getFoodShopList()
  108. }),
  109. loadMore() {
  110. this.getFoodShopList()
  111. },
  112. handleTab(val ){
  113. this.active = val
  114. },
  115. chooseCity(){
  116. uni.navigateTo({
  117. url:`/hotel/cityList?backUrl=/orderFood/shopList`
  118. })
  119. },
  120. handleItem(id){
  121. uni.navigateTo({
  122. url:'/orderFood/shopDetail?id='+id
  123. })
  124. },
  125. getFoodShopList(){
  126. this.status = 'loading'
  127. let query = JSON.parse(JSON.stringify(this.query))
  128. if(!query.jsonString['shop.shopName']){
  129. console.log(query);
  130. delete query.jsonString['shop.shopName']
  131. }
  132. query.jsonString = JSON.stringify(query.jsonString)
  133. getFoodShopList(query).then(res=>{
  134. if(res.state = 'Success'){
  135. console.log(res);
  136. this.list = this.list.concat(res.content.content)
  137. this.total = res.content.totalElements
  138. if(this.list.length >= res.content.totalElements){
  139. this.status = 'noMore'
  140. }else{
  141. this.status = 'more'
  142. this.query.page++
  143. }
  144. }
  145. })
  146. }
  147. },
  148. onLoad(options){
  149. // this.query.regionCode = options.regionCode||uni.getStorageSync('regionCode')
  150. if(options.regionCode){
  151. this.city = uni.getStorageSync('HomeCity')
  152. this.query.regionCode = options.regionCode
  153. }else{
  154. this.query.regionCode = uni.getStorageSync('regionCode')
  155. this.city = uni.getStorageSync('city')
  156. }
  157. this.query.jsonString.ot = uni.getStorageSync('ot')
  158. let location = JSON.parse(uni.getStorageSync('location'))
  159. this.query.latitude = location.latitude
  160. this.query.longitude = location.longitude
  161. }
  162. }
  163. </script>
  164. <style lang="scss" >
  165. .shopList{
  166. background: #F9F9F9;
  167. min-height: 100vh;
  168. .sub-title{
  169. font-weight: 800;
  170. font-size: 32rpx;
  171. color: #222222;
  172. background: #FFFFFF;
  173. text-align: center;
  174. }
  175. .step-box{
  176. display: flex;
  177. justify-content: space-between;
  178. background: #FFFFFF;
  179. border-radius: 0rpx 0rpx 40rpx 40rpx;
  180. padding: 28rpx 60rpx;
  181. .step-item{
  182. display: flex;
  183. align-items: center;
  184. .step-content{
  185. text-align: center;
  186. .icon{
  187. width: 80rpx;
  188. height: 80rpx;
  189. }
  190. .title{
  191. font-size: 24rpx;
  192. color: #222222;
  193. margin-top: 20rpx;
  194. }
  195. }
  196. .arrow{
  197. width: 70rpx;
  198. height: 6rpx;
  199. margin-top: -55rpx;
  200. }
  201. }
  202. }
  203. .search-box{
  204. display: flex;
  205. align-items: center;
  206. height: 72rpx;
  207. background: #FFFFFF;
  208. border-radius: 40rpx 40rpx 40rpx 40rpx;
  209. margin: 0 24rpx;
  210. padding: 12rpx 24rpx;
  211. box-sizing: border-box;
  212. margin-top: 32rpx;
  213. .city{
  214. display: flex;
  215. align-items: center;
  216. font-weight: bold;
  217. font-size: 28rpx;
  218. color: #222222;
  219. padding-right: 14rpx;
  220. border-right:2rpx solid #F0F0F0;
  221. .arrow{
  222. width: 48rpx;
  223. height: 48rpx;
  224. }
  225. }
  226. .search-input{
  227. flex: 1;
  228. padding: 0 20rpx;
  229. }
  230. }
  231. .tab-box{
  232. display: flex;
  233. align-items: center;
  234. .tab-item{
  235. display: flex;
  236. align-items: center;
  237. justify-content: center;
  238. flex: 1;
  239. padding: 28rpx 0;
  240. .title{
  241. font-weight: bold;
  242. font-size: 36rpx;
  243. color: #222222;
  244. }
  245. .num{
  246. color: #fff;
  247. font-size: 24rpx;
  248. min-width: 28rpx;
  249. text-align: center;
  250. height: 28rpx;
  251. line-height: 28rpx;
  252. padding: 2rpx 6rpx;
  253. border-radius: 14rpx;
  254. background: #AAAAAA;
  255. box-sizing: border-box;
  256. }
  257. }
  258. .tab-item.active{
  259. .num{
  260. background: #FF4D3A;
  261. }
  262. }
  263. }
  264. .zs-list{
  265. margin: 0 24rpx;
  266. .shop-item{
  267. padding: 28rpx;
  268. background: #FFFFFF;
  269. border-radius: 16rpx 16rpx 16rpx 16rpx;
  270. margin-bottom: 20rpx;
  271. .title{
  272. font-weight: 800;
  273. font-size: 32rpx;
  274. color: #222222;
  275. }
  276. .address{
  277. font-size: 24rpx;
  278. color: #AAAAAA;
  279. margin-top: 16rpx;
  280. }
  281. .distance-box{
  282. display: flex;
  283. align-items: center;
  284. margin-top: 16rpx;
  285. .icon{
  286. width: 28rpx;
  287. height: 28rpx;
  288. }
  289. .distance{
  290. font-size: 24rpx;
  291. color: #222222;
  292. margin-left: 4rpx;
  293. }
  294. }
  295. }
  296. }
  297. }
  298. </style>