修复地址错误

修复供应链列表错误
This commit is contained in:
mkm 2023-05-15 22:46:19 +08:00 committed by shengchanzhe
parent 3e1f97f269
commit a46be7373a
3 changed files with 876 additions and 744 deletions

View File

@ -1,245 +1,321 @@
<template> <template>
<view class="zbp-head-wrapper"> <view class="zbp-head-wrapper">
<view class="color-lump"></view> <view class="color-lump"></view>
<view class="bg-img"> <view class="bg-img">
<img :src="bgColor" alt=""> <img :src="bgColor" alt="">
</view> </view>
<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">{{street}}</view> <view class="town_name">{{recommend_address}}</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>
</navigator> </navigator>
</view> </view>
<!-- 搜索栏 --> <!-- 搜索栏 -->
<navigator url="/pages/columnGoods/goods_search/index" hover-class="none" class="search_content flex_a_c_j_sb"> <navigator url="/pages/columnGoods/goods_search/index" hover-class="none" class="search_content flex_a_c_j_sb">
<view class="flex_a_c"> <view class="flex_a_c">
<view class="iconfont icon-sousuo"></view> <view class="iconfont icon-sousuo"></view>
<input type="text" v-model="keyword" placeholder="搜索产品或店铺"> <input type="text" v-model="keyword" placeholder="搜索产品或店铺">
</view> </view>
<button class="search_btn">搜索</button> <button class="search_btn">搜索</button>
</navigator> </navigator>
<!-- 轮播图 --> <!-- 轮播图 -->
<view class="supply_chains-head"> <view class="supply_chains-head">
<swiper class="swiper l_center" @change="swiperChange" :indicator-dots="swiper.indicatorDots" <swiper class="swiper l_center" @change="swiperChange" :indicator-dots="swiper.indicatorDots"
:autoplay="swiper.autoplay" :interval="swiper.interval" :duration="swiper.duration" :autoplay="swiper.autoplay" :interval="swiper.interval" :duration="swiper.duration"
indicator-active-color="#fff"> indicator-active-color="#fff">
<block v-for="(item,index) in swiper['url']" :key="index"> <block v-for="(item,index) in swiper['url']" :key="index">
<swiper-item class="swi_item"> <swiper-item class="swi_item">
<u--image radius="15" :showLoading="true" :src="item.img" width="694.74rpx" height="242.11rpx" <u--image radius="15" :showLoading="true" :src="item.img" width="694.74rpx" height="242.11rpx"
mode="aspectFill"> mode="aspectFill">
</u--image> </u--image>
</swiper-item> </swiper-item>
</block> </block>
</swiper> </swiper>
</view> </view>
<u-picker :defaultIndex="[0,0]" :show="showPicker" ref="uPicker" :columns="columnData" @confirm="confirm" <u-picker :defaultIndex="[0,0]" :show="showPicker" ref="uPicker" :columns="columnData" @confirm="confirm"
@cancel="showPicker = false" @change="changeHandler" keyName="name"></u-picker> @cancel="showPicker = false" @change="changeHandler" keyName="name"></u-picker>
</view> </view>
</template> </template>
<script> <script>
import { getArea, getStreet } from '@/api/article.js'; import {
import { getIndexData, getDiy } from '@/api/api.js' getArea,
import { mapGetters } from 'vuex' getStreet
export default { } from '@/api/article.js';
props: { import {
isSelectPlace: { getIndexData,
type: Boolean, getDiy
default: false } from '@/api/api.js'
} import {getGeocoder } from '@/api/store.js';
},
data() { import {
return { mapGetters
showPicker: false, } from 'vuex'
columnData: [], export default {
keyword: '', props: {
street: '', isSelectPlace: {
bgColor: '', type: Boolean,
swiper: { default: false
url: [{ }
img: '' },
}], data() {
indicatorDots: true, // return {
vertical: false, // showPicker: false,
autoplay: true, // styleConfig: [],
interval: 2000, // columnData: [],
duration: 400 // homeCombData:[],
}, keyword: '',
} recommend_address: '',
}, bgColor: '',
computed: mapGetters(['location']), swiper: {
watch: {}, url: [{
created() { img: ''
const loca = JSON.parse(this.location) }],
this.street = loca.address_component.street indicatorDots: true, //
this.getBanner() vertical: false, //
this.Area() autoplay: true, //
}, interval: 2000, //
methods: { duration: 400 //
selectLocation() { },
this.isSelectPlace ? this.showPicker = true : '' }
}, },
confirm(e) { // computed: mapGetters(['location']),
this.showPicker = false watch: {},
this.$emit('selectPlce', e) created() {
}, //#ifdef APP
changeHandler(e) { this.selfLocation()
const { columnIndex, value, values, index, picker = this.$refs.uPicker } = e; //#endif
if (columnIndex === 0) { // const loca = JSON.parse(this.location)
getStreet({ area_code: value[0]['code'] }).then(res => { // this.street = loca.address_component.street
picker.setColumnValues(1, res.data); this.getBanner()
}); this.Area()
} },
}, methods: {
Area() { selectLocation() {
getArea({ city_code: 510500 }).then(res => { this.isSelectPlace ? this.showPicker = true : ''
this.$refs.uPicker.setColumnValues(0, res.data); },
this.Street(res.data[0]['code']); confirm(e) {
}); this.showPicker = false
}, this.$emit('selectPlce', e)
Street(code) { },
getStreet({ area_code: code }).then(res => { changeHandler(e) {
this.$refs.uPicker.setColumnValues(1, res.data); const {
}); columnIndex,
}, value,
swiperChange(e) { values,
let { current, source } = e.detail; index,
if (source === 'autoplay' || source === 'touch') { picker = this.$refs.uPicker
this.bgColor = this.swiper.url[e.detail.current]['img'] } = e;
} if (columnIndex === 0) {
}, getStreet({
async getBanner() { area_code: value[0]['code']
const { data } = await getDiy({ id: 0 }) }).then(res => {
/* 对象转数组*/ picker.setColumnValues(1, res.data);
let obj = Object.keys(data.value).sort(); });
let styleConfig = obj.map(key => data.value[key]); }
/* 循环数组得到数据*/ },
styleConfig.forEach((item, index, arr) => { Area() {
if (item.name == 'headerSerch' || item.name == 'homeComb') { getArea({
item.name == 'homeComb' ? this.swiper.url = item.swiperConfig.list : ''; city_code: 510500
} }).then(res => {
}) this.$refs.uPicker.setColumnValues(0, res.data);
this.bgColor = this.swiper.url[0].img this.Street(res.data[0]['code']);
}, });
} },
} Street(code) {
</script> getStreet({
area_code: code
<style lang="scss"> }).then(res => {
.zbp-head-wrapper { this.$refs.uPicker.setColumnValues(1, res.data);
position: relative; });
padding-top: 78.95rpx; },
overflow: hidden; selfLocation() {
let self = this
.color-lump { uni.getLocation({
z-index: 1; type: 'gcj02',
position: absolute; success: (res) => {
bottom: -86px; let latitude, longitude;
left: 50%; latitude = res.latitude.toString();
transform: translate(-50%, 0); longitude = res.longitude.toString();
width: 102%; this.latitude = res.latitude
height: 133px; this.longitude = res.longitude
border-radius: 30px 30px 0 0; getGeocoder({
background-color: #fff; lat: latitude,
} long: longitude
}).then(res => {
.bg-img { console.log(res)
position: absolute; this.detaile_address = res.data.address;
width: 100%; this.location_address = res.data.address;
height: 100%; this.recommend_address = res.data.formatted_addresses.recommend.length > 4 ? res.data.formatted_addresses.recommend.slice(0,7) + '...' : res.data.formatted_addresses.recommend
top: 0; }).catch(err => {
/* #ifdef MP || APP-PLUS */ uni.showToast({
z-index: -1; title: err,
/* #endif */ icon: 'none'
/* #ifdef H5 */ })
z-index: 0; })
/* #endif */ },
z-index: 0; fail: (res) => {
filter: blur(0); uni.showToast({
overflow: hidden; title: res,
icon: 'none',
img { duration: 1000
width: 100%; });
height: 100%; },
filter: blur(30rpx); });
transform: scale(1.5); },
} swiperChange(e) {
} let {
current,
.site-box { source
margin: 0 auto; } = e.detail;
width: 694.74rpx; if (source === 'autoplay' || source === 'touch') {
height: 66.67rpx; this.bgColor = this.swiper.url[e.detail.current]['img']
margin-bottom: 26.32rpx; }
position: relative; },
//
// objToArr(data) {
.place_wrapper { let obj = Object.keys(data).sort();
color: #fff; let m = obj.map(key => data[key]);
margin-right: 24.56rpx; return m;
font-size: 31.58rpx; },
async getBanner(id) {
.town_name { let that = this;
margin-left: 10.53rpx;
} const {
} data
} = await getDiy({
.iconfont { id: 0
font-size: 35.09rpx; })
} that.styleConfig = that.objToArr(data.value);
} /* 循环数组得到数据*/
that.styleConfig.forEach((item, index, arr) => {
.my-main { if (item.name == 'headerSerch' || item.name == 'homeComb') {
transition: background-color .5s ease; if (item.name == 'homeComb') {
} that.swiper.url = item.swiperConfig.list
}
.search_content { }
margin: 0 auto; })
width: 694.74rpx; this.bgColor = this.swiper.url[0].img
height: 61.4rpx; },
padding: 2px 2px 2px 21.05rpx; }
border-radius: 100px; }
background: #fff; </script>
margin-bottom: 17.54rpx;
position: relative; <style lang="scss">
box-sizing: border-box; .zbp-head-wrapper {
position: relative;
.icon-sousuo { padding-top: 78.95rpx;
font-size: 26.32rpx; overflow: hidden;
font-weight: bold;
color: #c8c7c6; .color-lump {
margin-right: 17.54rpx; z-index: 1;
} position: absolute;
bottom: -86px;
.search_btn { left: 50%;
color: #fff; transform: translate(-50%, 0);
width: 105.26rpx; width: 102%;
height: 52.63rpx; height: 133px;
line-height: 52.63rpx; border-radius: 30px 30px 0 0;
background: #f84221; background-color: #fff;
border-radius: 100px; }
font-size: 28.07rpx;
} .bg-img {
} position: absolute;
width: 100%;
.supply_chains-head { height: 100%;
margin-bottom: 17.54rpx; top: 0;
position: relative; /* #ifdef MP || APP-PLUS */
z-index: 2; z-index: -1;
/* #endif */
.swiper { /* #ifdef H5 */
width: 694.74rpx; z-index: 0;
height: 242.11rpx; /* #endif */
margin: 0 auto; z-index: 0;
filter: blur(0);
.swi_item { overflow: hidden;
width: 100%;
height: 242.11rpx; img {
} width: 100%;
} height: 100%;
} filter: blur(30rpx);
} transform: scale(1.5);
</style> }
}
.site-box {
margin: 0 auto;
width: 694.74rpx;
height: 66.67rpx;
margin-bottom: 26.32rpx;
position: relative;
//
.place_wrapper {
color: #fff;
margin-right: 24.56rpx;
font-size: 31.58rpx;
.town_name {
margin-left: 10.53rpx;
}
}
.iconfont {
font-size: 35.09rpx;
}
}
.my-main {
transition: background-color .5s ease;
}
.search_content {
margin: 0 auto;
width: 694.74rpx;
height: 61.4rpx;
padding: 2px 2px 2px 21.05rpx;
border-radius: 100px;
background: #fff;
margin-bottom: 17.54rpx;
position: relative;
box-sizing: border-box;
.icon-sousuo {
font-size: 26.32rpx;
font-weight: bold;
color: #c8c7c6;
margin-right: 17.54rpx;
}
.search_btn {
color: #fff;
width: 105.26rpx;
height: 52.63rpx;
line-height: 52.63rpx;
background: #f84221;
border-radius: 100px;
font-size: 28.07rpx;
}
}
.supply_chains-head {
margin-bottom: 17.54rpx;
position: relative;
z-index: 2;
.swiper {
width: 694.74rpx;
height: 242.11rpx;
margin: 0 auto;
.swi_item {
width: 100%;
height: 242.11rpx;
}
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="Circle_friends"> <view class="Circle_friends">
<view class="circle_friends_wrapper"> <view class="circle_friends_wrapper">
<zbpSwiper :isSelectPlace="true" @selectPlce="selectPlce"></zbpSwiper> <zbpSwiper></zbpSwiper>
<view class="shop_wrapper"> <view class="shop_wrapper">
<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=${street_id}`"> :url="`/pages/nongKe/supply_chain/supplier?type_id=10&street_id=${street_id}`">
@ -162,7 +162,7 @@
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
page { page {
background-color: #F5F5F5; background-color: #F5F5F5;
} }
@ -188,7 +188,7 @@
.l_yun { .l_yun {
width: 456.14rpx; width: 456.14rpx;
border-radius: 8px; border-radius: 16rpx;
background-image: url("@/static/images/zonghe.png"); background-image: url("@/static/images/zonghe.png");
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
@ -223,7 +223,7 @@
.iconlihai { .iconlihai {
font-size: 24.56rpx; font-size: 24.56rpx;
margin-left: 8px; margin-left: 16rpx;
} }
} }
@ -250,7 +250,7 @@
background: url("@/static/images/lihaiyun.png") no-repeat; background: url("@/static/images/lihaiyun.png") no-repeat;
background-size: cover; background-size: cover;
box-sizing: border-box; box-sizing: border-box;
border-radius: 8px; border-radius: 16rpx;
color: #fff; color: #fff;
font-weight: bold; font-weight: bold;
@ -271,7 +271,7 @@
width: 694.74rpx; width: 694.74rpx;
margin: 0 auto; margin: 0 auto;
background-color: #fff; background-color: #fff;
border-radius: 8px; border-radius: 16rpx;
padding: 0 24.56rpx; padding: 0 24.56rpx;
box-sizing: border-box; box-sizing: border-box;