Feat(千县店铺):收藏功能对接

This commit is contained in:
lifizer
2024-08-23 10:55:33 +08:00
parent 0528865e7b
commit 99dd695553
4 changed files with 382 additions and 122 deletions
+10 -14
View File
@@ -69,20 +69,18 @@
<text>{{ inn.zan }}</text>
</template>
</view>
<view class="flex flex-0 ai-end favorite-box">
<view class="flex flex-0 ai-end favorite-box" @click="doneFavorite">
<image
v-if="isFavorite"
:src="webUrl + '/icon/icon-star-on.png'"
mode="scaleToFill"
class="icon"
@click="doneFavorite"
/>
<image
v-else
:src="webUrl + '/icon/icon-star-off.png'"
mode="scaleToFill"
class="icon"
@click="doneFavorite"
/>
<text>{{ favoriteCount }}</text>
</view>
@@ -95,9 +93,9 @@
<view class="inn-signature">
{{ inn.shopIntro }}
</view>
<view class="share-btn" @click="changeShare">
<!-- <view class="share-btn" @click="changeShare">
<image :src="webUrl + '/page/hotel/share.png'" class="img" />
</view>
</view> -->
</view>
<view v-if="inn.name" class="map-wrapper">
<view class="map-cont">
@@ -449,25 +447,23 @@
</template>
<script>
import {
getPoster
} from "@/api/inn.js"
import {
getCountyFamousCityShop,
getCountyFamousCityNews,
getCountyFamousCityGuide,
postCountyFamousShopZan,
postCountyFamousShopAddFavorite,
postCountyFamousShopRemoveFavorite,
postCountyFamousNewsZan,
postCountyFamousNewsView,
getCountyFamousIndustry,
getCountyFamousIndustryProject,
getCountyFamousInvestmentFile
} from '@/api/qianxian'
import {formatDateTime} from "@/utils"
import {getUrlParam} from "@/utils/common.js"
import {formatDateTime} from '@/utils'
import {getUrlParam} from '@/utils/common.js'
import imgBox from '@/components/imageTypeSet/imagebox.vue'
import cookie from "@/utils/store/cookie"
import {addStore, removeStore} from "@/api/favorite"
import cookie from '@/utils/store/cookie'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
@@ -798,13 +794,13 @@ export default {
},
async doneFavorite() {
if (this.isFavorite) {
const res = await removeStore(this.id)
const res = await postCountyFamousShopRemoveFavorite({ countyFamousDataId: this.id })
if (res.success) {
this.isFavorite = false
this.favoriteCount = res.data.favoriteCount
}
} else {
const res = await addStore(this.id)
const res = await postCountyFamousShopAddFavorite({ countyFamousDataId: this.id })
if (res.success) {
this.isFavorite = true
this.favoriteCount = res.data.favoriteCount