调试接口

This commit is contained in:
wangxiaowei
2025-12-31 03:24:46 +08:00
parent 031649e9c4
commit f7a46dd713
14 changed files with 675 additions and 435 deletions

2
env/.env vendored
View File

@ -22,5 +22,5 @@ VITE_APP_PROXY_PREFIX = '/storeapi'
VITE_SERVER_BASEURL = 'https://cz.stnav.com' VITE_SERVER_BASEURL = 'https://cz.stnav.com'
# 上传图片请求地址 # 上传图片请求地址
VITE_UPLOAD_BASEURL = 'https://cz.stnav.com/storeapi/upload/image' VITE_UPLOAD_BASEURL = 'https://cz.stnav.com/teamapi/Upload/image'
VITE_UPLOAD_IMAGE_URL = 'https://cz.stnav.com/' VITE_UPLOAD_IMAGE_URL = 'https://cz.stnav.com/'

View File

@ -5,21 +5,21 @@ import type { IAddBankCardParams } from '@/api/types/bank'
* 添加银行卡 * 添加银行卡
*/ */
export function addBankCard(data: IAddBankCardParams) { export function addBankCard(data: IAddBankCardParams) {
return http.Post('/storeapi/user/addBank', data) return http.Post('/teamapi/user/addBank', data)
} }
/** /**
* 删除银行卡 * 删除银行卡
*/ */
export function deleteBankCard(id: number) { export function deleteBankCard(id: number) {
return http.Post('/storeapi/user/delBank', { id }) return http.Post('/teamapi/user/delBank', { id })
} }
/** /**
* 获取银行卡列表 * 获取银行卡列表
*/ */
export function getBankCardList() { export function getBankCardList() {
return http.Post<any>('/storeapi/user/checkBank') return http.Post<any>('/teamapi/user/checkBank')
} }
/** /**

View File

@ -6,3 +6,38 @@ import { http } from '@/http/alova'
export function getTeaSpecialistProfile() { export function getTeaSpecialistProfile() {
return http.Post<any>('/teamapi/user/Introduction') return http.Post<any>('/teamapi/user/Introduction')
} }
/**
* 编辑服务方式
*/
export function editServiceMethods(is_mileage) {
return http.Post<any>('/teamapi/user/editServer', {is_mileage})
}
/**
* 编辑茶艺师个人介绍
*/
export function editTeaSpecialistProfile(data) {
return http.Post<any>('/teamapi/user/editIntrod', data)
}
/**
* 添加茶艺师资质
*/
export function addTeaSpecialistQualification(data) {
return http.Post<any>('/teamapi/user/addCert', data)
}
/**
* 茶艺师资质详情
*/
export function getTeaSpecialistQualification() {
return http.Post<any>('/teamapi/user/certDetails')
}
/**
* 修改茶艺师资质
*/
export function editTeaSpecialistQualification(data) {
return http.Post<any>('/teamapi/user/editCert', data)
}

View File

@ -1,7 +1,5 @@
import { http } from '@/http/alova' import { http } from '@/http/alova'
import type { IUserAddressListResult, IUserAddressDetailsResult, IUserCouponListResult } from '@/api/types/user'
import type { IOrderListResult } from '@/api/types/teaSpecialist-order' import type { IOrderListResult } from '@/api/types/teaSpecialist-order'
import type { IUserResult } from '@/api/types/user'
/** /**
* 修改用户信息 * 修改用户信息
@ -19,6 +17,20 @@ export function updateUserInfo(data: IUpdateUserInfoParams) {
return http.Post('/storeapi/user/updateUser', data) return http.Post('/storeapi/user/updateUser', data)
} }
/**
* 修改头像
*/
export function updateUserAvatar(avatar: string) {
return http.Post('/teamapi/user/editAvatar', { avatar })
}
/**
* 修改昵称
*/
export function updateUserNickname(nickname: string) {
return http.Post('/teamapi/user/editNickname', { nickname })
}
/** /**
* 获取用户信息 * 获取用户信息
@ -111,10 +123,11 @@ export interface IUserAddressListParams {
longitude: number longitude: number
latitude: number latitude: number
address: string address: string
status: number
} }
export function getUserAddressList() { export function getUserAddressList() {
return http.Post<Array<IUserAddressListResult>>('/teamapi/user/addressList') return http.Post<Array<IUserAddressListParams>>('/teamapi/user/addressList')
} }
/** /**
@ -150,3 +163,17 @@ export function editUserAddress(data: IAddUserAddressListParams & { id: number }
export function deleteUserAddress(id: number) { export function deleteUserAddress(id: number) {
return http.Post('/teamapi/user/delAddress', { id }) return http.Post('/teamapi/user/delAddress', { id })
} }
/**
* 位置更新
*/
export function updateUserAddressLocation(id: number) {
return http.Post('/teamapi/user/selAddress', { id })
}
/**
* 地址详情
*/
export function getUserAddressInfo(id: number) {
return http.Post<any>('/teamapi/user/addressDetails', { id })
}

View File

