添加茶艺师收藏功能

This commit is contained in:
wangxiaowei
2026-04-28 17:27:50 +08:00
parent 8b5c23ee5b
commit dcbba2c79d
7 changed files with 330 additions and 165 deletions

View File

@ -83,6 +83,21 @@
</view>
</view>
</template>
<template #right>
<view class="flex items-center" :style="{ paddingRight: rightPadding }">
<view class="mr-16rpx flex items-center" @click="Detail.handleCollect">
<template v-if="info.collect > 0">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc_s.png`"></wd-img>
</template>
<template v-else>
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_sc.png`"></wd-img>
</template>
</view>
<!-- <view @click="Detail.handleShare" class="flex items-center">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_share.png`"></wd-img>
</view> -->
</view>
</template>
</navbar>
</view>
@ -376,7 +391,7 @@
<script lang="ts" setup>
import TeaSpecialistLevel from '@/components/TeaSpecialistLevel.vue'
import { useMessage } from 'wot-design-uni'
import { getTeaSpecialistDetail } from '@/api/tea-specialist'
import { getTeaSpecialistDetail, collectTeaSpecialist } from '@/api/tea-specialist'
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
import type { ITeaSpecialistRewardAmountsResult } from '@/api/types/tea'
import { toast } from '@/utils/toast'
@ -386,6 +401,7 @@ import { useUserStore } from '@/store'
import type { IUserInfoVo } from '@/api/types/login'
const OSS = inject('OSS')
const rightPadding = inject('capsuleOffset')
// tab
const tab = ref<number>(0)
@ -420,6 +436,7 @@ const info = ref({
license_img: '', // 营业执照图片
health_certificate: '', // 健康证图片
state: 0, // 茶艺师状态 0可约 1工作中 2不可约
collect: 0, // 是否收藏
})
const latitude = ref<number>(0) // 纬度
const longitude = ref<number>(0) // 经度
@ -495,6 +512,7 @@ const Detail = {
*/
handleGetTeaSpecialistDetail: async () => {
const res = await getTeaSpecialistDetail({
user_id: userInfo.value.id,
team_user_id: id.value,
latitude: uni.getStorageSync('latitude') || import.meta.env.VITE_DEFAULT_LATITUDE,
longitude: uni.getStorageSync('longitude') || import.meta.env.VITE_DEFAULT_LONGITUDE,
@ -503,16 +521,25 @@ const Detail = {
},
/**
* TODO 处理收藏-暂时不要
* 处理收藏
*/
handleCollect: async () => {
// let status = info.collect == 0 ? 1 : 0
// await collectTeaSpecialist({
// id: id.value,
// status
// })
console.log("🚀 ~ Detail.handleCollect:", 123)
// info.collect = info.collect == 0 ? 1 : 0
if (!userInfo.value.id) {
toast.info('请先登录')
router.navigateTo('/pages/login/login', 200)
}
await Detail.handleGetTeaSpecialistDetail()
let status = info.value.collect == 0 ? 1 : 0
await collectTeaSpecialist({
id: id.value,
status
})
info.value.collect = status
},
/**