获取地址,获取不同地区的里海云仓
This commit is contained in:
parent
17dcf15a47
commit
1539e07755
@ -7,7 +7,7 @@
|
|||||||
<view class="site-box flex_a_c_j_sb">
|
<view class="site-box flex_a_c_j_sb">
|
||||||
<view class="place_wrapper flex_a_c" @click="selectLocation">
|
<view class="place_wrapper flex_a_c" @click="selectLocation">
|
||||||
<view class="iconfont icon-weizhi"></view>
|
<view class="iconfont icon-weizhi"></view>
|
||||||
<view class="town_name">{{location_Arr.location_name}}</view>
|
<view class="town_name">{{street}}</view>
|
||||||
</view>
|
</view>
|
||||||
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
||||||
<view class="iconfont icon-xiaoxi" style="color:#fff;"></view>
|
<view class="iconfont icon-xiaoxi" style="color:#fff;"></view>
|
||||||
@ -58,6 +58,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
street: '',
|
||||||
showPicker: false,
|
showPicker: false,
|
||||||
styleConfig: [],
|
styleConfig: [],
|
||||||
columnData: [],
|
columnData: [],
|
||||||
@ -76,20 +77,19 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// computed: mapGetters(['location']),
|
computed: mapGetters(['location']),
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
this.getBanner()
|
this.getBanner()
|
||||||
this.Area()
|
this.Area()
|
||||||
// this.selfLocation()
|
this.street = JSON.parse(this.location).address_component.street
|
||||||
// const loca = JSON.parse(this.location)
|
|
||||||
// this.street = loca.address_component.street
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
selectLocation() {
|
selectLocation() {
|
||||||
this.isSelectPlace ? this.showPicker = true : ''
|
this.isSelectPlace ? this.showPicker = true : ''
|
||||||
},
|
},
|
||||||
confirm(e) {
|
confirm(e) {
|
||||||
|
this.street = e.value[1].name
|
||||||
this.showPicker = false
|
this.showPicker = false
|
||||||
this.$emit('selectPlce', e)
|
this.$emit('selectPlce', e)
|
||||||
},
|
},
|
||||||
@ -110,17 +110,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Area() {
|
Area() {
|
||||||
getArea({
|
getArea({ city_code: 510500 }).then(res => {
|
||||||
city_code: 510500
|
|
||||||
}).then(res => {
|
|
||||||
this.$refs.uPicker.setColumnValues(0, res.data);
|
this.$refs.uPicker.setColumnValues(0, res.data);
|
||||||
this.Street(res.data[0]['code']);
|
this.Street(res.data[0]['code']);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
Street(code) {
|
Street(code) {
|
||||||
getStreet({
|
getStreet({ area_code: code }).then(res => {
|
||||||
area_code: code
|
|
||||||
}).then(res => {
|
|
||||||
this.$refs.uPicker.setColumnValues(1, res.data);
|
this.$refs.uPicker.setColumnValues(1, res.data);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -139,12 +135,7 @@
|
|||||||
},
|
},
|
||||||
async getBanner(id) {
|
async getBanner(id) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
const { data } = await getDiy({ id: 0 })
|
||||||
const {
|
|
||||||
data
|
|
||||||
} = await getDiy({
|
|
||||||
id: 0
|
|
||||||
})
|
|
||||||
that.styleConfig = that.objToArr(data.value);
|
that.styleConfig = that.objToArr(data.value);
|
||||||
/* 循环数组得到数据*/
|
/* 循环数组得到数据*/
|
||||||
that.styleConfig.forEach((item, index, arr) => {
|
that.styleConfig.forEach((item, index, arr) => {
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
<view class="circle_friends_wrapper">
|
<view class="circle_friends_wrapper">
|
||||||
<zbpSwiper :isSelectPlace="true" @selectPlce="selectPlce" :location_Arr="locationArr"></zbpSwiper>
|
<zbpSwiper :isSelectPlace="true" @selectPlce="selectPlce" :location_Arr="locationArr"></zbpSwiper>
|
||||||
<view class="shop_wrapper">
|
<view class="shop_wrapper">
|
||||||
|
<!-- locationArr.address_reference.town.id -->
|
||||||
<navigator class="l_yun" hover-class="none"
|
<navigator class="l_yun" hover-class="none"
|
||||||
:url="`/pages/nongKe/supply_chain/supplier?type_id=10&street_id=${locationArr.address_reference.town.id}`"
|
:url="`/pages/nongKe/supply_chain/supplier?type_id=10&street_id=${street_id}`"
|
||||||
:style=" {'background-image': `url(${bgData[0].pic})`}">
|
:style=" {'background-image': `url(${bgData[0].pic})`}">
|
||||||
<view class=" text-name">
|
<view class=" text-name">
|
||||||
<text>{{locationArr.location_name}}</text>
|
<text>{{town}}</text>
|
||||||
<view class="name_town">-供销综合云市场-</view>
|
<view class="name_town">-供销综合云市场-</view>
|
||||||
</view>
|
</view>
|
||||||
</navigator>
|
</navigator>
|
||||||
<view class="r_lihai" hover-class="none" @click="go_shop()"
|
<view class="r_lihai" @click="go_shop" :style=" {'background-image': `url(${bgData[1].pic})`}">
|
||||||
:style=" {'background-image': `url(${bgData[1].pic})`}">
|
|
||||||
<view class="title">里海云仓</view>
|
<view class="title">里海云仓</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -25,8 +25,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="article_box">
|
<view class="article_box">
|
||||||
<block v-for="(item, index) in recoList.slice(0,2)" :key="index">
|
<block v-for="(item, index) in recoList.slice(0,2)" :key="index">
|
||||||
<navigator :url='"/pages/news_details/index?id="+item.article_id' hover-class='none'
|
<navigator :url='"/pages/news_details/index?id="+item.article_id' hover-class='none' class='article-item'>
|
||||||
class='article-item'>
|
|
||||||
<view class='text'>
|
<view class='text'>
|
||||||
<view class='name'>{{item.title}}</view>
|
<view class='name'>{{item.title}}</view>
|
||||||
<view class="time">{{item.create_time}}</view>
|
<view class="time">{{item.create_time}}</view>
|
||||||
@ -50,13 +49,12 @@
|
|||||||
<view class="title">{{item.title}}</view>
|
<view class="title">{{item.title}}</view>
|
||||||
<view class="goods_info flex_a_c">
|
<view class="goods_info flex_a_c">
|
||||||
<view class="l_info flex_a_c">
|
<view class="l_info flex_a_c">
|
||||||
<image :src="(item.author && item.author.avatar) || '/static/images/f.png'"
|
<image :src="(item.author && item.author.avatar) || '/static/images/f.png'" mode="aspectFill"
|
||||||
mode="aspectFill" class="g_img"></image>
|
class="g_img"></image>
|
||||||
<view class="g_name">{{item.author}}</view>
|
<view class="g_name">{{item.author}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="nice_box" @click.stop="giveStart(item)">
|
<view class="nice_box" @click.stop="giveStart(item)">
|
||||||
<text class="iconfont"
|
<text class="iconfont" :class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
|
||||||
:class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
|
|
||||||
<text class="collect">{{item.count_start}}</text>
|
<text class="collect">{{item.count_start}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -83,28 +81,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import zbpSwiper from '@/components/zbpSwiper'
|
import zbpSwiper from '@/components/zbpSwiper'
|
||||||
import {
|
import { mapGetters } from 'vuex'
|
||||||
mapGetters
|
|
||||||
} from 'vuex'
|
|
||||||
import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
|
import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
|
||||||
import {
|
import { graphicStartApi } from '@/api/community.js'
|
||||||
graphicStartApi
|
import { getArticleList, getArticleCategoryList, get_cloud_shop } from '@/api/api.js'
|
||||||
} from '@/api/community.js'
|
import { getHotBanner } from '@/api/store.js'
|
||||||
import {
|
import { Toast } from '@/libs/uniApi'
|
||||||
getArticleList,
|
import { getGeocoder } from '@/api/store.js';
|
||||||
getArticleCategoryList,
|
|
||||||
get_cloud_shop
|
|
||||||
} from '@/api/api.js'
|
|
||||||
import {
|
|
||||||
getHotBanner
|
|
||||||
} from '@/api/store.js'
|
|
||||||
import {
|
|
||||||
Toast
|
|
||||||
} from '@/libs/uniApi'
|
|
||||||
import {
|
|
||||||
getGeocoder
|
|
||||||
} from '@/api/store.js';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
mTabbar,
|
mTabbar,
|
||||||
@ -121,73 +104,47 @@
|
|||||||
articleList: [],
|
articleList: [],
|
||||||
recoList: [],
|
recoList: [],
|
||||||
street_id: '',
|
street_id: '',
|
||||||
bgData: [{
|
bgData: [{ pic: '' }, { pic: '' }],
|
||||||
pic: ''
|
|
||||||
}, {
|
|
||||||
pic: ''
|
|
||||||
}],
|
|
||||||
store_id: '',
|
store_id: '',
|
||||||
locationArr: ({}),
|
locationArr: ({}),
|
||||||
setrecommend_address: "",
|
setrecommend_address: "",
|
||||||
mer_id: 0
|
mer_id: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
getHotBanner('good').then(res => {
|
getHotBanner('good').then(res => {
|
||||||
this.bgData = res.data
|
this.bgData = res.data
|
||||||
})
|
})
|
||||||
uni.$on('resetLocation', function() {
|
|
||||||
console.log('resetLocation');
|
|
||||||
})
|
|
||||||
this.getArticle()
|
this.getArticle()
|
||||||
this.selfLocation()
|
|
||||||
getArticleList(19).then(res => {
|
getArticleList(19).then(res => {
|
||||||
this.recoList = res.data.list
|
this.recoList = res.data.list
|
||||||
})
|
})
|
||||||
|
console.log("位置", JSON.parse(this.location));
|
||||||
|
const LOCA = JSON.parse(this.location)
|
||||||
|
this.street_id = LOCA.address_reference.town.id
|
||||||
|
this.getCloudShopMerId(this.street_id)
|
||||||
|
this.town = LOCA.address_component.street ?? ''
|
||||||
},
|
},
|
||||||
onShow() {},
|
onShow() {},
|
||||||
methods: {
|
computed: mapGetters(['location']),
|
||||||
selfLocation() {
|
watch: {
|
||||||
let self = this
|
location(newVal, oldVal) {
|
||||||
uni.getLocation({
|
console.log('newVal', newVal);
|
||||||
type: 'gcj02',
|
return newVal
|
||||||
success: (res) => {
|
|
||||||
let latitude, longitude;
|
|
||||||
latitude = res.latitude.toString();
|
|
||||||
longitude = res.longitude.toString();
|
|
||||||
this.latitude = res.latitude
|
|
||||||
this.longitude = res.longitude
|
|
||||||
getGeocoder({
|
|
||||||
lat: latitude,
|
|
||||||
long: longitude
|
|
||||||
}).then(res => {
|
|
||||||
this.locationArr = res.data
|
|
||||||
this.locationArr.location_name = res.data.address_component.street
|
|
||||||
get_cloud_shop(res.data.address_reference.town.id).then(re => {
|
|
||||||
if(re.data.mer_id){
|
|
||||||
this.mer_id = re.data.mer_id
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}).catch(err => Toast(err))
|
|
||||||
|
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
methods: {
|
||||||
Toast(err)
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
selectPlce(e) {
|
selectPlce(e) {
|
||||||
|
console.log("e", e);
|
||||||
this.street_id = e.value[1].code
|
this.street_id = e.value[1].code
|
||||||
this.store_id = e.value[1].id
|
this.store_id = e.value[1].id
|
||||||
this.town = e.value[1].name
|
this.town = e.value[1].name
|
||||||
get_cloud_shop(e.value[1].code).then(re => {
|
this.getCloudShopMerId(e.value[1].code)
|
||||||
this.mer_id = re.data.mer_id
|
},
|
||||||
|
getCloudShopMerId(id) {
|
||||||
|
get_cloud_shop(id).then(res => {
|
||||||
|
this.mer_id = res.data.mer_id ?? 0
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
navigat() {
|
navigat() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@ -199,22 +156,18 @@
|
|||||||
url: '/pages/news_details/index?id=' + item.article_id
|
url: '/pages/news_details/index?id=' + item.article_id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
go_shop(id) {
|
go_shop() {
|
||||||
if (this.mer_id == 0) {
|
if (this.mer_id == 0) {
|
||||||
Toast('当前区域没有云仓库')
|
return Toast('当前区域没有云仓库')
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
console.log(this.mer_id)
|
console.log(this.mer_id)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
||||||
url: '/pages/store/home/index?id=' + this.mer_id + '&LihaiYun=Lihai'
|
url: '/pages/store/home/index?id=' + this.mer_id + '&LihaiYun=Lihai'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async getArticle() {
|
async getArticle() {
|
||||||
let list = []
|
let list = []
|
||||||
const {
|
const { data } = await getArticleCategoryList()
|
||||||
data
|
|
||||||
} = await getArticleCategoryList()
|
|
||||||
data.map((item, index) => {
|
data.map((item, index) => {
|
||||||
if (item.title !== '推荐') {
|
if (item.title !== '推荐') {
|
||||||
list.push(item)
|
list.push(item)
|
||||||
@ -224,9 +177,7 @@
|
|||||||
this.getArticleList(list[0].article_category_id)
|
this.getArticleList(list[0].article_category_id)
|
||||||
},
|
},
|
||||||
async getArticleList(id) {
|
async getArticleList(id) {
|
||||||
const {
|
const { data } = await getArticleList(id)
|
||||||
data
|
|
||||||
} = await getArticleList(id)
|
|
||||||
this.articleList = data.list
|
this.articleList = data.list
|
||||||
},
|
},
|
||||||
// 点赞
|
// 点赞
|
||||||
|
Loading…
x
Reference in New Issue
Block a user