@ -26,7 +26,7 @@
</wd-picker> </wd-picker>
</view> </view>
<view class="h-2rpx bg-#F2F2F2 mt-20rpx"></view> <view class="h-2rpx bg-#F2F2F2"></view>
<view> <view>
<view class="flex items-center"> <view class="flex items-center">
@ -47,7 +47,7 @@
确定 确定
</view> </view>
<view class="flex items-center justify-between mx-30rpx" v-if="addressId > 0"> <view class="flex items-center justify-center mx-30rpx" v-if="addressId > 0">
<view class="w-630rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] text-#FFFFFF rounded-8rpx" @click="Add.handleAddAddress">确定</view> <view class="w-630rpx h-90rpx leading-90rpx text-center bg-[#4C9F44] text-#FFFFFF rounded-8rpx" @click="Add.handleAddAddress">确定</view>
</view> </view>
</view> </view>
@ -58,12 +58,13 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useMessage } from 'wot-design-uni' import { useMessage } from 'wot-design-uni'
import { useColPickerData } from '@/hooks/useColPickerData' import { useColPickerData } from '@/hooks/useColPickerData'
import { addUserAddress, deleteUserAddress, editUserAddress, getOpenCityList } from '@/api/user' import { addUserAddress, deleteUserAddress, editUserAddress, getOpenCityList, getUserAddressInfo } from '@/api/user'
import { toast } from '@/utils/toast'
import { mobile } from '@/utils/test' import { mobile } from '@/utils/test'
import { router } from '@/utils/tools' import { router } from '@/utils/tools'
import { useToast } from 'wot-design-uni'
const OSS = inject('OSS') const OSS = inject('OSS')
const toast = useToast()
// 弹出框 // 弹出框
const message = useMessage('wd-message-box-slot') const message = useMessage('wd-message-box-slot')
@ -92,7 +93,7 @@
// 编辑地址 // 编辑地址
title.value = '修改地址' title.value = '修改地址'
addressId.value = Number(args.id) addressId.value = Number(args.id)
// Add.handleGetAddressDetails() Add.handleGetAddressDetails(args.id)
} }
Add.handleGetCity() Add.handleGetCity()
@ -118,30 +119,17 @@
city.value = e.selectedItems.label || '' city.value = e.selectedItems.label || ''
}, },
// // 获取地址详情 // 获取地址详情
// handleGetAddressDetails: async () => { handleGetAddressDetails: async (id: number) => {
// const res = await userAddressDetails({ const res = await getUserAddressInfo(id)
// id: addressId.value form.value = {
// }) city_id: res.city_id,
// form.contact = res.address_details.contact latitude: res.latitude,
// form.telephone = res.address_details.telephone longitude: res.longitude,
// form.province = res.address_details.province address: res.address,
// form.province_id = res.address_details.province_id }
// console.log("🚀 ~ form.province_id :", form.province_id ) city.value = res.city_name || ''
// form.city = res.address_details.city },
// form.city_id = res.address_details.city_id
// form.district = res.address_details.district
// form.district_id = res.address_details.district_id
// form.address = res.address_details.address
// form.is_default = res.address_details.is_default
// isDefaultAddress.value = res.address_details.is_default === 1 ? true : false
// address.value = [
// String(res.address_details.province_id),
// String(res.address_details.city_id),
// String(res.address_details.district_id)
// ]
// console.log("🚀 ~ address.value:", address.value)
// },
/** /**
* 选择地址 * 选择地址
@ -181,14 +169,19 @@
if (addressId.value > 0 ) { if (addressId.value > 0 ) {
// 编辑地址 // 编辑地址
// form.id = addressId.value const params = {
// await editUserAddress(form) id: addressId.value,
...form.value
}
await editUserAddress(params)
toast.show('修改成功')
} else { } else {
await addUserAddress(form.value) await addUserAddress(form.value)
toast.show('添加成功')
} }
uni.$emit('refreshAddressList') uni.$emit('refreshAddressList')
router.navigateBack(500) router.navigateBack(1, 500)
}, },
// // 添加地址 // // 添加地址

View File

@ -9,7 +9,7 @@
<template> <template>
<view class=""> <view class="pb-200rpx">
<!-- 消息弹窗 --> <!-- 消息弹窗 -->
<wd-message-box selector="wd-message-box-slot"></wd-message-box> <wd-message-box selector="wd-message-box-slot"></wd-message-box>
@ -55,11 +55,10 @@
class="fixed bottom-70rpx left-0 right-0 bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx" class="fixed bottom-70rpx left-0 right-0 bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx"
@click="router.navigateTo('/bundle/address/add')">新建地址</view> --> @click="router.navigateTo('/bundle/address/add')">新建地址</view> -->
<view <view class="bg-white fixed left-0 right-0 bottom-0 h-152rpx flex items-center px-30rpx">
class="bg-white fixed left-0 right-0 bottom-0 h-152rpx flex items-center px-30rpx"
@click="router.navigateTo('/bundle/address/add')"> <view v-if="addressList.length == 0" class="w-630rpx bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx" @click="router.navigateTo('/bundle/address/add')">新建地址</view>
<view v-if="addressList.length == 0" class="w-630rpx bg-#4C9F44 text-#fff font-bold text-30rpx leading-42rpx mx-60rpx h-90rpx leading-90rpx text-center rounded-8rpx">新建地址</view>
<view class="flex items-center justify-between w-full" v-if="addressList.length > 0"> <view class="flex items-center justify-between w-full" v-if="addressList.length > 0">
<view class="w-330rpx bg-[#F6F7F8] text-[#303133] h-90rpx text-center leading-90rpx rounded-8rpx" @click="router.navigateTo('/bundle/address/add')">新建地址</view> <view class="w-330rpx bg-[#F6F7F8] text-[#303133] h-90rpx text-center leading-90rpx rounded-8rpx" @click="router.navigateTo('/bundle/address/add')">新建地址</view>
<view class="w-330rpx bg-[#4C9F44] text-[#FFFFFF] h-90rpx text-center leading-90rpx rounded-8rpx" @click="List.handleUpdateLocation">位置更新</view> <view class="w-330rpx bg-[#4C9F44] text-[#FFFFFF] h-90rpx text-center leading-90rpx rounded-8rpx" @click="List.handleUpdateLocation">位置更新</view>
@ -73,7 +72,7 @@
import type { IUserAddressListResult } from '@/api/types/user' import type { IUserAddressListResult } from '@/api/types/user'
import { router } from '@/utils/tools' import { router } from '@/utils/tools'
import { useMessage } from 'wot-design-uni' import { useMessage } from 'wot-design-uni'
import { getUserAddressList, deleteUserAddress } from '@/api/user' import { getUserAddressList, deleteUserAddress, updateUserAddressLocation } from '@/api/user'
import { useToast } from 'wot-design-uni' import { useToast } from 'wot-design-uni'
const OSS = inject('OSS') const OSS = inject('OSS')
@ -88,7 +87,7 @@
// 选中的地址ID // 选中的地址ID
const addressId = ref<number>(0) const addressId = ref<number>(0)
const addressList = ref<Array<{id:number, address: string}>>([]) const addressList = ref<Array<{id:number, address: string, status: number}>>([])
onLoad((args) => { onLoad((args) => {
if (args.from) { if (args.from) {
@ -115,6 +114,7 @@
handleInit: async () => { handleInit: async () => {
const res = await getUserAddressList() const res = await getUserAddressList()
addressList.value = res addressList.value = res
addressId.value = addressList.value.filter(item => item.status === 1)[0]?.id || 0
}, },
/** /**
@ -122,7 +122,7 @@
* @param id 地址ID * @param id 地址ID
*/ */
handleEditAddress: (id: number) => { handleEditAddress: (id: number) => {
router.navigateTo(`/bundle_b/pages/tea-specialist/address/add?id=${id}`) router.navigateTo(`/bundle/address/add?id=${id}`)
}, },
/** /**
@ -162,8 +162,14 @@
/** /**
* 更新位置 * 更新位置
*/ */
handleUpdateLocation: () => { handleUpdateLocation: async () => {
if (addressId.value === 0) {
toast.show('请选择地址')
return
}
const res = await updateUserAddressLocation(addressId.value)
toast.show('更新成功')
} }
} }
</script> </script>

View File

@ -37,7 +37,7 @@
</view> </view>
</view> </view>
<view class="font-bold text-30rpx leading-42rpx bg-[#4C9F44] text-#fff rounded-8rpx mx-60rpx h-90rpx leading-90rpx text-center mt-82rpx" @click="List.handleAddBankCard"> <view class="fixed bottom-40rpx left-0 right-0 font-bold text-30rpx leading-42rpx bg-[#4C9F44] text-#fff rounded-8rpx mx-60rpx h-90rpx leading-90rpx text-center mt-82rpx" @click="List.handleAddBankCard">
添加其他银行卡 添加其他银行卡
</view> </view>
</view> </view>

View File

