解决登录显示、首页显示bug

This commit is contained in:
2026-05-19 11:06:46 +08:00
parent 2f7e097e6c
commit 00a859c551
181 changed files with 55329 additions and 998 deletions

View File

@@ -0,0 +1,92 @@
<template>
<ServicePageScaffold title="资质证书" fallback-url="/pages/mall/delivery/profile/index">
<ServicePanel title="证书列表" subtitle="基于当前服务人员档案展示资质状态和到期信息。">
<view v-if="certificates.length == 0" class="empty-box"><text class="empty-text">暂无资质信息</text></view>
<view v-for="item in certificates" :key="item.id" class="cert-card">
<text class="row-title">{{ item.name }}</text>
<text class="row-text">状态:{{ item.status }}</text>
<text class="row-text">到期时间:{{ item.expireAt }}</text>
<text class="row-text">发证机构:{{ item.issuer }}</text>
</view>
</ServicePanel>
</ServicePageScaffold>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uvue'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import type { DeliveryCertificateType, DeliveryInfoType } from '@/types/delivery.uts'
import { getDeliveryProfile } from '@/services/deliveryService.uts'
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
const certificates = ref([] as Array<DeliveryCertificateType>)
function buildProfileCertificates(profile: DeliveryInfoType): Array<DeliveryCertificateType> {
if (profile.certificates.length > 0) {
return profile.certificates
}
const result = [] as Array<DeliveryCertificateType>
result.push({
id: 'primary-certificate',
name: '服务人员主资质',
status: profile.certificateStatus,
expireAt: profile.certificateExpireAt != '' ? profile.certificateExpireAt : '待完善',
issuer: profile.organizationName != '' ? profile.organizationName : '机构待完善',
imageUrl: ''
} as DeliveryCertificateType)
if (profile.skills.length > 0) {
result.push({
id: 'skills-certificate',
name: '服务能力标签',
status: 'valid',
expireAt: '长期有效',
issuer: profile.skills.join(' / '),
imageUrl: ''
} as DeliveryCertificateType)
}
return result
}
async function loadData() {
const authResult = await requireDeliveryAuth({ redirectOnFail: true, toastOnFail: true })
if (!authResult.ok) {
return
}
const profile = await getDeliveryProfile()
certificates.value = profile != null ? buildProfileCertificates(profile) : [] as Array<DeliveryCertificateType>
}
onShow(() => {
loadData()
})
</script>
<style scoped>
.cert-card {
padding: 24rpx;
margin-bottom: 16rpx;
border-radius: 20rpx;
background: #f8fbfc;
}
.row-title {
font-size: 30rpx;
font-weight: 700;
color: #16324f;
}
.row-text,
.empty-text {
display: block;
margin-top: 12rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #5e758c;
}
.empty-box {
padding: 24rpx;
}
</style>

View File

