标签完善
This commit is contained in:
221
pages/champion/champion.vue
Normal file
221
pages/champion/champion.vue
Normal file
@@ -0,0 +1,221 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- #ifdef APP -->
|
||||
<statusBar></statusBar>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 导航栏 -->
|
||||
<uni-nav-bar
|
||||
:fixed="true"
|
||||
:statusBar="true"
|
||||
title="销冠"
|
||||
leftIcon="left"
|
||||
@clickLeft="goBack"
|
||||
color="#333"
|
||||
backgroundColor="#FFFFFF">
|
||||
</uni-nav-bar>
|
||||
|
||||
<view class="content">
|
||||
<!-- AI功能横幅 -->
|
||||
<view class="ai-banner">
|
||||
<text class="banner-text">AI让销售过程和团队管理更透明</text>
|
||||
</view>
|
||||
|
||||
<!-- 标签页 -->
|
||||
<view class="tabs">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'survey' }"
|
||||
@click="switchTab('survey')">
|
||||
<text>摸底</text>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'practice' }"
|
||||
@click="switchTab('practice')">
|
||||
<text>陪练</text>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'battle' }"
|
||||
@click="switchTab('battle')">
|
||||
<text>实战</text>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: activeTab === 'quality' }"
|
||||
@click="switchTab('quality')">
|
||||
<text>质检</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 摸底内容 -->
|
||||
<scroll-view
|
||||
class="tab-content"
|
||||
scroll-y
|
||||
v-if="activeTab === 'survey'">
|
||||
<view class="champion-card">
|
||||
<text class="champion-title">摸底</text>
|
||||
<text class="champion-desc">这里是摸底相关的内容展示区域</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 陪练内容 -->
|
||||
<scroll-view
|
||||
class="tab-content"
|
||||
scroll-y
|
||||
v-if="activeTab === 'practice'">
|
||||
<view class="champion-card">
|
||||
<text class="champion-title">陪练</text>
|
||||
<text class="champion-desc">这里是陪练相关的内容展示区域</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 实战内容 -->
|
||||
<scroll-view
|
||||
class="tab-content"
|
||||
scroll-y
|
||||
v-if="activeTab === 'battle'">
|
||||
<view class="champion-card">
|
||||
<text class="champion-title">实战</text>
|
||||
<text class="champion-desc">这里是实战相关的内容展示区域</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 质检内容 -->
|
||||
<scroll-view
|
||||
class="tab-content"
|
||||
scroll-y
|
||||
v-if="activeTab === 'quality'">
|
||||
<view class="champion-card">
|
||||
<text class="champion-title">质检</text>
|
||||
<text class="champion-desc">这里是质检相关的内容展示区域</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// #ifdef APP
|
||||
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
|
||||
// #endif
|
||||
export default {
|
||||
// #ifdef APP
|
||||
components: {
|
||||
statusBar
|
||||
},
|
||||
// #endif
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'survey'
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
switchTab(tab) {
|
||||
this.activeTab = tab;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 88rpx;
|
||||
}
|
||||
|
||||
/* AI功能横幅 */
|
||||
.ai-banner {
|
||||
background-color: #E3F2FD;
|
||||
padding: 24rpx 32rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.banner-text {
|
||||
font-size: 28rpx;
|
||||
color: #1976D2;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 标签页 */
|
||||
.tabs {
|
||||
display: flex;
|
||||
background-color: #FFFFFF;
|
||||
border-bottom: 1px solid #E0E0E0;
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
padding: 24rpx 32rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tab-item text {
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item.active text {
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tab-item.active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 32rpx;
|
||||
right: 32rpx;
|
||||
height: 4rpx;
|
||||
background-color: #007AFF;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
|
||||
/* 内容区域 */
|
||||
.tab-content {
|
||||
height: calc(100vh - 300rpx);
|
||||
background-color: #F5F5F5;
|
||||
padding: 24rpx 32rpx;
|
||||
}
|
||||
|
||||
.champion-card {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 400rpx;
|
||||
}
|
||||
|
||||
.champion-title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.champion-desc {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -254,49 +254,108 @@
|
||||
</scroll-view>
|
||||
|
||||
<!-- 标签管理 -->
|
||||
<view class="tag-management" v-if="activeTab === 'tag'">
|
||||
<!-- 标签列表 -->
|
||||
<scroll-view
|
||||
class="tag-list"
|
||||
class="service-status-list"
|
||||
scroll-y
|
||||
v-if="tagViewMode === 'list'">
|
||||
<view class="tag-list-header">
|
||||
<text class="tag-list-total">共{{ tagList.length }}条</text>
|
||||
<view class="tag-list-btn" @click="showAddTag">
|
||||
v-if="activeTab === 'tag' && tagViewMode === 'list'"
|
||||
@scrolltolower="onTagListReachBottom">
|
||||
<view class="service-status-toolbar">
|
||||
<text class="toolbar-total">共{{ tagTotal }}条</text>
|
||||
<input
|
||||
class="toolbar-input"
|
||||
v-model="tagQuery.tagType"
|
||||
placeholder="标签分类"
|
||||
placeholder-style="color: #b0b0b0"
|
||||
confirm-type="search"
|
||||
@confirm="onTagListSearch"
|
||||
/>
|
||||
<input
|
||||
class="toolbar-input"
|
||||
v-model="tagQuery.tagName"
|
||||
placeholder="标签名称"
|
||||
placeholder-style="color: #b0b0b0"
|
||||
confirm-type="search"
|
||||
@confirm="onTagListSearch"
|
||||
/>
|
||||
<view class="toolbar-actions">
|
||||
<view class="toolbar-btn toolbar-btn--refresh" @click="onTagListRefresh">
|
||||
<uni-icons type="refresh" size="18" color="#2A68FF"></uni-icons>
|
||||
</view>
|
||||
<view class="toolbar-btn toolbar-btn--add" @click="showAddTag">
|
||||
<uni-icons type="plus" size="18" color="#2A68FF"></uni-icons>
|
||||
<text>添加标签</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
class="service-card tag-card-item"
|
||||
v-for="(item, index) in tagList"
|
||||
:key="index"
|
||||
:class="{ 'tag-card-item--active': selectedTagItem && selectedTagItem.id === item.id }">
|
||||
<view class="card-header">
|
||||
<view class="staff-info" @click.stop="onTagItemClick(item)">
|
||||
<view class="staff-avatar">
|
||||
<text class="avatar-text">{{ (item.tagName || item.name || '标').charAt(0) }}</text>
|
||||
</view>
|
||||
<text class="staff-name">{{ item.tagName || item.name || '未命名标签' }}</text>
|
||||
</view>
|
||||
<view class="tag-card-action-btn" @click.stop="onTagActionBtnClick(item)">
|
||||
<uni-icons type="more-filled" size="20" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="customer-info" @click.stop="onTagItemClick(item)">
|
||||
<text class="customer-name" v-if="item.industry">所属行业:{{ item.industry }}</text>
|
||||
</view>
|
||||
|
||||
<view class="customer-tags" v-if="item.tagDetail || item.detail || item.remark" @click.stop="onTagItemClick(item)">
|
||||
<view
|
||||
class="tag-item tag-blue"
|
||||
v-if="item.tagDetail || item.detail">
|
||||
<text>详情:{{ item.tagDetail || item.detail }}</text>
|
||||
</view>
|
||||
<view
|
||||
class="tag-item tag-orange"
|
||||
v-if="item.remark">
|
||||
<text>备注:{{ item.remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 操作菜单 -->
|
||||
<view
|
||||
class="tag-card"
|
||||
v-for="(item, index) in tagList"
|
||||
:key="index">
|
||||
<view class="tag-card-header">
|
||||
<text class="tag-card-name">{{ item.name }}</text>
|
||||
class="tag-action-menu"
|
||||
v-if="selectedTagItem && selectedTagItem.id === item.id && showTagActionMenu"
|
||||
@click.stop>
|
||||
<view class="tag-action-menu-item" @click="editTag(item)">
|
||||
<text>编辑</text>
|
||||
</view>
|
||||
<view class="tag-card-content">
|
||||
<view class="tag-card-item" v-if="item.detail">
|
||||
<text class="tag-card-label">详情:</text>
|
||||
<text class="tag-card-value">{{ item.detail }}</text>
|
||||
</view>
|
||||
<view class="tag-card-item" v-if="item.remark">
|
||||
<text class="tag-card-label">备注:</text>
|
||||
<text class="tag-card-value">{{ item.remark }}</text>
|
||||
</view>
|
||||
<view class="tag-action-menu-divider"></view>
|
||||
<view class="tag-action-menu-item tag-action-menu-item--danger" @click="deleteTag(item)">
|
||||
<text>删除</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="tag-list-empty" v-if="!tagList.length">
|
||||
</view>
|
||||
<!-- 遮罩层,点击关闭菜单 -->
|
||||
<view
|
||||
class="tag-action-menu-mask"
|
||||
v-if="showTagActionMenu"
|
||||
@click="closeTagActionMenu">
|
||||
</view>
|
||||
<view class="service-status-empty" v-if="!tagLoading && !tagList.length">
|
||||
<text>暂无标签</text>
|
||||
</view>
|
||||
<view class="service-status-loading-more" v-if="tagLoading && tagList.length">
|
||||
<text>正在加载更多...</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 标签管理 - 添加/编辑标签表单 -->
|
||||
<view class="tag-management" v-if="activeTab === 'tag' && (tagViewMode === 'add' || tagViewMode === 'edit')">
|
||||
<!-- 添加标签表单 -->
|
||||
<scroll-view
|
||||
class="tag-form"
|
||||
scroll-y
|
||||
v-if="tagViewMode === 'add'">
|
||||
scroll-y>
|
||||
<view class="form-card">
|
||||
<view class="form-item">
|
||||
<view class="form-item" v-if="tagViewMode === 'add'">
|
||||
<text class="form-item__label">所属行业</text>
|
||||
<input
|
||||
class="form-item__input"
|
||||
@@ -305,7 +364,7 @@
|
||||
placeholder-style="color: #9ca3af"
|
||||
/>
|
||||
</view>
|
||||
<view class="form-item tag-select-wrapper form-item--half">
|
||||
<view class="form-item tag-select-wrapper">
|
||||
<text class="form-item__label">标签分类</text>
|
||||
<view
|
||||
class="tag-select"
|
||||
@@ -347,7 +406,7 @@
|
||||
<view class="form-item">
|
||||
<text class="form-item__label">详情</text>
|
||||
<textarea
|
||||
class="form-item__textarea"
|
||||
class="form-item__textarea form-item__textarea--detail"
|
||||
v-model="tagForm.detail"
|
||||
placeholder="请输入详情"
|
||||
placeholder-style="color: #9ca3af"
|
||||
@@ -357,20 +416,28 @@
|
||||
<view class="form-item">
|
||||
<text class="form-item__label">备注</text>
|
||||
<textarea
|
||||
class="form-item__textarea"
|
||||
class="form-item__textarea form-item__textarea--remark"
|
||||
v-model="tagForm.remark"
|
||||
placeholder="请输入备注"
|
||||
placeholder-style="color: #9ca3af"
|
||||
:maxlength="500"
|
||||
/>
|
||||
</view>
|
||||
<view class="form-item">
|
||||
<text class="form-item__label">是否启用</text>
|
||||
<switch
|
||||
:checked="tagForm.enabled"
|
||||
@change="onEnabledChange"
|
||||
color="#007AFF"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-actions">
|
||||
<view class="form-btn form-btn--cancel" @click="cancelAddTag">
|
||||
<text class="form-btn__text">取消</text>
|
||||
</view>
|
||||
<view class="form-btn form-btn--save" @click="saveTag">
|
||||
<text class="form-btn__text">保存</text>
|
||||
<text class="form-btn__text">{{ tagViewMode === 'edit' ? '更新' : '保存' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -432,17 +499,32 @@ import { getApiUrl } from "@/common/config.js";
|
||||
},
|
||||
serviceStatusList: [],
|
||||
// 标签管理
|
||||
tagViewMode: 'list', // 'list' 或 'add'
|
||||
tagViewMode: 'list', // 'list' 或 'add' 或 'edit'
|
||||
tagList: [],
|
||||
tagLoading: false,
|
||||
tagTotal: 0,
|
||||
tagPage: {
|
||||
current: 1,
|
||||
size: 10
|
||||
},
|
||||
tagQuery: {
|
||||
industry: '',
|
||||
tagType: '',
|
||||
tagName: ''
|
||||
},
|
||||
tagForm: {
|
||||
id: '',
|
||||
industry: '家居行业',
|
||||
tagType: '',
|
||||
name: '',
|
||||
detail: '',
|
||||
remark: ''
|
||||
remark: '',
|
||||
enabled: true
|
||||
},
|
||||
tagTypeOptions: ["接待客户", "质检SOP", "客户画像"],
|
||||
showTagTypeDropdown: false
|
||||
showTagTypeDropdown: false,
|
||||
selectedTagItem: null,
|
||||
showTagActionMenu: false
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -458,6 +540,7 @@ import { getApiUrl } from "@/common/config.js";
|
||||
this.fetchServiceStatusList();
|
||||
} else if (tab === 'tag') {
|
||||
this.tagViewMode = 'list';
|
||||
// 当进入标签管理页面时,请求接口填充数据
|
||||
this.fetchTagList();
|
||||
}
|
||||
},
|
||||
@@ -774,31 +857,190 @@ import { getApiUrl } from "@/common/config.js";
|
||||
}
|
||||
},
|
||||
// 标签管理相关方法
|
||||
fetchTagList() {
|
||||
// TODO: 从API获取标签列表
|
||||
// 目前使用模拟数据
|
||||
onTagListSearch() {
|
||||
if (this.activeTab !== 'tag') {
|
||||
this.activeTab = 'tag';
|
||||
}
|
||||
this.tagPage.current = 1;
|
||||
this.fetchTagList({ force: true });
|
||||
},
|
||||
onTagListRefresh() {
|
||||
this.tagPage.current = 1;
|
||||
this.fetchTagList({ force: true });
|
||||
},
|
||||
onTagListReachBottom() {
|
||||
// 已在加载中或全部加载完成则不再触发
|
||||
if (this.tagLoading) return;
|
||||
if (this.tagList.length >= this.tagTotal) return;
|
||||
this.tagPage.current += 1;
|
||||
this.fetchTagList();
|
||||
},
|
||||
async fetchTagList({ force = false } = {}) {
|
||||
if (this.tagLoading && !force) {
|
||||
return;
|
||||
}
|
||||
this.tagLoading = true;
|
||||
try {
|
||||
const queryParams = {
|
||||
current: this.tagPage.current,
|
||||
size: this.tagPage.size
|
||||
};
|
||||
const trimmedTagType = this.tagQuery?.tagType?.trim();
|
||||
const trimmedTagName = this.tagQuery?.tagName?.trim();
|
||||
if (trimmedTagType) {
|
||||
queryParams.tagType = trimmedTagType;
|
||||
}
|
||||
if (trimmedTagName) {
|
||||
queryParams.tagName = trimmedTagName;
|
||||
}
|
||||
const queryString = Object.keys(queryParams)
|
||||
.map(key => `${key}=${encodeURIComponent(queryParams[key])}`)
|
||||
.join('&');
|
||||
const url = `${getApiUrl('/api/industryTags/list')}?${queryString}`;
|
||||
const res = await uni.request({
|
||||
url,
|
||||
method: 'GET',
|
||||
timeout: 10000
|
||||
});
|
||||
if (res.statusCode === 200 && res.data && res.data.success) {
|
||||
const records = Array.isArray(res.data.data) ? res.data.data : [];
|
||||
// 第一页或强制刷新时重置列表,否则追加
|
||||
if (this.tagPage.current === 1 || force) {
|
||||
this.tagList = records;
|
||||
} else {
|
||||
this.tagList = this.tagList.concat(records);
|
||||
}
|
||||
this.tagTotal = Number(res.data.total) || 0;
|
||||
} else {
|
||||
this.tagList = [];
|
||||
this.tagTotal = 0;
|
||||
uni.showToast({
|
||||
title: res.data?.message || '获取标签列表失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取标签列表失败:', error);
|
||||
uni.showToast({
|
||||
title: '获取标签列表失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
} finally {
|
||||
this.tagLoading = false;
|
||||
}
|
||||
},
|
||||
showAddTag() {
|
||||
this.tagViewMode = 'add';
|
||||
this.showTagTypeDropdown = false;
|
||||
this.tagForm = {
|
||||
id: '',
|
||||
industry: '家居行业',
|
||||
tagType: '',
|
||||
name: '',
|
||||
detail: '',
|
||||
remark: ''
|
||||
remark: '',
|
||||
enabled: true
|
||||
};
|
||||
},
|
||||
onTagItemClick(item) {
|
||||
// 点击卡片内容区域,不做任何操作(保留用于其他可能的交互)
|
||||
},
|
||||
onTagActionBtnClick(item) {
|
||||
// 如果已经选中当前项,则关闭菜单
|
||||
if (this.selectedTagItem && this.selectedTagItem.id === item.id && this.showTagActionMenu) {
|
||||
this.closeTagActionMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示菜单
|
||||
this.selectedTagItem = item;
|
||||
this.showTagActionMenu = true;
|
||||
},
|
||||
closeTagActionMenu() {
|
||||
this.showTagActionMenu = false;
|
||||
this.selectedTagItem = null;
|
||||
},
|
||||
editTag(item) {
|
||||
this.closeTagActionMenu();
|
||||
this.tagViewMode = 'edit';
|
||||
this.showTagTypeDropdown = false;
|
||||
this.tagForm = {
|
||||
id: item.id || '',
|
||||
industry: item.industry || '家居行业',
|
||||
tagType: item.tagType || '',
|
||||
name: item.tagName || item.name || '',
|
||||
detail: item.tagDetail || item.detail || '',
|
||||
remark: item.remark || '',
|
||||
enabled: item.enabled !== undefined ? item.enabled : (item.isEnabled !== undefined ? item.isEnabled : true)
|
||||
};
|
||||
},
|
||||
async deleteTag(item) {
|
||||
this.closeTagActionMenu();
|
||||
const tagId = item.id;
|
||||
if (!tagId) {
|
||||
uni.showToast({
|
||||
title: '无法获取标签ID',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: `确定要删除标签"${item.tagName || item.name || '未命名标签'}"吗?`,
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: '删除中...'
|
||||
});
|
||||
|
||||
const deleteUrl = getApiUrl(`/api/industryTags/delete/${tagId}`);
|
||||
const deleteRes = await uni.request({
|
||||
url: deleteUrl,
|
||||
method: 'DELETE',
|
||||
timeout: 10000
|
||||
});
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (deleteRes.statusCode === 200 && deleteRes.data && deleteRes.data.success) {
|
||||
uni.showToast({
|
||||
title: deleteRes.data?.message || '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
// 删除成功后刷新列表
|
||||
this.tagPage.current = 1;
|
||||
this.fetchTagList({ force: true });
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: deleteRes.data?.message || '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
console.error('删除标签失败:', error);
|
||||
uni.showToast({
|
||||
title: '删除失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
cancelAddTag() {
|
||||
this.tagViewMode = 'list';
|
||||
this.showTagTypeDropdown = false;
|
||||
this.tagForm = {
|
||||
id: '',
|
||||
industry: '家居行业',
|
||||
tagType: '',
|
||||
name: '',
|
||||
detail: '',
|
||||
remark: ''
|
||||
remark: '',
|
||||
enabled: true
|
||||
};
|
||||
},
|
||||
toggleTagTypeDropdown() {
|
||||
@@ -811,6 +1053,9 @@ import { getApiUrl } from "@/common/config.js";
|
||||
closeTagTypeDropdown() {
|
||||
this.showTagTypeDropdown = false;
|
||||
},
|
||||
onEnabledChange(e) {
|
||||
this.tagForm.enabled = e.detail.value;
|
||||
},
|
||||
async saveTag() {
|
||||
// 表单验证
|
||||
if (!this.tagForm.name || !this.tagForm.name.trim()) {
|
||||
@@ -823,7 +1068,7 @@ import { getApiUrl } from "@/common/config.js";
|
||||
|
||||
try {
|
||||
uni.showLoading({
|
||||
title: "保存中..."
|
||||
title: this.tagViewMode === 'edit' ? "更新中..." : "保存中..."
|
||||
});
|
||||
|
||||
const payload = {
|
||||
@@ -831,12 +1076,25 @@ import { getApiUrl } from "@/common/config.js";
|
||||
tagType: this.tagForm.tagType?.trim() || '',
|
||||
tagName: this.tagForm.name.trim(),
|
||||
tagDetail: this.tagForm.detail?.trim() || '',
|
||||
remark: this.tagForm.remark?.trim() || ''
|
||||
remark: this.tagForm.remark?.trim() || '',
|
||||
enabled: this.tagForm.enabled !== undefined ? this.tagForm.enabled : true
|
||||
};
|
||||
|
||||
// 如果是编辑模式,添加id
|
||||
if (this.tagViewMode === 'edit' && this.tagForm.id) {
|
||||
payload.id = this.tagForm.id;
|
||||
}
|
||||
|
||||
// 根据模式选择不同的接口
|
||||
const url = this.tagViewMode === 'edit'
|
||||
? getApiUrl('/api/industryTags/update')
|
||||
: getApiUrl('/api/industryTags/add');
|
||||
|
||||
const method = this.tagViewMode === 'edit' ? 'PUT' : 'POST';
|
||||
|
||||
const res = await uni.request({
|
||||
url: getApiUrl('/api/industryTags/add'),
|
||||
method: "POST",
|
||||
url: url,
|
||||
method: method,
|
||||
data: payload,
|
||||
header: {
|
||||
"Content-Type": "application/json"
|
||||
@@ -847,19 +1105,20 @@ import { getApiUrl } from "@/common/config.js";
|
||||
const { statusCode, data } = res;
|
||||
if (statusCode === 200 && data && (data.success || data.code === 200)) {
|
||||
uni.showToast({
|
||||
title: data?.message || "保存成功",
|
||||
title: data?.message || (this.tagViewMode === 'edit' ? "更新成功" : "保存成功"),
|
||||
icon: "success"
|
||||
});
|
||||
// 保存成功后返回列表并刷新
|
||||
this.tagViewMode = 'list';
|
||||
this.fetchTagList();
|
||||
this.tagPage.current = 1;
|
||||
this.fetchTagList({ force: true });
|
||||
} else {
|
||||
throw new Error(data?.message || "保存失败");
|
||||
throw new Error(data?.message || (this.tagViewMode === 'edit' ? "更新失败" : "保存失败"));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("保存标签失败:", error);
|
||||
uni.showToast({
|
||||
title: error?.message || "保存失败,请重试",
|
||||
title: error?.message || (this.tagViewMode === 'edit' ? "更新失败,请重试" : "保存失败,请重试"),
|
||||
icon: "none"
|
||||
});
|
||||
} finally {
|
||||
@@ -999,6 +1258,18 @@ import { getApiUrl } from "@/common/config.js";
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
overflow: visible;
|
||||
/* 确保左右padding完全对称,所有内容都在padding范围内 */
|
||||
}
|
||||
|
||||
/* 标签卡片特殊处理 */
|
||||
.service-card.tag-card-item {
|
||||
padding-left: 32rpx;
|
||||
padding-right: 32rpx;
|
||||
padding-top: 32rpx;
|
||||
padding-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
@@ -1006,11 +1277,20 @@ import { getApiUrl } from "@/common/config.js";
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
/* 确保头部内容在卡片padding范围内 */
|
||||
}
|
||||
|
||||
.staff-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.staff-avatar {
|
||||
@@ -1022,6 +1302,10 @@ import { getApiUrl } from "@/common/config.js";
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 16rpx;
|
||||
margin-left: 0;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
@@ -1052,6 +1336,13 @@ import { getApiUrl } from "@/common/config.js";
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 20rpx;
|
||||
gap: 12rpx;
|
||||
box-sizing: border-box;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
/* 确保标签容器不会超出卡片padding范围 */
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.customer-info {
|
||||
@@ -1059,6 +1350,13 @@ import { getApiUrl } from "@/common/config.js";
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
box-sizing: border-box;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
/* 确保信息容器不会超出卡片padding范围 */
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.customer-name,
|
||||
@@ -1070,6 +1368,12 @@ import { getApiUrl } from "@/common/config.js";
|
||||
.tag-item {
|
||||
padding: 8rpx 16rpx;
|
||||
border-radius: 8rpx;
|
||||
box-sizing: border-box;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
/* 确保标签项不会超出卡片padding范围,允许换行 */
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.tag-blue {
|
||||
@@ -1305,11 +1609,11 @@ import { getApiUrl } from "@/common/config.js";
|
||||
|
||||
.tag-select-wrapper {
|
||||
position: relative;
|
||||
width: 50%;
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.tag-select {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background-color: #f9fafb;
|
||||
border-radius: 12rpx;
|
||||
@@ -1325,9 +1629,7 @@ import { getApiUrl } from "@/common/config.js";
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 160rpx;
|
||||
width: calc(100% - 160rpx);
|
||||
min-width: 260rpx;
|
||||
max-width: none;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
border-radius: 16rpx;
|
||||
box-shadow: 0 12rpx 30rpx rgba(15, 23, 42, 0.1);
|
||||
@@ -1408,95 +1710,89 @@ import { getApiUrl } from "@/common/config.js";
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* 标签管理样式 */
|
||||
/* 标签管理样式 - 添加表单 */
|
||||
.tag-management {
|
||||
height: calc(100vh - 300rpx);
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
height: 100%;
|
||||
padding: 24rpx 32rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tag-list-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.tag-list-total {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tag-list-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
background-color: #E3F2FD;
|
||||
border-radius: 12rpx;
|
||||
color: #2A68FF;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.tag-card {
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 16rpx;
|
||||
padding: 32rpx;
|
||||
margin-bottom: 24rpx;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.tag-card-header {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.tag-card-name {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.tag-card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
/* 标签卡片操作菜单 */
|
||||
.tag-card-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tag-card-action-btn {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
margin-left: auto;
|
||||
margin-right: 0;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
/* 确保按钮在卡片padding范围内,距离右边框32rpx */
|
||||
}
|
||||
|
||||
.tag-card-label {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
.tag-card-action-btn uni-icons {
|
||||
display: block;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.tag-card-value {
|
||||
.tag-card-action-btn:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.tag-action-menu {
|
||||
position: absolute;
|
||||
top: 60rpx;
|
||||
right: 32rpx;
|
||||
width: 160rpx;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 12rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
|
||||
z-index: 100;
|
||||
overflow: hidden;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.tag-action-menu-item {
|
||||
padding: 24rpx 32rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
width: 40%;
|
||||
max-width: 40%;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
text-align: center;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.tag-list-empty {
|
||||
padding: 48rpx 0;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
.tag-action-menu-item:active {
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
.tag-action-menu-item--danger {
|
||||
color: #FF5722;
|
||||
}
|
||||
|
||||
.tag-action-menu-divider {
|
||||
height: 1rpx;
|
||||
background-color: #E0E0E0;
|
||||
margin: 0 16rpx;
|
||||
}
|
||||
|
||||
.tag-action-menu-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: transparent;
|
||||
z-index: 99;
|
||||
}
|
||||
|
||||
.tag-form {
|
||||
@@ -1516,4 +1812,19 @@ import { getApiUrl } from "@/common/config.js";
|
||||
box-sizing: border-box;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.form-item__textarea--detail {
|
||||
min-height: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.form-item__textarea--remark {
|
||||
min-height: 88rpx;
|
||||
height: 88rpx;
|
||||
}
|
||||
|
||||
/* 开关样式 */
|
||||
.form-item switch {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user