添加上下班

This commit is contained in:
wangxiaowei
2026-04-20 17:34:37 +08:00
parent e978bd932e
commit 7c784284ce
4 changed files with 62 additions and 43 deletions

View File

@ -181,3 +181,20 @@ export function updateUserAddressLocation(id: number) {
export function getUserAddressInfo(id: number) {
return http.Post<any>('/teamapi/user/addressDetails', { id })
}
/**
* 获取配置项
*/
export function getConfigItem() {
return http.Post<any>('/teamapi/setting/set', null, {
meta: { ignoreAuth: true }
})
}
/**
* 更新用户上下班状态
*/
export function updateWorkState(state: number) {
return http.Post<any>('/teamapi/user/updateState', {state})
}

View File

@ -32,7 +32,7 @@
<view class="">
<wd-radio :value="item.id" checked-color="#4C9F44">
<view class="flex items-center">
<wd-img :src="`${OSS}icon/icon_location5.png`" width="40rpx" height="40rpx"></wd-img>
<wd-img :src="`${OSS}icon/icon_location6.png`" width="40rpx" height="40rpx"></wd-img>
<view class="ml-16rpx text-30rpx leading-42rpx text-[#303133]">位置{{ index + 1 }}</view>
</view>
</wd-radio>

View File

@ -128,7 +128,7 @@
</view>
</view>
<!-- 服务方式 -->
<view class="schedule-item mb-20rpx flex items-center">
<view class="schedule-item mb-20rpx flex items-center" v-if="setting.status == 1">
<text class="label-text w-140rpx text-24rpx text-[#606266] leading-40rpx">服务方式:</text>
<view class="flex flex-1 items-center">
<view class="mr-16rpx flex items-center">
@ -157,15 +157,15 @@
<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">
<wd-switch v-model="isWork" size="32rpx" active-color="#4C9F44"/>
<wd-switch v-model="isWork" size="32rpx" active-color="#4C9F44" @change="My.handleChangeWorkState"/>
</view>
<view class="text-28rpx text-[#606266] mt-6rpx font-bold ml-10rpx">{{ isWork ? '上班中' : '已下班' }}</view>
</view>
</view> -->
</view>
</view>
<!-- 更多服务区域 -->
@ -254,11 +254,13 @@
<script lang="ts" setup>
import { router, hidePhoneMiddle } from '@/utils/tools'
import { useUserStore } from '@/store'
import { getUserInfo } from '@/api/user'
import { getUserInfo, getConfigItem, updateWorkState } from '@/api/user'
import { useToast } from 'wot-design-uni'
const OSS = inject('OSS')
const navbarHeight = inject('navbarHeight')
const rightPadding = inject('capsuleOffset')
const toast = useToast()
// 用户信息
const userStore = useUserStore()
@ -274,21 +276,6 @@
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)
@ -297,7 +284,12 @@
const hasProfileInfo = ref(true) // 改为 false 可以测试跳转到填写页面
const setting = ref({
status: 0
})
onShow(() => {
My.handleGetSettings()
My.handleGetUserInfo()
})
@ -309,22 +301,15 @@
const res = await getUserInfo()
userInfo.value = res
userStore.setUserInfo(res)
isWork.value = res.state === 0
},
/**
* 跳转到消息页面
* 获取配置项
*/
handleToMessage: () => {
// TODO: 跳转到消息页面
console.log('跳转到消息页面')
},
/**
* 跳转到设置页面
*/
handleToSettings: () => {
// TODO: 跳转到设置页面
console.log('跳转到设置页面')
handleGetSettings: async () => {
const res = await getConfigItem()
setting.value.status = res.status
},
/**
@ -339,12 +324,6 @@
}
},
// 跳转到提现页面
handleToWithdraw: () => {
// TODO: 跳转到提现页面
console.log('跳转到提现页面')
},
// 免费出行
handleFreeTravel: () => {
// TODO: 免费出行功能
@ -397,6 +376,16 @@
console.log('点击服务:', type)
}
},
/**
* 上下班状态切换
*/
handleChangeWorkState: async () => {
const state = isWork.value === true ? 0 : 2
await updateWorkState(state)
toast.show('保存成功')
isWork.value = state === 0
}
}
watch(

View File

@ -227,7 +227,7 @@
<view class="mx-30rpx">
<!-- 订单预约信息 -->
<view class="h-374rpx bg-white rounded-16rpx">
<view class="h-460rpx bg-white rounded-16rpx">
<view class="order-card relative">
<view class="price-btn" @click.stop="showCostDetailPopup = true">
<price-format color="#FFFFFF" :first-size="32" :second-size="32" :subscript-size="24"
@ -255,7 +255,7 @@
<view class="border-2rpx border-dashed border-[#E5E5E5]"></view>
<view class="px-30rpx pt-20rpx pb-40rpx">
<view class="px-30rpx pt-20rpx pb-80rpx">
<view class="info-card-title">
预约信息
</view>
@ -267,6 +267,11 @@
<text class="info-label">预约时长:</text>
<text class="info-value">{{ order.hours }}小时</text>
</view>
<view class="info-item">
<text class="info-label">用户联系方式:</text>
<text class="info-value" @click="Detail.handleCall(order.user_mobile)">{{ order.user_mobile }}</text>
</view>
</view>
</view>
@ -528,6 +533,7 @@
is_img: 0, //是否打卡 0未打卡 1已打卡
img: '', // 到达打卡拍照
img_time: '', // 到达打卡时间
user_mobile: '', // 用户手机号
})
onLoad(async (args) => {
@ -811,6 +817,13 @@
uni.previewImage({
urls: [order.value.img],
})
},
// 拨打手机号
handleCall: (phone: string) => {
uni.makePhoneCall({
phoneNumber: phone,
})
}
}
</script>