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

238 lines
6.5 KiB
Plaintext
Raw 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 style="padding: 20rpx;">
<view class="" style="background-color: #fff; padding: 20rpx">
<up-scroll-list :indicator='false'>
<view v-for="(item, index) in tabList" @click="chooseTab(item,index)"
style=" margin: 0 10rpx; display: flex; flex-direction: column; align-items: center; justify-content: center;"
:key="index">
<view class="" :class="{tabimgActive:index==tabCurrent,tabimg: index!=tabCurrent }"
style=" border-radius: 50%; display: flex; align-items: center; justify-content: center; height: 100rpx; width: 100rpx; ">
<img :src="Service.GetMateUrlByImg(item.icon)" style="width: 50rpx; height: 50rpx; "></img>
</view>
<view :class="{tabActivefont:index==tabCurrent,tabfont:index!=tabCurrent}"
style="font-size: 26rpx; width: fit-content; white-space: nowrap; margin-top: 15rpx;" class="">
{{item.name}}
</view>
</view>
</up-scroll-list>
</view>
<view class="" style=" background-color: #fff; padding: 20rpx; ">
<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}}</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>
<up-loadmore :status="status" />
</view>
</template>
<script setup lang="ts">
import { onShow, onLoad, onReachBottom } from "@dcloudio/uni-app";
import { ref } from "vue";
import { Service } from "@/Service/Service"
import { vpMerchService } from '@/Service/vp/vpMerchService'
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
}
let current = ref(0)
let swiperList = ref([])
let address = ref('许昌市魏都区')
let notice = ref('uview-plus UI众多组件覆盖开发过程的各个需求组件功能丰富多端兼容。让您快速集成开箱即用')
let tabCurrent = ref(0)
let tabList = ref<tab[]>([])
let scrollList = ref([
{
name: '牛肉面',
img: '/static/dele/dele1.jpg'
}
])
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(() => {
getLocation()
});
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 getdata = () => {
status.value = 'loadmore'
page.value = 1
getList()
}
const getList = () => {
if (status.value !== 'loadmore') {
return
}
status.value = 'loading'
vpMerchService.GetMerchList(assId.value ? assId.value : '', comId.value ? comId.value : '', longitude.value, latitude.value, page.value).then(res => {
swiperList.value = []
res.data.banner.map((item : any) => {
swiperList.value.push(Service.GetMateUrlByImg(item.img))
})
merchList.value = [...merchList.value, ...res.data.merchList]
tabList.value = res.data.assortList.slice(0, 10)
status.value = res.data.merchList.length == 10 ? 'loadmore' : 'nomore'
page.value++
})
}
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">
.tabimgActive {
background-color: var(--nav-mian);
}
.tabimg {
background-color: #F5F5F5;
}
.tabActivefont {
color: var(--nav-mian);
}
.tabfont {
color: #333333
}
.tag {
display: flex;
align-items: center;
justify-content: center;
width: fit-content;
font-size: 24rpx;
margin-left: 10rpx;
}
</style>