修改本地生活页面

This commit is contained in:
wangxiaowei 2024-06-25 13:42:40 +08:00
parent 27f50fc643
commit 0c7b44d710

@ -5,15 +5,15 @@
<view class="index">
<u-sticky offset-top="0" h5-nav-height="0" bg-color="transparent">
<view class="index-bg">
<u-navbar title="本地生活" title-color="#fff" :is-fixed="false" :border-bottom="false" :background="{ background: 'transparent', }"
:is-back="false">
<u-navbar title="本地生活" title-color="#fff" :is-fixed="false" :border-bottom="false"
:background="{ background: 'transparent', }" :is-back="false">
<view class="flex row city">
<router-link class="m-l-16 flex white row-center" to="/bundle_b/pages/city/city">
<text class="m-r-6">{{ cityInfo.name || '选择' }}</text>
<u-icon name="arrow-down" size="24" color="#FFFFFF"></u-icon>
</router-link>
</view>
<view class="flex-1">
<router-link to="/bundle_b/pages/local_search/index">
<u-search wrap-bg-color="transparent" bg-color="#fff" :disabled="true" :height="62">
@ -27,9 +27,9 @@
<view class="nav bg-white m-t-20" v-if="navList.length">
<swiper :style="'height:' + navSwiperH + 'rpx;'" @change="swiperChange">
<swiper-item v-for="(items, index) in navList" :key="index">
<view class="nav-list flex flex-wrap">
<view v-for="(item, index2) in items" :key="index2"
class="nav-item m-t-30" @tap="menuJump(item)">
<view class="flex flex-wrap">
<view v-for="(item, index2) in items" :key="index2" class="nav-item m-t-30"
@tap="menuJump(item)">
<view class="flex-col col-center">
<image class="nav-icon m-b-15" :src="item.image"></image>
<view class="name xs">{{item.name}}</view>
@ -44,10 +44,52 @@
</view>
</view>
</view>
<view class="swiper">
<ad-swipers :pid="7" height="260rpx" radius="20rpx"></ad-swipers>
</view>
<view class="list">
<view class="info">
<navigator url="/bundle_b/pages/local_shop/local_shop" hover-class="none">
<view class="flex row-between col-center">
<view>
<u-image width="120rpx" height="120rpx" radius="50"
src="https://dlh.hainings.com/uploads/images/20231130103254fa5431831.jpg"></u-image>
</view>
<view class="shop-info">
<view>商家名称</view>
<view class="address">
<u-icon name="map" color="#9e9e9e" size="28"></u-icon>
浙江省 嘉兴市 秀洲区 新洲国际大酒店
</view>
</view>
</view>
</navigator>
<view>
<scroll-view style="white-space: nowrap;" :scroll-x="true">
<view class="goods-wrap">
<view class="goods-item" v-for="(item, index) in shop">
<navigator url="/bundle_b/pages/local_shop/local_shop" hover-class="none">
<u-image :src="item.image" width="200rpx" height="200rpx"
border-radius="10rpx"></u-image>
<view class="line-1">{{item.name}}</view>
<view>
<price-format :color="colorConfig.primary" class="m-r-10" :first-size="34"
:second-size="26" :subscript-size="26" :price="item.price"
:weight="500"></price-format>
</view>
</navigator>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</view>
<tabbar></tabbar>
</mescroll-body>
</template>
<script>
@ -62,7 +104,7 @@
arraySlice,
menuJump
} from '@/utils/tools'
export default {
mixins: [MescrollMixin, MescrollCompMixin],
data() {
@ -70,26 +112,65 @@
enable: true,
navSwiperH: '',
currentSwiper: 0,
navList:[
[
{image: 'https://dlh.hainings.com/uploads/images/202401151539353104e7660.jpeg', name: '商家入驻', is_tab: 0, link: '/bundle_b/pages/local_settled/index', link_type: 1}
]
navList: [
[{
image: 'https://dlh.hainings.com/uploads/images/202401151539353104e7660.jpeg',
name: '商家入驻',
is_tab: 0,
link: '/bundle_b/pages/local_settled/index',
link_type: 1
}, ]
],
shop: [{
image: 'https://dlh.hainings.com/uploads/images/20230617152038ec2d56794.png',
name: '东龙汇金卡金卡金卡金卡金卡金卡金卡金卡金卡',
price: 1.00,
id: 1
},
{
image: 'https://dlh.hainings.com/uploads/images/20230617152038ec2d56794.png',
name: '东龙汇金卡',
price: 1.00,
id: 2
},
{
image: 'https://dlh.hainings.com/uploads/images/20230617152038ec2d56794.png',
name: '东龙汇金卡',
price: 1.00,
id: 3
},
{
image: 'https://dlh.hainings.com/uploads/images/20230617152038ec2d56794.png',
name: '东龙汇金卡',
price: 1.00,
id: 4
},
{
image: 'https://dlh.hainings.com/uploads/images/20230617152038ec2d56794.png',
name: '东龙汇金卡',
price: 1.00,
id: 5
},
]
}
},
async onLoad(options) {
console.log(this.navList)
try{
if (this.navList[0].length <= 5) {
this.navSwiperH = 200
} else {
this.navSwiperH = 374
}
this.navList = arraySlice(this.navList[0])
try {
if (!options?.refresh) {
this.reLocationFunc();
console.log(1)
console.log(this.cityInfo.id)
this.getHome()
}
}catch(e){
}
} catch (e) {}
// 选择城市后是否刷新
if(options?.refresh) await this.getHomeFun()
if (options?.refresh) await this.getHomeFun()
},
onUnload() {
uni.$off('refreshhome')
@ -105,26 +186,26 @@
methods: {
...mapActions(['initLocationFunc', 'getCartNum']),
...mapMutations(['setCityInfo']),
// 位置
async reLocationFunc() {
await this.initLocationFunc();
},
async downCallback() {
this.mescroll.endSuccess(0, false)
},
async getHomeFun() {
console.log('getHome')
console.log(this.cityInfo.id)
},
swiperChange(e) {
this.currentSwiper = e.detail.current
},
menuJump(item){
menuJump(item) {
menuJump(item)
},
},
@ -137,14 +218,14 @@
this.getHomeFun()
}
},
navList(val) {
if (val.length <= 5) {
this.navSwiperH = 200
} else {
this.navSwiperH = 374
}
this.navList = arraySlice(val)
},
// navList(val) {
// if (val[0].length <= 5) {
// this.navSwiperH = 200
// } else {
// this.navSwiperH = 374
// }
// this.navList = arraySlice(val)
// },
list(val) {
this.goodsList = val
}
@ -159,49 +240,49 @@
.index {
min-height: calc(100vh - var(--window-bottom));
.index-bg {
background-image: url('https://dlh.hainings.com/uploads/images/2024010413223852d897379.jpg');
}
.u-navbar {
::v-deep .u-search {
padding: 0 30rpx;
}
}
.city {
flex: 0 0 auto;
position: relative;
}
.nav {
position: relative;
border-radius:20rpx;
border-radius: 20rpx;
.nav-item {
width: 20%;
.nav-icon {
width: 82rpx;
height: 82rpx;
}
}
.dots {
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 20rpx;
display: flex;
.dot {
width: 10rpx;
height: 6rpx;
border-radius: 6rpx;
margin-right: 10rpx;
background-color: rgba(255, 44, 60, 0.4);
&.active {
width: 20rpx;
background-color: $-color-primary;
@ -209,5 +290,41 @@
}
}
}
.swiper {
margin-top: 20rpx;
}
.list {
margin-top: 40rpx;
padding: 0 0 20rpx;
.info {
background-color: #fff;
padding: 0 20rpx;
margin-bottom: 20rpx;
.shop-info {
width: 100%;
overflow: hidden;
.address {
margin-top: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.goods-wrap {
.goods-item {
margin-top: 20rpx;
padding: 0 20rpx 20rpx;
display: inline-block;
width: 240rpx;
}
}
}
}
}
</style>
</style>