Feat:寻看点和抽奖
This commit is contained in:
+46
-13
@@ -42,16 +42,29 @@
|
||||
inn.guaranteeValue
|
||||
}}元
|
||||
</view>
|
||||
<view class="zan-box flex flex-0 ai-end" @click="zanInn">
|
||||
<template v-if="isLike">
|
||||
<image :src="webUrl+'/20230828095210280991.png'"/>
|
||||
<text style="font-size: 28rpx;color: #FF564A;">{{ inn.zan }}</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image :src="webUrl+'/20230828095217616640.png'"/>
|
||||
<text style="font-size: 28rpx;color: #333333;">{{ inn.zan }}</text>
|
||||
</template>
|
||||
|
||||
<view class="flex ai-center">
|
||||
<view class="zan-box flex flex-0 ai-end" @click="zanInn">
|
||||
<template v-if="isLike">
|
||||
<image :src="webUrl+'/20230828095210280991.png'"/>
|
||||
<text style="font-size: 28rpx;color: #FF564A;">{{ inn.zan }}</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<image :src="webUrl+'/20230828095217616640.png'"/>
|
||||
<text style="font-size: 28rpx;color: #333333;">{{ inn.zan }}</text>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
<view class="flex flex-0 ai-end">
|
||||
<image style="width: 32rpx;height: 32rpx;margin-left: 10rpx;" :src="webUrl+'/20240113230535491918.png'"
|
||||
mode="scaleToFill" @click="doneFavorite" v-if="isFavorite"/>
|
||||
<image style="width: 32rpx;height: 32rpx;margin-left: 10rpx;" :src="webUrl+'/20240122093206161576.png'"
|
||||
mode="scaleToFill" @click="doneFavorite" v-else/>
|
||||
<text style="font-size: 28rpx;color: #333333;">{{ favoriteCount }}</text>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -221,13 +234,12 @@ import {
|
||||
import {formatDateTime} from "@/utils";
|
||||
import {getUrlParam} from "@/utils/common.js";
|
||||
import imgBox from '@/components/imageTypeSet/imagebox.vue'
|
||||
import dragButton from "@/components/drag-button/drag-button.vue";
|
||||
import cookie from "@/utils/store/cookie";
|
||||
import {addStore, removeStore} from "@/api/favorite";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
imgBox,
|
||||
dragButton
|
||||
imgBox
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -249,7 +261,9 @@ export default {
|
||||
posterUrl: "", // 分享海报
|
||||
id: null,
|
||||
partnerId: null,
|
||||
isLike: false //点赞
|
||||
isLike: false, //点赞
|
||||
isFavorite: false,
|
||||
favoriteCount: 0
|
||||
}
|
||||
},
|
||||
//必须在页面加 onPageScroll(e){} ,才能滑动显示背景
|
||||
@@ -537,6 +551,8 @@ export default {
|
||||
getHotelDetail(that.id).then((res) => {
|
||||
that.inn = res.data;
|
||||
that.isLike = res.data.zanVo !== null;
|
||||
that.isFavorite = res.data.hasFavorite
|
||||
that.favoriteCount = res.data.favoriteCount
|
||||
}).catch((err) => {
|
||||
|
||||
}).finally(() => {
|
||||
@@ -546,6 +562,8 @@ export default {
|
||||
getHomeHotelDetail(that.id).then((res) => {
|
||||
that.inn = res.data;
|
||||
that.isLike = res.data.zanVo !== null;
|
||||
that.isFavorite = res.data.hasFavorite
|
||||
that.favoriteCount = res.data.favoriteCount
|
||||
}).catch((err) => {
|
||||
|
||||
}).finally(() => {
|
||||
@@ -643,6 +661,21 @@ export default {
|
||||
} else {
|
||||
this.$dialog.error('电话为空');
|
||||
}
|
||||
},
|
||||
async doneFavorite() {
|
||||
if (this.isFavorite) {
|
||||
const res = await removeStore(this.id)
|
||||
if (res.success) {
|
||||
this.isFavorite = false
|
||||
this.favoriteCount = res.data.favoriteCount
|
||||
}
|
||||
} else {
|
||||
const res = await addStore(this.id)
|
||||
if (res.success) {
|
||||
this.isFavorite = true
|
||||
this.favoriteCount = res.data.favoriteCount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user