shopList.vue 7.1 KB

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