Feat:优惠券对接
This commit is contained in:
@@ -19,29 +19,68 @@
|
||||
@up="upCallback" @down="downCallback" @init="mescrollInit" @emptyclick="emptyClick">
|
||||
|
||||
<view class="fixed-box">
|
||||
<view class="line-location flex ai-center" v-if="location">
|
||||
<view class="line-location flex ai-center">
|
||||
<image :src="webUrl+'/20220903142929759087.png'" mode="scaleToFill"></image>
|
||||
<text class="bold">当前定位:{{ location }}</text>
|
||||
<!-- @click="select(location)"-->
|
||||
<text class="bold" v-if="location">当前定位:{{ location }}</text>
|
||||
<view style="color:#f66" @click="reload()" v-else>定位失败
|
||||
<image :src="webUrl+'/20231215213824297278.png'" mode="scaleToFill"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<image class="banner" :src="banner.icon" mode="scaleToFill" v-if="banner"
|
||||
@click="$global.commonJump(banner.url)"/>
|
||||
|
||||
<view class="top-box" v-if="listTop.length">
|
||||
<view class="tips">特别推荐</view>
|
||||
<view class="top-list custom-list flex ai-center">
|
||||
<view class="item" v-for="(item,index) in listTop" :key="index" @click="select(item)">
|
||||
<view class="has-goods" v-if="type===0 && item.hasData===0">暂无特产</view>
|
||||
<view class="has-goods" v-if="type>0 && type<6&& item.hasShop===0">暂无店铺</view>
|
||||
<image :src="item.icon" mode="scaleToFill"></image>
|
||||
<view class="one-t">{{ item.cityName }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="top-box" v-if="listTop.length">-->
|
||||
<!-- <view class="tips">特别推荐</view>-->
|
||||
<!-- <view class="top-list custom-list flex ai-center">-->
|
||||
<!-- <view class="item" v-for="(item,index) in listTop" :key="index" @click="select(item)">-->
|
||||
<!-- <view class="has-goods" v-if="type===0 && item.hasData===0">暂无特产</view>-->
|
||||
<!-- <view class="has-goods" v-if="type>0 && type<6&& item.hasShop===0">暂无店铺</view>-->
|
||||
<!-- <image :src="item.icon" mode="scaleToFill"></image>-->
|
||||
<!-- <view class="one-t">{{ item.cityName }}</view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
<!-- </view>-->
|
||||
</view>
|
||||
|
||||
<view class="province-name">{{ provinceName }}</view>
|
||||
<!--9-2 推荐信息-->
|
||||
<view class="recommendInfo" v-if="recommendInfo && type<2">
|
||||
<template v-if="(type===0 && recommendInfo.hotelList) || (type===1 && recommendInfo.productList)">
|
||||
<view class="red-border-title">{{ recommendInfo.title }}</view>
|
||||
<image class="bg-custom" :src="recommendInfo.backgroundImage" mode="scaleToFill"/>
|
||||
|
||||
<scroll-view class="scroll-box flex" enable-flex scroll-x>
|
||||
<!-- :style="{'backgroundImage':`url(${recommendInfo.backgroundImage})`}"-->
|
||||
|
||||
|
||||
<view class="item flex-0 flex flex-col jc-between ai-center"
|
||||
v-for="(item,index) in recommendInfo.hotelList"
|
||||
:key="index" v-if="type===0" @click="goStore(item.hotelId)">
|
||||
<image class="cover" :src="item.hotelImage" mode="scaleToFill"/>
|
||||
<image class="logo" :src="item.hotelLogo" mode="scaleToFill"/>
|
||||
<view style="width: 100%">
|
||||
<view class="name tc one-t">{{ item.hotelName }}</view>
|
||||
<rich-text class="text tc one-t" :nodes="item.hotelText"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="item flex-0 flex flex-col jc-between ai-center"
|
||||
v-for="(item,index) in recommendInfo.productList" :key="index" v-if="type===1"
|
||||
@click="$global.navToGoods(item.productId)">
|
||||
<image class="cover" :src="item.productImage" mode="scaleToFill"/>
|
||||
<image class="logo" :src="item.merLogo" mode="scaleToFill"/>
|
||||
<view style="width: 100%">
|
||||
<view class="name tc one-t">{{ item.productName }}</view>
|
||||
<rich-text class="text tc one-t" :nodes="item.productText"/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<!-- province-name-->
|
||||
<view class="red-border-title" style="margin-left: 38rpx;">{{ provinceName }}</view>
|
||||
<view class="group-list custom-list flex flex-wrap">
|
||||
<view class="item" v-for="(item, index) in listCity" :key="index" @click="select(item)">
|
||||
<view class="has-goods" v-if="type===0 && item.hasData===0">暂无特产</view>
|
||||
@@ -102,7 +141,8 @@ export default {
|
||||
keyword: "",
|
||||
type: null,
|
||||
location: "",
|
||||
banner: {}
|
||||
banner: {},
|
||||
recommendInfo: null, // 推荐信息
|
||||
};
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -114,11 +154,50 @@ export default {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
reload() {
|
||||
uni.getSetting({
|
||||
success(res) {
|
||||
if (res.authSetting['scope.userLocation']) {
|
||||
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前定位未开启,请点击确定手动开启定位',
|
||||
duration: 5000,
|
||||
success(result) {
|
||||
if (result.confirm) {
|
||||
uni.openSetting({
|
||||
success(openRes) {
|
||||
if (openRes.authSetting['scope.userLocation']) {
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '你拒绝了授权,无法继续',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if (result.cancel) {
|
||||
uni.showToast({
|
||||
title: '你拒绝了授权,无法获取定位信息',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
async getMapData() {
|
||||
const map = await getLocation();
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.location = address[1].data.result.ad_info.city;
|
||||
if (map) {
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.location = address[1].data.result.ad_info.city;
|
||||
}
|
||||
},
|
||||
|
||||
init() {
|
||||
@@ -130,6 +209,7 @@ export default {
|
||||
this.listTop = this.listGroup[0].top;
|
||||
this.listCity = this.listGroup[0].city;
|
||||
this.provinceName = this.listGroup[0].label;
|
||||
this.recommendInfo = this.listGroup[0].recommendInfo
|
||||
this.banner = {
|
||||
icon: this.listGroup[0].icon,
|
||||
url: this.listGroup[0].uniappUrl
|
||||
@@ -143,6 +223,7 @@ export default {
|
||||
this.listTop = this.listGroup[index].top;
|
||||
this.listCity = this.listGroup[index].city;
|
||||
this.provinceName = this.listGroup[index].label;
|
||||
this.recommendInfo = this.listGroup[index].recommendInfo
|
||||
this.banner = {
|
||||
icon: this.listGroup[index].icon,
|
||||
url: this.listGroup[index].uniappUrl
|
||||
@@ -195,7 +276,13 @@ export default {
|
||||
uni.navigateBack()
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
goStore(id) {
|
||||
uni.navigateTo({
|
||||
url: "/pagesInn/inn/innHome?id=" + id
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -307,8 +394,22 @@ export default {
|
||||
margin-left: 161rpx;
|
||||
margin-top: 110rpx;
|
||||
|
||||
.red-border-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
margin: 18rpx 0;
|
||||
padding: 8rpx 0 0 8rpx;
|
||||
border-left: 6rpx solid #FD574B;
|
||||
color: #262626;
|
||||
font-size: 30rpx;
|
||||
line-height: 30rpx;
|
||||
font-weight: bold;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.fixed-box {
|
||||
padding: 32rpx 0 44rpx 38rpx;
|
||||
padding: 32rpx 0 0 38rpx;
|
||||
|
||||
.line-location {
|
||||
font-size: 28rpx;
|
||||
@@ -338,6 +439,77 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.recommendInfo {
|
||||
position: relative;
|
||||
margin-left: 38rpx;
|
||||
|
||||
.scroll-box {
|
||||
position: relative;
|
||||
width: 520rpx;
|
||||
height: 314rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 70rpx 20rpx 0 20rpx;
|
||||
border-radius: 20rpx;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 520rpx 314rpx;
|
||||
}
|
||||
|
||||
.item {
|
||||
position: relative;
|
||||
width: 136rpx;
|
||||
height: 220rpx;
|
||||
margin-right: 28rpx;
|
||||
border-radius: 8rpx;
|
||||
background: linear-gradient(180deg, #08255D 0%, #6FA2FF 100%);
|
||||
color: #FFFFFF;
|
||||
line-height: 1;
|
||||
//overflow: hidden;
|
||||
|
||||
image {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 136rpx;
|
||||
height: 136rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.logo {
|
||||
position: absolute;
|
||||
left: 68rpx;
|
||||
top: 136rpx;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.name {
|
||||
padding-bottom: 10rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.text {
|
||||
padding-bottom: 10rpx;
|
||||
font-size: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -14rpx;
|
||||
top: 26rpx;
|
||||
width: 2rpx;
|
||||
height: 172rpx;
|
||||
background: #D2E0E8;
|
||||
}
|
||||
.item:last-child::after{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.province-name {
|
||||
margin: 0 38rpx 24rpx;
|
||||
font-size: 28rpx;
|
||||
@@ -366,5 +538,13 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg-custom {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 74rpx;
|
||||
width: 520rpx;
|
||||
height: 314rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user