@ -141,7 +141,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { toast } from '@/utils/toast' import { toast } from '@/utils/toast'
import { getUserInfo, updateUserInfo } from '@/api/user' import { getUserInfo, updateUserInfo, updateUserAvatar, updateUserNickname } from '@/api/user'
import type { IUserResult } from '@/api/types/user' import type { IUserResult } from '@/api/types/user'
import { router } from '@/utils/tools' import { router } from '@/utils/tools'
import { useUserStore } from '@/store' import { useUserStore } from '@/store'
@ -195,22 +195,17 @@
}, },
/** /**
* 图片选择/删除 * 上传头像
* @param e
*/ */
handleChange: (e: any) => {
console.log("🚀 ~ e:", e)
},
handleUploadSuccess: async (e: any) => { handleUploadSuccess: async (e: any) => {
try { try {
const response = JSON.parse(e.file.response) const response = JSON.parse(e.file.response)
if (response.code) { if (response.code) {
const avatarUrl = response.data.url const avatarUrl = response.data.url
console.log("🚀 ~ avatarUrl:", response) await updateUserAvatar( response.data.url)
// await updateUserInfo({ avatar: avatarUrl }) Profile.handleInit()
// user.value.avatar = avatarUrl user.value.avatar = avatarUrl
// toast.info('头像上传成功') toast.info('头像上传成功')
} else { } else {
throw new Error('上传失败') throw new Error('上传失败')
} }
@ -228,7 +223,7 @@
return return
} }
await updateUserInfo({ nickname: nickname.value }) await updateUserNickname(nickname.value)
showEditNicknamePopup.value = false showEditNicknamePopup.value = false
user.value.nickname = nickname.value user.value.nickname = nickname.value
toast.info('昵称修改成功') toast.info('昵称修改成功')

View File

@ -4,7 +4,7 @@
<!-- 金牌茶艺师 --> <!-- 金牌茶艺师 -->
<wd-img :src="levelMap[level].icon" width="36rpx" height="36rpx"></wd-img> <wd-img :src="levelMap[level].icon" width="36rpx" height="36rpx"></wd-img>
</view> </view>
<view class="bg-[#F0F6EF] text-[#006C2D] font-400 text-22rpx leading-32rpx rounded-4rpx text-center w-150rpx ml-18rpx pb-4rpx">{{ levelMap[level].text }}</view> <view class="bg-[#F0F6EF] text-[#006C2D] font-400 text-22rpx leading-32rpx rounded-4rpx text-center w-150rpx ml-18rpx pb-4rpx">{{ levelMap[level]?.text }}</view>
</view> </view>
</template> </template>

View File

@ -86,7 +86,7 @@
<!-- 可提现金额 --> <!-- 可提现金额 -->
<view class="flex-1 text-center"> <view class="flex-1 text-center">
<view class=""> <view class="">
<price-format color="#000000" :first-size="32" :second-size="32" :subscript-size="20" :price="otherInfo.user_money"></price-format> <price-format color="#000000" :first-size="32" :second-size="32" :subscript-size="20" :price="userInfo.user_money"></price-format>
</view> </view>
<view class="mt-8rpx text-24rpx text-[#909399] leading-34rpx"> <view class="mt-8rpx text-24rpx text-[#909399] leading-34rpx">
可提现金额 可提现金额
@ -95,7 +95,7 @@
<!-- 不可提现金额 --> <!-- 不可提现金额 -->
<view class="flex-1 text-center"> <view class="flex-1 text-center">
<view> <view>
<price-format color="#000000" :first-size="32" :second-size="32" :subscript-size="20" :price="otherInfo.no_reflect_amount"></price-format> <price-format color="#000000" :first-size="32" :second-size="32" :subscript-size="20" :price="userInfo.no_reflect_amount"></price-format>
</view> </view>
<view class="mt-8rpx text-24rpx text-[#909399] leading-34rpx"> <view class="mt-8rpx text-24rpx text-[#909399] leading-34rpx">
不可提现金额 不可提现金额
@ -103,9 +103,9 @@
</view> </view>
</view> </view>
<!-- 装饰性金币图标预留位置右侧散落 --> <!-- 装饰性金币图标预留位置右侧散落 -->
<view class="coin-decoration absolute right-20rpx top-30rpx"> <!-- <view class="coin-decoration absolute right-20rpx top-30rpx">
<wd-img width="120rpx" height="120rpx" :src="`${OSS}images/my/coin_decor.png`" class="opacity-40" /> <wd-img width="120rpx" height="120rpx" :src="`${OSS}images/my/coin_decor.png`" class="opacity-40" />
</view> </view> -->
</view> </view>
<!-- 上班安排区域 --> <!-- 上班安排区域 -->
@ -117,12 +117,12 @@
}" class="work-schedule-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx"> }" class="work-schedule-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx">
<!-- 标题和免费出行按钮 --> <!-- 标题和免费出行按钮 -->
<view class="mb-24rpx flex items-center justify-between"> <view class="mb-24rpx flex items-center justify-between">
<view class="flex items-center" v-if="otherInfo.is_mileage == 1"> <view class="flex items-center" v-if="userInfo.is_mileage == 1">
<wd-img width="32rpx" height="32rpx" :src="`${OSS}images/chayishi/work_task.png`" <wd-img width="32rpx" height="32rpx" :src="`${OSS}images/chayishi/work_task.png`"
class="mr-12rpx" /> class="mr-12rpx" />
<text class="text-32rpx text-[#303133] font-bold">上班安排</text> <text class="text-32rpx text-[#303133] font-bold">上班安排</text>
</view> </view>
<view @click="My.handleFreeTravel" v-if="otherInfo.is_mileage == 0"> <view @click="My.handleFreeTravel" v-if="userInfo.is_mileage == 1">
<wd-img width="180rpx" height="64rpx" :src="`${OSS}images/chayishi/free_go.png`" <wd-img width="180rpx" height="64rpx" :src="`${OSS}images/chayishi/free_go.png`"
class="mr-12rpx" /> class="mr-12rpx" />
</view> </view>
@ -143,21 +143,21 @@
</view> </view>
<!-- 工作日 --> <!-- 工作日 -->
<view class="schedule-item mb-20rpx flex items-center"> <view class="schedule-item mb-20rpx flex items-center">
<text class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作日:</text> <view class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作日:</view>
<text class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ otherInfo.work || '-' }}</text> <view class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ userInfo.work || '-' }}</view>
</view> </view>
<!-- 工作时间 --> <!-- 工作时间 -->
<view class="schedule-item mb-20rpx flex items-center"> <view class="schedule-item mb-20rpx flex items-center">
<text class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作时间:</text> <view class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作时间:</view>
<text class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ otherInfo.work_time }}</text> <view class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ userInfo.work_time || '-' }}</view>
</view> </view>
<!-- 住址 --> <!-- 住址 -->
<view class="schedule-item flex items-start"> <view class="schedule-item flex items-center">
<text class="label-text w-140rpx pt-4rpx text-24rpx text-[#606266] leading-40rpx">住址:</text> <view class="label-text w-140rpx pt-4rpx text-24rpx text-[#606266] leading-40rpx">住址:</view>
<text class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ otherInfo.address || '-' }}</text> <view class="flex-1 text-24rpx text-[#303133] line-2">{{ userInfo.address || '-' }}</view>
</view> </view>
<!-- 上下班状态 --> <!-- 上下班状态 -->
<view class="schedule-item flex items-center mt-20rpx"> <!-- <view class="schedule-item flex items-center mt-20rpx">
<view class="label-text w-140rpx pt-4rpx text-24rpx text-[#606266] leading-40rpx">上下班:</view> <view class="label-text w-140rpx pt-4rpx text-24rpx text-[#606266] leading-40rpx">上下班:</view>
<view class="flex items-center"> <view class="flex items-center">
<view class="mt-20rpx"> <view class="mt-20rpx">
@ -165,8 +165,7 @@
</view> </view>
<view class="text-28rpx text-[#606266] mt-6rpx font-bold ml-10rpx">{{ isWork ? '上班中' : '已下班' }}</view> <view class="text-28rpx text-[#606266] mt-6rpx font-bold ml-10rpx">{{ isWork ? '上班中' : '已下班' }}</view>
</view> </view>
</view> -->
</view>
</view> </view>
<!-- 更多服务区域 --> <!-- 更多服务区域 -->
@ -264,25 +263,32 @@
// 用户信息 // 用户信息
const userStore = useUserStore() const userStore = useUserStore()
const userInfo = ref({ const userInfo = ref({
avatar: userStore.userInfo.avatar, avatar: '',
nickname: userStore.userInfo.nickname, nickname: '',
account: userStore.userInfo.account account: '',
})
const otherInfo = ref<{
user_money: number // 可提现金额
no_reflect_amount: number // 不可提现金额
work: string // 工作日
address: string // 住址
work_time: string // 工作时间
is_mileage: number // 是否开启里程
}>({
user_money: 0, user_money: 0,
no_reflect_amount: 0, no_reflect_amount: 0,
work: '', work: '',
address: '', address: '',
work_time: '', work_time: '',
is_mileage: 0 is_mileage: 0,
cert_id: 0,
}) })
// const userInfo = ref<{
// user_money: number // 可提现金额
// no_reflect_amount: number // 不可提现金额
// work: string // 工作日
// address: string // 住址
// work_time: string // 工作时间
// is_mileage: number // 是否开启里程
// }>({
// user_money: 0,
// no_reflect_amount: 0,
// work: '',
// address: '',
// work_time: '',
// is_mileage: 0
// })
// 上下班切换 // 上下班切换
const isWork = ref<boolean>(true) const isWork = ref<boolean>(true)
@ -301,7 +307,8 @@
*/ */
handleGetUserInfo: async () => { handleGetUserInfo: async () => {
const res = await getUserInfo() const res = await getUserInfo()
otherInfo.value = res userInfo.value = res
userInfo.value.cert_id = 1
}, },
/** /**
@ -325,8 +332,6 @@
*/ */
handleToProfile: () => { handleToProfile: () => {
// TODO: 跳转到个人信息页面 // TODO: 跳转到个人信息页面
console.log('跳转到个人信息页面')
console.log("🚀 ~ userStore.isLoggedIn:", userStore.isLoggedIn)
if (userStore.isLoggedIn) { if (userStore.isLoggedIn) {
router.navigateTo('/bundle/profile/profile') router.navigateTo('/bundle/profile/profile')
} else { } else {
@ -367,10 +372,14 @@
} }
else if (type === 'upload') { else if (type === 'upload') {
// 跳转到上传资料页面 // 跳转到上传资料页面
router.navigateTo('/pages/my/upload-data') // cert_id: 0 未上传1 审核中2 已认证3 未通过
const status = userInfo.value.cert_id == 0 ? 'add' : 'view'
console.log("🚀 ~ userInfo.value.cert_id:", userInfo.value.cert_id)
router.navigateTo(`/pages/my/upload-data?status=${status}`)
} }
else if (type === 'record') { else if (type === 'record') {
// 跳转到行程记录页面 // 跳转到行程记录页面
// 如过cer
router.navigateTo('/pages/my/travel-record') router.navigateTo('/pages/my/travel-record')
} }
else { else {
@ -388,16 +397,14 @@
userInfo.value = { userInfo.value = {
avatar: '', avatar: '',
nickname: '', nickname: '',
account: '' account: '',
}
otherInfo.value = {
user_money: 0, user_money: 0,
no_reflect_amount: 0, no_reflect_amount: 0,
work: '', work: '',
address: '', address: '',
work_time: '', work_time: '',
is_mileage: 0 is_mileage: 0,
cert_id: 0
} }
} }
} }
@ -455,7 +462,7 @@ page {
} }
.wallet-card { .wallet-card {
background-color: #ffb347; // background-color: #ffb347;
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;

View File

@ -10,7 +10,7 @@
<!-- 顶部背景区域 --> <!-- 顶部背景区域 -->
<wd-navbar safe-area-inset-top :bordered="false" :zIndex="20" fixed custom-style="background: transparent !important;"> <wd-navbar safe-area-inset-top :bordered="false" :zIndex="20" fixed custom-style="background: transparent !important;">
<template #left> <template #left>
<view class="ml-16rpx flex items-center" @click.stop="ProfileDisplay.handleBack"> <view class="ml-16rpx flex items-center" @click.stop="router.navigateBack()">
<wd-img :src="`${OSS}icon/icon_arrow_left2.png`" width="48rpx" height="48rpx"></wd-img> <wd-img :src="`${OSS}icon/icon_arrow_left2.png`" width="48rpx" height="48rpx"></wd-img>
</view> </view>
</template> </template>
@ -94,7 +94,7 @@
<text class="text-28rpx text-[#303133] font-bold leading-40rpx">兴趣爱好</text> <text class="text-28rpx text-[#303133] font-bold leading-40rpx">兴趣爱好</text>
</view> </view>
<view class="interest-text text-26rpx text-[#606266] leading-40rpx"> <view class="interest-text text-26rpx text-[#606266] leading-40rpx">
爱好茶艺,喜欢旅游,把爱好当工作 {{ profile.hobby_introduce }}
</view> </view>
</view> </view>
</view> </view>
@ -113,11 +113,11 @@
</view> </view>
<view class="cost-item flex items-center justify-between"> <view class="cost-item flex items-center justify-between">
<text class="text-26rpx text-[#606266] leading-40rpx">服务费</text> <text class="text-26rpx text-[#606266] leading-40rpx">服务费</text>
<text class="text-26rpx text-[#303133] font-500 leading-48rpx">¥160/小时</text> <text class="text-26rpx text-[#303133] font-500 leading-48rpx">¥{{ profile.price }}/小时</text>
</view> </view>
<view class="cost-item flex items-center justify-between"> <view class="cost-item flex items-center justify-between">
<text class="text-26rpx text-[#606266] leading-40rpx">车马费</text> <text class="text-26rpx text-[#606266] leading-40rpx">车马费</text>
<text class="text-26rpx text-[#303133] font-500 leading-48rpx">¥3.00/公里</text> <text class="text-26rpx text-[#303133] font-500 leading-48rpx">¥{{ profile.mileage_price }}/公里</text>
</view> </view>
</view> </view>
</view> </view>
@ -138,13 +138,6 @@
const navbarHeight = inject('navbarHeight') const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset') const rightPadding = inject('capsuleOffset')
// 照片列表(静态数据)
const photoList = ref([
`${OSS}images/chayishi/photo1.png`,
`${OSS}images/chayishi/photo2.png`,
`${OSS}images/chayishi/photo3.png`,
])
const profile = ref<{ const profile = ref<{
name: string // 茶艺师名字 name: string // 茶艺师名字
star: number // 评分 star: number // 评分
@ -173,7 +166,7 @@
mileage_price: 0, mileage_price: 0,
}) })
onLoad(() => { onShow(() => {
ProfileDisplay.handleInit() ProfileDisplay.handleInit()
}) })
@ -186,22 +179,20 @@
profile.value = res profile.value = res
}, },
// 返回 /**
handleBack: () => { * 跳转到编辑页面
console.log("🚀 ~ ProfileDisplay.handleBack:", 213) */
router.navigateBack()
},
// 跳转到编辑页面
handleEdit: () => { handleEdit: () => {
router.navigateTo('/pages/my/profile-edit') router.navigateTo('/pages/my/profile-edit')
}, },
// 预览照片 /**
* 预览照片
*/
handlePreviewPhoto: (index: number) => { handlePreviewPhoto: (index: number) => {
uni.previewImage({ uni.previewImage({
current: index, current: index,
urls: photoList.value, urls: profile.value.image_arr,
}) })
}, },
} }

