index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="refuel">
  3. <!-- 内容 -->
  4. <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
  5. <view class="item" v-for="(item,index) in list" :key="index">
  6. <zs-img :src="item.logoPath" width="200rpx" height="200rpx" radius="full" @click.native="goDetail(item)"></zs-img>
  7. <view class="info">
  8. <view class="title">
  9. {{item.shopVo.shopName}}
  10. </view>
  11. <view class="address" >
  12. 距离你{{(item.shopVo.distance/1000).toFixed(2)}}公里 驾车 11分钟
  13. </view>
  14. <view class="activity">
  15. <view class="price-box">
  16. <view class="price">
  17. ¥7.36L
  18. </view>
  19. <view class="old-price">
  20. 国际价 ¥7.92
  21. </view>
  22. </view>
  23. <view class="coupon">
  24. 可使用优惠券
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </zs-list>
  30. </view>
  31. </template>
  32. <script>
  33. import { search } from '@/api/shop.js';
  34. export default {
  35. data() {
  36. return {
  37. map: null,
  38. longitude: 0,
  39. latitude: 0,
  40. scale:18,
  41. markers: [],
  42. destination: '',
  43. active: 0,
  44. status: 'more',
  45. list: [],
  46. list: [],
  47. query:{
  48. menuId:'',
  49. queryName:'',
  50. 'location.lat':0,
  51. 'location.lon':0,
  52. pageCurrent:1,
  53. pageSize:10
  54. }
  55. }
  56. },
  57. methods: {
  58. goDetail(item) {
  59. uni.navigateTo({
  60. url: '/refuel/refuelDetail?'
  61. })
  62. },
  63. loadMore() {
  64. this.search()
  65. },
  66. search() {
  67. return new Promise((resolve,reject)=>{
  68. if(this.status == 'noMore') return
  69. this.status = 'loading'
  70. search(this.query).then(res=>{
  71. if(res.state == 'Success'){
  72. this.list = this.list.concat(res.content.records)
  73. res.content.records.map((item,index)=>{
  74. this.markers.push(
  75. {
  76. id: index+1,
  77. latitude: item.shopVo.location.lat,
  78. longitude: item.shopVo.location.lon,
  79. zIndex: '1',
  80. iconPath: '/static/triangle.png',
  81. width: '18rpx',
  82. height: '16rpx',
  83. customCallout: {
  84. anchorY: 0,
  85. anchorX: 0,
  86. display: 'ALWAYS'
  87. },
  88. label:{
  89. content:item.shopVo.shopName,
  90. fontSize:'10',
  91. textAlign:'center'
  92. },
  93. joinCluster:true
  94. }
  95. )
  96. })
  97. if(this.list.length >= res.content.total){
  98. this.status = 'noMore'
  99. }else{
  100. this.status = 'more'
  101. this.query.pageCurrent++
  102. }
  103. resolve()
  104. }
  105. })
  106. })
  107. },
  108. },
  109. onLoad(option) {
  110. this.query.menuId = option.id
  111. },
  112. onReady() {
  113. let location = JSON.parse(uni.getStorageSync('location'))
  114. this.query['location.lat'] = location.latitude
  115. this.query['location.lon'] = location.longitude
  116. this.search()
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. .refuel {
  122. background: #F9F9F9;
  123. padding: 20rpx 24rpx;
  124. .zs-list {
  125. // padding-top: 20rpx;
  126. .item {
  127. display: flex;
  128. padding: 24rpx;
  129. background: #fff;
  130. border-radius: 16rpx;
  131. margin-bottom: 20rpx;
  132. .icon {
  133. width: 200rpx;
  134. height: 180rpx;
  135. border-radius: 8px;
  136. }
  137. .info{
  138. flex: 1;
  139. padding: 16rpx 0 16rpx 20rpx;
  140. display: flex;
  141. flex-direction: column;
  142. justify-content: space-between;
  143. .title{
  144. font-size: 28rpx;
  145. font-weight: bold;
  146. width: 340rpx;
  147. white-space: nowrap;
  148. overflow: hidden;
  149. text-overflow: ellipsis;
  150. margin-top: 10rpx;
  151. }
  152. .address{
  153. font-weight: 300;
  154. font-size: 24rpx;
  155. color: #AAAAAA;
  156. }
  157. .activity{
  158. display: flex;
  159. align-items: center;
  160. justify-content: space-between;
  161. .price-box{
  162. display: flex;
  163. align-items: center;
  164. .price{
  165. font-weight: 600;
  166. font-size: 32rpx;
  167. color: #FF4D3A;
  168. }
  169. .old-price{
  170. font-weight: 300;
  171. font-size: 20rpx;
  172. color: #AAAAAA;
  173. text-decoration: line-through;
  174. margin-left: 10rpx;
  175. }
  176. }
  177. .coupon{
  178. font-weight: 300;
  179. font-size: 24rpx;
  180. color: #FF4D3A;
  181. }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. </style>