123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- <template>
- <view class="container">
- <navbar id="navbar" :config="config" backColor="#666666"></navbar>
- <view class="search-top" :style="{'top': sticky + 'px'}">
- <view class="city-text" @click="addressShow=true">
- <image mode="widthFix" src="/static/shop/location-icon.png"></image>
- <view>{{cityName}}</view>
- </view>
- <view class="searchBox">
- <u-search v-model="param.shop_name" shape="round" :clearabled="false" height="70" bg-color="#f7f7f7"
- border-color="#D9D9D9" laceholder-color="#CCCCCC" search-icon="/static/shop/search-icon.png"
- @search="$u.throttle(search, 1000)" @custom="$u.throttle(search, 1000)"></u-search>
- </view>
- </view>
- <view style="height: 110rpx;"></view>
- <view class="u-skeleton">
- <view class="banner" v-if="bannerList.length > 0||skeletonShow">
- <!-- <image src="/static/shop/banner.png" mode="aspectFill"></image> -->
- <u-swiper class="u-skeleton-fillet" :list="bannerList" name="cover" height="360" :mode="bannerList.length>1?'round':'none'"
- bg-color="transparent" @click="bannerClick"></u-swiper>
- </view>
- <view class="menu" v-if="typeList.length > 0 || iconList.length > 0||skeletonShow">
- <swiper class="swiper u-skeleton-fillet" :indicator-dots="true" :autoplay="false" :current="current"
- :style="{'height':((iconList[current]&&iconList[current].length)>5?'350rpx':'150rpx')}" @change="swiperChange">
- <swiper-item class="swiper-item" v-for="(el, k) in iconList">
- <view class="item" v-for="(v,i) in (skeletonShow?5:el)" :key="i" @click="goShop(v)">
- <view class="img">
- <image class="u-skeleton-fillet" :src="v.icon" mode="widthFix"></image>
- </view>
- <text class="u-skeleton-fillet">{{v.name||'加载中'}}</text>
- </view>
- </swiper-item>
- </swiper>
- </view>
- <view class="con-box">
- <u-section class="u-skeleton-fillet" title="附近门店" font-size="36" :bold="true" color="#333333" :show-line="false" sub-title="查看更多"
- sub-color="#333333" @click="goShop()">
- </u-section>
- <view class="items">
- <view class="item " v-for="(v, index) in (skeletonShow?10:listData)" :key="index" @click="goDetails(v)">
- <view class="shop-img">
- <image class="u-skeleton-fillet" :src="v.logo" mode="aspectFill"></image>
- </view>
- <view class="right">
- <view class="title u-skeleton-fillet">{{v.shop_name||'加载中'}}</view>
- <view class="score-box u-skeleton-fillet">
- <view class="score ">
- <rate :value="Math.round(v.average||0)"></rate>
- </view>
- <text class="score-text ">{{v.average?v.average.toFixed(2):''}}分</text>
- <text class="ju">距离:{{Math.round(v.distance/1000*100)/100}}KM</text>
- </view>
- <view class="address-box u-skeleton-fillet">
- <view class="left">
- <image class="location1" src="/static/shop/location-icon.png" mode="widthFix">
- </image>
- <view class="district">{{v.map_punctuation || '商户暂无地理位置'}}</view>
- </view>
- <view class="goShopping">
- <text class="iconfont3"></text>
- <text class="text">去逛逛</text>
- </view>
- </view>
- <!-- <view class="location2-box">
- <image class="location2" src="/static/convenienceService/location2.png" mode="widthFix">
- </image>
- <view>{{v.map_punctuation}}></view>
- </view> -->
- </view>
- </view>
- </view>
- </view>
- <view>
- <noData v-if="listData.length<=0"></noData>
- </view>
- <!-- <u-loadmore :status="loadStatus" /> -->
- <u-skeleton :loading="skeletonShow" :animation="true" bgColor="#FFF"></u-skeleton>
- </view>
- <!-- 选择地区 -->
- <u-select v-model="addressShow" mode="mutil-column-auto" :list="cityTree" @confirm="addressConfirm">
- </u-select>
- <entrepreneurship-zone-tabbar :current="2"></entrepreneurship-zone-tabbar>
- </view>
- </template>
- <script>
- import rate from "@/components/rate.vue"
- import noData from "@/components/noData/nodata.vue"
- import {
- number
- } from "mathjs";
- export default {
- components: {
- rate,
- noData
- },
- data() {
- return {
- config: {
- back: true,
- title: '附近门店',
- color: '#1A1A1A',
- backgroundColor: [1, "#fff"],
- // statusBarFontColor: '#1A1A1A',
- leftSlot: true
- },
- //手机状态栏高度
- statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
- sticky: uni.getSystemInfoSync().statusBarHeight + 44,
- // loadStatus: 'loadmore', //loading / nomore
- pageParams: {
- page: 1,
- limit: 10,
- city_code: 420100, //武汉市
- },
- listData: [],
- loading: false,
- cityName: '洪山区',
- addressShow: false,
- param: {
- union_business: true
- },
- cityTree: [],
- typeList: [],
- iconList: [],
- bannerList: [],
- current: 0,
- skeletonShow:true
- }
- },
- onLoad() {
- this.getCitys();
- this.getLoca();
- this.getTypeList();
- this.getBanner()
- // this.getList();
- },
- onPullDownRefresh() {
- this.getList();
- this.getTypeList();
- this.getBanner();
- setTimeout(() => {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- methods: {
- goShop(item = {}) {
- uni.navigateTo({
- url: '/pages/nearbyShop/list?id=' + (item.id || '') + '&cityName=' + this.cityName + '&address=' + (this
- .param.address || '') + '&area_code=' + (this.param.area_code || '')
- })
- },
- getBanner() {
- this.$http.get('/ad/ad/getByCode/localMerchant-banner')
- .then(res => {
- if (res.code == 200) {
- this.bannerList = res.list;
- }
- })
- },
- bannerClick(e) {
- let item = this.bannerList[e]
- this.$mUtil.imgLink(item.model_type, item.model_id, item.url, item.shop_id)
- },
- // 获取城市
- getCitys() {
- this.$http.get('/cnarea/tree-lbs').then(res => {
- if (res && res.code == 200) {
- this.cityTree = res.tree.children
- this.cityTree.forEach(v => {
- if (v.children.length <= 0) {
- v.children = [{}]
- }
- })
- this.skeletonShow=false;
- }
- })
- },
- getLoca() {
- let that = this
- // #ifdef APP-PLUS
- uni.getLocation({
- type: 'gcj02',
- geocode: true,
- success: function(res) {
- that.cityName = res.address ? res.address.district : '';
- that.param.address = res.address.province + res.address.city + res.address.district
- that.param.lon = res.longitude;
- that.param.lat = res.latitude;
- that.getList()
- if (!that.cityName) {
- uni.request({
- url: `https://restapi.amap.com/v3/geocode/regeo?key=47798318a0d39673a1fb9729aa6a468a&location=${res.longitude+','+res.latitude}`, //仅为示例,并非真实接口地址。
- method: "GET",
- header: {
- "content-type": "application/x-www-form-urlencoded"
- },
- success: (re) => {
- console.log(re);
- that.cityName = re.data.regeocode
- .addressComponent.city;
- }
- });
- }
- },
- complete(e) {
- console.log(e)
- }
- });
- // #endif
- // #ifdef H5
- this.getList()
- // #endif
- },
- // 获取便民服务分类列表
- getTypeList() {
- this.$http.get('/union/business/classify/list').then(res => {
- if (res && res.code == 200) {
- this.typeList = res.list
- let list = []
- let typePage = Math.ceil(res.list.length / 10)
- for (let i = 0; i < typePage; i++) {
- list[i] = this.typeList.splice(0, 10)
- }
- this.iconList = list
- }
- })
- },
- swiperChange(e) {
- if (e) {
- this.current = e.detail.current
- }
- },
- // 选择地区
- addressConfirm(e) {
- // this.param.city_code = e[2].value ? e[2].value : e[1].value ? e[1].value : e[0].value;
- this.cityName = e[2].label ? e[2].label : e[1].label ? e[1].label : e[0].label;
- this.param.area_code = e[2].value ? e[2].value : e[1].value ? e[1].value : e[0].value;
- delete this.param.address
- // this.param.lon = e[1].data.longitude || e[0].data.longitude;
- // this.param.lat = e[1].data.latitude || e[0].data.latitude;
- console.log(e)
- this.getList()
- },
- // service/goods/nearby /convenience/service/classify/list
- getList() {
- let that = this;
- uni.showLoading({
- title: '努力加载中...',
- mask: true
- });
- // this.loadStatus = 'loading';
- this.$http.get('/service/goods/nearby', that.param)
- .then(res => {
- if (res.code == 200) {
- that.listData = res.list;
- // that.loadStatus = that.listData.length > 0 ? 'loadmore' : 'nomore';
- }
- })
- .finally(() => {
- uni.hideLoading();
- })
- },
- // 跳转商品详情
- goDetails(v) {
- uni.navigateTo({
- url: "/pages/nearbyShop/shopDetail?shopId=" + v.shop_id
- })
- },
- search() {
- this.getList()
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- .search-top {
- position: fixed;
- width: 100%;
- height: 110rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 30rpx;
- background-color: #fff;
- z-index: 3;
- }
- .city-text {
- margin-right: 12rpx;
- font-size: 30rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #666666;
- display: flex;
- align-items: center;
- view {
- max-width: 100rpx;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- image {
- width: 26rpx;
- height: 36rpx;
- margin-right: 10rpx;
- vertical-align: middle;
- }
- }
- .searchBox {
- position: relative;
- flex: 1;
- // width: 580rpx;
- height: 70rpx;
- image {
- width: 35rpx;
- height: 35rpx;
- }
- /deep/ .u-content {
- padding-left: 27rpx;
- border-radius: 36rpx !important;
- .u-input {
- margin-left: 22rpx;
- margin-right: 124rpx;
- }
- }
- /deep/ .u-action-active {
- position: absolute;
- top: 0;
- right: 0;
- width: 124rpx;
- height: 70rpx;
- margin-left: 0;
- background: linear-gradient(98deg,#fa673e 5%, #fdac69 94%);
- border-radius: 35rpx;
- font-size: 30rpx;
- line-height: 70rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #ffffff;
- }
- }
- }
- .navbar {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 90rpx;
- text-align: center;
- line-height: 90rpx;
- z-index: 9;
- background-color: #fff;
- .title {
- font-size: 36rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #1a1a1a;
- }
- .left {
- position: absolute;
- top: 50%;
- left: 30rpx;
- display: flex;
- align-items: center;
- font-size: 30rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #1a1a1a;
- transform: translateY(-50%);
- .city-icon {
- width: 19rpx;
- height: 12rpx;
- margin-left: 5rpx;
- }
- }
- }
- .banner {
- width: 100%;
- height: 350rpx;
- padding: 0rpx 30rpx 0;
- margin-bottom: 20rpx;
- image {
- width: 100%;
- height: 100%;
- }
-
- /deep/ uni-swiper {
- height: 350rpx !important;
- }
- }
- .menu {
- display: flex;
- // justify-content: space-between;
- // align-items: center;
- flex-wrap: wrap;
- padding: 0 30rpx;
- margin-bottom: 22rpx;
- .swiper {
- width: 100%;
- height: auto;
- transition: all .3s;
- /deep/ .uni-swiper-dots-horizontal {
- bottom: 0;
- .uni-swiper-dot-active {
- background-color: #FA6138;
- }
- }
- }
- .swiper-item {
- display: flex;
- flex-wrap: wrap;
- }
- .item {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 20%;
- margin-bottom: 30rpx;
- .img {
- width: 70rpx;
- height: 70rpx;
- margin-bottom: 13rpx;
- // border-radius: 50%;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- }
- }
- text {
- width: 100%;
- font-size: 26rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: center;
- color: #1a1a1a;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- // .item:nth-child(5n) {
- // margin-right: 0;
- // }
- }
- .con-box {
- padding: 0 30rpx;
- .u-section {
- margin-bottom: 27rpx;
- /deep/ .uicon-arrow-right:before {
- color: #666;
- }
- }
- .items {
- .item {
- display: flex;
- align-items: center;
- padding: 25rpx 0;
- // border-bottom: 1rpx solid #e6e6e6;
- .shop-img {
- width: 162rpx;
- height: 158rpx;
- margin-right: 40rpx;
- border-radius: 10rpx;
- overflow: hidden;
- flex-shrink: 0;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .right {
- flex: 1;
- width: 0;
- .score-box,
- .address-box,
- .location2-box {
- display: flex;
- align-items: center;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- }
- .location1,
- .location2 {
- width: 20rpx;
- height: 27rpx;
- flex-shrink: 0;
- margin-right: 9rpx;
- }
- .light-start,
- .startt {
- width: 30rpx;
- height: 30rpx;
- margin-right: 12rpx;
- }
- .title {
- margin-bottom: 18rpx;
- font-size: 28rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- color: #1a1a1a;
- }
- .score-box {
- display: flex;
- align-items: normal;
- margin-bottom: 10rpx;
- font-family: PingFang SC, PingFang SC-Semibold;
- color: #333333;
- .score {
- flex-shrink: 0;
- }
- .score-text {
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Medium;
- font-weight: 500;
- text-align: left;
- color: #333333;
- flex-shrink: 0;
- }
- .ju {
- margin-left: 23rpx;
- font-size: 24rpx;
- color: #808080;
- text-align: left;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .address-box {
- // margin-bottom: 10rpx;
- font-family: PingFang SC;
- color: #666666;
- justify-content: space-between;
- .left {
- flex: 1;
- width: 0;
- display: flex;
- align-items: center;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Regular;
- font-weight: 400;
- text-align: left;
- color: #333333;
- }
- .goShopping {
- display: flex;
- align-items: center;
- font-size: 40rpx;
- color: #FA6138;
- flex-shrink: 0;
- .text {
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Medium;
- font-weight: 500;
- text-align: left;
- color: #666666;
- }
- }
- .district {
- color: #1a1a1a;
- margin-right: 40rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- .location2-box {
- color: #333333;
- view {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- }
- }
- }
- </style>
|