123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <template>
- <view class="refuel">
- <!-- 内容 -->
- <zs-list class="store-box" mt="0" @load="loadMore" :status="status">
- <view class="item" v-for="(item,index) in list" :key="index">
- <zs-img :src="item.logoPath" width="200rpx" height="200rpx" radius="full" @click.native="goDetail(item)"></zs-img>
- <view class="info">
- <view class="title">
- {{item.shopVo.shopName}}
- </view>
- <view class="address" >
- 距离你{{(item.shopVo.distance/1000).toFixed(2)}}公里 驾车 11分钟
- </view>
- <view class="activity">
- <view class="price-box">
- <view class="price">
- ¥7.36L
- </view>
- <view class="old-price">
- 国际价 ¥7.92
- </view>
- </view>
- <view class="coupon">
- 可使用优惠券
- </view>
- </view>
-
- </view>
- </view>
- </zs-list>
- </view>
- </template>
- <script>
- import { search } from '@/api/shop.js';
- export default {
- data() {
- return {
- map: null,
- longitude: 0,
- latitude: 0,
- scale:18,
- markers: [],
- destination: '',
- active: 0,
- status: 'more',
- list: [],
- list: [],
- query:{
- menuId:'',
- queryName:'',
- 'location.lat':0,
- 'location.lon':0,
- pageCurrent:1,
- pageSize:10
- }
- }
- },
- methods: {
- goDetail(item) {
- uni.navigateTo({
- url: '/refuel/refuelDetail?'
- })
- },
- loadMore() {
- this.search()
- },
- search() {
- return new Promise((resolve,reject)=>{
- if(this.status == 'noMore') return
- this.status = 'loading'
- search(this.query).then(res=>{
- if(res.state == 'Success'){
- this.list = this.list.concat(res.content.records)
- res.content.records.map((item,index)=>{
- this.markers.push(
- {
- id: index+1,
- latitude: item.shopVo.location.lat,
- longitude: item.shopVo.location.lon,
- zIndex: '1',
- iconPath: '/static/triangle.png',
- width: '18rpx',
- height: '16rpx',
- customCallout: {
- anchorY: 0,
- anchorX: 0,
- display: 'ALWAYS'
- },
- label:{
- content:item.shopVo.shopName,
- fontSize:'10',
- textAlign:'center'
- },
- joinCluster:true
- }
- )
- })
-
- if(this.list.length >= res.content.total){
- this.status = 'noMore'
- }else{
- this.status = 'more'
- this.query.pageCurrent++
- }
- resolve()
- }
- })
- })
- },
- },
- onLoad(option) {
- this.query.menuId = option.id
- },
- onReady() {
- let location = JSON.parse(uni.getStorageSync('location'))
- this.query['location.lat'] = location.latitude
- this.query['location.lon'] = location.longitude
- this.search()
- }
- }
- </script>
- <style lang="scss">
- .refuel {
- background: #F9F9F9;
- padding: 20rpx 24rpx;
- .zs-list {
- // padding-top: 20rpx;
- .item {
- display: flex;
- padding: 24rpx;
- background: #fff;
- border-radius: 16rpx;
- margin-bottom: 20rpx;
- .icon {
- width: 200rpx;
- height: 180rpx;
- border-radius: 8px;
- }
- .info{
- flex: 1;
- padding: 16rpx 0 16rpx 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- .title{
- font-size: 28rpx;
- font-weight: bold;
- width: 340rpx;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- margin-top: 10rpx;
- }
- .address{
- font-weight: 300;
- font-size: 24rpx;
- color: #AAAAAA;
- }
-
- .activity{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .price-box{
- display: flex;
- align-items: center;
- .price{
- font-weight: 600;
- font-size: 32rpx;
- color: #FF4D3A;
- }
- .old-price{
- font-weight: 300;
- font-size: 20rpx;
- color: #AAAAAA;
- text-decoration: line-through;
- margin-left: 10rpx;
- }
- }
- .coupon{
- font-weight: 300;
- font-size: 24rpx;
- color: #FF4D3A;
- }
- }
-
- }
- }
- }
- }
- </style>
|