|
@@ -9,7 +9,7 @@
|
|
|
<!-- 搜素栏 -->
|
|
|
<view class="search flex">
|
|
|
<image src="../../static/icon/address.png" class="address"></image>
|
|
|
- <view class="shop-name clamp" @click.stop="nav('/pages/shoping/list')">{{store_name}}</view>
|
|
|
+ <view class="shop-name clamp" @click.stop="nav('/pages/shoping/list')">{{storeInfo.name}}</view>
|
|
|
<view class="input-box flex" @click.stop="clickSearch">
|
|
|
<view class=" input-content flex">
|
|
|
<view class="iconfont iconsearch"></view>
|
|
@@ -32,7 +32,7 @@
|
|
|
<text>全部分类</text>
|
|
|
</view>
|
|
|
</navigator>
|
|
|
- <navigator url="/pages/address/shopList">
|
|
|
+ <navigator url="/pages/shoping/list">
|
|
|
<view class="cate-item">
|
|
|
<image src="/static/icon/in1.png"></image>
|
|
|
<text>附近门店</text>
|
|
@@ -134,10 +134,11 @@
|
|
|
|
|
|
<script>
|
|
|
import seckill from './seckill';
|
|
|
+import { openMap } from '@/utils/rocessor.js';
|
|
|
import { loadIndexs,store_list } from '@/api/index.js';
|
|
|
import { interceptor } from '@/utils/loginUtils';
|
|
|
import { userinfo } from '@/api/user.js';
|
|
|
-import { mapState } from 'vuex';
|
|
|
+import { mapState, mapMutations } from 'vuex';
|
|
|
import { getProducts } from '@/api/product.js';
|
|
|
// #ifdef H5
|
|
|
import { weixindata } from '@/utils/wxAuthorized';
|
|
@@ -158,7 +159,6 @@ export default {
|
|
|
swiperLength: 0,
|
|
|
longitude:121.436289,//经度
|
|
|
latitude:28.651485,//纬度
|
|
|
- store_name:'',//门店姓名
|
|
|
carouselList: [], //轮播列表
|
|
|
goodsList: [], //积分商品列表
|
|
|
bastList: [], //消费券商品列表
|
|
@@ -172,7 +172,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState(['loginInterceptor']),
|
|
|
+ ...mapState(['loginInterceptor','storeInfo']),
|
|
|
...mapState('user', ['hasLogin', 'userInfo'])
|
|
|
},
|
|
|
onLoad(option) {
|
|
@@ -190,6 +190,7 @@ export default {
|
|
|
data: option.spread
|
|
|
});
|
|
|
}
|
|
|
+ this.getaddress();
|
|
|
},
|
|
|
onShow() {
|
|
|
// 判断是否强制登录
|
|
@@ -201,39 +202,6 @@ export default {
|
|
|
console.log(e);
|
|
|
});
|
|
|
}
|
|
|
- // // #ifdef H5
|
|
|
- // weixindata().then(wxOjb => {
|
|
|
- // console.log(wxOjb,'123456798')
|
|
|
- // wxOjb.getLocation({
|
|
|
- // type: 'wgs84',
|
|
|
- // success: function(res) {
|
|
|
- // console.log('获取经纬度', res);
|
|
|
- // obj.longitude = res.longitude;
|
|
|
- // obj.latitude = res.latitude;
|
|
|
- // uni.setStorageSync('longitude', obj.longitude4);
|
|
|
- // uni.setStorageSync('latitude', obj.latitude4);
|
|
|
- // obj.marker = [
|
|
|
- // {
|
|
|
- // longitude: res.longitude,
|
|
|
- // latitude: res.latitude,
|
|
|
- // iconPath: '/static/img/img19.png',
|
|
|
- // width: '45',
|
|
|
- // height: '45'
|
|
|
- // }
|
|
|
- // ];
|
|
|
- // obj.loadData();
|
|
|
- // },
|
|
|
- // fail(e) {
|
|
|
- // console.log('失败', e);
|
|
|
- // // window.location.reload();
|
|
|
- // obj.tishi()
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }).catch(err => {
|
|
|
- // obj.tishi()
|
|
|
- // console.log(err)
|
|
|
- // })
|
|
|
- // // #endif
|
|
|
this.loadData();
|
|
|
},
|
|
|
// #ifndef MP
|
|
@@ -263,6 +231,28 @@ export default {
|
|
|
},
|
|
|
// #endif
|
|
|
methods: {
|
|
|
+ ...mapMutations(['setLat', 'setLon','setStoreInfo']),
|
|
|
+ //获取定位信息
|
|
|
+ getaddress() {
|
|
|
+ console.log('dizhi+++++++++++')
|
|
|
+ let obj = this;
|
|
|
+ uni.getLocation({
|
|
|
+ type:'gcj02',
|
|
|
+ success: res => {
|
|
|
+ console.log(res)
|
|
|
+ console.log('66666666666666666666')
|
|
|
+ obj.setLat(res.latitude);
|
|
|
+ obj.setLon(res.longitude);
|
|
|
+ obj.getStore(res.latitude, res.longitude);
|
|
|
+ },
|
|
|
+ fail: err => {
|
|
|
+ console.log(err,'shi+++++++++++++++')
|
|
|
+ openMap().then(e => {
|
|
|
+ this.getaddress();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 點擊搜索框
|
|
|
clickSearch() {
|
|
|
uni.navigateTo({
|
|
@@ -273,13 +263,25 @@ export default {
|
|
|
onImageError(key, index) {
|
|
|
this[key][index].image = '/static/error/errorImage.jpg';
|
|
|
},
|
|
|
+ getStore(latitude,longitude) {
|
|
|
+ let obj = this
|
|
|
+ store_list({
|
|
|
+ latitude:latitude,
|
|
|
+ longitude:longitude,
|
|
|
+ page: 1,
|
|
|
+ limit: 1,
|
|
|
+ }).then(({data})=> {
|
|
|
+ console.log(data,'storeInfo++++')
|
|
|
+ obj.setStoreInfo(data.list[0])
|
|
|
+ })
|
|
|
+ },
|
|
|
// 请求载入数据
|
|
|
async loadData() {
|
|
|
const obj = this;
|
|
|
- store_list({latitude:obj.latitude,longitude:obj.longitude}).then(({data}) =>{
|
|
|
- console.log(data)
|
|
|
- obj.store_name = data.list[0].detailed_address
|
|
|
- })
|
|
|
+ // store_list({latitude:obj.latitude,longitude:obj.longitude}).then(({data}) =>{
|
|
|
+ // console.log(data)
|
|
|
+ // obj.store_name = data.list[0].detailed_address
|
|
|
+ // })
|
|
|
loadIndexs({}).then(({ data }) => {
|
|
|
let goods = data.info;
|
|
|
this.carouselList = data.banner;
|
|
@@ -375,6 +377,7 @@ page {
|
|
|
height: 38rpx;
|
|
|
}
|
|
|
.shop-name {
|
|
|
+ height: 38rpx;
|
|
|
position: relative;
|
|
|
z-index: 100;
|
|
|
width: 206rpx;
|