Files
vpUni/.svn/pristine/bd/bd11df8e46fa9bb754fd8c76d88893f06cd5de17.svn-base
2026-03-09 16:39:03 +08:00

415 lines
14 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<view :style="{'height':topHeight+'rpx'}"
style=" position: fixed; top: 0; z-index: 2; width: 100%; background-color: #fff; ">
<view class="" @click="isCommunity=!isCommunity"
:style="{'margin-top':top+'rpx','height':height+'rpx','line-height':height+'rpx'}"
style=" margin-left: 40rpx; display: flex; align-items: center;">
<img :src="Service.GetIconImg('/static/index/index/location.png')" style="width: 40rpx; height: 40rpx;"
alt="" />
<text style="margin-left: 15rpx; font-size: 26rpx; font-weight: 600; ">{{address}}</text>
</view>
</view>
<view class="" :style="{ 'margin-top':topHeight+20+'rpx' } ">
<view class="" style="margin: 40rpx 20rpx">
<up-swiper imgMode='heightFix' indicatorStyle="right: 20px" :list="swiperList" height='140'
@change="e => current = e.current" :autoplay="false">
<template #indicator style="right: 36rpx;">
<view class="indicator">
<view class="indicator__dot" v-for="(item, index) in swiperList" :key="index"
:class="[index === current && 'indicator__dot--active']">
</view>
</view>
</template>
</up-swiper>
</view>
</view>
<view class="" style="margin-top: 40rpx; background-color: #fff; padding: 20rpx; ">
<view class=""
style=" margin: 20rpx 0 40rpx; display: flex; align-items: center; justify-content: space-between;">
<view class="" style=" display: flex;align-items: center; font-weight: 600; font-size: 38rpx;">
<up-icon name="bell-fill" color="#333333" size="20"></up-icon>
<text style="margin-left: 20rpx;">社区公告</text>
</view>
<view class="" @click="Service.GoPage('/pages/community/noticeList?comId='+comId)"
style="display: flex;align-items: center;">
<text style="color: #666666;margin-right: 10rpx; font-size: 28rpx; ">查看更多</text>
<up-icon name="arrow-right" size="14" color='#666666' :bold='true'></up-icon>
</view>
</view>
<view class="" @click="Service.GoPage('/pages/article/articleCom?noticeId='+comNotice?.noticeId)"
style=" padding: 20rpx; margin: 20rpx 0; border-radius: 20rpx; box-shadow: 0 0 10rpx 4rpx #e2e2e2; ">
<view class="" style="display: flex; align-items: center; ">
<view class="tag"
style=" color: #fff; border-radius: 12rpx; background-color: #FF6B35; padding: 4rpx 20rpx; ">
<img :src="Service.GetIconImg('/static/index/community/top.png')"
style="width: 30rpx; height: 30rpx; " alt="" />
<text style="margin-left: 10rpx;">{{comNotice?.sign}}</text>
</view>
<text style="font-size: 32rpx; font-weight: 600; margin-left: 10rpx;">{{comNotice?.title}}</text>
</view>
<view class=""
style=" margin: 16rpx 0; color: #666666; font-size: 26rpx; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; ">
{{comNotice?.remark}}
</view>
<view class="" style=" font-size: 22rpx; color: #999999; display: flex; align-items: center;">
<up-icon name="clock" size="12" color='#999999' ></up-icon>
<text style="margin-left: 10rpx;" >{{Service.formatDate(comNotice?.addTime,2)}}</text>
<!-- <text style="margin: 0 15rpx;">·</text>
<view class="" style="display: flex;align-items: center;">
<img :src="Service.GetIconImg('/static/index/community/see.png')"
style="width: 30rpx; height: 30rpx; " alt="" />
<text style="margin-left: 10rpx;">1200人阅读</text>
</view> -->
</view>
</view>
</view>
<!-- <view class="" style="margin-top: 40rpx; background-color: #fff; padding: 20rpx; ">
<view class=""
style=" margin: 10rpx 0; display: flex; align-items: center; justify-content: space-between;">
<view class="" style="font-weight: 600; width: 70%; font-size: 32rpx;">
<up-notice-bar bgColor='#fff' color='#FF6B35' :text="notice"></up-notice-bar>
</view>
<view class="" @click="Service.GoPage('/pages/article/newsList')"
style="display: flex;align-items: center;">
<text style="color: #666666;margin-right: 10rpx; font-size: 28rpx; ">查看更多</text>
<up-icon name="arrow-right" size="14" color='#666666' :bold='true'></up-icon>
</view>
</view>
<view class="" @click="Service.GoPage('/pages/article/news')"
style="display: flex; margin-top: 20rpx; border-radius: 20rpx; ">
<image :src="Service.GetIconImg('/static/dele/dele1.jpg')" mode="aspectFill"
style=" border-radius: 20rpx; width: 190rpx; height: 150rpx;" alt="" />
<view class=""
style=" flex: 1; margin-left: 20rpx; display: flex; flex-direction: column; justify-content: space-between; ">
<view class="" style=" ">
<view class=""
style="font-weight: 700; font-size: 32rpx; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
老北京炸酱面
</view>
</view>
<view class=""
style="color: #666666; font-size: 26rpx; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; ">
老北京炸酱面是北京市传统小吃,属北京菜系,在京津冀地区广为流传。该菜品以面条为主料,搭配炸酱与时令菜码拌制而成,核心酱料选用肥瘦相间的五花肉丁,配以干黄酱和甜面酱混合炒制,经慢火熬煮形成深褐色酱料
</view>
<view class="" style=" ">
<text style="color: #666666; font-size: 26rpx;">2026-10-15</text>
</view>
</view>
</view>
</view> -->
<view class="" style="margin-top: 40rpx; background-color: #fff; padding: 20rpx; ">
<view class="" style=" display: flex; align-items: center; justify-content: space-between;">
<view class="" style=" font-weight: 600; ">
附近商家推荐
</view>
</view>
<view class="" style="margin-top: 20rpx;">
<up-scroll-list :indicator='false'>
<view v-for="(item, index) in tabList" @click="chooseTab(item,index)"
style="display: flex; width: 200rpx; flex-direction: column; align-items: center; justify-content: center;"
:key="index">
<view class="" v-if="item.icon" :class="{tabimgActive:index==tabCurrent,tabimg: index!=tabCurrent }"
style=" border-radius: 50%; display: flex; align-items: center; justify-content: center; height: 80rpx; width: 80rpx; ">
<img :src="Service.GetMateUrlByImg(item.icon)" style="width: 45rpx; height: 45rpx; "></img>
</view>
<view :class="{tabActivefont:index==tabCurrent,tabfont:index!=tabCurrent}"
style="font-size: 26rpx; white-space: nowrap; margin-top: 15rpx; width: fit-content; "
class="">
{{item.name}}
</view>
</view>
</up-scroll-list>
</view>
<!-- <view class="" style=" display: flex; align-items: center; justify-content: space-between;">
<view class="" style=" font-weight: 600; ">
</view>
<view class="" @click="Service.GoPage('/pages/community/merchantCom')"
style="display: flex;align-items: center;">
<text style="color: #666666;margin-right: 10rpx; font-size: 28rpx; ">查看更多</text>
<up-icon name="arrow-right" size="14" color='#666666' :bold='true'></up-icon>
</view>
</view> -->
<view class="" v-for="(item,index) in merchList" :key="index"
style="padding: 20rpx; margin-top: 30rpx; border-radius: 20rpx; box-shadow: 0 0 10rpx 4rpx #e2e2e2;">
<view @click="Service.GoPage('/pages/community/merchantDetail?merchId='+item.merchId)" class="" style="display: flex; ">
<img :src="Service.GetMateUrlByImg(item.showImg)"
style=" border-radius: 20rpx; width: 140rpx; height: 140rpx;" alt="" />
<view class=""
style=" flex: 1; margin-left: 20rpx; display: flex; flex-direction: column; justify-content: space-between; ">
<view class="" style="display: flex; align-items: center;">
<view class="" style="font-weight: 700; font-size: 32rpx;">
{{item.name}}
</view>
<view class="tag" v-if="item.tag" v-for="(tagItem,tagIndex) in item.tag.split(',')" :key="tagIndex"
style=" margin-left: 15rpx; color: #fff; border-radius: 12rpx; background-color: #FF6B35; padding: 4rpx 20rpx; ">
{{tagItem}}
</view>
</view>
<view class="" style="display: flex;align-items: center;">
<up-rate count="1" activeColor='#FF6B35' size='16' :readonly='true'></up-rate>
<text style="color: #666666; font-size: 26rpx;">{{item.score.toFixed(1)}}</text>
<text style="margin-left: 10rpx;color: #666666; font-size: 26rpx; ">月售{{item.sale}}单</text>
</view>
<view class="" style="display: flex; align-items: center; justify-content: space-between; ">
<view class="" style="display: flex;align-items: center;">
<up-icon name="map" color="#666666" size="18"></up-icon>
<text style="color: #666666; margin-left: 12rpx; font-size: 26rpx;">{{cancleDistance(item.distance)}}</text>
</view>
<view class="" style="margin-right: 20rpx;">
<text style="font-size: 28rpx;font-weight: 600; color: #FF6B35; "> ¥{{item.price}}/人 </text>
</view>
</view>
</view>
</view>
<view class="" v-if="item.goodsList.length>0" style="margin: 20rpx; margin-bottom: 0; ">
<up-scroll-list :indicator='false'>
<view @click="Service.GoPage('/pages/goods/goodsDetail?goodsId='+goodsItem.goodsId)" v-for="(goodsItem, goodsIndex) in item.goodsList"
:key="goodsIndex"
style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<img :src="Service.GetMateUrlByImg(goodsItem.img)" alt=""
style="width: 100rpx; height: 100rpx; border-radius: 20rpx; " />
<view class="" style="font-size: 24rpx; color: #666666; margin-top: 10rpx; ">
{{goodsItem.name}}
</view>
</view>
</up-scroll-list>
</view>
</view>
</view>
<view class="" style="width: 100%; height: 100rpx; ">
<up-loadmore :status="status" />
</view>
<up-picker @cancel='isCommunity=!isCommunity' @confirm="selecComunity" :show="isCommunity"
:columns="comunityColumns" keyName="name" valueName="name" ></up-picker>
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad, onShareAppMessage, onShareTimeline, onReachBottom } from "@dcloudio/uni-app";
import { ref } from "vue";
import { Service } from "@/Service/Service"
import { vpCommunityService } from '@/Service/vp/vpCommunityService'
// 导航栏
let topHeight = ref()
let height = ref()
let top = ref()
let isCommunity = ref(false)
let comunityColumns = ref([[]])
interface tab {
name : string
icon : string
assortId : string
}
interface Goods {
showImg : string
distance : number
tips : string
price : number
name : string
score : number
tag : string
merchId : string
sale:number
goodsList:merchGoods[]
}
interface merchGoods{
name:string
img:string
goodsId:string
}
interface notice{
addTime:string
noticeId:string
remark:string
sign:string
title:string
}
let notice = ref('uview-plus UI众多组件覆盖开发过程的各个需求组件功能丰富多端兼容。让您快速集成开箱即用')
let comNotice=ref<notice>()
let current = ref(0)
let swiperList = ref([])
let address = ref('')
let tabCurrent = ref(0)
let tabList = ref<tab[]>([])
let assId = ref('')
let comId = ref('')
let page = ref(1)
let status = ref('nomore')
let longitude = ref()
let latitude = ref()
let merchList=ref<Goods[]>([])
onLoad(() => {
let res = wx.getMenuButtonBoundingClientRect()
topHeight.value = (res.top + res.height + 5) * 2
height.value = res.height * 2
top.value = res.top * 2
getCommunity()
});
onShow(() => {
});
onReachBottom(()=>{
getList()
})
const getLocation = () => {
uni.getLocation({
type: 'wgs84',
success: function (res) {
longitude.value = res.longitude
latitude.value = res.latitude
getdata()
},
fail: function (e) {
console.log(e);
}
});
}
const getCommunity=()=>{
vpCommunityService.GetCommunityList().then(res=>{
tabList.value = res.data.assortList
comunityColumns.value[0]=res.data.comList
address.value = res.data.comList[0].name
comId.value=res.data.comList[0].communityId
assId.value=res.data.assortList[0].assortId
getLocation()
})
}
const getdata = () => {
status.value = 'loadmore'
page.value = 1
merchList.value=[]
getList()
}
const getList = () => {
if (status.value !== 'loadmore') {
return
}
status.value = 'loading'
vpCommunityService.GetCommunityMerchList( comId.value, assId.value, longitude.value, latitude.value, page.value).then(res => {
comNotice.value=res.data.notice
swiperList.value = []
res.data.banner.map((item : any) => {
swiperList.value.push(Service.GetMateUrlByImg(item.url))
})
merchList.value=[...merchList.value,...res.data.list]
status.value = res.data.list.length == 10 ? 'loadmore' : 'nomore'
page.value++
})
}
const selecComunity = (e) => {
isCommunity.value = !isCommunity.value
address.value = e.value[0].name
comId.value=e.value[0].communityId
}
const chooseTab = (e : any, index : number) => {
tabCurrent.value = index
assId.value = e.assortId
getdata()
}
const cancleDistance = (item : any) => {
if (item >= 1000) {
return (item / 1000).toFixed(1) + 'km'
} else {
return item + 'm'
}
}
</script>
<style lang="scss">
page {
background-color: #f5f5f5;
}
.indicator {
@include flex(row);
justify-content: center;
&__dot {
height: 6px;
width: 6px;
border-radius: 100px;
background-color: rgba(255, 255, 255, 0.35);
margin: 0 5px;
transition: background-color 0.3s;
&--active {
background-color: #ffffff;
}
}
}
.tag {
display: flex;
align-items: center;
justify-content: center;
width: fit-content;
font-size: 24rpx;
}
.tabimgActive {
background-color: var(--nav-mian);
}
.tabimg {
background-color: #F5F5F5;
}
.tabActivefont {
color: var(--nav-mian);
}
.tabfont {
color: #333333
}
</style>