@@ -0,0 +1,736 @@
<template>
<ServicePageScaffold title="我的" fallback-url="/pages/mall/delivery/home/index" :hide-header="true">
<view class="delivery-profile-page">
<view class="delivery-profile-hero">
<view class="delivery-hero-top">
<view class="delivery-avatar">
<text class="delivery-avatar-text">{{ getAvatarText() }}</text>
</view>
<view class="delivery-user-main">
<text class="delivery-user-name">{{ deliveryInfo != null ? deliveryInfo.name : '服务人员' }}</text>
<view class="delivery-user-tags">
<text class="delivery-user-tag">{{ deliveryInfo != null ? deliveryInfo.role : '居家服务人员' }}</text>
<text class="delivery-user-tag delivery-user-tag-light">{{ getOnlineStatusText() }}</text>
</view>
<text class="delivery-user-org">{{ displayOrganizationName() }}</text>
</view>
<view class="delivery-setting-btn" @click="goSettings">
<text class="delivery-setting-text">设置</text>
</view>
</view>
<view class="delivery-hero-info-row">
<view class="delivery-hero-info-item">
<text class="delivery-hero-info-value">{{ displayStaffNo() }}</text>
<text class="delivery-hero-info-label">人员编号</text>
</view>
<view class="delivery-hero-info-item">
<text class="delivery-hero-info-value">{{ getCertificateStatusText() }}</text>
<text class="delivery-hero-info-label">资质状态</text>
</view>
<view class="delivery-hero-info-item">
<text class="delivery-hero-info-value">{{ displayServiceArea() }}</text>
<text class="delivery-hero-info-label">服务区域</text>
</view>
</view>
</view>
<view class="delivery-level-card">
<view class="delivery-card-header">
<view>
<text class="delivery-card-title">服务等级</text>
<text class="delivery-card-subtitle">接单、完成服务和用户好评会提升等级</text>
</view>
<text class="delivery-level-badge">{{ growthStats.levelName }}</text>
</view>
<view class="delivery-level-main">
<text class="delivery-growth-value">{{ growthStats.growthValue }}</text>
<text class="delivery-growth-total"> / {{ growthStats.nextLevelValue }} 成长值</text>
</view>
<view class="delivery-progress-track">
<view class="delivery-progress-fill" :style="{ width: getLevelProgressWidth() }"></view>
</view>
<text class="delivery-level-tip">{{ growthStats.nextTips }}</text>
<view class="delivery-level-tags">
<text class="delivery-level-tag">接单稳定</text>
<text class="delivery-level-tag">好评优秀</text>
<text class="delivery-level-tag">准时服务</text>
</view>
</view>
<view class="delivery-stats-card">
<view class="delivery-stat-item">
<text class="delivery-stat-value">{{ deliveryInfo != null ? deliveryInfo.todayAccepted : 0 }}</text>
<text class="delivery-stat-label">今日接单</text>
</view>
<view class="delivery-stat-item">
<text class="delivery-stat-value">{{ deliveryInfo != null ? deliveryInfo.todayServing : 0 }}</text>
<text class="delivery-stat-label">服务中</text>
</view>
<view class="delivery-stat-item">
<text class="delivery-stat-value">{{ deliveryInfo != null ? deliveryInfo.todayCompleted : 0 }}</text>
<text class="delivery-stat-label">今日完成</text>
</view>
<view class="delivery-stat-item">
<text class="delivery-stat-value">{{ growthStats.goodRate }}%</text>
<text class="delivery-stat-label">好评率</text>
</view>
</view>
<view class="delivery-status-card">
<view class="delivery-card-header">
<view>
<text class="delivery-card-title">当前状态</text>
<text class="delivery-card-subtitle">切换后会影响平台派单</text>
</view>
</view>
<view class="delivery-status-row">
<view class="delivery-status-btn" :class="deliveryInfo != null && deliveryInfo.onlineStatus == 'online' ? 'delivery-status-active' : ''" @click="changeStatus('online')">
<text class="delivery-status-text">在线</text>
</view>
<view class="delivery-status-btn" :class="deliveryInfo != null && deliveryInfo.onlineStatus == 'resting' ? 'delivery-status-active' : ''" @click="changeStatus('resting')">
<text class="delivery-status-text">休息</text>
</view>
<view class="delivery-status-btn" :class="deliveryInfo != null && deliveryInfo.onlineStatus == 'busy' ? 'delivery-status-active' : ''" @click="changeStatus('busy')">
<text class="delivery-status-text">忙碌</text>
</view>
</view>
</view>
<view class="delivery-tools-card">
<view class="delivery-card-header">
<text class="delivery-card-title">常用功能</text>
</view>
<view class="delivery-tools-grid">
<view class="delivery-tool-item" @click="goOrders">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">单</text></view>
<text class="delivery-tool-name">工单列表</text>
</view>
<view class="delivery-tool-item" @click="goMessages">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">息</text></view>
<text class="delivery-tool-name">消息中心</text>
</view>
<view class="delivery-tool-item" @click="goCertificates">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">证</text></view>
<text class="delivery-tool-name">资质证书</text>
</view>
<view class="delivery-tool-item" @click="goRecords">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">记</text></view>
<text class="delivery-tool-name">服务记录</text>
</view>
<view class="delivery-tool-item" @click="showTodo('异常上报')">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">异</text></view>
<text class="delivery-tool-name">异常上报</text>
</view>
<view class="delivery-tool-item" @click="showTodo('服务规范')">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">规</text></view>
<text class="delivery-tool-name">服务规范</text>
</view>
<view class="delivery-tool-item" @click="goSettings">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">设</text></view>
<text class="delivery-tool-name">设置</text>
</view>
<view class="delivery-tool-item" @click="showTodo('联系平台')">
<view class="delivery-tool-icon"><text class="delivery-tool-icon-text">客</text></view>
<text class="delivery-tool-name">联系平台</text>
</view>
</view>
</view>
<view class="delivery-account-card">
<view class="delivery-card-header">
<view>
<text class="delivery-card-title">账号与资质</text>
<text class="delivery-card-subtitle">展示机构、区域、证书与账号安全信息</text>
</view>
</view>
<view class="delivery-account-row">
<text class="delivery-account-label">所属机构</text>
<text class="delivery-account-value">{{ displayOrganizationName() }}</text>
</view>
<view class="delivery-account-row">
<text class="delivery-account-label">服务区域</text>
<text class="delivery-account-value">{{ displayServiceArea() }}</text>
</view>
<view class="delivery-account-row">
<text class="delivery-account-label">资质状态</text>
<text class="delivery-account-value">{{ getCertificateStatusText() }}</text>
</view>
<view class="delivery-account-row delivery-account-row-last">
<text class="delivery-account-label">资质到期</text>
<text class="delivery-account-value">{{ displayCertificateExpireAt() != '' ? displayCertificateExpireAt() : '暂无' }}</text>
</view>
<view class="delivery-logout-btn" @click="logout">
<text class="delivery-logout-text">退出登录</text>
</view>
</view>
<view class="delivery-profile-safe"></view>
</view>
</ServicePageScaffold>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uvue'
import type { DeliveryInfoType } from '@/types/delivery.uts'
import { getDeliveryProfile, updateDeliveryOnlineStatus } from '@/services/deliveryService.uts'
import { logoutDelivery, requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
type DeliveryGrowthStatsType = {
levelName: string
growthValue: number
nextLevelValue: number
completedTotal: number
goodRate: number
goodReviewCount: number
onTimeRate: number
nextTips: string
}
const deliveryInfo = ref<DeliveryInfoType | null>(null)
// TODO: 后续接入真实 delivery 服务等级统计接口
const growthStats = ref({
levelName: '银牌服务师',
growthValue: 486,
nextLevelValue: 800,
completedTotal: 126,
goodRate: 98,
goodReviewCount: 112,
onTimeRate: 96,
nextTips: '再完成 12 单并获得 5 个好评可升级'
} as DeliveryGrowthStatsType)
function displayOrganizationName(): string {
if (deliveryInfo.value == null) {
return '暂未绑定服务机构'
}
const organizationName = deliveryInfo.value.organizationName.trim()
if (organizationName != '') {
return organizationName
}
return '暂未绑定服务机构'
}
function displayStaffNo(): string {
if (deliveryInfo.value == null) {
return '待分配'
}
const staffNo = deliveryInfo.value.staffNo.trim()
if (staffNo != '') {
return staffNo
}
return '待分配'
}
function displayServiceArea(): string {
if (deliveryInfo.value == null) {
return '待完善'
}
const serviceArea = deliveryInfo.value.serviceArea.trim()
if (serviceArea != '') {
return serviceArea
}
return '待完善'
}
function displayCertificateExpireAt(): string {
if (deliveryInfo.value == null) {
return ''
}
return deliveryInfo.value.certificateExpireAt.trim()
}
function getOnlineStatusText(): string {
if (deliveryInfo.value == null) {
return '未登录'
}
const status = deliveryInfo.value.onlineStatus
if (status == 'online') {
return '在线接单'
}
if (status == 'resting') {
return '休息中'
}
if (status == 'busy') {
return '忙碌中'
}
return '未知状态'
}
function getCertificateStatusText(): string {
if (deliveryInfo.value == null) {
return '待认证'
}
const status = deliveryInfo.value.certificateStatus.trim()
if (status == 'valid') {
return '已认证'
}
if (status == 'expired') {
return '已过期'
}
if (status == 'pending') {
return '审核中'
}
if (status != '') {
return status
}
return '待认证'
}
function getAvatarText(): string {
if (deliveryInfo.value == null) {
return '护'
}
const name = deliveryInfo.value.name.trim()
if (name == '') {
return '护'
}
return name.substring(0, 1)
}
function getLevelProgressWidth(): string {
if (growthStats.value.nextLevelValue <= 0) {
return '0%'
}
const percent = growthStats.value.growthValue * 100 / growthStats.value.nextLevelValue
if (percent >= 100) {
return '100%'
}
if (percent <= 0) {
return '0%'
}
return percent.toString() + '%'
}
async function loadData() {
const authResult = await requireDeliveryAuth({ redirectOnFail: true, toastOnFail: true })
if (!authResult.ok) {
return
}
deliveryInfo.value = await getDeliveryProfile()
}
async function changeStatus(status: string) {
const nextInfo = await updateDeliveryOnlineStatus(status)
if (nextInfo != null) {
deliveryInfo.value = nextInfo
uni.showToast({ title: '状态已更新', icon: 'success' })
}
}
function goCertificates() {
uni.navigateTo({ url: '/pages/mall/delivery/profile/certificates' })
}
function goSettings() {
uni.navigateTo({ url: '/pages/mall/delivery/profile/settings' })
}
function goOrders() {
uni.switchTab({ url: '/pages/mall/delivery/orders/index' })
}
function goMessages() {
uni.switchTab({ url: '/pages/mall/delivery/messages/index' })
}
function goRecords() {
uni.navigateTo({ url: '/pages/mall/delivery/records/index' })
}
function showTodo(title: string) {
uni.showToast({
title: title + '建设中',
icon: 'none'
})
}
async function logout() {
await logoutDelivery()
uni.reLaunch({ url: '/pages/user/login?mode=delivery' })
}
onShow(() => {
loadData()
})
</script>
<style scoped>
.delivery-profile-page {
min-height: 100%;
margin-left: -24rpx;
margin-right: -24rpx;
margin-top: -24rpx;
padding-bottom: 32rpx;
background-color: #f4f8fb;
}
.delivery-profile-hero {
padding: 72rpx 28rpx 34rpx;
border-bottom-left-radius: 36rpx;
border-bottom-right-radius: 36rpx;
background-color: #0f766e;
}
.delivery-hero-top {
display: flex;
flex-direction: row;
align-items: center;
}
.delivery-avatar {
width: 112rpx;
height: 112rpx;
margin-right: 22rpx;
border-radius: 56rpx;
background-color: rgba(255, 255, 255, 0.92);
display: flex;
align-items: center;
justify-content: center;
}
.delivery-avatar-text {
font-size: 42rpx;
font-weight: 700;
color: #0f766e;
}
.delivery-user-main {
flex: 1;
display: flex;
flex-direction: column;
}
.delivery-user-name {
font-size: 38rpx;
font-weight: 700;
color: #ffffff;
}
.delivery-user-tags {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 12rpx;
flex-wrap: wrap;
}
.delivery-user-tag {
margin-right: 10rpx;
margin-bottom: 8rpx;
padding: 6rpx 14rpx;
border-radius: 999rpx;
font-size: 22rpx;
color: #0f766e;
background-color: rgba(255, 255, 255, 0.9);
}
.delivery-user-tag-light {
color: #ffffff;
background-color: rgba(255, 255, 255, 0.22);
}
.delivery-user-org {
margin-top: 10rpx;
font-size: 24rpx;
color: rgba(255, 255, 255, 0.9);
}
.delivery-setting-btn {
padding: 10rpx 18rpx;
border-radius: 999rpx;
background-color: rgba(255, 255, 255, 0.18);
}
.delivery-setting-text {
font-size: 24rpx;
color: #ffffff;
}
.delivery-hero-info-row {
margin-top: 32rpx;
padding: 22rpx 18rpx;
border-radius: 26rpx;
background-color: rgba(255, 255, 255, 0.18);
display: flex;
flex-direction: row;
}
.delivery-hero-info-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.delivery-hero-info-value {
font-size: 26rpx;
font-weight: 700;
color: #ffffff;
max-width: 180rpx;
text-align: center;
line-height: 34rpx;
}
.delivery-hero-info-label {
margin-top: 8rpx;
font-size: 22rpx;
color: rgba(255, 255, 255, 0.78);
}
.delivery-level-card,
.delivery-stats-card,
.delivery-status-card,
.delivery-tools-card,
.delivery-account-card {
margin-left: 24rpx;
margin-right: 24rpx;
margin-top: 22rpx;
padding: 26rpx;
border-radius: 28rpx;
background-color: #ffffff;
box-shadow: 0 10rpx 28rpx rgba(15, 35, 55, 0.06);
}
.delivery-level-card {
margin-top: -18rpx;
position: relative;
}
.delivery-card-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.delivery-card-title {
font-size: 30rpx;
font-weight: 700;
color: #16324f;
}
.delivery-card-subtitle {
display: block;
margin-top: 8rpx;
font-size: 22rpx;
line-height: 32rpx;
color: #64748b;
}
.delivery-level-badge {
padding: 8rpx 16rpx;
border-radius: 999rpx;
font-size: 22rpx;
color: #92400e;
background-color: #fef3c7;
}
.delivery-level-main {
margin-top: 24rpx;
display: flex;
flex-direction: row;
align-items: flex-end;
}
.delivery-growth-value {
font-size: 46rpx;
font-weight: 700;
color: #0f766e;
}
.delivery-growth-total {
margin-left: 6rpx;
margin-bottom: 6rpx;
font-size: 24rpx;
color: #64748b;
}
.delivery-progress-track {
margin-top: 18rpx;
height: 16rpx;
border-radius: 999rpx;
background-color: #e2e8f0;
overflow: hidden;
}
.delivery-progress-fill {
height: 16rpx;
border-radius: 999rpx;
background-color: #0f766e;
}
.delivery-level-tip {
display: block;
margin-top: 14rpx;
font-size: 23rpx;
line-height: 34rpx;
color: #64748b;
}
.delivery-level-tags {
margin-top: 18rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.delivery-level-tag {
margin-right: 12rpx;
margin-bottom: 10rpx;
padding: 8rpx 16rpx;
border-radius: 999rpx;
font-size: 22rpx;
color: #0f766e;
background-color: #ecfdf5;
}
.delivery-stats-card {
display: flex;
flex-direction: row;
padding-top: 28rpx;
padding-bottom: 28rpx;
}
.delivery-stat-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.delivery-stat-value {
font-size: 36rpx;
font-weight: 700;
color: #16324f;
}
.delivery-stat-label {
margin-top: 8rpx;
font-size: 22rpx;
color: #64748b;
}
.delivery-status-row {
margin-top: 22rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.delivery-status-btn {
width: 31%;
height: 68rpx;
border-radius: 999rpx;
background-color: #f1f5f9;
display: flex;
align-items: center;
justify-content: center;
}
.delivery-status-active {
background-color: #0f766e;
box-shadow: 0 8rpx 18rpx rgba(15, 118, 110, 0.18);
}
.delivery-status-text {
font-size: 26rpx;
font-weight: 700;
color: #64748b;
}
.delivery-status-active .delivery-status-text {
color: #ffffff;
}
.delivery-tools-grid {
margin-top: 22rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.delivery-tool-item {
width: 25%;
margin-bottom: 24rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.delivery-tool-icon {
width: 72rpx;
height: 72rpx;
border-radius: 24rpx;
background-color: #ecfdf5;
display: flex;
align-items: center;
justify-content: center;
}
.delivery-tool-icon-text {
font-size: 28rpx;
font-weight: 700;
color: #0f766e;
}
.delivery-tool-name {
margin-top: 10rpx;
font-size: 23rpx;
color: #334155;
}
.delivery-account-row {
min-height: 72rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom-width: 1rpx;
border-bottom-color: #eef2f7;
}
.delivery-account-row-last {
border-bottom-width: 0;
}
.delivery-account-label {
font-size: 26rpx;
color: #64748b;
}
.delivery-account-value {
max-width: 420rpx;
text-align: right;
font-size: 26rpx;
line-height: 36rpx;
color: #16324f;
}
.delivery-logout-btn {
margin-top: 24rpx;
height: 76rpx;
border-radius: 20rpx;
background-color: #fff1f2;
display: flex;
align-items: center;
justify-content: center;
}
.delivery-logout-text {
font-size: 28rpx;
font-weight: 700;
color: #e11d48;
}
.delivery-profile-safe {
height: 40rpx;
}
</style>

View File

@@ -0,0 +1,123 @@
<template>
<ServicePageScaffold title="设置" fallback-url="/pages/mall/delivery/profile/index">
<ServicePanel title="账号信息" subtitle="展示当前服务人员账号和档案状态。">
<text v-if="deliveryInfo != null" class="info-text">姓名:{{ deliveryInfo.name }}</text>
<text v-if="deliveryInfo != null" class="info-text">编号:{{ displayStaffNo() }}</text>
<text v-if="deliveryInfo != null" class="info-text">机构:{{ displayOrganizationName() }}</text>
<text v-if="deliveryInfo != null" class="info-text">在线状态:{{ deliveryInfo.onlineStatus }}</text>
<text v-if="deliveryInfo != null" class="info-text">资质状态:{{ deliveryInfo.certificateStatus }}</text>
</ServicePanel>
<ServicePanel title="提醒与权限" subtitle="预留定位权限、语音播报和消息提醒控制。">
<view class="setting-row">
<text class="setting-text">消息提醒</text>
<switch :checked="messageEnabled" color="#0f766e" @change="toggleMessage" />
</view>
<view class="setting-row">
<text class="setting-text">语音播报</text>
<switch :checked="voiceEnabled" color="#0f766e" @change="toggleVoice" />
</view>
<view class="setting-row">
<text class="setting-text">定位权限提示</text>
<text class="setting-hint">请确保 Android 和小程序侧授权开启</text>
</view>
</ServicePanel>
</ServicePageScaffold>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uvue'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import type { DeliveryInfoType } from '@/types/delivery.uts'
import { getDeliveryProfile } from '@/services/deliveryService.uts'
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
const messageEnabled = ref(true)
const voiceEnabled = ref(false)
const deliveryInfo = ref<DeliveryInfoType | null>(null)
function displayOrganizationName(): string {
if (deliveryInfo.value == null) {
return ''
}
const organizationName = deliveryInfo.value.organizationName.trim()
if (organizationName != '') {
return organizationName
}
return '暂未绑定服务机构'
}
function displayStaffNo(): string {
if (deliveryInfo.value == null) {
return ''
}
const staffNo = deliveryInfo.value.staffNo.trim()
if (staffNo != '') {
return staffNo
}
return '待分配'
}
function restoreSettings() {
const msg = uni.getStorageSync('delivery_setting_message') as boolean | null
const voice = uni.getStorageSync('delivery_setting_voice') as boolean | null
messageEnabled.value = msg == null ? true : msg
voiceEnabled.value = voice == null ? false : voice
}
function toggleMessage(event: any) {
messageEnabled.value = event.detail.value === true
uni.setStorageSync('delivery_setting_message', messageEnabled.value)
}
function toggleVoice(event: any) {
voiceEnabled.value = event.detail.value === true
uni.setStorageSync('delivery_setting_voice', voiceEnabled.value)
}
async function loadData() {
const authResult = await requireDeliveryAuth({ redirectOnFail: true, toastOnFail: true })
if (!authResult.ok) {
return
}
restoreSettings()
deliveryInfo.value = await getDeliveryProfile()
}
onShow(() => {
loadData()
})
</script>
<style scoped>
.setting-row {
padding: 20rpx 0;
border-bottom: 1rpx solid #e6edf1;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.info-text {
display: block;
margin-top: 12rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #5e758c;
}
.setting-text {
font-size: 28rpx;
color: #16324f;
}
.setting-hint {
font-size: 24rpx;
line-height: 36rpx;
color: #5e758c;
text-align: right;
width: 60%;
}
</style>