2026-03-04 15:42:43 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="nail-artists">
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<a-page-header v-if="!isMobile" title="美甲师管理" sub-title="管理美甲师详细信息" />
|
|
|
|
|
|
|
|
|
|
|
|
<section v-else class="admin-page-intro">
|
|
|
|
|
|
<span class="admin-page-intro__eyebrow">经营</span>
|
|
|
|
|
|
<h1 class="admin-page-intro__title">美甲师管理</h1>
|
|
|
|
|
|
<p class="admin-page-intro__subtitle">
|
|
|
|
|
|
把状态、技能和作品挂载关系收成单列卡片,手机端可以直接查看和编辑。
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<div class="admin-page-intro__meta">
|
|
|
|
|
|
<span class="admin-page-chip">美甲师 {{ nailArtistList.length }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</section>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
|
|
|
|
|
|
<a-card :bordered="false">
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<template #title v-if="isMobile">
|
|
|
|
|
|
美甲师列表
|
|
|
|
|
|
</template>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<template #extra>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<div class="admin-toolbar" :class="{ 'admin-toolbar--stacked': isMobile }">
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<a-input-search
|
|
|
|
|
|
v-model:value="searchText"
|
|
|
|
|
|
placeholder="搜索美甲师姓名"
|
2026-05-13 12:43:01 +08:00
|
|
|
|
:style="isMobile ? { width: '100%' } : { width: '250px' }"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
@search="handleSearch"
|
|
|
|
|
|
/>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</div>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<a-table
|
2026-05-13 12:43:01 +08:00
|
|
|
|
v-if="!isMobile"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
:columns="columns"
|
|
|
|
|
|
:data-source="nailArtistList"
|
|
|
|
|
|
:loading="loading"
|
|
|
|
|
|
:pagination="pagination"
|
|
|
|
|
|
@change="handleTableChange"
|
|
|
|
|
|
row-key="userId"
|
2026-05-29 13:30:56 +08:00
|
|
|
|
:scroll="{ x: 'max-content' }"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
|
|
|
<template v-if="column.key === 'status'">
|
|
|
|
|
|
<a-tag :color="getStatusColor(record.status)">
|
|
|
|
|
|
{{ getStatusText(record.status) }}
|
|
|
|
|
|
</a-tag>
|
|
|
|
|
|
</template>
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<template v-else-if="column.key === 'userTypeName'">
|
|
|
|
|
|
<a-tag :color="record.userType === 2 ? 'gold' : 'blue'">
|
|
|
|
|
|
{{ record.userTypeName || (record.userType === 2 ? '店长' : '美甲师') }}
|
|
|
|
|
|
</a-tag>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="column.key === 'participateProduction'">
|
|
|
|
|
|
<a-tag :color="record.participateProduction === 1 ? 'green' : 'default'">
|
|
|
|
|
|
{{ record.participateProduction === 1 ? '参与制作' : '不参与' }}
|
|
|
|
|
|
</a-tag>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else-if="column.key === 'workTime'">
|
|
|
|
|
|
{{ formatWorkTime(record) }}
|
|
|
|
|
|
</template>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<template v-else-if="column.key === 'actions'">
|
|
|
|
|
|
<a-space>
|
|
|
|
|
|
<a-button v-if="hasPermission('nail_artist:view')" type="link" size="small" @click="showViewModal(record)">
|
|
|
|
|
|
查看
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<a-button v-if="hasPermission('nail_artist:edit')" type="link" size="small" @click="showEditModal(record)">
|
|
|
|
|
|
编辑
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</a-space>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-table>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
|
|
|
|
|
|
<AdminMobileCardList v-else :items="nailArtistList" item-key="userId" empty-description="暂无美甲师数据">
|
|
|
|
|
|
<template #item="{ item }">
|
|
|
|
|
|
<article class="admin-mobile-card">
|
|
|
|
|
|
<div class="admin-mobile-card__head">
|
|
|
|
|
|
<div class="admin-mobile-card__body">
|
|
|
|
|
|
<div class="admin-mobile-card__title">{{ item.nickname }}</div>
|
|
|
|
|
|
<div class="admin-mobile-card__subtitle">{{ item.shopName || '未绑定店铺' }}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<a-tag :color="getStatusColor(item.status)">{{ getStatusText(item.status) }}</a-tag>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="admin-mobile-card__rows">
|
|
|
|
|
|
<div class="admin-mobile-card__row">
|
|
|
|
|
|
<span>身份</span>
|
|
|
|
|
|
<strong>{{ item.identity || '--' }}</strong>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="admin-mobile-card__row">
|
|
|
|
|
|
<span>从业年限</span>
|
|
|
|
|
|
<strong>{{ item.experience ?? '--' }}</strong>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="admin-mobile-card__row">
|
|
|
|
|
|
<span>评分</span>
|
|
|
|
|
|
<strong>{{ item.rating || '--' }}</strong>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="admin-mobile-card__actions">
|
|
|
|
|
|
<a-button v-if="hasPermission('nail_artist:view')" size="small" @click="showViewModal(item)">查看</a-button>
|
|
|
|
|
|
<a-button v-if="hasPermission('nail_artist:edit')" size="small" @click="showEditModal(item)">编辑</a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</AdminMobileCardList>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
</a-card>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 编辑美甲师信息模态框 -->
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<AdminResponsiveModal
|
2026-03-04 15:42:43 +08:00
|
|
|
|
v-model:open="modalVisible"
|
|
|
|
|
|
title="编辑美甲师信息"
|
|
|
|
|
|
@ok="handleModalOk"
|
|
|
|
|
|
@cancel="handleModalCancel"
|
|
|
|
|
|
:confirmLoading="modalLoading"
|
2026-05-13 12:43:01 +08:00
|
|
|
|
:desktop-width="800"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
>
|
2026-03-26 12:04:02 +08:00
|
|
|
|
<DraftActions
|
|
|
|
|
|
:saved-at="draftSavedAt"
|
|
|
|
|
|
@save="handleSaveDraft"
|
|
|
|
|
|
@clear="handleClearDraft"
|
|
|
|
|
|
/>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<a-form
|
|
|
|
|
|
ref="formRef"
|
|
|
|
|
|
:model="formState"
|
|
|
|
|
|
:rules="formRules"
|
|
|
|
|
|
:label-col="{ span: 6 }"
|
|
|
|
|
|
:wrapper-col="{ span: 16 }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-form-item label="美甲师姓名" name="nickname">
|
|
|
|
|
|
<a-input v-model:value="formState.nickname" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="身份" name="identity">
|
|
|
|
|
|
<a-input
|
|
|
|
|
|
v-model:value="formState.identity"
|
|
|
|
|
|
placeholder="请输入身份"
|
|
|
|
|
|
:disabled="!isShopOwner"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="从业年限" name="experience">
|
|
|
|
|
|
<a-input-number
|
|
|
|
|
|
v-model:value="formState.experience"
|
|
|
|
|
|
:min="0"
|
|
|
|
|
|
placeholder="请输入从业年限"
|
|
|
|
|
|
:disabled="!isShopOwner"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="技能标签" name="skills">
|
|
|
|
|
|
<a-select
|
|
|
|
|
|
v-model:value="formState.skills"
|
|
|
|
|
|
mode="multiple"
|
|
|
|
|
|
placeholder="请选择技能标签"
|
|
|
|
|
|
:loading="tagLoading"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-select-option
|
|
|
|
|
|
v-for="tag in tagList"
|
|
|
|
|
|
:key="tag.id"
|
|
|
|
|
|
:value="tag.id.toString()"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ tag.tagName }}
|
|
|
|
|
|
</a-select-option>
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="状态" name="status">
|
|
|
|
|
|
<a-select
|
|
|
|
|
|
v-model:value="formState.status"
|
|
|
|
|
|
placeholder="请选择状态"
|
|
|
|
|
|
:disabled="!isShopOwner"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-select-option :value="1">营业中</a-select-option>
|
|
|
|
|
|
<a-select-option :value="0">休息中</a-select-option>
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
</a-form-item>
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<a-form-item label="参与制作" name="participateProduction">
|
|
|
|
|
|
<a-switch
|
|
|
|
|
|
v-model:checked="formState.participateProduction"
|
|
|
|
|
|
:checked-value="1"
|
|
|
|
|
|
:un-checked-value="0"
|
|
|
|
|
|
:disabled="!isShopOwner"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="工作时间">
|
|
|
|
|
|
<a-input v-model:value="formState.workStartTime" type="time" placeholder="开始" />
|
|
|
|
|
|
<span class="time-separator">至</span>
|
|
|
|
|
|
<a-input v-model:value="formState.workEndTime" type="time" placeholder="结束" />
|
|
|
|
|
|
</a-form-item>
|
2026-03-05 16:08:27 +08:00
|
|
|
|
<a-form-item label="作品" name="portfolio">
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<a-select
|
|
|
|
|
|
v-model:value="formState.portfolio"
|
|
|
|
|
|
mode="multiple"
|
2026-03-05 16:08:27 +08:00
|
|
|
|
placeholder="请选择作品作品"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
:loading="productLoading"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-select-option
|
|
|
|
|
|
v-for="product in productList"
|
|
|
|
|
|
:key="product.id"
|
|
|
|
|
|
:value="product.id.toString()"
|
|
|
|
|
|
>
|
|
|
|
|
|
{{ product.title }}
|
|
|
|
|
|
</a-select-option>
|
|
|
|
|
|
</a-select>
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="评分">
|
|
|
|
|
|
<a-input v-model:value="formState.rating" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
</a-form>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</AdminResponsiveModal>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 查看美甲师详情模态框 -->
|
2026-05-13 12:43:01 +08:00
|
|
|
|
<AdminResponsiveModal
|
2026-03-04 15:42:43 +08:00
|
|
|
|
v-model:open="viewModalVisible"
|
|
|
|
|
|
title="查看美甲师详情"
|
2026-05-13 12:43:01 +08:00
|
|
|
|
:footer="null"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
@cancel="handleViewModalCancel"
|
2026-05-13 12:43:01 +08:00
|
|
|
|
:desktop-width="600"
|
2026-03-04 15:42:43 +08:00
|
|
|
|
>
|
|
|
|
|
|
<a-form
|
|
|
|
|
|
:model="viewFormState"
|
|
|
|
|
|
:label-col="{ span: 6 }"
|
|
|
|
|
|
:wrapper-col="{ span: 16 }"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-form-item label="美甲师姓名">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.nickname" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="所属店铺">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.shopName" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="身份">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.identity" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="从业年限">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.experience" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="技能标签">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.skillsText" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="状态">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.statusText" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
2026-05-18 09:46:11 +08:00
|
|
|
|
<a-form-item label="人员类型">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.userTypeName" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
<a-form-item label="工作时间">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.workTime" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<a-form-item label="评分">
|
|
|
|
|
|
<a-input v-model:value="viewFormState.rating" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
2026-03-05 16:08:27 +08:00
|
|
|
|
<a-form-item label="作品">
|
2026-03-04 15:42:43 +08:00
|
|
|
|
<a-input v-model:value="viewFormState.portfolioText" :disabled="true" />
|
|
|
|
|
|
</a-form-item>
|
|
|
|
|
|
</a-form>
|
2026-05-13 12:43:01 +08:00
|
|
|
|
</AdminResponsiveModal>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* NailArtistsView page script.
|
|
|
|
|
|
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
|
|
|
|
|
|
*/
|
2026-03-10 23:23:15 +08:00
|
|
|
|
import { ref, reactive, onMounted } from 'vue'
|
2026-03-04 15:42:43 +08:00
|
|
|
|
import { message } from 'ant-design-vue'
|
|
|
|
|
|
import type { FormInstance } from 'ant-design-vue'
|
2026-03-26 12:04:02 +08:00
|
|
|
|
import DraftActions from '@/components/DraftActions.vue'
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: NailArtistInfoVO supports NailArtistsView.vue by holding or executing the nail artist info vo page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
import { adminNailArtistApi, type NailArtistInfoVO } from '@/api/admin'
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: Tag supports NailArtistsView.vue by holding or executing the tag page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
import { adminTagApi, type Tag } from '@/api/admin'
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: Product supports NailArtistsView.vue by holding or executing the product page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
import { adminProductApi, type Product } from '@/api/admin'
|
2026-03-26 12:04:02 +08:00
|
|
|
|
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
|
2026-03-04 15:42:43 +08:00
|
|
|
|
import { usePermission } from '@/utils/permission'
|
2026-05-13 12:43:01 +08:00
|
|
|
|
import { runWithGlobalLoading } from '@/utils/action-loading'
|
|
|
|
|
|
import { useAdminViewport } from '@/composables/useAdminViewport'
|
|
|
|
|
|
import AdminMobileCardList from '@/components/admin/AdminMobileCardList.vue'
|
|
|
|
|
|
import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
|
2026-03-04 15:42:43 +08:00
|
|
|
|
|
|
|
|
|
|
const { hasPermission, loadUserPermissions } = usePermission()
|
2026-05-13 12:43:01 +08:00
|
|
|
|
const { isMobile } = useAdminViewport()
|
2026-03-04 15:42:43 +08:00
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** getCurrentUserInfo is a local helper used by this page script. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const getCurrentUserInfo = () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const userInfoStr = localStorage.getItem('adminUserInfo')
|
|
|
|
|
|
if (userInfoStr) {
|
|
|
|
|
|
const userInfo = JSON.parse(userInfoStr)
|
|
|
|
|
|
isAdmin.value = userInfo.type === 4
|
|
|
|
|
|
isShopOwner.value = userInfo.type === 2
|
|
|
|
|
|
return userInfo
|
|
|
|
|
|
}
|
2026-03-27 12:29:36 +08:00
|
|
|
|
} catch (error: any) {
|
2026-03-04 15:42:43 +08:00
|
|
|
|
console.error('获取当前用户信息失败', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
return null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** loading is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const loading = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** tagLoading is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const tagLoading = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** productLoading is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const productLoading = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** searchText is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const searchText = ref('')
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: nailArtistList supports NailArtistsView.vue by holding or executing the nail artist list page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const nailArtistList = ref<NailArtistInfoVO[]>([])
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: tagList supports NailArtistsView.vue by holding or executing the tag list page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const tagList = ref<Tag[]>([])
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: productList supports NailArtistsView.vue by holding or executing the product list page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const productList = ref<Product[]>([])
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** modalVisible is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const modalVisible = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** modalLoading is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const modalLoading = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** viewModalVisible is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const viewModalVisible = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** isAdmin is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const isAdmin = ref(false)
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** isShopOwner is a reactive state variable used by the template and event handlers. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const isShopOwner = ref(false)
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: formRef supports NailArtistsView.vue by holding or executing the form ref page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const formRef = ref<FormInstance>()
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: currentNailArtist supports NailArtistsView.vue by holding or executing the current nail artist page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const currentNailArtist = ref<NailArtistInfoVO | null>(null)
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: currentUserInfo supports NailArtistsView.vue by holding or executing the current user info page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const currentUserInfo = getCurrentUserInfo()
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: draftSavedAt supports NailArtistsView.vue by holding or executing the draft saved at page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-26 12:04:02 +08:00
|
|
|
|
const draftSavedAt = ref<number | null>(null)
|
2026-03-04 15:42:43 +08:00
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: viewFormState supports NailArtistsView.vue by holding or executing the view form state page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const viewFormState = reactive({
|
|
|
|
|
|
nickname: '',
|
|
|
|
|
|
shopName: '',
|
|
|
|
|
|
identity: '',
|
|
|
|
|
|
experience: '',
|
|
|
|
|
|
skillsText: '',
|
|
|
|
|
|
statusText: '',
|
2026-05-18 09:46:11 +08:00
|
|
|
|
userTypeName: '',
|
|
|
|
|
|
workTime: '',
|
2026-03-04 15:42:43 +08:00
|
|
|
|
rating: '',
|
|
|
|
|
|
portfolioText: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: pagination supports NailArtistsView.vue by holding or executing the pagination page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const pagination = reactive({
|
|
|
|
|
|
current: 1,
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
total: 0,
|
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
|
showQuickJumper: true,
|
|
|
|
|
|
showTotal: (total: number) => `共 ${total} 条`
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: formState supports NailArtistsView.vue by holding or executing the form state page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const formState = reactive({
|
|
|
|
|
|
userId: 0,
|
|
|
|
|
|
identity: '',
|
|
|
|
|
|
experience: 0,
|
|
|
|
|
|
skills: [] as string[],
|
|
|
|
|
|
rating: 0,
|
|
|
|
|
|
status: 1,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
participateProduction: 1,
|
|
|
|
|
|
workStartTime: '',
|
|
|
|
|
|
workEndTime: '',
|
2026-03-04 15:42:43 +08:00
|
|
|
|
portfolio: [] as string[],
|
|
|
|
|
|
nickname: ''
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** getDraftKey is a local helper used by this page script. */
|
2026-03-26 12:04:02 +08:00
|
|
|
|
const getDraftKey = () => buildDraftStorageKey('admin-nail-artists', 'edit', currentNailArtist.value?.userId ?? formState.userId ?? 'unknown')
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** buildDraftPayload is a local helper used by this page script. */
|
2026-03-26 12:04:02 +08:00
|
|
|
|
const buildDraftPayload = () => ({
|
|
|
|
|
|
identity: formState.identity,
|
|
|
|
|
|
experience: formState.experience,
|
|
|
|
|
|
skills: [...formState.skills],
|
|
|
|
|
|
status: formState.status,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
participateProduction: formState.participateProduction,
|
|
|
|
|
|
workStartTime: formState.workStartTime,
|
|
|
|
|
|
workEndTime: formState.workEndTime,
|
2026-03-27 13:28:57 +08:00
|
|
|
|
portfolio: [...formState.portfolio]
|
2026-03-26 12:04:02 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** restoreDraft is a local helper used by this page script. */
|
2026-03-26 12:04:02 +08:00
|
|
|
|
const restoreDraft = () => {
|
|
|
|
|
|
const draft = loadDraftRecord<ReturnType<typeof buildDraftPayload>>(getDraftKey())
|
|
|
|
|
|
if (!draft) {
|
|
|
|
|
|
draftSavedAt.value = null
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-03-27 13:28:57 +08:00
|
|
|
|
Object.assign(formState, {
|
|
|
|
|
|
identity: draft.payload.identity ?? formState.identity,
|
|
|
|
|
|
experience: typeof draft.payload.experience === 'number' ? draft.payload.experience : formState.experience,
|
|
|
|
|
|
skills: Array.isArray(draft.payload.skills) ? draft.payload.skills : formState.skills,
|
|
|
|
|
|
status: typeof draft.payload.status === 'number'
|
|
|
|
|
|
? (draft.payload.status === 0 ? 0 : 1)
|
|
|
|
|
|
: formState.status,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
participateProduction: typeof draft.payload.participateProduction === 'number'
|
|
|
|
|
|
? (draft.payload.participateProduction === 1 ? 1 : 0)
|
|
|
|
|
|
: formState.participateProduction,
|
|
|
|
|
|
workStartTime: draft.payload.workStartTime ?? formState.workStartTime,
|
|
|
|
|
|
workEndTime: draft.payload.workEndTime ?? formState.workEndTime,
|
2026-03-27 13:28:57 +08:00
|
|
|
|
portfolio: Array.isArray(draft.payload.portfolio) ? draft.payload.portfolio : formState.portfolio
|
|
|
|
|
|
})
|
2026-03-26 12:04:02 +08:00
|
|
|
|
draftSavedAt.value = draft.savedAt
|
|
|
|
|
|
message.success('已恢复暂存内容')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleSaveDraft is a local helper used by this page script. */
|
2026-03-26 12:04:02 +08:00
|
|
|
|
const handleSaveDraft = () => {
|
|
|
|
|
|
const draft = saveDraftRecord(getDraftKey(), buildDraftPayload())
|
|
|
|
|
|
draftSavedAt.value = draft.savedAt
|
|
|
|
|
|
message.success('已暂存到本地')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleClearDraft is a local helper used by this page script. */
|
2026-03-26 12:04:02 +08:00
|
|
|
|
const handleClearDraft = (showMessage = true) => {
|
|
|
|
|
|
clearDraftRecord(getDraftKey())
|
|
|
|
|
|
draftSavedAt.value = null
|
|
|
|
|
|
if (showMessage) {
|
|
|
|
|
|
message.success('已清除暂存')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: formRules supports NailArtistsView.vue by holding or executing the form rules page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const formRules = {
|
|
|
|
|
|
identity: [{ required: true, message: '请输入身份', trigger: 'blur' }],
|
|
|
|
|
|
experience: [{ required: true, message: '请输入从业年限', trigger: 'blur' }],
|
|
|
|
|
|
skills: [{ required: true, message: '请选择技能标签', trigger: 'change' }],
|
|
|
|
|
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
2026-03-05 16:08:27 +08:00
|
|
|
|
portfolio: [{ required: true, message: '请选择作品作品', trigger: 'change' }]
|
2026-03-10 23:23:15 +08:00
|
|
|
|
} as any
|
2026-03-04 15:42:43 +08:00
|
|
|
|
|
2026-05-23 18:44:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Purpose: columns supports NailArtistsView.vue by holding or executing the columns page or API role.
|
|
|
|
|
|
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
|
|
|
|
|
*/
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const columns = [
|
|
|
|
|
|
{ title: '美甲师姓名', dataIndex: 'nickname', key: 'nickname' },
|
|
|
|
|
|
{ title: '所属店铺', dataIndex: 'shopName', key: 'shopName' },
|
2026-05-18 09:46:11 +08:00
|
|
|
|
{ title: '人员类型', key: 'userTypeName', width: 110 },
|
|
|
|
|
|
{ title: '参与制作', key: 'participateProduction', width: 120 },
|
|
|
|
|
|
{ title: '工作时间', key: 'workTime', width: 150 },
|
2026-03-04 15:42:43 +08:00
|
|
|
|
{ title: '身份', dataIndex: 'identity', key: 'identity' },
|
|
|
|
|
|
{ title: '从业年限', dataIndex: 'experience', key: 'experience' },
|
|
|
|
|
|
{ title: '评分', dataIndex: 'rating', key: 'rating' },
|
|
|
|
|
|
{ title: '状态', key: 'status', width: 100 },
|
|
|
|
|
|
{ title: '操作', key: 'actions', width: 150, fixed: 'right' as const }
|
|
|
|
|
|
]
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** getStatusText is a local helper used by this page script. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const getStatusText = (status: number) => {
|
|
|
|
|
|
return status === 1 ? '营业中' : '休息中'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** getStatusColor is a local helper used by this page script. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const getStatusColor = (status: number) => {
|
|
|
|
|
|
return status === 1 ? 'green' : 'default'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** formatWorkTime is a local helper used by this page script. */
|
|
|
|
|
|
const formatWorkTime = (record: Partial<NailArtistInfoVO>) => {
|
|
|
|
|
|
const start = record.workStartTime ? String(record.workStartTime).slice(0, 5) : ''
|
|
|
|
|
|
const end = record.workEndTime ? String(record.workEndTime).slice(0, 5) : ''
|
|
|
|
|
|
return start && end ? `${start} - ${end}` : '--'
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** normalizeTime is a local helper used by this page script. */
|
|
|
|
|
|
const normalizeTime = (value?: string) => value ? (String(value).length === 5 ? `${value}:00` : String(value)) : undefined
|
|
|
|
|
|
|
|
|
|
|
|
/** fetchTagList is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const fetchTagList = async () => {
|
|
|
|
|
|
tagLoading.value = true
|
|
|
|
|
|
try {
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const res = await adminTagApi.listAllTags() as unknown as Tag[]
|
2026-03-04 15:42:43 +08:00
|
|
|
|
tagList.value = res || []
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('获取标签列表失败:', error)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
tagLoading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** fetchProductList is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const fetchProductList = async () => {
|
|
|
|
|
|
productLoading.value = true
|
|
|
|
|
|
try {
|
|
|
|
|
|
const params: any = {
|
|
|
|
|
|
page: 1,
|
|
|
|
|
|
size: 1000
|
|
|
|
|
|
}
|
|
|
|
|
|
if (currentUserInfo && currentUserInfo.type !== 4 && currentUserInfo.shopId) {
|
|
|
|
|
|
params.shopId = currentUserInfo.shopId
|
|
|
|
|
|
}
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const res = await adminProductApi.listProducts(params) as unknown as { list: Product[] }
|
2026-03-04 15:42:43 +08:00
|
|
|
|
productList.value = res.list || []
|
|
|
|
|
|
} catch (error) {
|
2026-03-05 16:08:27 +08:00
|
|
|
|
console.error('获取作品列表失败:', error)
|
2026-03-04 15:42:43 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
productLoading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** fetchNailArtistList is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const fetchNailArtistList = async () => {
|
|
|
|
|
|
loading.value = true
|
|
|
|
|
|
try {
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const res = await adminNailArtistApi.listNailArtists() as unknown as NailArtistInfoVO[]
|
2026-03-04 15:42:43 +08:00
|
|
|
|
let filteredList = res || []
|
|
|
|
|
|
|
|
|
|
|
|
// 按搜索词过滤
|
|
|
|
|
|
if (searchText.value) {
|
2026-03-10 23:23:15 +08:00
|
|
|
|
filteredList = filteredList.filter((item: NailArtistInfoVO) =>
|
2026-03-04 15:42:43 +08:00
|
|
|
|
item.nickname?.includes(searchText.value)
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nailArtistList.value = filteredList
|
|
|
|
|
|
pagination.total = filteredList.length || 0
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
message.error('获取美甲师列表失败')
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleSearch is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
2026-05-13 12:43:01 +08:00
|
|
|
|
const handleSearch = async () => {
|
2026-03-04 15:42:43 +08:00
|
|
|
|
pagination.current = 1
|
2026-05-13 12:43:01 +08:00
|
|
|
|
await runWithGlobalLoading(() => fetchNailArtistList())
|
2026-03-04 15:42:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleTableChange is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
2026-05-13 12:43:01 +08:00
|
|
|
|
const handleTableChange = async (pag: any) => {
|
2026-03-04 15:42:43 +08:00
|
|
|
|
pagination.current = pag.current
|
|
|
|
|
|
pagination.pageSize = pag.pageSize
|
2026-05-13 12:43:01 +08:00
|
|
|
|
await runWithGlobalLoading(() => fetchNailArtistList())
|
2026-03-04 15:42:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** showEditModal is a local helper used by this page script. */
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const showEditModal = (record: Record<string, any>) => {
|
|
|
|
|
|
currentNailArtist.value = record as NailArtistInfoVO
|
2026-03-27 13:28:57 +08:00
|
|
|
|
const lockedFields = {
|
2026-03-04 15:42:43 +08:00
|
|
|
|
userId: record.userId,
|
2026-03-27 13:28:57 +08:00
|
|
|
|
rating: record.rating || 0,
|
|
|
|
|
|
nickname: record.nickname || ''
|
|
|
|
|
|
}
|
|
|
|
|
|
Object.assign(formState, {
|
2026-03-04 15:42:43 +08:00
|
|
|
|
identity: record.identity || '',
|
|
|
|
|
|
experience: record.experience || 0,
|
|
|
|
|
|
skills: record.skills ? record.skills.split(',').filter(Boolean) : [],
|
|
|
|
|
|
status: record.status || 1,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
participateProduction: record.participateProduction ?? (record.userType === 3 ? 1 : 0),
|
|
|
|
|
|
workStartTime: record.workStartTime || '',
|
|
|
|
|
|
workEndTime: record.workEndTime || '',
|
2026-03-04 15:42:43 +08:00
|
|
|
|
portfolio: record.portfolio ? record.portfolio.split(',').filter(Boolean) : [],
|
2026-03-27 13:28:57 +08:00
|
|
|
|
...lockedFields
|
2026-03-04 15:42:43 +08:00
|
|
|
|
})
|
2026-03-26 12:04:02 +08:00
|
|
|
|
restoreDraft()
|
2026-03-27 13:28:57 +08:00
|
|
|
|
Object.assign(formState, lockedFields)
|
2026-03-04 15:42:43 +08:00
|
|
|
|
modalVisible.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** showViewModal is a local helper used by this page script. */
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const showViewModal = (record: Record<string, any>) => {
|
|
|
|
|
|
const nailArtist = record as NailArtistInfoVO
|
2026-03-04 15:42:43 +08:00
|
|
|
|
// 构建技能标签文本
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const skillsArray = nailArtist.skills ? nailArtist.skills.split(',').filter(Boolean) : []
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const skillsText = skillsArray.map(skillId => {
|
|
|
|
|
|
const tag = tagList.value.find(t => t.id.toString() === skillId)
|
|
|
|
|
|
return tag ? tag.tagName : skillId
|
|
|
|
|
|
}).join(', ')
|
|
|
|
|
|
|
2026-03-05 16:08:27 +08:00
|
|
|
|
// 构建作品文本
|
2026-03-10 23:23:15 +08:00
|
|
|
|
const portfolioArray = nailArtist.portfolio ? nailArtist.portfolio.split(',').filter(Boolean) : []
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const portfolioText = portfolioArray.map(productId => {
|
|
|
|
|
|
const product = productList.value.find(p => p.id.toString() === productId)
|
|
|
|
|
|
return product ? product.title : productId
|
|
|
|
|
|
}).join(', ')
|
|
|
|
|
|
|
|
|
|
|
|
Object.assign(viewFormState, {
|
2026-03-10 23:23:15 +08:00
|
|
|
|
nickname: nailArtist.nickname || '',
|
|
|
|
|
|
shopName: nailArtist.shopName || '',
|
|
|
|
|
|
identity: nailArtist.identity || '',
|
|
|
|
|
|
experience: (nailArtist.experience || 0).toString(),
|
2026-03-04 15:42:43 +08:00
|
|
|
|
skillsText: skillsText,
|
2026-03-10 23:23:15 +08:00
|
|
|
|
statusText: getStatusText(nailArtist.status || 1),
|
2026-05-18 09:46:11 +08:00
|
|
|
|
userTypeName: nailArtist.userTypeName || (nailArtist.userType === 2 ? '店长' : '美甲师'),
|
|
|
|
|
|
workTime: formatWorkTime(nailArtist),
|
2026-03-10 23:23:15 +08:00
|
|
|
|
rating: (nailArtist.rating || 0).toString(),
|
2026-03-04 15:42:43 +08:00
|
|
|
|
portfolioText: portfolioText
|
|
|
|
|
|
})
|
|
|
|
|
|
viewModalVisible.value = true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleViewModalCancel is a local helper used by this page script. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const handleViewModalCancel = () => {
|
|
|
|
|
|
viewModalVisible.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleModalOk is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const handleModalOk = async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await formRef.value?.validate()
|
2026-03-27 13:28:57 +08:00
|
|
|
|
|
|
|
|
|
|
const targetUserId = currentNailArtist.value?.userId ?? formState.userId
|
|
|
|
|
|
if (!targetUserId) {
|
|
|
|
|
|
message.error('未获取到当前美甲师信息,请关闭弹窗后重试')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-03-04 15:42:43 +08:00
|
|
|
|
modalLoading.value = true
|
|
|
|
|
|
|
2026-05-13 12:43:01 +08:00
|
|
|
|
await runWithGlobalLoading(async () => {
|
|
|
|
|
|
// 准备提交数据
|
|
|
|
|
|
const submitData = {
|
|
|
|
|
|
userId: targetUserId,
|
|
|
|
|
|
identity: formState.identity,
|
|
|
|
|
|
experience: formState.experience,
|
|
|
|
|
|
rating: formState.rating,
|
|
|
|
|
|
status: formState.status,
|
2026-05-18 09:46:11 +08:00
|
|
|
|
participateProduction: formState.participateProduction,
|
|
|
|
|
|
workStartTime: normalizeTime(formState.workStartTime),
|
|
|
|
|
|
workEndTime: normalizeTime(formState.workEndTime),
|
2026-05-13 12:43:01 +08:00
|
|
|
|
skills: formState.skills.join(','),
|
|
|
|
|
|
portfolio: formState.portfolio.join(',')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await adminNailArtistApi.saveNailArtistInfo(submitData)
|
|
|
|
|
|
message.success('保存成功')
|
|
|
|
|
|
|
|
|
|
|
|
handleClearDraft(false)
|
|
|
|
|
|
modalVisible.value = false
|
|
|
|
|
|
await fetchNailArtistList()
|
|
|
|
|
|
})
|
2026-03-04 15:42:43 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error)
|
2026-03-27 12:29:36 +08:00
|
|
|
|
const errorMessage = (error as Error)?.message
|
|
|
|
|
|
if (errorMessage) {
|
|
|
|
|
|
message.error(errorMessage)
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2026-03-04 15:42:43 +08:00
|
|
|
|
message.error('操作失败')
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
modalLoading.value = false
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 09:46:11 +08:00
|
|
|
|
/** handleModalCancel is a local helper used by this page script. */
|
2026-03-04 15:42:43 +08:00
|
|
|
|
const handleModalCancel = () => {
|
|
|
|
|
|
modalVisible.value = false
|
2026-03-27 13:28:57 +08:00
|
|
|
|
currentNailArtist.value = null
|
2026-03-04 15:42:43 +08:00
|
|
|
|
formRef.value?.resetFields()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
|
await loadUserPermissions()
|
|
|
|
|
|
fetchTagList()
|
|
|
|
|
|
fetchProductList()
|
|
|
|
|
|
fetchNailArtistList()
|
|
|
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.nail-artists {
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
}
|
2026-03-26 12:04:02 +08:00
|
|
|
|
</style>
|