123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292 |
- <style lang="scss">
- .m-app{
-
- }
- .mpp{
- padding: 10px 20rpx;
- }
- .sreach{
- background: #fff;
- border-radius: 32rpx;
- padding: 16rpx 32rpx;
- .icon{
- width: 46rpx;
- height: 46rpx;
- }
- input{
- width: calc(100% - 46rpx - 16rpx - 50px);
- font-size: 16px;
- }
- .search-btn{
- font-size: 14px;
- color: #FF4C4C;
- }
- }
-
- .shop-items{
- background: #fff;
- padding: 10px 20rpx;
- .item{
- margin-top: 30rpx;
- .img{
- width: 180rpx;
- height: 180rpx;
- border-radius: 10rpx;
- }
- .info{
- position: relative;
- margin-left: 20rpx;
- width: calc(100% - 200rpx);
- border-bottom: 1px solid #F8F8F8;
- .title{
- font-weight: bold;
- font-size: 34rpx;
- color: #333333;
- width: calc(60%);
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- .ii{
- image{width: 20rpx;height: 28rpx;margin-right: 8rpx}
- font-weight: 400;
- font-size: 22rpx;
- color: #666666;
-
- }
-
- .address{
- .icon{width: 28rpx;height: 28rpx;}
- .value{font-size: 22rpx;color: #666666;opacity: 0.5;margin-left: 10rpx;}
- margin-top: 20rpx;
- }
- .tel{
- margin-top: 16rpx;
- .icon{width: 28rpx;height: 28rpx;}
- .value{font-size: 22rpx;color: #666666;opacity: 0.5;margin-left: 10rpx;}
- }
- .business{
- font-weight: bold;
- font-size: 24rpx;
- color: #FF6F0F;
- background: rgba(252, 243, 240, 0.8);
- border-radius: 16rpx 16rpx 16rpx 0px;
- padding: 10rpx 10rpx;
- display: inline-block;
- margin-bottom: 20rpx;
- }
-
- .wiget{
- position: absolute;
- right: 0;
- bottom: 20rpx;
- .wline{
- margin: 0px 24rpx;
- height: 40rpx;
- width: 1px;
- background: #eee;
- }
- .witem{
- image{
- width: 46rpx;
- height: 46rpx;
- }
-
- .text{
- font-size: 14px;
- color: #666666;
- margin-top: 8rpx;
- }
- }
- }
-
- }
- }
- }
-
- </style>
- <template>
- <view class="m-app">
- <!--关键词搜索-->
- <view class="mpp">
- <view class="sreach fx-r fx-bc fx-ac" id="top-main" >
- <image class="icon" src="/static/img/tb-seach.png"></image>
- <input type="text" confirm-type="search" v-model="keyword" @confirm="tapInput" placeholder="请输入关键词" placeholder-style="color: #B3B3B3;" />
- <view class="fx-g1"></view>
- <view class="search-btn" @tap="tapInput" v-if="keyword != ''">搜索</view>
- </view>
- </view>
-
-
- <scroll-view :style="'height:calc(100vh - ' + topHeight + 'px - ' + h5Foot + 'px - 20px)'" class="mid-body clearfix" scroll-y="true" @scrolltolower="loadMoreData">
- <view class="shop-items">
- <view class="item fx-r" @tap="tapOpen" :data-url="'../merchant/index?id=' + item.id" v-for="item in data">
- <image :src="item.logo" class="img" mode="aspectFill"></image>
- <view class="info">
- <view class="iview-top fx-r">
- <view class="title">{{ item.name }}</view>
- <view class="fx-g1"></view>
- <view class="ii fx-r fx-bc">
- <image src="/static/img/shop-small-location.png"></image>
- 距离{{ item.dis_km }}
- </view>
- </view>
- <view class="address fx-r fx-bc">
- <image src="/static/img/address-shop.png" class="icon"></image>
- <view class="value">{{ item.address }}</view>
- </view>
-
- <view class="tel fx-r fx-bc">
- <image src="/static/img/tel-shop.png" class="icon"></image>
- <view class="value">{{ item.tel }}</view>
- </view>
-
- <view class="business">
- 营业时间: {{ item.business }}
- </view>
-
- <view class="wiget fx-r">
- <view class="witem fx-h fx-bc fx-ac" @tap="tapTel(item)">
- <image src="/static/img/shop-tel.png"></image>
- <view class="text">电话</view>
- </view>
-
- <view class="wline"></view>
-
- <view class="witem fx-h fx-bc fx-ac" @tap="tapLbs(item)">
- <image src="/static/img/shop-location.png"></image>
- <view class="text">导航</view>
- </view>
-
- </view>
-
- </view>
- </view>
-
- <view class="loading fx-r fx-ac fx-bc" v-if="!page.isFoot">
- <image src="/static/img/xloading.png"></image>
- <text>正在载入更多...</text>
- </view>
- <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
- </view>
- </scroll-view>
-
- </view>
- </template>
- <script>
- import {mapState,mapMutations } from 'vuex'
- export default {
- computed: mapState(['user','lbs']),
- data() {
- return {
- keyword : "",
- data : [],
- h5Foot : 0,
- topHeight : 0,
- page:{
- page:1,
- isLoad:false,
- isFoot:false
- }
- }
- },
- /**
- * 跳转的值
- * @param {Object} option
- */
- onLoad(option){
- this.$nextTick(()=>{
- const query = uni.createSelectorQuery().in(this);
- query.select("#top-main").boundingClientRect(res=>{
- this.topHeight = res.height;
- }).exec();
- });
- //判断是否H5
- // #ifdef H5
- this.h5Foot = 50;
- // #endif
- this.getData(true);
- },
- methods: {
- /**
- * 输入
- */
- tapInput:function(ev){
- this.page = {page:1,isLoad:false,isFoot:false};
- this.getData(true);
- },
- /**
- * 下拉加载
- */
- loadMoreData:function(){
-
- if(this.page.isFoot || this.page.isLoad) {
- return;
- }
- this.page.page ++;
- this.getData();
- },
- /**
- * 获取get数据
- */
- getData:function(isPull = false){
- if (this.page.isLoad) return;
- this.page.isLoad = true;
- if (isPull) {
- uni.showLoading({ title: '获取数据中..'});
- }
- var post = {};
- if(this.keyword != "") {
- post.keyword = this.keyword;
- }
- post.page = this.page.page;
- if(this.lbs != null) {
- post.lat = this.utils.isDefine(this.lbs.latitude) ? this.lbs.latitude : 0 ;
- post.lng = this.utils.isDefine(this.lbs.longitude) ? this.lbs.longitude : 0 ;
- }
- this
- .request
- .post("merchantList",post)
- .then(res => {
- uni.hideLoading();
- if (isPull) {
- this.data = res.data.list;
- } else {
- this.data = this.data.concat(res.data.list);
- }
- this.page.isLoad = false;
- //是否到底
- if (res.data.list.length != res.data.pageSize) {
- this.page.isFoot = true;
- }
-
- })
- .catch(res=>{
- console.log(res);
- uni.hideLoading();
- uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
- });
- },
-
- /**
- * 打开其他页面
- * @param {Object} ev
- */
- tapOpen: function(ev) {
- let url = ev.currentTarget.dataset.url
- uni.navigateTo({
- url: url
- });
- },
- /**
- * 返回上一页
- */
- tapBack: function () {
- uni.navigateBack({ delta: 1 });
- },
- }
- }
- </script>
|