731 lines
16 KiB
Vue
731 lines
16 KiB
Vue
<template>
|
|
|
|
<view class="Circle_friends">
|
|
<view class="circle_friends_wrapper">
|
|
<view class="site-box flex_a_c_j_sb">
|
|
<view class="place_wrapper flex_a_c" @click="selectLocation">
|
|
<view class="iconfont icon-weizhi" style="margin-left: 20rpx;"></view>
|
|
<view class="town_name">{{street}}</view>
|
|
</view>
|
|
|
|
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
|
<view class="iconfont icon-xiaoxi" style="color:#fff;"></view>
|
|
</navigator>
|
|
<view class="bg-img" v-if="isFshow">
|
|
<img :src="bgColor" alt="">
|
|
</view>
|
|
</view>
|
|
|
|
<zbpSwiper :isSelectPlace="true" @kkchange='kkchange' :location_Arr="locationArr">
|
|
</zbpSwiper>
|
|
<view class="shop_wrapper">
|
|
<!-- locationArr.address_reference.town.id -->
|
|
<navigator class="l_yun" hover-class="none"
|
|
:url="`/pages/nongKe/supply_chain/supplier?type_id=10&street_id=${street_id}`"
|
|
:style=" {'background-image': `url(${bgData[0].pic})`}">
|
|
<view class=" text-name">
|
|
<text>{{town}}</text>
|
|
<view class="name_town">-供销综合云市场-</view>
|
|
</view>
|
|
</navigator>
|
|
<view class="r_lihai" @click="go_shop" :style=" {'background-image': `url(${bgData[1].pic})`}">
|
|
<view class="title">里海云仓</view>
|
|
</view>
|
|
</view>
|
|
<view class="tabs_wrapper flex_a_c_j_sb">
|
|
<view class="title flex_a_c">热点资讯</view>
|
|
<navigator class="flex_a_c" hover-class="none" url="/pages/news_list/index">
|
|
更多
|
|
<view class="iconfont icon-gengduo3"></view>
|
|
</navigator>
|
|
</view>
|
|
<view class="article_box">
|
|
<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'
|
|
class='article-item'>
|
|
<view class='text'>
|
|
<view class='name'>{{item.title}}</view>
|
|
<view class="time">{{item.create_time}}</view>
|
|
</view>
|
|
<view class='pictrue'>
|
|
<image :src='item.image_input'></image>
|
|
</view>
|
|
</navigator>
|
|
</block>
|
|
</view>
|
|
|
|
<view class="tabs_wrapper">
|
|
<u-tabs :list="tabsData.list" @click="tabsChange" keyName="title" lineColor="#F84221"></u-tabs>
|
|
</view>
|
|
|
|
<view class="goods">
|
|
<block v-for="(item,index) in articleList" :key="index">
|
|
<view class="goods_item" @click="gogogo(item)">
|
|
<image class="goods_img" :src="item.image_input" mode="aspectFill"></image>
|
|
<view class="botm">
|
|
<view class="title">{{item.title}}</view>
|
|
<view class="goods_info flex_a_c">
|
|
<view class="l_info flex_a_c">
|
|
<image :src="(item.author && item.author.avatar) || '/static/images/f.png'"
|
|
mode="aspectFill" class="g_img"></image>
|
|
<view class="g_name">{{item.author}}</view>
|
|
</view>
|
|
<!-- <view class="nice_box" @click.stop="giveStart(item)">
|
|
<text class="iconfont" :class="item.relevance_id ? 'icon-shoucang1' : 'icon-dianzan'"></text>
|
|
<text class="collect">{{item.count_start}}</text>
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</block>
|
|
</view>
|
|
<view class="empty_wrapper" v-if="emptyShow">
|
|
<u-empty :show="emptyShow" mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png"></u-empty>
|
|
</view>
|
|
</view>
|
|
<u-picker :defaultIndex="defaInd" :show="showPicker" ref="uPicker" :columns="columnData" @confirm="confirm"
|
|
@cancel="showPicker = false" @change="changeHandler" keyName="name"></u-picker>
|
|
<!-- <view class="bg_color"></view> -->
|
|
|
|
<!-- <m-tabbar native>
|
|
<template v-slot:tabbar_index_2>
|
|
<view class="custom_style">
|
|
<view class="custom_style_icon"></view>
|
|
</view>
|
|
</template>
|
|
</m-tabbar> -->
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Cache from '@/utils/cache';
|
|
import zbpSwiper from '@/components/zbpSwiper'
|
|
import {
|
|
getArea,
|
|
getStreet
|
|
} from '@/api/article.js';
|
|
import {
|
|
mapGetters
|
|
} from 'vuex'
|
|
import mTabbar from '@/components/m-tabbar/m-tabbar.vue'
|
|
import {
|
|
graphicStartApi
|
|
} from '@/api/community.js'
|
|
import {
|
|
getArticleList,
|
|
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 {
|
|
components: {
|
|
mTabbar,
|
|
zbpSwiper
|
|
},
|
|
data() {
|
|
return {
|
|
defaInd: [0, 0],
|
|
tabsData: {
|
|
list: [],
|
|
tabsActive: 0
|
|
},
|
|
town: '',
|
|
street_id: '',
|
|
emptyShow: false,
|
|
articleList: [],
|
|
recoList: [],
|
|
columnData: [],
|
|
bgData: [{
|
|
pic: ''
|
|
}, {
|
|
pic: ''
|
|
}],
|
|
store_id: '',
|
|
locationArr: ({}),
|
|
setrecommend_address: "",
|
|
isYunCang: 0,
|
|
bgColor: '',
|
|
isFshow: false,
|
|
street: '',
|
|
showPicker: false,
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.Area()
|
|
this.appLocation()
|
|
getHotBanner('good').then(res => {
|
|
// console.log(res);
|
|
this.bgData = res.data
|
|
})
|
|
this.getArticle()
|
|
getArticleList(19).then(res => {
|
|
this.recoList = res.data.list
|
|
})
|
|
// this.getTownAndStoreId()
|
|
|
|
},
|
|
onShow() {},
|
|
// computed: mapGetters(['location']),
|
|
mounted() {
|
|
// #ifdef H5
|
|
// 监听页面滚动事件
|
|
window.addEventListener("scroll", this.scrolling);
|
|
// #endif
|
|
|
|
|
|
},
|
|
watch: {
|
|
street: {
|
|
handler(newVal, oldVal) {
|
|
this.street = newVal
|
|
let arr = Cache.get('ADRESS_LOCATION')
|
|
console.log(arr,'3')
|
|
if (arr.length > 0) {
|
|
this.street=arr.split(',')[0]
|
|
this.town = arr.split(',')[1]
|
|
this.street_id =arr.split(',')[2]
|
|
this.getCloudShopMerId(this.street_id)
|
|
}
|
|
},
|
|
}
|
|
},
|
|
// #ifdef APP-PLUS
|
|
onPageScroll(e) {
|
|
// this.scrollTop = e.scrollTop;
|
|
console.log(e.scrollTop)
|
|
if (e.scrollTop > 0) {
|
|
this.isFshow = true
|
|
} else {
|
|
this.isFshow = false
|
|
}
|
|
|
|
},
|
|
// #endif
|
|
methods: {
|
|
confirm(e) {
|
|
this.street = e.value[1].name
|
|
this.town = e.value[1].name
|
|
this.showPicker = false
|
|
this.street_id = e.value[1].code
|
|
this.getCloudShopMerId(e.value[1].code)
|
|
|
|
Cache.set('ADRESS_LOCATION',
|
|
this.street + ','+ this.town+','+
|
|
|
|
this.street_id
|
|
)
|
|
},
|
|
changeHandler(e) {
|
|
const {
|
|
columnIndex,
|
|
value,
|
|
values,
|
|
index,
|
|
picker = this.$refs.uPicker
|
|
} = e;
|
|
if (columnIndex === 0) {
|
|
getStreet({
|
|
area_code: value[0]['code']
|
|
}).then(res => {
|
|
picker.setColumnValues(1, res.data);
|
|
});
|
|
}
|
|
},
|
|
Area() {
|
|
getArea({
|
|
city_code: 510500
|
|
}).then(res => {
|
|
this.$refs.uPicker.setColumnValues(0, res.data);
|
|
this.Street(res.data[0]['code']);
|
|
});
|
|
},
|
|
Street(code) {
|
|
getStreet({
|
|
area_code: code
|
|
}).then(res => {
|
|
this.$refs.uPicker.setColumnValues(1, res.data);
|
|
});
|
|
},
|
|
|
|
swiperChange(e) {
|
|
let {
|
|
current,
|
|
source
|
|
} = e.detail;
|
|
if (source === 'autoplay' || source === 'touch') {
|
|
this.bgColor = this.swiper.url[e.detail.current]['img']
|
|
this.$emit('kkchange', this.bgColor)
|
|
}
|
|
},
|
|
|
|
selectLocation() {
|
|
this.showPicker = true
|
|
|
|
},
|
|
scrolling() {
|
|
// 滚动条距文档顶部的距离
|
|
let scrollTop =
|
|
window.pageYOffset ||
|
|
document.documentElement.scrollTop ||
|
|
document.body.scrollTop;
|
|
// 滚动条滚动的距离
|
|
let scrollStep = scrollTop - this.oldScrollTop;
|
|
console.log("header 滚动距离 ", scrollTop);
|
|
// 更新——滚动前,滚动条距文档顶部的距离
|
|
this.oldScrollTop = scrollTop;
|
|
|
|
//变量windowHeight是可视区的高度
|
|
let windowHeight =
|
|
document.documentElement.clientHeight || document.body.clientHeight;
|
|
//变量scrollHeight是滚动条的总高度
|
|
let scrollHeight =
|
|
document.documentElement.scrollHeight || document.body.scrollHeight;
|
|
|
|
//滚动条到底部的条件
|
|
if (scrollTop + windowHeight == scrollHeight) {
|
|
//你想做的事情
|
|
console.log("header 你已经到底部了");
|
|
}
|
|
if (scrollStep < 0) {
|
|
this.isFshow = false
|
|
console.log("header 滚动条向上滚动了!");
|
|
} else {
|
|
this.isFshow = true
|
|
console.log("header 滚动条向下滚动了!");
|
|
}
|
|
// 判断是否到了最顶部
|
|
if (scrollTop <= 0) {
|
|
this.isFshow = false
|
|
console.log("header 到了最顶部")
|
|
}
|
|
},
|
|
kkchange(e) {
|
|
this.bgColor = e
|
|
},
|
|
|
|
async appLocation() {
|
|
|
|
uni.getLocation({
|
|
type: 'wgs84',
|
|
timeout: '10',
|
|
success: (res) => {
|
|
|
|
let latitude, longitude;
|
|
latitude = res.latitude.toString();
|
|
longitude = res.longitude.toString();
|
|
getGeocoder({
|
|
lat: latitude,
|
|
long: longitude
|
|
}).then(res => {
|
|
this.street = res.data.address_component.street
|
|
this.town = res.data.address_reference.town.title
|
|
this.street_id = res.data.address_reference.town.id
|
|
|
|
Cache.set('ADRESS_LOCATION',
|
|
this.street + ','+ this.town+','+
|
|
this.street_id
|
|
)
|
|
|
|
this.getCloudShopMerId(this.street_id)
|
|
}).catch(err => {
|
|
uni.showToast({
|
|
title: err,
|
|
icon: 'none'
|
|
})
|
|
})
|
|
},
|
|
fail: (err) => {
|
|
|
|
uni.showToast({
|
|
title: "获取定位超时",
|
|
icon: 'none',
|
|
duration: 2000
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
selectPlce(e) {
|
|
this.street_id = e.value[1].code
|
|
this.town = e.value[1].name
|
|
this.getCloudShopMerId(e.value[1].code)
|
|
|
|
},
|
|
getCloudShopMerId(id) {
|
|
get_cloud_shop(id).then(res => {
|
|
res.data.length > 0 ? this.isYunCang = 1 : this.isYunCang = 0
|
|
})
|
|
},
|
|
navigat() {
|
|
uni.navigateTo({
|
|
url: '/pages/store/settledApply/settledApply'
|
|
})
|
|
},
|
|
gogogo(item) {
|
|
uni.navigateTo({
|
|
url: '/pages/news_details/index?id=' + item.article_id
|
|
})
|
|
},
|
|
go_shop() {
|
|
if (this.isYunCang == 0) {
|
|
return Toast('当前区域没有云仓库')
|
|
}
|
|
uni.navigateTo({
|
|
url: `/pages/nongKe/cloud_entrepot/index?street=${this.street_id}&town=${this.town}`
|
|
})
|
|
// uni.navigateTo({
|
|
// url: '/pages/store/home/index?id=' + this.mer_id + '&LihaiYun=Lihai'
|
|
// })
|
|
},
|
|
async getArticle() {
|
|
let list = []
|
|
const {
|
|
data
|
|
} = await getArticleCategoryList()
|
|
data.map((item, index) => {
|
|
if (item.title !== '推荐') {
|
|
list.push(item)
|
|
}
|
|
})
|
|
this.tabsData.list = list
|
|
this.getArticleList(list[0].article_category_id)
|
|
},
|
|
async getArticleList(id) {
|
|
const {
|
|
data
|
|
} = await getArticleList(id)
|
|
this.articleList = data.list
|
|
},
|
|
// 点赞
|
|
giveStart(item) {
|
|
let status = item.status ? 0 : 1
|
|
// console.log('item', item);
|
|
graphicStartApi(item.community_id, {
|
|
status: status
|
|
}).then(res => {
|
|
Toast(res.message)
|
|
this.getArticleList()
|
|
})
|
|
},
|
|
tabsChange(item) {
|
|
|
|
this.getArticleList(item.article_category_id)
|
|
this.street_id = item.id
|
|
this.tabsData.tabsActive = item.index
|
|
},
|
|
},
|
|
onPullDownRefresh() {
|
|
uni.stopPullDownRefresh()
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.Circle_friends {
|
|
background: linear-gradient(180deg, #FFFFFF 0%, #F6F6F6 100%);
|
|
}
|
|
|
|
.bg-img {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
top: 0;
|
|
/* #ifdef MP || APP-PLUS */
|
|
z-index: -100;
|
|
/* #endif */
|
|
/* #ifdef H5 */
|
|
z-index: -100;
|
|
/* #endif */
|
|
z-index: -100;
|
|
filter: blur(0);
|
|
overflow: hidden;
|
|
|
|
|
|
img {
|
|
width: 100%;
|
|
height: 100%;
|
|
filter: blur(30rpx);
|
|
transform: scale(1.5);
|
|
}
|
|
}
|
|
|
|
.site-box {
|
|
width: 100%;
|
|
/* #ifdef MP || APP-PLUS */
|
|
height: 170rpx;
|
|
/* #endif */
|
|
/* #ifdef H5 */
|
|
height: 120rpx;
|
|
/* #endif */
|
|
margin-bottom: 26.32rpx;
|
|
position: absolute;
|
|
top: 0rpx;
|
|
position: fixed;
|
|
z-index: 999;
|
|
padding-top: 30rpx;
|
|
padding-right: 20rpx;
|
|
|
|
// 位置
|
|
.place_wrapper {
|
|
color: #fff;
|
|
margin-right: 24.56rpx;
|
|
font-size: 30rpx;
|
|
|
|
.town_name {
|
|
margin-left: 21rpx;
|
|
}
|
|
}
|
|
|
|
.iconfont {
|
|
font-size: 35.09rpx;
|
|
}
|
|
}
|
|
|
|
.shop_wrapper {
|
|
height: 192.98rpx;
|
|
width: 694.74rpx;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-top: 0;
|
|
|
|
.l_yun {
|
|
width: 456.14rpx;
|
|
border-radius: 16rpx;
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
overflow: hidden;
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
|
|
.text-name {
|
|
margin-top: 14.04rpx;
|
|
text-align: center;
|
|
color: #fff;
|
|
font-weight: bold;
|
|
font-size: 29.82rpx;
|
|
|
|
text {
|
|
font-size: 40.35rpx;
|
|
}
|
|
}
|
|
|
|
.yun_title {
|
|
color: #B24322;
|
|
background-color: #ffad99;
|
|
height: 56.14rpx;
|
|
clip-path: polygon(0% 0, 100% 0, 90% 100%, 0 100%);
|
|
text-align: center;
|
|
line-height: 56.14rpx;
|
|
padding: 0 31.58rpx 0 21.05rpx;
|
|
width: max-content;
|
|
|
|
.iconlihai {
|
|
font-size: 24.56rpx;
|
|
margin-left: 16rpx;
|
|
}
|
|
}
|
|
|
|
.text_cont {
|
|
position: absolute;
|
|
left: 21.05rpx;
|
|
bottom: 47.37rpx;
|
|
color: #7F1616;
|
|
font-weight: 700;
|
|
font-size: 31.58rpx;
|
|
|
|
.name_town {
|
|
font-size: 49.12rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.r_lihai {
|
|
width: 217.54rpx;
|
|
height: 100%;
|
|
font-size: 35.09rpx;
|
|
padding-top: 28.07rpx;
|
|
text-align: center;
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
box-sizing: border-box;
|
|
border-radius: 16rpx;
|
|
color: #fff;
|
|
font-weight: bold;
|
|
|
|
.title {
|
|
margin-top: 105.26rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.tabs_wrapper {
|
|
width: 694.74rpx;
|
|
margin: 38.6rpx auto;
|
|
margin-bottom: 21.05rpx;
|
|
|
|
.title {
|
|
font-size: 31.58rpx;
|
|
font-weight: bold;
|
|
|
|
&::before {
|
|
content: '';
|
|
display: inline-block;
|
|
width: 3px;
|
|
height: 31.58rpx;
|
|
background-color: #F84221;
|
|
margin-right: 7.02rpx;
|
|
}
|
|
}
|
|
}
|
|
|
|
.article_box {
|
|
height: 100%;
|
|
width: 694.74rpx;
|
|
margin: 0 auto;
|
|
background-color: #fff;
|
|
border-radius: 16rpx;
|
|
padding: 0 24.56rpx;
|
|
box-sizing: border-box;
|
|
|
|
.title-box {
|
|
height: 87.72rpx;
|
|
|
|
text {
|
|
font-size: 28.07rpx;
|
|
}
|
|
}
|
|
|
|
.article-item {
|
|
display: flex;
|
|
// height: 175.44rpx;
|
|
justify-content: space-between;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
padding: 21.05rpx 0;
|
|
|
|
.text {
|
|
flex: 1;
|
|
height: 122.81rpx;
|
|
margin-right: 17.54rpx;
|
|
font-size: 24rpx;
|
|
color: #999;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
|
|
.name {
|
|
font-size: 26.32rpx;
|
|
color: #282828;
|
|
}
|
|
}
|
|
|
|
.pictrue {
|
|
width: 175.44rpx;
|
|
height: 122.81rpx;
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
border-radius: 8px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.goods {
|
|
margin: 0 auto;
|
|
width: 694.74rpx;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
justify-content: space-between;
|
|
|
|
.goods_item {
|
|
width: 342.11rpx;
|
|
height: 491.23rpx;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
background-color: #fff;
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-bottom: 10.53rpx;
|
|
|
|
.goods_img {
|
|
width: 100%;
|
|
height: 294.74rpx;
|
|
}
|
|
|
|
.botm {
|
|
flex: 1;
|
|
padding: 0 14.04rpx;
|
|
padding-bottom: 21.05rpx;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
|
|
.title {
|
|
margin: 12px 0;
|
|
width: 100%;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 2;
|
|
-webkit-box-orient: vertical;
|
|
}
|
|
|
|
.goods_info {
|
|
justify-content: space-between;
|
|
|
|
.g_img {
|
|
width: 60rpx;
|
|
height: 60rpx;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.g_name {
|
|
margin-left: 8.77rpx;
|
|
width: 100.63rpx;
|
|
text-overflow: ellipsis;
|
|
/* 溢出显示省略号 */
|
|
overflow: hidden;
|
|
/* 溢出隐藏 */
|
|
white-space: nowrap;
|
|
/* 强制不换行 */
|
|
}
|
|
|
|
.nice_box {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.isshow {
|
|
color: #FE3530 !important;
|
|
}
|
|
|
|
.iconfont {
|
|
font-size: 30rpx;
|
|
}
|
|
|
|
.icon-shoucang1 {
|
|
color: #F84221;
|
|
}
|
|
|
|
.collect {
|
|
font-size: 24rpx;
|
|
margin-left: 5rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
</style> |