123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- <template>
- <view :style="colorStyle">
- <!-- 附近门店 -->
- <view class="nearby" v-if="header">
- <view class="store acea-row row-middle">
- <view class="btn" :class="{'activeColor':active==1}" @click="btnFn(1)">
- 附近门店
- </view>
- <view class="btn" :class="{'activeColor':active==2}" @click="btnFn(2)">
- 常用门店
- </view>
- <input type="text" placeholder="搜索门店" class="input" @input="setValue" v-model="content.keyword"></input>
- <view class="search" @click="searchMap()">
- <text class="iconfont icon-sousuo6" />
- </view>
- </view>
- </view>
- <!-- 门店列表 -->
- <view class="content" v-if="info.length>0">
- <view class="list acea-row row-between-wrapper" v-for="(item,index) in info" :key="index"
- :class="{active:sortIndex==item.id}" @click="navTuShopIndex(item)">
- <view class="flex">
- <image :src="item.image" class="storeImg" mode="scaleToFill"></image>
- <view class="left">
- <view class="name line2">
- {{item.name}}
- </view>
- <view class="adress acea-row">
- <view class="con line2"><text class="iconfont icon-dingwei2" />{{item.detailed_address}}
- </view>
- </view>
- <view class="adress">
- <text class="iconfont icon-yingyeshijian2" />
- 营业时间:{{item.day_time}}
- </view>
- </view>
- </view>
- <!-- <text class="iconfont icon-xuanzhong6" v-if="sortIndex==item.id"></text> -->
- <view class="right flex">
- <view class="distance">
- 距离{{item.range}}km
- </view>
- <view class="telephone">
- <view class="phone" @click.stop="callPhone(item)">
- <text class="iconfont icon-dianhua"></text>
- </view>
- <view class="phone" @click.stop="showMaoLocation(item)">
- <text class="iconfont icon-dingwei2"></text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 缺省页 -->
- <view class="default" v-if="info.length==0">
- <image :src="imgHost+'/statics/images/store-default.png'" mode="" class="img"></image>
- <view class="text">
- 暂无门店信息,再去试试其他地址吧~
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- HTTP_REQUEST_URL
- } from '@/config/app';
- import colors from "@/mixins/color";
- import {
- getList
- } from '@/api/new_store.js'
- export default {
- mixins: [colors],
- data() {
- return {
- imgHost: HTTP_REQUEST_URL,
- sortIndex: 0,
- active: 1,
- content: {
- // 自己的位置
- latitude: uni.getStorageSync('user_latitude'),
- longitude: uni.getStorageSync('user_longitude'),
- store_type: 1,
- keyword: "",
- limit: 1000,
- page: 1,
- loding:false,//判断是否加载中
- lode:false//判断是否可以继续加载
- },
- info: [],
- map: 1,
- header: 1,
- comeType: 0,
- // 门店位置
- latitudeStore: 0,
- longitudeStore: 0,
- covers: []
- };
- },
- onShow() {
- if (this.content.latitude && this.content.longitude) {
- this.getlist();
- } else {
- this.selfLocation();
- }
- },
- // onReachBottom() {
- // if (this.content.latitude && this.content.longitude) {
- // this.getlist();
- // } else {
- // this.selfLocation();
- // }
- // },
- methods: {
- // 跳转到门店详情页面
- navTuShopIndex(item) {
- uni.setStorageSync('user_latitude', item.latitude);
- uni.setStorageSync('user_longitude', item.longitude);
- uni.navigateTo({
- url: '/pages/store_cate/store_cate_index',
- });
- },
- // 获取当前位置信息
- selfLocation() {
- let self = this
- // #ifdef H5
- if (self.$wechat.isWeixin()) {
- self.$wechat.location().then(res => {
- this.content.latitude = res.latitude;
- this.content.longitude = res.longitude;
- uni.setStorageSync('user_latitude', res.latitude);
- uni.setStorageSync('user_longitude', res.longitude);
- self.getlist();
- })
- } else {
- // #endif
- uni.getLocation({
- type: 'wgs84',
- success: (res) => {
- try {
- this.content.latitude = res.latitude;
- this.content.longitude = res.longitude;
- uni.setStorageSync('user_latitude', res.latitude);
- uni.setStorageSync('user_longitude', res.longitude);
- } catch {}
- self.getlist();
- },
- complete: function() {
- self.getlist();
- }
- });
- // #ifdef H5
- }
- // #endif
- },
- // 门店列表
- getlist(address) {
- let cot = this.content;
- let content = {
- store_type: cot.store_type,
- keyword: cot.keyword,
- limit: cot.limit,
- page: cot.page,
- }
- console.log(address)
- if (address) {
- // 自己的位置
- content.latitude = address.latitude;
- content.longitude = address.longitude
- } else {
- // 自己的位置
- content.latitude = uni.getStorageSync('user_latitude');
- content.longitude = uni.getStorageSync('user_longitude');
- }
- getList(content).then(res => {
- this.info = res.data
- res.data.forEach(item => {
- if (this.sortIndex == item.id) {
- this.latitudeStore = item.latitude;
- this.longitudeStore = item.longitude;
- this.covers.push({
- title: item.name,
- latitude: item.latitude,
- longitude: item.longitude,
- iconPath: item.image,
- width: 30,
- height: 30
- })
- }
- })
- if(res.data.length== cot.limit){
- cot.page++
- }else{
-
- }
- })
- },
- // 输入关键字搜索门店
- setValue(e) {
- this.getlist()
- },
- // 点击高亮
- // activeFn(row) {
- // this.sortIndex = row.id
- // if (this.comeType) {
- // uni.$emit("handClick", {
- // latitude: row.latitude,
- // longitude: row.longitude,
- // store_id: row.id
- // });
- // uni.navigateBack();
- // }
- // },
- // 搜索门店
- searchMap() {
- // this.header = 0
- },
- // 收起地图
- putMap() {
- if (this.map == 1) {
- this.map = 0
- } else if (this.map == 0) {
- this.map = 1
- }
- },
- // 打电话
- callPhone(row) {
- uni.makePhoneCall({
- phoneNumber: row.phone //仅为示例
- });
- },
- btnFn(num) {
- switch (num) {
- case 1:
- this.active = 1
- this.content.store_type = 1
- break;
- case 2:
- this.active = 2
- this.content.store_type = 2
- break;
- }
- this.getlist()
- },
- showMaoLocation(e) {
- let self = this;
- // #ifdef H5
- if (self.$wechat.isWeixin()) {
- self.$wechat.seeLocation({
- latitude: Number(e.latitude),
- longitude: Number(e.longitude),
- name: e.name,
- scale: 13,
- address: `${e.address}-${e.detailed_address}`,
- }).then(res => {})
- } else {
- // #endif
- uni.openLocation({
- latitude: Number(e.latitude),
- longitude: Number(e.longitude),
- name: e.name,
- address: `${e.address}-${e.detailed_address}`,
- success: function() {
- Number
- }
- });
- // #ifdef H5
- }
- // #endif
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- width: 750rpx;
- }
- .active {
- position: relative;
- border: 1px solid var(--view-theme) !important;
- .icon-xuanzhong6 {
- font-size: 46rpx;
- position: absolute;
- bottom: -4rpx;
- right: -6rpx;
- color: var(--view-theme);
- }
- }
- .activeColor {
- background-color: var(--view-theme) !important;
- color: #fff !important;
- }
- .nearby {
- width: 100%;
- background-color: #fff;
- box-shadow: 0px -2px 22px 0px rgba(0, 0, 0, 0.0400);
- .store {
- height: 80rpx;
- padding: 0 30rpx;
- align-items: flex-start;
- .input {
- padding-left: 30rpx;
- height: 60rpx;
- background: #F5F5F5;
- border-radius: 30rpx;
- font-size: 26rpx;
- font-weight: 400;
- }
- .btn {
- margin-right: 16rpx;
- width: 160rpx;
- height: 56rpx;
- background: #F5F5F5;
- border-radius: 29rpx;
- text-align: center;
- line-height: 56rpx;
- font-size: 26rpx;
- font-weight: 400;
- color: #999999;
- }
- .put {
- color: #666666 !important;
- margin-left: 96rpx;
- background-color: #fff !important;
- .icon-xiangshang {
- margin-right: 10rpx;
- color: #666666;
- font-size: 24rpx;
- }
- .icon-xiangxia {
- margin-right: 10rpx;
- color: #666666;
- font-size: 24rpx;
- }
- }
- .search {
- position: absolute;
- right: 30rpx;
- text-align: center;
- line-height: 56rpx;
- width: 56rpx;
- height: 56rpx;
- background: #F5F5F5;
- border-radius: 50%;
- }
- }
- }
- .content {
- width: 100%;
- height: 100%;
- padding: 0 30rpx;
- .list {
- margin-top: 20rpx;
- width: 100%;
- background: #FFFFFF;
- border-radius: 12rpx;
- padding: 28rpx 30rpx;
- border: 1px solid #fff;
- .flex {
- flex-grow: 1;
- }
- .storeImg {
- width: 200rpx;
- height: 200rpx;
- }
- .left {
- width: 300rpx;
- flex-grow: 1;
- padding: 0 20rpx;
- .name {
- font-size: 32rpx;
- font-weight: bold;
- color: #333333;
- }
- .adress {
- width: 100%;
- margin-top: 18rpx;
- word-wrap: break-word;
- font-size: 28rpx;
- font-weight: 400;
- color: #888888;
- .con {
- flex-shrink: 1;
- }
- .icon-dingwei2 {
- margin-right: 8rpx;
- font-size: 18rpx;
- color: #ccc;
- margin-top: 6rpx;
- }
- .icon-yingyeshijian2 {
- margin-right: 8rpx;
- font-size: 18rpx;
- color: #ccc;
- }
- }
- }
- .right {
- align-items: center;
- .gostore {
- font-size: 22rpx;
- font-weight: 400;
- color: var(--view-theme);
- }
- .distance {
- margin-top: 14rpx;
- font-size: 28rpx;
- font-weight: bold;
- color: #999999;
- flex-grow: 1;
- }
- .telephone {
- margin-top: 14rpx;
- display: flex;
- .phone:nth-child(2) {
- margin-left: 30rpx;
- }
- .phone {
- position: relative;
- width: 60rpx;
- height: 60rpx;
- background: var(--view-minorColorT);
- border-radius: 50%;
- text-align: center;
- line-height: 60rpx;
- z-index: 10;
- .icon-dingwei2 {
- font-size: 32rpx;
- color: var(--view-theme) !important;
- }
- .icon-dianhua {
- font-size: 32rpx;
- color: var(--view-theme) !important;
- }
- }
- }
- }
- }
- }
- .lyric-enter,
- .lyric-leave-to {
- opacity: 0;
- transform: translateY(60px);
- }
- .lyric-enter-to,
- .lyric-leave {
- opacity: 1;
- }
- .lyric-enter-active,
- .lyric-leave-active {
- transition: all 0.3s;
- }
- .default {
- display: flex;
- flex-direction: column;
- align-items: center;
- .img {
- width: 414rpx;
- height: 256rpx;
- }
- .text {
- margin-top: 54rpx;
- font-size: 26rpx;
- font-weight: 400;
- color: #999999;
- }
- }
- </style>
|