View File

@ -8,9 +8,9 @@
<template> <template>
<view class="page-container pb-40rpx"> <view class="page-container">
<!-- 导航栏 --> <!-- 导航栏 -->
<navbar title="个人介绍填写"></navbar> <navbar title="个人介绍填写" fixed></navbar>
<view class="content-wrapper"> <view class="content-wrapper">
<!-- 基本信息 --> <!-- 基本信息 -->
@ -32,12 +32,14 @@
<view class="form-item mb-24rpx"> <view class="form-item mb-24rpx">
<text class="label-text mb-12rpx block text-28rpx text-[#303133] leading-40rpx">性别</text> <text class="label-text mb-12rpx block text-28rpx text-[#303133] leading-40rpx">性别</text>
<view class="gender-select rounded-16rpx bg-[#F5F7FA]"> <view class="gender-select rounded-16rpx bg-[#F5F7FA]">
<wd-picker v-model="formData.gender" :columns="genderOptions" placeholder="请选择性别" <wd-picker v-model="formData.sex" :columns="genderOptions" placeholder="请选择性别"
custom-class="!bg-transparent" @confirm="Profile.handleGenderConfirm"> custom-class="!bg-transparent" @confirm="ProfileEdit.handleGenderConfirm">
<wd-input :value="formData.gender || '请选择性别'" readonly no-border <wd-input v-model="sex" readonly no-border
custom-class="!bg-transparent" custom-input-class="!h-88rpx !px-24rpx !text-28rpx"> custom-class="!bg-transparent" custom-input-class="!h-88rpx !px-24rpx !text-28rpx">
<template #suffix> <template #suffix>
<view class="pr-10rpx">
<wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" /> <wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" />
</view>
</template> </template>
</wd-input> </wd-input>
</wd-picker> </wd-picker>
@ -48,12 +50,14 @@
<view class="form-item mb-24rpx"> <view class="form-item mb-24rpx">
<text class="label-text mb-12rpx block text-28rpx text-[#303133] leading-40rpx">出生年月</text> <text class="label-text mb-12rpx block text-28rpx text-[#303133] leading-40rpx">出生年月</text>
<view class="date-select rounded-16rpx bg-[#F5F7FA]"> <view class="date-select rounded-16rpx bg-[#F5F7FA]">
<wd-datetime-picker v-model="formData.birthDate" type="year-month" placeholder="请选择出生年月" <wd-datetime-picker v-model="formData.both" type="year-month" placeholder="请选择出生年月" :min-date="new Date(1970, 0, 1).getTime()" :max-date="Date.now()"
custom-class="!bg-transparent" @confirm="Profile.handleDateConfirm"> custom-class="!bg-transparent" @confirm="ProfileEdit.handleDateConfirm">
<wd-input :value="formData.birthDate || '请选择出生年月'" readonly no-border <wd-input v-model="both" readonly no-border
custom-class="!bg-transparent" custom-input-class="!h-88rpx !px-24rpx !text-28rpx"> custom-class="!bg-transparent" custom-input-class="!h-88rpx !px-24rpx !text-28rpx">
<template #suffix> <template #suffix>
<view class="pr-10rpx">
<wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" /> <wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" />
</view>
</template> </template>
</wd-input> </wd-input>
</wd-datetime-picker> </wd-datetime-picker>
@ -88,7 +92,7 @@
<!-- 兴趣爱好 --> <!-- 兴趣爱好 -->
<view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx"> <view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx">
<text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">兴趣爱好</text> <text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">兴趣爱好</text>
<wd-textarea v-model="formData.interests" <wd-textarea v-model="formData.hobby_introduce"
:auto-height="true" :auto-height="true"
no-border no-border
placeholder="茶艺: 你的茶艺兴趣爱好是什么? 比如茶艺研究、品鉴、茶道美学......快来分享一下吧!" placeholder="茶艺: 你的茶艺兴趣爱好是什么? 比如茶艺研究、品鉴、茶道美学......快来分享一下吧!"
@ -101,7 +105,7 @@
<text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">视频信息</text> <text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">视频信息</text>
<view <view
class="upload-area flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA] py-60rpx" class="upload-area flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA] py-60rpx"
@click="Profile.handleUploadVideo"> @click="ProfileEdit.handleUploadVideo">
<wd-icon name="video-camera" size="80rpx" color="#C0C4CC" /> <wd-icon name="video-camera" size="80rpx" color="#C0C4CC" />
<text class="mt-24rpx text-28rpx text-[#909399] leading-40rpx">本人视频</text> <text class="mt-24rpx text-28rpx text-[#909399] leading-40rpx">本人视频</text>
</view> </view>
@ -127,146 +131,238 @@
</view> </view>
<text class="text-24rpx text-[#909399] leading-34rpx">可上传1-5张照片</text> <text class="text-24rpx text-[#909399] leading-34rpx">可上传1-5张照片</text>
</view> </view>
<view class="photo-upload-grid grid grid-cols-3 gap-16rpx">
<!-- 已上传的照片 --> <!-- 已上传的照片 -->
<view v-for="(photo, index) in formData.photos" :key="index" <!-- <view v-for="(photo, index) in formData.image_arr" :key="index"
class="photo-item relative aspect-square w-full overflow-hidden rounded-16rpx"> class="photo-item relative aspect-square w-full overflow-hidden rounded-16rpx">
<wd-img width="100%" height="100%" :src="photo" mode="aspectFill" /> <wd-img width="100%" height="100%" :src="photo" mode="aspectFill" />
<view <view
class="absolute right-8rpx top-8rpx h-40rpx w-40rpx flex items-center justify-center rounded-full bg-black bg-opacity-60" class="absolute right-8rpx top-8rpx h-40rpx w-40rpx flex items-center justify-center rounded-full bg-black bg-opacity-60"
@click="Profile.handleRemovePhoto(index)"> @click="ProfileEdit.handleRemovePhoto(index)">
<wd-icon name="close" size="20rpx" color="#fff" /> <wd-icon name="close" size="20rpx" color="#fff" />
</view> </view>
</view> </view> -->
<!-- 上传按钮 --> <!-- 上传按钮 -->
<view v-if="formData.photos.length < 5" <!-- <view v-if="formData.image_arr.length < 5"
class="upload-btn aspect-square w-full flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA]" class="upload-btn aspect-square w-full flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA]"
@click="Profile.handleUploadPhoto"> @click="ProfileEdit.handleUploadPhoto">
<wd-icon name="camera" size="48rpx" color="#C0C4CC" /> <wd-icon name="camera" size="48rpx" color="#C0C4CC" />
<text class="mt-12rpx text-24rpx text-[#909399] leading-34rpx">本人照片</text> <text class="mt-12rpx text-24rpx text-[#909399] leading-34rpx">本人照片</text>
</view> -->
<wd-upload :header="{'token': token}" :file-list="fileList" image-mode="aspectFill" :limit="5" multiple :action="action"
@change="ProfileEdit.handleUploadFile">
<view
class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
<view class="">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_upload.png`"
mode="aspectFill" />
</view> </view>
<view class="font-400 text-26rpx leading-36rpx text-#303133">添加图片</view>
</view> </view>
</wd-upload>
</view> </view>
<!-- 保存按钮 --> <!-- 保存按钮 -->
<view class="fixed bottom-0 left-0 right-0 px-30rpx pb-40rpx pt-24rpx"> <view class="mt-38rpx px-30rpx pb-40rpx pt-24rpx">
<view class="save-btn h-88rpx rounded-16rpx bg-[#4C9F44] text-center leading-88rpx" <view class="save-btn h-88rpx rounded-16rpx bg-[#4C9F44] text-center leading-88rpx"
@click="Profile.handleSave"> @click="ProfileEdit.handleSave">
<text class="text-32rpx text-[#fff] font-bold">保存</text> <text class="text-32rpx text-[#fff] font-bold">保存</text>
</view> </view>
</view> </view>
<!-- 底部留白 -->
<view class="pb-160rpx" />
</view> </view>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { router } from '@/utils/tools' import { router } from '@/utils/tools'
import { getTeaSpecialistProfile, editTeaSpecialistProfile } from '@/api/tes-specialist'
import { useToast } from 'wot-design-uni'
const OSS = inject('OSS') const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight') const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset') const rightPadding = inject('capsuleOffset')
const token = ref<string>('') // 用户token
const toast = useToast()
// 表单数据 // 上传文件
const formData = ref({ const fileList = ref<any[]>([])
const action = import.meta.env.VITE_UPLOAD_BASEURL
// 性别选择器
const genderOptions = ref(['男', '女'])
// 茶艺师资料
const formData = ref<{
name: string // 茶艺师名字
both: number | string // 出生年月
sex: number // 性别 1男 2女
height: number // 身高
weight: number // 体重
image_arr: string[] // 照片数组
hobby_introduce: string // 兴趣爱好介绍
}>({
name: '', name: '',
gender: '', both: 0,
birthDate: '', sex: 1,
height: '', height: 0,
weight: '', weight: 0,
interests: '', image_arr: [],
video: '', hobby_introduce: '',
photos: [] as string[], })
})
// 性别选择器 // 表单内容回显
const genderOptions = ref(['男', '女']) const sex = ref<string>('')
const both = ref<string>('')
const Profile = { onLoad(() => {
// 返回 token.value = uni.getStorageSync('token')
handleBack: () => { ProfileEdit.handleInit()
router.navigateBack() })
const ProfileEdit = {
fileList: [],
/**
* 初始化茶艺师详情
*/
handleInit: async() => {
const res = await getTeaSpecialistProfile()
// 处理性别
formData.value = res
sex.value = res.sex == 1 ? '男' : '女'
// 单独处理出生年月
const born = res.both
formData.value.both = new Date(born).getTime()
both.value = born
// 处理照片数组
fileList.value = (formData.value.image_arr || []).map((item: string) => ({ url: item, name: item}))
ProfileEdit.fileList = fileList.value
console.log("🚀 ~ ProfileEdit.fileList:", ProfileEdit.fileList)
}, },
// 选择性别 /**
handleGenderConfirm: (value: string) => { * 选择性别
formData.value.gender = value */
handleGenderConfirm: (item: {value: string}) => {
formData.value.sex = item.value === '男' ? 1 : 2
sex.value = item.value
}, },
// 选择日期 /**
* 选择日期
*/
handleDateConfirm: ({ value }: any) => { handleDateConfirm: ({ value }: any) => {
console.log("🚀 ~ value:", value)
const d = new Date(value) const d = new Date(value)
const year = d.getFullYear() const year = d.getFullYear()
const month = d.getMonth() + 1 const month = d.getMonth() + 1
formData.value.birthDate = `${year}${month}` const day = d.getDay()
both.value = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
formData.value.both = value / 1000 // 转为秒
}, },
// 上传视频 /**
handleUploadVideo: () => { * 图片选择/删除
// TODO: 实现视频上传功能 */
uni.chooseVideo({ handleUploadFile: ({ fileList: files }) => {
sourceType: ['camera', 'album'], let url = ''
maxDuration: 60, let name = ''
camera: 'back', let response = null
success: (res) => {
console.log('选择视频:', res) const res = files.map(item => {
// 这里应该上传视频到服务器 if (item.response) {
formData.value.video = res.tempFilePath response = JSON.parse(item.response)
}, url = response.data.url
name = response.data.name
}
return {
name: name || item.name,
url: url || item.url
}
}) })
ProfileEdit.fileList = res
}, },
// 上传照片
handleUploadPhoto: () => {
const maxCount = 5 - formData.value.photos.length
uni.chooseImage({
count: maxCount,
sourceType: ['camera', 'album'],
success: (res) => {
// TODO: 这里应该上传照片到服务器
formData.value.photos.push(...res.tempFilePaths)
},
})
},
// 删除照片
handleRemovePhoto: (index: number) => {
formData.value.photos.splice(index, 1)
},
// 保存 // 保存
handleSave: () => { handleSave: async () => {
// TODO: 实现保存逻辑 // 处理出生年月
console.log('保存数据:', formData.value) formData.value.both = both.value
uni.showToast({
title: '保存成功', // 处理图片路径
icon: 'success', formData.value.image_arr = ProfileEdit.fileList.map(item => {
if (typeof item.url === 'string') {
return item.url.replace(import.meta.env.VITE_UPLOAD_IMAGE_URL, '')
}
return item.url
}) })
setTimeout(() => {
router.navigateBack() if (!formData.value.name) {
}, 1500) toast.show('请填写姓名')
return false
}
if (!formData.value.sex) {
toast.show('请选择性别')
return false
}
if (!formData.value.both) {
toast.show('请选择出生年月')
return false
}
if (!formData.value.height) {
toast.show('请填写身高')
return false
}
if (!formData.value.weight) {
toast.show('请填写体重')
return false
}
if (!formData.value.image_arr.length) {
toast.show('请上传照片')
return false
}
const params = {
name: formData.value.name,
sex: formData.value.sex,
both: formData.value.both,
weight: formData.value.weight,
height: formData.value.height,
hobby_introduce: formData.value.hobby_introduce,
image: formData.value.image_arr.join(','),
}
await editTeaSpecialistProfile(params)
toast.show('保存成功')
router.navigateBack(1, 500)
}, },
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
background: #f5f7fa; background: #f5f7fa;
} }
.page-container { .page-container {
min-height: 100vh; min-height: 100vh;
background: #f5f7fa; background: #f5f7fa;
} }
.content-wrapper { .content-wrapper {
// position: relative; // position: relative;
// z-index: 10; // z-index: 10;
} }
.right-slot { .right-slot {
padding-right: v-bind(rightPadding); padding-right: v-bind(rightPadding);
.nav-icon-item { .nav-icon-item {
@ -277,33 +373,33 @@ page {
justify-content: center; justify-content: center;
min-height: 60rpx; min-height: 60rpx;
} }
} }
.info-card { .info-card {
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08); box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
} }
.form-item { .form-item {
.label-text { .label-text {
display: block; display: block;
} }
} }
.gender-select, .gender-select,
.date-select { .date-select {
cursor: pointer; cursor: pointer;
} }
.unit-text { .unit-text {
pointer-events: none; pointer-events: none;
} }
.upload-area { .upload-area {
cursor: pointer; cursor: pointer;
min-height: 200rpx; min-height: 200rpx;
} }
.photo-upload-grid { .photo-upload-grid {
.photo-item { .photo-item {
cursor: pointer; cursor: pointer;
} }
@ -312,19 +408,19 @@ page {
cursor: pointer; cursor: pointer;
min-height: 200rpx; min-height: 200rpx;
} }
} }
.save-btn-wrapper { .save-btn-wrapper {
box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.08); box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.08);
z-index: 100; z-index: 100;
} }
.save-btn { .save-btn {
cursor: pointer; cursor: pointer;
transition: all 0.3s; transition: all 0.3s;
&:active { &:active {
opacity: 0.8; opacity: 0.8;
} }
} }
</style> </style>

View File

@ -10,13 +10,6 @@
<template> <template>
<view class="page-container"> <view class="page-container">
<!-- 导航栏 --> <!-- 导航栏 -->
<!-- <wd-navbar safe-area-inset-top title="服务方式" :bordered="false">
<template #left>
<view class="ml-16rpx flex items-center" @click="ServiceMethod.handleBack">
<wd-icon name="arrow-left" size="32rpx" color="#303133" />
</view>
</template>
</wd-navbar> -->
<navbar title="服务方式"></navbar> <navbar title="服务方式"></navbar>
<view class="content-wrapper" :style="{ paddingTop: `0px` }"> <view class="content-wrapper" :style="{ paddingTop: `0px` }">
@ -60,7 +53,7 @@
开启免费出行,可以获得更多流量扶持 开启免费出行,可以获得更多流量扶持
</view> </view>
</view> </view>
<wd-switch v-model="isFreeTravel" size="40rpx" active-color="#4C9F44" custom-class="!mr-0" /> <wd-switch v-model="travel" size="40rpx" active-color="#4C9F44" custom-class="!mr-0" />
</view> </view>
</view> </view>
@ -79,46 +72,58 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { router } from '@/utils/tools' import { router } from '@/utils/tools'
import { editServiceMethods } from '@/api/tes-specialist'
import { getUserInfo } from '@/api/user'
import { useToast } from 'wot-design-uni'
const OSS = inject('OSS') const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight') const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset') const rightPadding = inject('capsuleOffset')
const toast = useToast()
// 服务方式选择 // 服务方式选择
const serviceMethods = ref({ const serviceMethods = ref({
door: true, // 上门服务 door: true, // 上门服务
store: false, // 到店服务 store: false, // 到店服务
}) })
// 是否免费出行 // 是否免费出行
const isFreeTravel = ref(false) const isFreeTravel = ref(false)
const ServiceMethod = { // 出行
// 返回 const travel = ref<boolean>(false)
handleBack: () => {
router.navigateBack() onLoad(() => {
ServiceMethod.handleInit()
})
const ServiceMethod = {
/**
* 获取服务方式
*/
handleInit: async () => {
const res = await getUserInfo()
travel.value = res.is_mileage == 1 ? true : false
}, },
// 切换服务方式 /**
* 切换服务方式
* @param type
*/
handleToggleService: (type: 'door' | 'store') => { handleToggleService: (type: 'door' | 'store') => {
serviceMethods.value[type] = !serviceMethods.value[type] serviceMethods.value[type] = !serviceMethods.value[type]
}, },
// 保存 /**
handleSave: () => { * 保存
// TODO: 实现保存逻辑 */
console.log('保存服务方式:', { handleSave: async () => {
serviceMethods: serviceMethods.value, const val = travel.value ? 1 : 0
isFreeTravel: isFreeTravel.value, await editServiceMethods(val)
}) toast.show('更新成功')
uni.showToast({
title: '保存成功',
icon: 'success',
})
router.navigateBack(1, 1500)
}, },
} }
</script> </script>
<style lang="scss"> <style lang="scss">

View File

@ -119,60 +119,69 @@
<!-- 营业执照 --> <!-- 营业执照 -->
<view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx"> <view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx">
<text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">营业执照</text> <text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">营业执照</text>
<view v-if="documents.businessLicense" class="relative mb-24rpx w-[200rpx]"> <view class="relative mb-24rpx w-[200rpx]">
<wd-img width="200rpx" height="200rpx" :src="documents.businessLicense" mode="aspectFill" <wd-upload
class="rounded-12rpx" /> :header="{'token': token}"
:file-list="fileList1"
:limit="1"
image-mode="scaleToFill"
:action="action"
@success="UploadData.handleUploadBusinessLicense">
<view <view
class="delete-btn absolute right-8rpx top-8rpx h-48rpx w-48rpx flex items-center justify-center rounded-full bg-black bg-opacity-60" class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
@click="UploadData.handleDeleteImage('businessLicense')"> <view class="">
<wd-icon name="close" size="24rpx" color="#fff" /> <wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_upload.png`"
mode="aspectFill" />
</view> </view>
<view class="font-400 text-26rpx leading-36rpx text-#303133">营业执照</view>
</view> </view>
<view v-else </wd-upload>
class="upload-area flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA]"
@click="UploadData.handleUploadImage('businessLicense')">
<wd-icon name="camera" size="80rpx" color="#C0C4CC" />
<text class="mt-24rpx text-28rpx text-[#909399] leading-40rpx">营业执照</text>
</view> </view>
</view> </view>
<!-- 资质证书 --> <!-- 资质证书 -->
<view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx"> <view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx">
<text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">资质证书</text> <text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">资质证书</text>
<view v-if="documents.qualification" class="relative mb-24rpx w-[200rpx]"> <view class="relative mb-24rpx w-[200rpx]">
<wd-img width="200rpx" height="200rpx" :src="documents.qualification" mode="aspectFill" <wd-upload
class="rounded-12rpx" /> :header="{'token': token}"
:file-list="fileList2"
:limit="1"
image-mode="scaleToFill"
:action="action"
@success="UploadData.handleUploadQualification">
<view <view
class="delete-btn absolute right-8rpx top-8rpx h-48rpx w-48rpx flex items-center justify-center rounded-full bg-black bg-opacity-60" class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
@click="UploadData.handleDeleteImage('qualification')"> <view class="">
<wd-icon name="close" size="24rpx" color="#fff" /> <wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_upload.png`"
mode="aspectFill" />
</view> </view>
<view class="font-400 text-26rpx leading-36rpx text-#303133">茶艺师资格证</view>
</view> </view>
<view v-else </wd-upload>
class="upload-area flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA]"
@click="UploadData.handleUploadImage('qualification')">
<wd-icon name="camera" size="80rpx" color="#C0C4CC" />
<text class="mt-24rpx text-28rpx text-[#909399] leading-40rpx">茶艺师资格证</text>
</view> </view>
</view> </view>
<!-- 健康证 --> <!-- 健康证 -->
<view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx"> <view class="info-card mx-30rpx mt-30rpx rounded-24rpx bg-white p-30rpx">
<text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">健康证</text> <text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">健康证</text>
<view v-if="documents.healthCert" class="relative mb-24rpx w-[200rpx]"> <view class="relative mb-24rpx w-[200rpx]">
<wd-img width="200rpx" height="200rpx" :src="documents.healthCert" mode="aspectFill" <wd-upload
class="rounded-12rpx" /> :header="{'token': token}"
:file-list="fileList3"
:limit="1"
image-mode="scaleToFill"
:action="action"
@success="UploadData.handleUploadHealthCert">
<view <view
class="delete-btn absolute right-8rpx top-8rpx h-48rpx w-48rpx flex items-center justify-center rounded-full bg-black bg-opacity-60" class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
@click="UploadData.handleDeleteImage('healthCert')"> <view class="">
<wd-icon name="close" size="24rpx" color="#fff" /> <wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_upload.png`"
mode="aspectFill" />
</view> </view>
<view class="font-400 text-26rpx leading-36rpx text-#303133">健康证</view>
</view> </view>
<view v-else </wd-upload>
class="upload-area flex flex-col items-center justify-center border-2rpx border-[#C0C4CC] rounded-16rpx border-dashed bg-[#F5F7FA]"
@click="UploadData.handleUploadImage('healthCert')">
<wd-icon name="camera" size="80rpx" color="#C0C4CC" />
<text class="mt-24rpx text-28rpx text-[#909399] leading-40rpx">健康证</text>
</view> </view>
</view> </view>
@ -190,7 +199,7 @@
<!-- 提交按钮仅在新增/编辑状态显示 --> <!-- 提交按钮仅在新增/编辑状态显示 -->
<view v-if="pageStatus === 'add' || pageStatus === 'edit'" <view v-if="pageStatus === 'add' || pageStatus === 'edit'"
class="fixed bottom-0 left-0 right-0 px-30rpx pb-40rpx pt-24rpx"> class="fixed bottom-0 left-0 right-0 px-30rpx pb-40rpx pt-24rpx z-100">
<view class="save-btn h-88rpx rounded-16rpx bg-[#4C9F44] text-center leading-88rpx" <view class="save-btn h-88rpx rounded-16rpx bg-[#4C9F44] text-center leading-88rpx"
@click="UploadData.handleSubmit"> @click="UploadData.handleSubmit">
<text class="text-32rpx text-[#fff] font-bold">提交</text> <text class="text-32rpx text-[#fff] font-bold">提交</text>
@ -200,32 +209,44 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { router } from '@/utils/tools' import { router } from '@/utils/tools'
import { useToast } from 'wot-design-uni'
import { addTeaSpecialistQualification, getTeaSpecialistQualification } from '@/api/tes-specialist'
const OSS = inject('OSS') const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight') const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset') const rightPadding = inject('capsuleOffset')
const token = ref<string>('') // 用户token
const toast = useToast()
// 页面状态:'add' | 'edit' | 'pending' | 'view' // 页面状态:'add' | 'edit' | 'pending' | 'view'
// 可以通过路由参数或API获取状态这里使用静态数据模拟 // 可以通过路由参数或API获取状态这里使用静态数据模拟
const pageStatus = ref<'add' | 'edit' | 'pending' | 'view'>('view') const pageStatus = ref<'add' | 'edit' | 'pending' | 'view'>('view')
// 资料数据 // 资料数据
const documents = ref({ const documents = ref({
businessLicense: '', // 营业执照 businessLicense: '', // 营业执照
qualification: '', // 资质证书 qualification: '', // 资质证书
healthCert: '', // 健康证 healthCert: '', // 健康证
}) })
// 审核状态:'approved' | 'pending' | 'rejected' | 'none' // 审核状态:'approved' | 'pending' | 'rejected' | 'none'
const auditStatus = ref({ const auditStatus = ref({
businessLicense: 'approved', // 'approved' | 'pending' | 'rejected' | 'none' businessLicense: 'approved', // 'approved' | 'pending' | 'rejected' | 'none'
qualification: 'none', qualification: 'none',
healthCert: 'pending', healthCert: 'pending',
}) })
// 上传文件
const fileList1 = ref<any[]>([]) // 营业执照
const fileList2 = ref<any[]>([]) // 资质证书
const fileList3 = ref<any[]>([]) // 健康证
const action = import.meta.env.VITE_UPLOAD_BASEURL
// 初始化:根据实际情况判断页面状态
onLoad((options: any) => {
token.value = uni.getStorageSync('token')
// 初始化:根据实际情况判断页面状态
onLoad((options: any) => {
// 如果有状态参数,使用参数 // 如果有状态参数,使用参数
if (options.status) { if (options.status) {
pageStatus.value = options.status as 'add' | 'edit' | 'pending' | 'view' pageStatus.value = options.status as 'add' | 'edit' | 'pending' | 'view'
@ -234,13 +255,18 @@ onLoad((options: any) => {
// 如果已提交且在审核中显示pending // 如果已提交且在审核中显示pending
// 如果已审核通过显示view // 如果已审核通过显示view
// 如果有数据但需要编辑显示edit // 如果有数据但需要编辑显示edit
UploadData.handleGetInfo()
// 如果无数据显示add // 如果无数据显示add
}) })
const UploadData = {
/**
* 初始化数据
*/
handleGetInfo: async () => {
const res = await getTeaSpecialistQualification()
console.log("🚀 ~ res:", res)
const UploadData = {
// 返回
handleBack: () => {
router.navigateBack()
}, },
// 上传图片 // 上传图片
@ -261,19 +287,78 @@ const UploadData = {
documents.value[type] = '' documents.value[type] = ''
}, },
// 提交
handleSubmit: () => {
// TODO: 实现提交逻辑
console.log('提交资料:', documents.value)
// 提交后设置为申请中状态
pageStatus.value = 'pending'
},
// 修改信息 // 修改信息
handleEdit: () => { handleEdit: () => {
pageStatus.value = 'edit' pageStatus.value = 'edit'
}, },
}
/**
* 上传营业执照
*/
handleUploadBusinessLicense: async (e: any) => {
try {
const response = JSON.parse(e.file.response)
if (response.code) {
const avatarUrl = response.data.url
documents.value.businessLicense = avatarUrl
} else {
throw new Error('上传失败')
}
} catch (error) {
toast.show('上传失败')
}
},
/**
* 上传资质证书
*/
handleUploadQualification: async (e: any) => {
try {
const response = JSON.parse(e.file.response)
if (response.code) {
const avatarUrl = response.data.url
documents.value.qualification = avatarUrl
} else {
throw new Error('上传失败')
}
} catch (error) {
toast.show('上传失败')
}
},
/**
* 上传健康证
*/
handleUploadHealthCert: async (e: any) => {
try {
const response = JSON.parse(e.file.response)
if (response.code) {
const avatarUrl = response.data.url
documents.value.healthCert = avatarUrl
} else {
throw new Error('上传失败')
}
} catch (error) {
toast.show('上传失败')
}
},
/**
* 提交数据
*/
handleSubmit: async () => {
// // TODO: 实现提交逻辑
await addTeaSpecialistQualification({
license_img: documents.value.businessLicense,
cert_img: documents.value.qualification,
fitness_img: documents.value.healthCert,
})
toast.show('资料提交成功')
// 提交后设置为申请中状态
pageStatus.value = 'pending'
},
}
</script> </script>
<style lang="scss"> <style lang="scss">