调试接口
This commit is contained in:
2
env/.env
vendored
2
env/.env
vendored
@ -22,5 +22,5 @@ VITE_APP_PROXY_PREFIX = '/storeapi'
|
||||
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/'
|
||||
@ -5,21 +5,21 @@ import type { IAddBankCardParams } from '@/api/types/bank'
|
||||
* 添加银行卡
|
||||
*/
|
||||
export function addBankCard(data: IAddBankCardParams) {
|
||||
return http.Post('/storeapi/user/addBank', data)
|
||||
return http.Post('/teamapi/user/addBank', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除银行卡
|
||||
*/
|
||||
export function deleteBankCard(id: number) {
|
||||
return http.Post('/storeapi/user/delBank', { id })
|
||||
return http.Post('/teamapi/user/delBank', { id })
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取银行卡列表
|
||||
*/
|
||||
export function getBankCardList() {
|
||||
return http.Post<any>('/storeapi/user/checkBank')
|
||||
return http.Post<any>('/teamapi/user/checkBank')
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -6,3 +6,38 @@ import { http } from '@/http/alova'
|
||||
export function getTeaSpecialistProfile() {
|
||||
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)
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
import { http } from '@/http/alova'
|
||||
import type { IUserAddressListResult, IUserAddressDetailsResult, IUserCouponListResult } from '@/api/types/user'
|
||||
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)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改头像
|
||||
*/
|
||||
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
|
||||
latitude: number
|
||||
address: string
|
||||
status: number
|
||||
}
|
||||
|
||||
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) {
|
||||
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 })
|
||||
}
|
||||
@ -26,7 +26,7 @@
|
||||
</wd-picker>
|
||||
</view>
|
||||
|
||||
<view class="h-2rpx bg-#F2F2F2 mt-20rpx"></view>
|
||||
<view class="h-2rpx bg-#F2F2F2"></view>
|
||||
|
||||
<view>
|
||||
<view class="flex items-center">
|
||||
@ -47,7 +47,7 @@
|
||||
确定
|
||||
</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>
|
||||
</view>
|
||||
@ -58,12 +58,13 @@
|
||||
<script lang="ts" setup>
|
||||
import { useMessage } from 'wot-design-uni'
|
||||
import { useColPickerData } from '@/hooks/useColPickerData'
|
||||
import { addUserAddress, deleteUserAddress, editUserAddress, getOpenCityList } from '@/api/user'
|
||||
import { toast } from '@/utils/toast'
|
||||
import { addUserAddress, deleteUserAddress, editUserAddress, getOpenCityList, getUserAddressInfo } from '@/api/user'
|
||||
import { mobile } from '@/utils/test'
|
||||
import { router } from '@/utils/tools'
|
||||
import { useToast } from 'wot-design-uni'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
const toast = useToast()
|
||||
|
||||
// 弹出框
|
||||
const message = useMessage('wd-message-box-slot')
|
||||
@ -92,7 +93,7 @@
|
||||
// 编辑地址
|
||||
title.value = '修改地址'
|
||||
addressId.value = Number(args.id)
|
||||
// Add.handleGetAddressDetails()
|
||||
Add.handleGetAddressDetails(args.id)
|
||||
}
|
||||
|
||||
Add.handleGetCity()
|
||||
@ -118,30 +119,17 @@
|
||||
city.value = e.selectedItems.label || ''
|
||||
},
|
||||
|
||||
// // 获取地址详情
|
||||
// handleGetAddressDetails: async () => {
|
||||
// const res = await userAddressDetails({
|
||||
// id: addressId.value
|
||||
// })
|
||||
// form.contact = res.address_details.contact
|
||||
// form.telephone = res.address_details.telephone
|
||||
// form.province = res.address_details.province
|
||||
// form.province_id = res.address_details.province_id
|
||||
// console.log("🚀 ~ form.province_id :", form.province_id )
|
||||
// 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)
|
||||
// },
|
||||
// 获取地址详情
|
||||
handleGetAddressDetails: async (id: number) => {
|
||||
const res = await getUserAddressInfo(id)
|
||||
form.value = {
|
||||
city_id: res.city_id,
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude,
|
||||
address: res.address,
|
||||
}
|
||||
city.value = res.city_name || ''
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择地址
|
||||
@ -181,14 +169,19 @@
|
||||
|
||||
if (addressId.value > 0 ) {
|
||||
// 编辑地址
|
||||
// form.id = addressId.value
|
||||
// await editUserAddress(form)
|
||||
const params = {
|
||||
id: addressId.value,
|
||||
...form.value
|
||||
}
|
||||
await editUserAddress(params)
|
||||
toast.show('修改成功')
|
||||
} else {
|
||||
await addUserAddress(form.value)
|
||||
toast.show('添加成功')
|
||||
}
|
||||
|
||||
uni.$emit('refreshAddressList')
|
||||
router.navigateBack(500)
|
||||
router.navigateBack(1, 500)
|
||||
},
|
||||
|
||||
// // 添加地址
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
<template>
|
||||
<view class="">
|
||||
<view class="pb-200rpx">
|
||||
<!-- 消息弹窗 -->
|
||||
<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"
|
||||
@click="router.navigateTo('/bundle/address/add')">新建地址</view> -->
|
||||
|
||||
<view
|
||||
class="bg-white fixed left-0 right-0 bottom-0 h-152rpx flex items-center px-30rpx"
|
||||
@click="router.navigateTo('/bundle/address/add')">
|
||||
<view class="bg-white fixed left-0 right-0 bottom-0 h-152rpx flex items-center px-30rpx">
|
||||
|
||||
<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="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>
|
||||
@ -73,7 +72,7 @@
|
||||
import type { IUserAddressListResult } from '@/api/types/user'
|
||||
import { router } from '@/utils/tools'
|
||||
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'
|
||||
|
||||
const OSS = inject('OSS')
|
||||
@ -88,7 +87,7 @@
|
||||
|
||||
// 选中的地址ID
|
||||
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) => {
|
||||
if (args.from) {
|
||||
@ -115,6 +114,7 @@
|
||||
handleInit: async () => {
|
||||
const res = await getUserAddressList()
|
||||
addressList.value = res
|
||||
addressId.value = addressList.value.filter(item => item.status === 1)[0]?.id || 0
|
||||
},
|
||||
|
||||
/**
|
||||
@ -122,7 +122,7 @@
|
||||
* @param id 地址ID
|
||||
*/
|
||||
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>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
</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>
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
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 { router } from '@/utils/tools'
|
||||
import { useUserStore } from '@/store'
|
||||
@ -195,22 +195,17 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* 图片选择/删除
|
||||
* @param e
|
||||
* 上传头像
|
||||
*/
|
||||
handleChange: (e: any) => {
|
||||
console.log("🚀 ~ e:", e)
|
||||
},
|
||||
|
||||
handleUploadSuccess: async (e: any) => {
|
||||
try {
|
||||
const response = JSON.parse(e.file.response)
|
||||
if (response.code) {
|
||||
const avatarUrl = response.data.url
|
||||
console.log("🚀 ~ avatarUrl:", response)
|
||||
// await updateUserInfo({ avatar: avatarUrl })
|
||||
// user.value.avatar = avatarUrl
|
||||
// toast.info('头像上传成功')
|
||||
await updateUserAvatar( response.data.url)
|
||||
Profile.handleInit()
|
||||
user.value.avatar = avatarUrl
|
||||
toast.info('头像上传成功')
|
||||
} else {
|
||||
throw new Error('上传失败')
|
||||
}
|
||||
@ -228,7 +223,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
await updateUserInfo({ nickname: nickname.value })
|
||||
await updateUserNickname(nickname.value)
|
||||
showEditNicknamePopup.value = false
|
||||
user.value.nickname = nickname.value
|
||||
toast.info('昵称修改成功')
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<!-- 金牌茶艺师 -->
|
||||
<wd-img :src="levelMap[level].icon" width="36rpx" height="36rpx"></wd-img>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
<!-- 可提现金额 -->
|
||||
<view class="flex-1 text-center">
|
||||
<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 class="mt-8rpx text-24rpx text-[#909399] leading-34rpx">
|
||||
可提现金额
|
||||
@ -95,7 +95,7 @@
|
||||
<!-- 不可提现金额 -->
|
||||
<view class="flex-1 text-center">
|
||||
<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 class="mt-8rpx text-24rpx text-[#909399] leading-34rpx">
|
||||
不可提现金额
|
||||
@ -103,9 +103,9 @@
|
||||
</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" />
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 上班安排区域 -->
|
||||
@ -117,12 +117,12 @@
|
||||
}" 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="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`"
|
||||
class="mr-12rpx" />
|
||||
<text class="text-32rpx text-[#303133] font-bold">上班安排</text>
|
||||
</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`"
|
||||
class="mr-12rpx" />
|
||||
</view>
|
||||
@ -143,21 +143,21 @@
|
||||
</view>
|
||||
<!-- 工作日 -->
|
||||
<view class="schedule-item mb-20rpx flex items-center">
|
||||
<text class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作日:</text>
|
||||
<text class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ otherInfo.work || '-' }}</text>
|
||||
<view class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作日:</view>
|
||||
<view class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ userInfo.work || '-' }}</view>
|
||||
</view>
|
||||
<!-- 工作时间 -->
|
||||
<view class="schedule-item mb-20rpx flex items-center">
|
||||
<text class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作时间:</text>
|
||||
<text class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ otherInfo.work_time }}</text>
|
||||
<view class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">工作时间:</view>
|
||||
<view class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ userInfo.work_time || '-' }}</view>
|
||||
</view>
|
||||
<!-- 住址 -->
|
||||
<view class="schedule-item flex items-start">
|
||||
<text class="label-text w-140rpx pt-4rpx text-24rpx text-[#606266] leading-40rpx">住址:</text>
|
||||
<text class="flex-1 text-24rpx text-[#303133] leading-40rpx">{{ otherInfo.address || '-' }}</text>
|
||||
<view class="schedule-item flex items-center">
|
||||
<view class="label-text w-140rpx pt-4rpx text-24rpx text-[#606266] leading-40rpx">住址:</view>
|
||||
<view class="flex-1 text-24rpx text-[#303133] line-2">{{ userInfo.address || '-' }}</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="flex items-center">
|
||||
<view class="mt-20rpx">
|
||||
@ -165,8 +165,7 @@
|
||||
</view>
|
||||
<view class="text-28rpx text-[#606266] mt-6rpx font-bold ml-10rpx">{{ isWork ? '上班中' : '已下班' }}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- 更多服务区域 -->
|
||||
@ -264,25 +263,32 @@
|
||||
// 用户信息
|
||||
const userStore = useUserStore()
|
||||
const userInfo = ref({
|
||||
avatar: userStore.userInfo.avatar,
|
||||
nickname: userStore.userInfo.nickname,
|
||||
account: userStore.userInfo.account
|
||||
})
|
||||
const otherInfo = ref<{
|
||||
user_money: number // 可提现金额
|
||||
no_reflect_amount: number // 不可提现金额
|
||||
work: string // 工作日
|
||||
address: string // 住址
|
||||
work_time: string // 工作时间
|
||||
is_mileage: number // 是否开启里程
|
||||
}>({
|
||||
avatar: '',
|
||||
nickname: '',
|
||||
account: '',
|
||||
user_money: 0,
|
||||
no_reflect_amount: 0,
|
||||
work: '',
|
||||
address: '',
|
||||
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)
|
||||
@ -301,7 +307,8 @@
|
||||
*/
|
||||
handleGetUserInfo: async () => {
|
||||
const res = await getUserInfo()
|
||||
otherInfo.value = res
|
||||
userInfo.value = res
|
||||
userInfo.value.cert_id = 1
|
||||
},
|
||||
|
||||
/**
|
||||
@ -325,8 +332,6 @@
|
||||
*/
|
||||
handleToProfile: () => {
|
||||
// TODO: 跳转到个人信息页面
|
||||
console.log('跳转到个人信息页面')
|
||||
console.log("🚀 ~ userStore.isLoggedIn:", userStore.isLoggedIn)
|
||||
if (userStore.isLoggedIn) {
|
||||
router.navigateTo('/bundle/profile/profile')
|
||||
} else {
|
||||
@ -367,10 +372,14 @@
|
||||
}
|
||||
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') {
|
||||
// 跳转到行程记录页面
|
||||
// 如过cer
|
||||
router.navigateTo('/pages/my/travel-record')
|
||||
}
|
||||
else {
|
||||
@ -388,16 +397,14 @@
|
||||
userInfo.value = {
|
||||
avatar: '',
|
||||
nickname: '',
|
||||
account: ''
|
||||
}
|
||||
|
||||
otherInfo.value = {
|
||||
account: '',
|
||||
user_money: 0,
|
||||
no_reflect_amount: 0,
|
||||
work: '',
|
||||
address: '',
|
||||
work_time: '',
|
||||
is_mileage: 0
|
||||
is_mileage: 0,
|
||||
cert_id: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -455,7 +462,7 @@ page {
|
||||
}
|
||||
|
||||
.wallet-card {
|
||||
background-color: #ffb347;
|
||||
// background-color: #ffb347;
|
||||
background-size: 100% 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<!-- 顶部背景区域 -->
|
||||
<wd-navbar safe-area-inset-top :bordered="false" :zIndex="20" fixed custom-style="background: transparent !important;">
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
@ -94,7 +94,7 @@
|
||||
<text class="text-28rpx text-[#303133] font-bold leading-40rpx">兴趣爱好</text>
|
||||
</view>
|
||||
<view class="interest-text text-26rpx text-[#606266] leading-40rpx">
|
||||
爱好茶艺,喜欢旅游,把爱好当工作
|
||||
{{ profile.hobby_introduce }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -113,11 +113,11 @@
|
||||
</view>
|
||||
<view class="cost-item flex items-center justify-between">
|
||||
<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 class="cost-item flex items-center justify-between">
|
||||
<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>
|
||||
@ -138,13 +138,6 @@
|
||||
const navbarHeight = inject('navbarHeight')
|
||||
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<{
|
||||
name: string // 茶艺师名字
|
||||
star: number // 评分
|
||||
@ -173,7 +166,7 @@
|
||||
mileage_price: 0,
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
onShow(() => {
|
||||
ProfileDisplay.handleInit()
|
||||
})
|
||||
|
||||
@ -186,22 +179,20 @@
|
||||
profile.value = res
|
||||
},
|
||||
|
||||
// 返回
|
||||
handleBack: () => {
|
||||
console.log("🚀 ~ ProfileDisplay.handleBack:", 213)
|
||||
router.navigateBack()
|
||||
},
|
||||
|
||||
// 跳转到编辑页面
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
*/
|
||||
handleEdit: () => {
|
||||
router.navigateTo('/pages/my/profile-edit')
|
||||
},
|
||||
|
||||
// 预览照片
|
||||
/**
|
||||
* 预览照片
|
||||
*/
|
||||
handlePreviewPhoto: (index: number) => {
|
||||
uni.previewImage({
|
||||
current: index,
|
||||
urls: photoList.value,
|
||||
urls: profile.value.image_arr,
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
|
||||
|
||||
<template>
|
||||
<view class="page-container pb-40rpx">
|
||||
<view class="page-container">
|
||||
<!-- 导航栏 -->
|
||||
<navbar title="个人介绍填写"></navbar>
|
||||
<navbar title="个人介绍填写" fixed></navbar>
|
||||
|
||||
<view class="content-wrapper">
|
||||
<!-- 基本信息 -->
|
||||
@ -32,12 +32,14 @@
|
||||
<view class="form-item mb-24rpx">
|
||||
<text class="label-text mb-12rpx block text-28rpx text-[#303133] leading-40rpx">性别</text>
|
||||
<view class="gender-select rounded-16rpx bg-[#F5F7FA]">
|
||||
<wd-picker v-model="formData.gender" :columns="genderOptions" placeholder="请选择性别"
|
||||
custom-class="!bg-transparent" @confirm="Profile.handleGenderConfirm">
|
||||
<wd-input :value="formData.gender || '请选择性别'" readonly no-border
|
||||
<wd-picker v-model="formData.sex" :columns="genderOptions" placeholder="请选择性别"
|
||||
custom-class="!bg-transparent" @confirm="ProfileEdit.handleGenderConfirm">
|
||||
<wd-input v-model="sex" readonly no-border
|
||||
custom-class="!bg-transparent" custom-input-class="!h-88rpx !px-24rpx !text-28rpx">
|
||||
<template #suffix>
|
||||
<wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" />
|
||||
<view class="pr-10rpx">
|
||||
<wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" />
|
||||
</view>
|
||||
</template>
|
||||
</wd-input>
|
||||
</wd-picker>
|
||||
@ -48,12 +50,14 @@
|
||||
<view class="form-item mb-24rpx">
|
||||
<text class="label-text mb-12rpx block text-28rpx text-[#303133] leading-40rpx">出生年月</text>
|
||||
<view class="date-select rounded-16rpx bg-[#F5F7FA]">
|
||||
<wd-datetime-picker v-model="formData.birthDate" type="year-month" placeholder="请选择出生年月"
|
||||
custom-class="!bg-transparent" @confirm="Profile.handleDateConfirm">
|
||||
<wd-input :value="formData.birthDate || '请选择出生年月'" readonly no-border
|
||||
<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="ProfileEdit.handleDateConfirm">
|
||||
<wd-input v-model="both" readonly no-border
|
||||
custom-class="!bg-transparent" custom-input-class="!h-88rpx !px-24rpx !text-28rpx">
|
||||
<template #suffix>
|
||||
<wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" />
|
||||
<view class="pr-10rpx">
|
||||
<wd-icon name="arrow-down" size="24rpx" color="#C0C4CC" />
|
||||
</view>
|
||||
</template>
|
||||
</wd-input>
|
||||
</wd-datetime-picker>
|
||||
@ -88,7 +92,7 @@
|
||||
<!-- 兴趣爱好 -->
|
||||
<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>
|
||||
<wd-textarea v-model="formData.interests"
|
||||
<wd-textarea v-model="formData.hobby_introduce"
|
||||
:auto-height="true"
|
||||
no-border
|
||||
placeholder="茶艺: 你的茶艺兴趣爱好是什么? 比如茶艺研究、品鉴、茶道美学......快来分享一下吧!"
|
||||
@ -101,7 +105,7 @@
|
||||
<text class="mb-24rpx block text-32rpx text-[#303133] font-bold leading-44rpx">视频信息</text>
|
||||
<view
|
||||
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" />
|
||||
<text class="mt-24rpx text-28rpx text-[#909399] leading-40rpx">本人视频</text>
|
||||
</view>
|
||||
@ -127,204 +131,296 @@
|
||||
</view>
|
||||
<text class="text-24rpx text-[#909399] leading-34rpx">可上传1-5张照片</text>
|
||||
</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">
|
||||
<wd-img width="100%" height="100%" :src="photo" mode="aspectFill" />
|
||||
<view
|
||||
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" />
|
||||
</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]"
|
||||
@click="Profile.handleUploadPhoto">
|
||||
@click="ProfileEdit.handleUploadPhoto">
|
||||
<wd-icon name="camera" size="48rpx" color="#C0C4CC" />
|
||||
<text class="mt-12rpx text-24rpx text-[#909399] leading-34rpx">本人照片</text>
|
||||
</view>
|
||||
</view>
|
||||
</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 class="font-400 text-26rpx leading-36rpx text-#303133">添加图片</view>
|
||||
</view>
|
||||
</wd-upload>
|
||||
</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"
|
||||
@click="Profile.handleSave">
|
||||
@click="ProfileEdit.handleSave">
|
||||
<text class="text-32rpx text-[#fff] font-bold">保存</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部留白 -->
|
||||
<view class="pb-160rpx" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<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 navbarHeight = inject('navbarHeight')
|
||||
const rightPadding = inject('capsuleOffset')
|
||||
const OSS = inject('OSS')
|
||||
const navbarHeight = inject('navbarHeight')
|
||||
const rightPadding = inject('capsuleOffset')
|
||||
const token = ref<string>('') // 用户token
|
||||
const toast = useToast()
|
||||
|
||||
// 表单数据
|
||||
const formData = ref({
|
||||
name: '',
|
||||
gender: '',
|
||||
birthDate: '',
|
||||
height: '',
|
||||
weight: '',
|
||||
interests: '',
|
||||
video: '',
|
||||
photos: [] as string[],
|
||||
})
|
||||
// 上传文件
|
||||
const fileList = ref<any[]>([])
|
||||
const action = import.meta.env.VITE_UPLOAD_BASEURL
|
||||
|
||||
// 性别选择器
|
||||
const genderOptions = ref(['男', '女'])
|
||||
// 性别选择器
|
||||
const genderOptions = ref(['男', '女'])
|
||||
|
||||
const Profile = {
|
||||
// 返回
|
||||
handleBack: () => {
|
||||
router.navigateBack()
|
||||
},
|
||||
// 茶艺师资料
|
||||
const formData = ref<{
|
||||
name: string // 茶艺师名字
|
||||
both: number | string // 出生年月
|
||||
sex: number // 性别 1男 2女
|
||||
height: number // 身高
|
||||
weight: number // 体重
|
||||
image_arr: string[] // 照片数组
|
||||
hobby_introduce: string // 兴趣爱好介绍
|
||||
}>({
|
||||
name: '',
|
||||
both: 0,
|
||||
sex: 1,
|
||||
height: 0,
|
||||
weight: 0,
|
||||
image_arr: [],
|
||||
hobby_introduce: '',
|
||||
})
|
||||
|
||||
// 表单内容回显
|
||||
const sex = ref<string>('')
|
||||
const both = ref<string>('')
|
||||
|
||||
// 选择性别
|
||||
handleGenderConfirm: (value: string) => {
|
||||
formData.value.gender = value
|
||||
},
|
||||
onLoad(() => {
|
||||
token.value = uni.getStorageSync('token')
|
||||
ProfileEdit.handleInit()
|
||||
})
|
||||
|
||||
// 选择日期
|
||||
handleDateConfirm: ({ value }: any) => {
|
||||
const d = new Date(value)
|
||||
const year = d.getFullYear()
|
||||
const month = d.getMonth() + 1
|
||||
formData.value.birthDate = `${year}年${month}月`
|
||||
},
|
||||
const ProfileEdit = {
|
||||
fileList: [],
|
||||
|
||||
// 上传视频
|
||||
handleUploadVideo: () => {
|
||||
// TODO: 实现视频上传功能
|
||||
uni.chooseVideo({
|
||||
sourceType: ['camera', 'album'],
|
||||
maxDuration: 60,
|
||||
camera: 'back',
|
||||
success: (res) => {
|
||||
console.log('选择视频:', res)
|
||||
// 这里应该上传视频到服务器
|
||||
formData.value.video = res.tempFilePath
|
||||
},
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 初始化茶艺师详情
|
||||
*/
|
||||
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
|
||||
|
||||
// 上传照片
|
||||
handleUploadPhoto: () => {
|
||||
const maxCount = 5 - formData.value.photos.length
|
||||
uni.chooseImage({
|
||||
count: maxCount,
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
// TODO: 这里应该上传照片到服务器
|
||||
formData.value.photos.push(...res.tempFilePaths)
|
||||
},
|
||||
})
|
||||
},
|
||||
// 处理照片数组
|
||||
fileList.value = (formData.value.image_arr || []).map((item: string) => ({ url: item, name: item}))
|
||||
ProfileEdit.fileList = fileList.value
|
||||
console.log("🚀 ~ ProfileEdit.fileList:", ProfileEdit.fileList)
|
||||
},
|
||||
|
||||
// 删除照片
|
||||
handleRemovePhoto: (index: number) => {
|
||||
formData.value.photos.splice(index, 1)
|
||||
},
|
||||
/**
|
||||
* 选择性别
|
||||
*/
|
||||
handleGenderConfirm: (item: {value: string}) => {
|
||||
formData.value.sex = item.value === '男' ? 1 : 2
|
||||
sex.value = item.value
|
||||
},
|
||||
|
||||
// 保存
|
||||
handleSave: () => {
|
||||
// TODO: 实现保存逻辑
|
||||
console.log('保存数据:', formData.value)
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
})
|
||||
setTimeout(() => {
|
||||
router.navigateBack()
|
||||
}, 1500)
|
||||
},
|
||||
}
|
||||
/**
|
||||
* 选择日期
|
||||
*/
|
||||
handleDateConfirm: ({ value }: any) => {
|
||||
console.log("🚀 ~ value:", value)
|
||||
const d = new Date(value)
|
||||
const year = d.getFullYear()
|
||||
const month = d.getMonth() + 1
|
||||
const day = d.getDay()
|
||||
both.value = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`
|
||||
formData.value.both = value / 1000 // 转为秒
|
||||
},
|
||||
|
||||
/**
|
||||
* 图片选择/删除
|
||||
*/
|
||||
handleUploadFile: ({ fileList: files }) => {
|
||||
let url = ''
|
||||
let name = ''
|
||||
let response = null
|
||||
|
||||
const res = files.map(item => {
|
||||
if (item.response) {
|
||||
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
|
||||
},
|
||||
|
||||
|
||||
// 保存
|
||||
handleSave: async () => {
|
||||
// 处理出生年月
|
||||
formData.value.both = both.value
|
||||
|
||||
// 处理图片路径
|
||||
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
|
||||
})
|
||||
|
||||
if (!formData.value.name) {
|
||||
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>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.page-container {
|
||||
min-height: 100vh;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
// position: relative;
|
||||
// z-index: 10;
|
||||
}
|
||||
|
||||
.right-slot {
|
||||
padding-right: v-bind(rightPadding);
|
||||
|
||||
.nav-icon-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 60rpx;
|
||||
page {
|
||||
background: #f5f7fa;
|
||||
}
|
||||
}
|
||||
|
||||
.info-card {
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.form-item {
|
||||
.label-text {
|
||||
display: block;
|
||||
.page-container {
|
||||
min-height: 100vh;
|
||||
background: #f5f7fa;
|
||||
}
|
||||
}
|
||||
|
||||
.gender-select,
|
||||
.date-select {
|
||||
cursor: pointer;
|
||||
}
|
||||
.content-wrapper {
|
||||
// position: relative;
|
||||
// z-index: 10;
|
||||
}
|
||||
|
||||
.unit-text {
|
||||
pointer-events: none;
|
||||
}
|
||||
.right-slot {
|
||||
padding-right: v-bind(rightPadding);
|
||||
|
||||
.upload-area {
|
||||
cursor: pointer;
|
||||
min-height: 200rpx;
|
||||
}
|
||||
.nav-icon-item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.photo-upload-grid {
|
||||
.photo-item {
|
||||
.info-card {
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.form-item {
|
||||
.label-text {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.gender-select,
|
||||
.date-select {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.upload-btn {
|
||||
.unit-text {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.upload-area {
|
||||
cursor: pointer;
|
||||
min-height: 200rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn-wrapper {
|
||||
box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
z-index: 100;
|
||||
}
|
||||
.photo-upload-grid {
|
||||
.photo-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
.upload-btn {
|
||||
cursor: pointer;
|
||||
min-height: 200rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.save-btn-wrapper {
|
||||
box-shadow: 0 -4rpx 12rpx rgba(0, 0, 0, 0.08);
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.save-btn {
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
|
||||
&:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -10,13 +10,6 @@
|
||||
<template>
|
||||
<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>
|
||||
|
||||
<view class="content-wrapper" :style="{ paddingTop: `0px` }">
|
||||
@ -60,7 +53,7 @@
|
||||
开启免费出行,可以获得更多流量扶持
|
||||
</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>
|
||||
|
||||
@ -79,46 +72,58 @@
|
||||
</template>
|
||||
|
||||
<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 navbarHeight = inject('navbarHeight')
|
||||
const rightPadding = inject('capsuleOffset')
|
||||
const OSS = inject('OSS')
|
||||
const navbarHeight = inject('navbarHeight')
|
||||
const rightPadding = inject('capsuleOffset')
|
||||
const toast = useToast()
|
||||
|
||||
// 服务方式选择
|
||||
const serviceMethods = ref({
|
||||
door: true, // 上门服务
|
||||
store: false, // 到店服务
|
||||
})
|
||||
// 服务方式选择
|
||||
const serviceMethods = ref({
|
||||
door: true, // 上门服务
|
||||
store: false, // 到店服务
|
||||
})
|
||||
|
||||
// 是否免费出行
|
||||
const isFreeTravel = ref(false)
|
||||
// 是否免费出行
|
||||
const isFreeTravel = ref(false)
|
||||
|
||||
const ServiceMethod = {
|
||||
// 返回
|
||||
handleBack: () => {
|
||||
router.navigateBack()
|
||||
},
|
||||
// 出行
|
||||
const travel = ref<boolean>(false)
|
||||
|
||||
// 切换服务方式
|
||||
handleToggleService: (type: 'door' | 'store') => {
|
||||
serviceMethods.value[type] = !serviceMethods.value[type]
|
||||
},
|
||||
onLoad(() => {
|
||||
ServiceMethod.handleInit()
|
||||
})
|
||||
|
||||
// 保存
|
||||
handleSave: () => {
|
||||
// TODO: 实现保存逻辑
|
||||
console.log('保存服务方式:', {
|
||||
serviceMethods: serviceMethods.value,
|
||||
isFreeTravel: isFreeTravel.value,
|
||||
})
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
})
|
||||
router.navigateBack(1, 1500)
|
||||
},
|
||||
}
|
||||
const ServiceMethod = {
|
||||
/**
|
||||
* 获取服务方式
|
||||
*/
|
||||
handleInit: async () => {
|
||||
const res = await getUserInfo()
|
||||
travel.value = res.is_mileage == 1 ? true : false
|
||||
},
|
||||
|
||||
/**
|
||||
* 切换服务方式
|
||||
* @param type
|
||||
*/
|
||||
handleToggleService: (type: 'door' | 'store') => {
|
||||
serviceMethods.value[type] = !serviceMethods.value[type]
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
handleSave: async () => {
|
||||
const val = travel.value ? 1 : 0
|
||||
await editServiceMethods(val)
|
||||
toast.show('更新成功')
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@ -119,60 +119,69 @@
|
||||
<!-- 营业执照 -->
|
||||
<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>
|
||||
<view v-if="documents.businessLicense" class="relative mb-24rpx w-[200rpx]">
|
||||
<wd-img width="200rpx" height="200rpx" :src="documents.businessLicense" mode="aspectFill"
|
||||
class="rounded-12rpx" />
|
||||
<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"
|
||||
@click="UploadData.handleDeleteImage('businessLicense')">
|
||||
<wd-icon name="close" size="24rpx" color="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-else
|
||||
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 class="relative mb-24rpx w-[200rpx]">
|
||||
<wd-upload
|
||||
:header="{'token': token}"
|
||||
:file-list="fileList1"
|
||||
:limit="1"
|
||||
image-mode="scaleToFill"
|
||||
:action="action"
|
||||
@success="UploadData.handleUploadBusinessLicense">
|
||||
<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 class="font-400 text-26rpx leading-36rpx text-#303133">营业执照</view>
|
||||
</view>
|
||||
</wd-upload>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 资质证书 -->
|
||||
<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>
|
||||
<view v-if="documents.qualification" class="relative mb-24rpx w-[200rpx]">
|
||||
<wd-img width="200rpx" height="200rpx" :src="documents.qualification" mode="aspectFill"
|
||||
class="rounded-12rpx" />
|
||||
<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"
|
||||
@click="UploadData.handleDeleteImage('qualification')">
|
||||
<wd-icon name="close" size="24rpx" color="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-else
|
||||
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 class="relative mb-24rpx w-[200rpx]">
|
||||
<wd-upload
|
||||
:header="{'token': token}"
|
||||
:file-list="fileList2"
|
||||
:limit="1"
|
||||
image-mode="scaleToFill"
|
||||
:action="action"
|
||||
@success="UploadData.handleUploadQualification">
|
||||
<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 class="font-400 text-26rpx leading-36rpx text-#303133">茶艺师资格证</view>
|
||||
</view>
|
||||
</wd-upload>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 健康证 -->
|
||||
<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>
|
||||
<view v-if="documents.healthCert" class="relative mb-24rpx w-[200rpx]">
|
||||
<wd-img width="200rpx" height="200rpx" :src="documents.healthCert" mode="aspectFill"
|
||||
class="rounded-12rpx" />
|
||||
<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"
|
||||
@click="UploadData.handleDeleteImage('healthCert')">
|
||||
<wd-icon name="close" size="24rpx" color="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
<view v-else
|
||||
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 class="relative mb-24rpx w-[200rpx]">
|
||||
<wd-upload
|
||||
:header="{'token': token}"
|
||||
:file-list="fileList3"
|
||||
:limit="1"
|
||||
image-mode="scaleToFill"
|
||||
:action="action"
|
||||
@success="UploadData.handleUploadHealthCert">
|
||||
<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 class="font-400 text-26rpx leading-36rpx text-#303133">健康证</view>
|
||||
</view>
|
||||
</wd-upload>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -190,7 +199,7 @@
|
||||
|
||||
<!-- 提交按钮(仅在新增/编辑状态显示) -->
|
||||
<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"
|
||||
@click="UploadData.handleSubmit">
|
||||
<text class="text-32rpx text-[#fff] font-bold">提交</text>
|
||||
@ -200,80 +209,156 @@
|
||||
</template>
|
||||
|
||||
<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 navbarHeight = inject('navbarHeight')
|
||||
const rightPadding = inject('capsuleOffset')
|
||||
const OSS = inject('OSS')
|
||||
const navbarHeight = inject('navbarHeight')
|
||||
const rightPadding = inject('capsuleOffset')
|
||||
const token = ref<string>('') // 用户token
|
||||
const toast = useToast()
|
||||
|
||||
// 页面状态:'add' | 'edit' | 'pending' | 'view'
|
||||
// 可以通过路由参数或API获取状态,这里使用静态数据模拟
|
||||
const pageStatus = ref<'add' | 'edit' | 'pending' | 'view'>('view')
|
||||
// 页面状态:'add' | 'edit' | 'pending' | 'view'
|
||||
// 可以通过路由参数或API获取状态,这里使用静态数据模拟
|
||||
const pageStatus = ref<'add' | 'edit' | 'pending' | 'view'>('view')
|
||||
|
||||
// 资料数据
|
||||
const documents = ref({
|
||||
businessLicense: '', // 营业执照
|
||||
qualification: '', // 资质证书
|
||||
healthCert: '', // 健康证
|
||||
})
|
||||
// 资料数据
|
||||
const documents = ref({
|
||||
businessLicense: '', // 营业执照
|
||||
qualification: '', // 资质证书
|
||||
healthCert: '', // 健康证
|
||||
})
|
||||
|
||||
// 审核状态:'approved' | 'pending' | 'rejected' | 'none'
|
||||
const auditStatus = ref({
|
||||
businessLicense: 'approved', // 'approved' | 'pending' | 'rejected' | 'none'
|
||||
qualification: 'none',
|
||||
healthCert: 'pending',
|
||||
})
|
||||
// 审核状态:'approved' | 'pending' | 'rejected' | 'none'
|
||||
const auditStatus = ref({
|
||||
businessLicense: 'approved', // 'approved' | 'pending' | 'rejected' | 'none'
|
||||
qualification: 'none',
|
||||
healthCert: 'pending',
|
||||
})
|
||||
|
||||
// 初始化:根据实际情况判断页面状态
|
||||
onLoad((options: any) => {
|
||||
// 如果有状态参数,使用参数
|
||||
if (options.status) {
|
||||
pageStatus.value = options.status as 'add' | 'edit' | 'pending' | 'view'
|
||||
// 上传文件
|
||||
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')
|
||||
|
||||
// 如果有状态参数,使用参数
|
||||
if (options.status) {
|
||||
pageStatus.value = options.status as 'add' | 'edit' | 'pending' | 'view'
|
||||
}
|
||||
// TODO: 否则根据API数据判断状态
|
||||
// 如果已提交且在审核中,显示pending
|
||||
// 如果已审核通过,显示view
|
||||
// 如果有数据但需要编辑,显示edit
|
||||
UploadData.handleGetInfo()
|
||||
// 如果无数据,显示add
|
||||
})
|
||||
|
||||
const UploadData = {
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
handleGetInfo: async () => {
|
||||
const res = await getTeaSpecialistQualification()
|
||||
console.log("🚀 ~ res:", res)
|
||||
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
handleUploadImage: (type: 'businessLicense' | 'qualification' | 'healthCert') => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
// TODO: 上传图片到服务器
|
||||
console.log('选择图片:', res)
|
||||
documents.value[type] = res.tempFilePaths[0]
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
handleDeleteImage: (type: 'businessLicense' | 'qualification' | 'healthCert') => {
|
||||
documents.value[type] = ''
|
||||
},
|
||||
|
||||
|
||||
// 修改信息
|
||||
handleEdit: () => {
|
||||
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'
|
||||
},
|
||||
}
|
||||
// TODO: 否则根据API数据判断状态
|
||||
// 如果已提交且在审核中,显示pending
|
||||
// 如果已审核通过,显示view
|
||||
// 如果有数据但需要编辑,显示edit
|
||||
// 如果无数据,显示add
|
||||
})
|
||||
|
||||
const UploadData = {
|
||||
// 返回
|
||||
handleBack: () => {
|
||||
router.navigateBack()
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
handleUploadImage: (type: 'businessLicense' | 'qualification' | 'healthCert') => {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
// TODO: 上传图片到服务器
|
||||
console.log('选择图片:', res)
|
||||
documents.value[type] = res.tempFilePaths[0]
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
handleDeleteImage: (type: 'businessLicense' | 'qualification' | 'healthCert') => {
|
||||
documents.value[type] = ''
|
||||
},
|
||||
|
||||
// 提交
|
||||
handleSubmit: () => {
|
||||
// TODO: 实现提交逻辑
|
||||
console.log('提交资料:', documents.value)
|
||||
// 提交后设置为申请中状态
|
||||
pageStatus.value = 'pending'
|
||||
},
|
||||
|
||||
// 修改信息
|
||||
handleEdit: () => {
|
||||
pageStatus.value = 'edit'
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user