liujiaxin há 1 dia atrás
pai
commit
71902e13b6
4 ficheiros alterados com 479 adições e 427 exclusões
  1. 12 0
      api/task.js
  2. 391 406
      pages_task/approvalCenter.vue
  3. 71 15
      pages_task/pointsSettings.vue
  4. 5 6
      pages_task/selectCustomer.vue

+ 12 - 0
api/task.js

@@ -68,3 +68,15 @@ export function copy(id) {
 export function companyUserList(data) {
  	 return request('/company/companyUser/list',data,'GET','application/json;charset=UTF-8');
 } 
+//检查积分是否超过限制
+// export function checkIntegralLimit(data) {
+// 	 return request('/project/standard/checkIntegralLimit',data,'GET','application/json;charset=UTF-8');
+// }
+//查询公司积分范围
+export function getCompanyIntegralRanges(data) {
+	 return request('/project/standard/getCompanyIntegralRanges',data,'POST','application/json;charset=UTF-8');
+}
+//查询到 定义审核通过了的医生
+export function getAppliedList(companyId) {
+	 return request(`/doctor/doctor/appliedList?companyId=${companyId}`,null,'GET','application/json;charset=UTF-8');
+}

+ 391 - 406
pages_task/approvalCenter.vue

@@ -3,9 +3,11 @@
 		<!-- 搜索+筛选栏 -->
 		<view class="top-box">
 			<view class="input-item">
-					<image class="icon search-icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/search.png" mode="widthFix"></image>
-					<input v-model="searchKeywords" @input="handleSearchInput" placeholder="请输入发起人姓名、手机号" placeholder-class="placeholder" />
-				</view>
+				<image class="icon search-icon"
+					src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/search.png" mode="widthFix"></image>
+				<input v-model="searchKeywords" @input="handleSearchInput" placeholder="请输入发起人姓名、手机号"
+					placeholder-class="placeholder" />
+			</view>
 		</view>
 
 		<!-- 顶部选项卡 -->
@@ -20,13 +22,19 @@
 		<view class="sub-tabs-wrapper">
 			<!-- 动态子标签 -->
 			<view class="sub-tabs">
-				<view class="sub-tab-item" :class="{ active: currentSubTab === 'all' || currentSubTab === 'taskCreate' }" @click="openSubTabPopup('all')">
-						<text>{{ selectedSubTabLabels['all'] || '全部审核' }}</text>
-						<image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png" mode="widthFix"></image>
+				<view class="sub-tab-item"
+					:class="{ active: currentSubTab === 'all' || currentSubTab === 'taskCreate' }"
+					@click="openSubTabPopup('all')">
+					<text>{{ selectedSubTabLabels['all'] || '全部审核' }}</text>
+					<image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png"
+						mode="widthFix"></image>
 				</view>
-				<view class="sub-tab-item" :class="{ active: currentSubTab === 'unfinished' || currentSubTab === 'finished' }" @click="openSubTabPopup('unfinished')">
-						<text>{{ selectedSubTabLabels['unfinished'] || '最新发起' }}</text>
-						<image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png" mode="widthFix"></image>
+				<view class="sub-tab-item"
+					:class="{ active: currentSubTab === 'unfinished' || currentSubTab === 'finished' }"
+					@click="openSubTabPopup('unfinished')">
+					<text>{{ selectedSubTabLabels['unfinished'] || '最新发起' }}</text>
+					<image class="icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_expand.png"
+						mode="widthFix"></image>
 				</view>
 			</view>
 			<!-- 子标签弹窗 -->
@@ -34,28 +42,35 @@
 			<view class="sub-tab-popup" v-if="showSubTabPopup">
 				<view class="sub-tab-options">
 					<!-- 全部审核选项 -->
-						<template v-if="currentPopupType === 'all'">
-							<view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'all' }" @click="selectSubTabOption('all', '全部审核')">
-								<text>全部审核</text>
-							</view>
-							<view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'taskCreate' }" @click="selectSubTabOption('taskCreate', '任务创建')">
-								<text>任务创建</text>
-							</view>
-						</template>
-						<!-- 最新发起选项 -->
-						<template v-else-if="currentPopupType === 'unfinished'">
-							<view class="sub-tab-option" :class="{ active: selectedSubTabOptions['unfinished'] === 'unfinished' }" @click="selectSubTabOption('unfinished', '最新发起')">
-								<text>最新发起</text>
-							</view>
-							<view class="sub-tab-option" :class="{ active: selectedSubTabOptions['unfinished'] === 'finished' }" @click="selectSubTabOption('finished', '最早发起')">
-								<text>最早发起</text>
-							</view>
-						</template>
+					<template v-if="currentPopupType === 'all'">
+						<view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'all' }"
+							@click="selectSubTabOption('all', '全部审核')">
+							<text>全部审核</text>
+						</view>
+						<view class="sub-tab-option" :class="{ active: selectedSubTabOptions['all'] === 'taskCreate' }"
+							@click="selectSubTabOption('taskCreate', '任务创建')">
+							<text>任务创建</text>
+						</view>
+					</template>
+					<!-- 最新发起选项 -->
+					<template v-else-if="currentPopupType === 'unfinished'">
+						<view class="sub-tab-option"
+							:class="{ active: selectedSubTabOptions['unfinished'] === 'unfinished' }"
+							@click="selectSubTabOption('unfinished', '最新发起')">
+							<text>最新发起</text>
+						</view>
+						<view class="sub-tab-option"
+							:class="{ active: selectedSubTabOptions['unfinished'] === 'finished' }"
+							@click="selectSubTabOption('finished', '最早发起')">
+							<text>最早发起</text>
+						</view>
+					</template>
 				</view>
 			</view>
 		</view>
 		<!-- 列表内容 -->
-		<scroll-view class="content" scroll-y refresher-enabled :refresher-triggered="refreshing" @refresherrefresh="onRefresh" @refresherrestore="onRestore">
+		<scroll-view class="content" scroll-y refresher-enabled :refresher-triggered="refreshing"
+			@refresherrefresh="onRefresh" @refresherrestore="onRestore">
 			<view class="task-card" v-for="(item, index) in currentList" :key="index" @click="goDetails(item)">
 				<!-- 任务/审核标题+状态 -->
 				<view class="card-top">
@@ -72,15 +87,17 @@
 							<text>{{ item.auditName || '未设置' }}</text>
 						</view>
 						<view class="time-item">
-												<text class="title">任务类型:</text>
-												<text>{{ getBusinessTypeLabel(item.businessType) }}</text>
-											</view>
+							<text class="title">任务类型:</text>
+							<text>{{ getBusinessTypeLabel(item.businessType) }}</text>
+						</view>
 					</view>
 
 					<!-- 操作按钮 -->
 					<view class="operate-btn-group">
 						<view class="share-btn" @click="handleShare(item)">
-							<image class="share-icon" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_user.png" mode="widthFix"></image>
+							<image class="share-icon"
+								src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_user.png"
+								mode="widthFix"></image>
 							<text>{{ item.initiatorName || '未命名' }}</text>
 						</view>
 						<view class="date">
@@ -96,8 +113,9 @@
 			<view class="filter-content" @click.stop>
 				<view class="filter-header">
 					<view class="filter-title">筛选</view>
-					<image class="filter-close-btn" src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_close.png" @click="closeFilter"
-						mode="widthFix"></image>
+					<image class="filter-close-btn"
+						src="https://ysrw-1395926010.cos.ap-chengdu.myqcloud.com/image/icon_close.png"
+						@click="closeFilter" mode="widthFix"></image>
 				</view>
 
 				<view class="filter-form">
@@ -174,119 +192,122 @@
 	</view>
 </template>
 <script>
-import utils from '@/utils/common.js'
+	import utils from '@/utils/common.js'
 	import TabPopup from '@/components/tab-popup.vue'
-	import { getPendingAuditList, searchCompanyUser } from '@/api/audit.js'
-	
+	import {
+		getPendingAuditList,
+		searchCompanyUser
+	} from '@/api/audit.js'
+
 	export default {
 		components: {
 			TabPopup
 		},
 		data() {
-											return {
-													processTemplate: null,
-													popShow: false,
-													showFilter: false,
-													selectedTabItem: '',
-													searchKeywords: '',
-													searchTimer: null,
-													filters: {
-														applyTimeStart: '',
-														applyTimeEnd: '',
-														finishTimeStart: '',
-														finishTimeEnd: '',
-														auditTimeStart: '',
-														auditTimeEnd: '',
-														taskBelong: 'my',
-														finishStatus: '',
-														belongType: ''
-													},
-													refreshing: false,
-													showSubTabPopup: false,
-													currentPopupType: 'all',
-													// 为每种类型的弹窗分别存储选中的选项
-													selectedSubTabOptions: {
-														all: 'all',
-														unfinished: 'unfinished'
-													},
-													selectedSubTabLabels: {
-														all: '全部审核',
-														unfinished: '最新发起'
-													},
-					// 顶部选项卡数组
-					topTabs: [{
-								label: '待办',
-								value: 'todo',
-								badge: 0
-							},
-							{
-								label: '已办',
-								value: 'done',
-								badge: 0
-							},
-							{
-								label: '我发起的',
-								value: 'myInitiate',
-								badge: 0
-							}
-						],
-					currentTopTab: 0,
-					currentSubTab: 'all',
-					// 子标签数组
-					taskSubTabs: [{
-							label: '全部审批',
-							value: 'all'
-						},
-						{
-							label: '最新发起',
-							value: 'unfinished'
-						}
-					],
-					tabsList: ['全部审批', '任务创建'],
-					tabsList2: ['最新发起', '最早发起'],
-					// auditSubTabs: [{
-					// 		label: '全部',
-					// 		value: 'all'
-					// 	},
-					// 	{
-					// 		label: '驳回',
-					// 		value: 'rejected'
-					// 	}
-					// ],
-					// 加载状态
-					loading: {
-						todo: false,
-						done: false,
-						myInitiate: false
+			return {
+				processTemplate: null,
+				popShow: false,
+				showFilter: false,
+				selectedTabItem: '',
+				searchKeywords: '',
+				searchTimer: null,
+				filters: {
+					applyTimeStart: '',
+					applyTimeEnd: '',
+					finishTimeStart: '',
+					finishTimeEnd: '',
+					auditTimeStart: '',
+					auditTimeEnd: '',
+					taskBelong: 'my',
+					finishStatus: '',
+					belongType: ''
+				},
+				refreshing: false,
+				showSubTabPopup: false,
+				currentPopupType: 'all',
+				// 为每种类型的弹窗分别存储选中的选项
+				selectedSubTabOptions: {
+					all: 'all',
+					unfinished: 'unfinished'
+				},
+				selectedSubTabLabels: {
+					all: '全部审核',
+					unfinished: '最新发起'
+				},
+				// 顶部选项卡数组
+				topTabs: [{
+						label: '待办',
+						value: 'todo',
+						badge: 0
 					},
-					// 列表数据
-					todoList: [], // 待办列表(index=0)
-					doneList: [], // 已办列表(index=1)
-					myInitiateList: [] // 我发起的列表(index=2)
-				}
-			},
-			computed: {
-				currentSubTabsList() {
-					 return this.taskSubTabs;
-
-					// if (this.currentTopTab === 0) return this.taskSubTabs;
-					// if (this.currentTopTab === 1) return this.auditSubTabs;
-					// if (this.currentTopTab === 2) return this.myInitiateList;
+					{
+						label: '已办',
+						value: 'done',
+						badge: 0
+					},
+					{
+						label: '我发起的',
+						value: 'myInitiate',
+						badge: 0
+					}
+				],
+				currentTopTab: 0,
+				currentSubTab: 'all',
+				// 子标签数组
+				taskSubTabs: [{
+						label: '全部审批',
+						value: 'all'
+					},
+					{
+						label: '最新发起',
+						value: 'unfinished'
+					}
+				],
+				tabsList: ['全部审批', '任务创建'],
+				tabsList2: ['最新发起', '最早发起'],
+				// auditSubTabs: [{
+				// 		label: '全部',
+				// 		value: 'all'
+				// 	},
+				// 	{
+				// 		label: '驳回',
+				// 		value: 'rejected'
+				// 	}
+				// ],
+				// 加载状态
+				loading: {
+					todo: false,
+					done: false,
+					myInitiate: false
 				},
-				currentList() {
-					if (this.currentTopTab === 0) return this.todoList;
-					if (this.currentTopTab === 1) return this.doneList;
-					if (this.currentTopTab === 2) return this.myInitiateList;
-				}
-			},
-			onLoad() {
-				// 页面加载时的初始化操作
-				this.loadData();
-				utils.getDicts("FLOW_TEMPLATE").then(res => {
-					this.processTemplate = res;
-					console.log("流程模板", this.processTemplate)
-				});
+				// 列表数据
+				todoList: [], // 待办列表(index=0)
+				doneList: [], // 已办列表(index=1)
+				myInitiateList: [], // 我发起的列表(index=2)
+				// 初始化/加载状态控制,避免初次进入重复请求
+				isInitializing: true,
+				hasLoadedOnce: false
+			}
+		},
+		computed: {
+			currentSubTabsList() {
+				return this.taskSubTabs;
+
 			},
+			currentList() {
+				if (this.currentTopTab === 0) return this.todoList;
+				if (this.currentTopTab === 1) return this.doneList;
+				if (this.currentTopTab === 2) return this.myInitiateList;
+			}
+		},
+		onLoad() {
+			// 页面加载时的初始化操作
+			this.loadData();
+			utils.getDicts("FLOW_TEMPLATE").then(res => {
+				this.processTemplate = res;
+				console.log("流程模板", this.processTemplate)
+			});
+		},
 		methods: {
 			onRefresh() {
 				this.refreshing = true;
@@ -304,41 +325,39 @@ import utils from '@/utils/common.js'
 				this.showSubTabPopup = true;
 			},
 			selectSubTabOption(value, label) {
-					// 根据当前弹窗类型更新对应类型的选中选项
-					this.selectedSubTabOptions[this.currentPopupType] = value;
-					this.selectedSubTabLabels[this.currentPopupType] = label;
-					this.currentSubTab = value;
-					this.showSubTabPopup = false;
-					// 这里可以添加根据选择的子标签过滤数据的逻辑
-					this.loadData();
-				},
+				// 根据当前弹窗类型更新对应类型的选中选项
+				this.selectedSubTabOptions[this.currentPopupType] = value;
+				this.selectedSubTabLabels[this.currentPopupType] = label;
+				this.currentSubTab = value;
+				this.showSubTabPopup = false;
+				// 这里可以添加根据选择的子标签过滤数据的逻辑
+			},
 			selectTabItem(item) {
 				this.selectedTabItem = item;
 				this.popShow = false;
 			},
 			goDetails(item) {
-				console.log("跳转参数",item)
+				console.log("跳转参数", item)
 				uni.navigateTo({
 					url: `/pages_task/approvalTaskDetail?taskId=${item.id}&businessType=${item.businessType}`
 				})
 			},
 			switchTopTab(index) {
-					this.currentTopTab = index;
-					this.currentSubTab = 'all';
-					// 重置所有子标签选项
-					this.selectedSubTabOptions = {
-						all: 'all',
-						unfinished: 'unfinished'
-					};
-					this.selectedSubTabLabels = {
-						all: '全部审核',
-						unfinished: '最新发起'
-					};
-					this.popShow = false;
-					this.showSubTabPopup = false;
-					// 切换标签时重新加载数据
-					this.loadData();
-				},
+				this.currentTopTab = index;
+				this.currentSubTab = 'all';
+				// 重置所有子标签选项
+				this.selectedSubTabOptions = {
+					all: 'all',
+					unfinished: 'unfinished'
+				};
+				this.selectedSubTabLabels = {
+					all: '全部审核',
+					unfinished: '最新发起'
+				};
+				this.popShow = false;
+				this.showSubTabPopup = false;
+				// 切换标签仅切换展示数据
+			},
 			closeFilter() {
 				this.showFilter = false
 			},
@@ -360,259 +379,225 @@ import utils from '@/utils/common.js'
 				console.log('筛选条件:', this.filters)
 				// 筛选后重新加载数据
 				this.loadData()
-				},
-				getAuditNameDisplay(auditName) {
-					if (!auditName) return '未设置'
-					switch (auditName) {
-						case '完成任务审核':
-							return '"完成任务"审核'
-						case '定级审核':
-							return '"讲者定级"审核'
-						default:
-							// 对于其他审核类型,在最开始和审核前都加双引号
-							const prefix = auditName.replace('审核', '')
-							return '"' + prefix + '"审核'
-					}
-				},
-								handleShare(item) {
-									uni.showToast({
-										title: '分享功能待实现',
-										icon: 'none'
-									})
-									},
-								handleSearchInput() {
-									// 防抖处理,避免频繁请求
-									if (this.searchTimer) {
-										clearTimeout(this.searchTimer)
-									}
-									
-									this.searchTimer = setTimeout(async () => {
-										if (this.searchKeywords.trim()) {
-											try {
-												// 调用搜索发起人接口
-												const res = await searchCompanyUser({
-													keywords: this.searchKeywords.trim(),
-													pageNum: 1,
-													pageSize: 10
-												})
-												
-												if (res.code === 200 && res.rows) {
-													// 根据当前标签页更新对应列表
-													if (this.currentTopTab === 0) {
-														this.todoList = res.rows.map(item => ({
-															auditName: item.auditName || '未知审核',
-															statusText: '待审核',
-															statusClass: 'status-createPending',
-															id: item.id,
-															status: item.status,
-															auditType: item.auditType,
-															businessId: item.businessId,
-															businessType: item.businessType,
-															createTime: item.createTime,
-															initiatorName: item.initiatorName
-														}))
-													} else if (this.currentTopTab === 1) {
-														this.doneList = res.rows.map(item => ({
-															auditName: item.auditName || '未知审核',
-															statusText: item.status === 1 ? '已通过' : '已驳回',
-															statusClass: item.status === 1 ? 'status-finish' : 'status-rejected',
-															id: item.id,
-															status: item.status,
-															auditType: item.auditType,
-															businessId: item.businessId,
-															businessType: item.businessType,
-															createTime: item.createTime,
-															initiatorName: item.initiatorName
-														}))
-													} else if (this.currentTopTab === 2) {
-														this.myInitiateList = res.rows.map(item => ({
-															auditName: item.auditName || '未知审核',
-															statusText: '待审核',
-															statusClass: 'status-createPending',
-															id: item.id,
-															status: item.status,
-															auditType: item.auditType,
-															businessId: item.businessId,
-															businessType: item.businessType,
-															createTime: item.createTime,
-															initiatorName: item.initiatorName
-														}))
-													}
-												} else {
-													// 搜索结果为空,清空对应列表
-													if (this.currentTopTab === 0) {
-														this.todoList = []
-													} else if (this.currentTopTab === 1) {
-														this.doneList = []
-													} else if (this.currentTopTab === 2) {
-														this.myInitiateList = []
-													}
-												}
-												} catch (e) {
-												console.error('搜索失败', e)
-												uni.showToast({
-													title: '搜索失败',
-													icon: 'none'
-												})
-											}
-										} else {
-											// 搜索框为空,重新加载默认数据
-											this.loadData()
-										}
-									}, 300)
-									},
-				// 加载审批数据
-				async loadData() {
-					try {
-						// 无论当前标签是什么,都调用getPendingAuditList请求
-						const userInfoStr = uni.getStorageSync('userInfo')
-						const userInfo = userInfoStr ? (typeof userInfoStr === 'string' ? JSON.parse(userInfoStr) : userInfoStr) : {}
-						// 获取不同status的数据total并更新badge
-					const getBadgeData = async () => {
-						// 获取待办数据(total)
-						const todoParams = {
-							initiatorName: userInfo.nickName || '',
-							initiatorPhone: userInfo.phone || '',
-							status: 1,
-							sort: 0,
-							userId: userInfo.userId || '',
-							companyId: userInfo.companyId || 0
-						}
-						const todoRes = await getPendingAuditList(todoParams)
-						this.topTabs[0].badge = todoRes.code === 200 ? (todoRes.total || 0) : 0
-
-						// 获取已办数据(total)
-						const doneParams = {
-							initiatorName: userInfo.nickName || '',
-							initiatorPhone: userInfo.phone || '',
-							status: 2,
-							sort: 0,
-							userId: userInfo.userId || '',
-							companyId: userInfo.companyId || 0
-						}
-						const doneRes = await getPendingAuditList(doneParams)
-						this.topTabs[1].badge = doneRes.code === 200 ? (doneRes.total || 0) : 0
-
-						// 获取我发起的数据(total)
-						const myInitiateParams = {
-							initiatorName: userInfo.nickName || '',
-							initiatorPhone: userInfo.phone || '',
-							status: '',
-							sort: 0,
-							userId: userInfo.userId || '',
-							companyId: userInfo.companyId || 0
+			},
+			getAuditNameDisplay(auditName) {
+				if (!auditName) return '未设置'
+				switch (auditName) {
+					case '完成任务审核':
+						return '"完成任务"审核'
+					case '定级审核':
+						return '"讲者定级"审核'
+					default:
+						// 对于其他审核类型,在最开始和审核前都加双引号
+						const prefix = auditName.replace('审核', '')
+						return '"' + prefix + '"审核'
+				}
+			},
+			handleShare(item) {
+				uni.showToast({
+					title: '分享功能待实现',
+					icon: 'none'
+				})
+			},
+			handleSearchInput() {
+				// 初次进入时不触发重新加载,避免重复请求
+				if (this.isInitializing) return;
+				// 防抖处理,避免频繁请求
+				if (this.searchTimer) {
+					clearTimeout(this.searchTimer)
+				}
 
+				this.searchTimer = setTimeout(async () => {
+					if (this.searchKeywords.trim()) {
+						try {
+							// 调用搜索发起人接口
+							const res = await searchCompanyUser({
+								keywords: this.searchKeywords.trim(),
+								pageNum: 1,
+								pageSize: 10
+							})
+
+							if (res.code === 200 && res.rows) {
+								// 根据当前标签页更新对应列表
+								if (this.currentTopTab === 0) {
+									this.todoList = res.rows.map(item => ({
+										auditName: item.auditName || '未知审核',
+										statusText: '待审核',
+										statusClass: 'status-createPending',
+										id: item.id,
+										status: item.status,
+										auditType: item.auditType,
+										businessId: item.businessId,
+										businessType: item.businessType,
+										createTime: item.createTime,
+										initiatorName: item.initiatorName
+									}))
+								} else if (this.currentTopTab === 1) {
+									this.doneList = res.rows.map(item => ({
+										auditName: item.auditName || '未知审核',
+										statusText: item.status === 1 ? '已通过' : '已驳回',
+										statusClass: item.status === 1 ? 'status-finish' :
+											'status-rejected',
+										id: item.id,
+										status: item.status,
+										auditType: item.auditType,
+										businessId: item.businessId,
+										businessType: item.businessType,
+										createTime: item.createTime,
+										initiatorName: item.initiatorName
+									}))
+								} else if (this.currentTopTab === 2) {
+									this.myInitiateList = res.rows.map(item => ({
+										auditName: item.auditName || '未知审核',
+										statusText: '待审核',
+										statusClass: 'status-createPending',
+										id: item.id,
+										status: item.status,
+										auditType: item.auditType,
+										businessId: item.businessId,
+										businessType: item.businessType,
+										createTime: item.createTime,
+										initiatorName: item.initiatorName
+									}))
+								}
+							} else {
+								// 搜索结果为空,清空对应列表
+								if (this.currentTopTab === 0) {
+									this.todoList = []
+								} else if (this.currentTopTab === 1) {
+									this.doneList = []
+								} else if (this.currentTopTab === 2) {
+									this.myInitiateList = []
+								}
+							}
+						} catch (e) {
+							console.error('搜索失败', e)
+							uni.showToast({
+								title: '搜索失败',
+								icon: 'none'
+							})
+						}
+					} else {
+						// 搜索框为空,重新加载默认数据
+						if (this.hasLoadedOnce) {
+							this.loadData()
 						}
-						const myInitiateRes = await getPendingAuditList(myInitiateParams)
-						this.topTabs[2].badge = myInitiateRes.code === 200 ? (myInitiateRes.total || 0) : 0
 					}
-
-						// 先获取所有badge数据
-						await getBadgeData()
-
-						// 获取当前标签页的数据
+				}, 300)
+			},
+			// 加载审批数据
+			async loadData() {
+				try {
+					const userInfoStr = uni.getStorageSync('userInfo')
+					const userInfo = userInfoStr ? (typeof userInfoStr === 'string' ? JSON.parse(userInfoStr) :
+						userInfoStr) : {}
+					// 一次请求获取全部列表与badge
 					const params = {
 						initiatorName: userInfo.nickName || '',
 						initiatorPhone: userInfo.phone || '',
-						status: this.currentTopTab === 0 ? 1 : this.currentTopTab === 1 ? 2 : '',
-						sort: 0,
 						userId: userInfo.userId || '',
-						companyId: this.currentTopTab === 2 ? 1 : (userInfo.companyId || 0)
+						companyId: userInfo.companyId || 0
 					}
-						const res = await getPendingAuditList(params)
-						if (res.code === 200) {
-								// 处理返回的数据
-							const responseData = res.rows || [];
-								
-							// 直接使用responseData作为对应列表的数据
-							if (this.currentTopTab === 0) {
-								// 待办列表
-								this.loading.todo = true
-								this.todoList = responseData.map(item => ({
-									auditName: item.auditName || '未知审核',
-									statusText: '待审核',
-									statusClass: 'status-createPending',
-									id: item.id,
-									status: item.status,
-									auditType: item.auditType,
-									businessId: item.businessId,
-									businessType: item.businessType,
-									createTime: item.createTime,
-									initiatorName: item.initiatorName
-								}))
-								this.loading.todo = false
-							} else if (this.currentTopTab === 1) {
-								// 已办列表
-								this.loading.done = true
-								this.doneList = responseData.map(item => ({
-									auditName: item.auditName || '未知审核',
-									statusText: item.status === 1 ? '已通过' : '已驳回',
-									statusClass: item.status === 1 ? 'status-finish' : 'status-rejected',
-									id: item.id,
-									status: item.status,
-									auditType: item.auditType,
-									businessId: item.businessId,
-									businessType: item.businessType,
-									createTime: item.createTime,
-									initiatorName: item.initiatorName
-								}))
-								this.loading.done = false
-							} else if (this.currentTopTab === 2) {
-								// 我发起的列表
-								this.loading.myInitiate = true
-								this.myInitiateList = responseData.map(item => ({
-									auditName: item.auditName || '未知审核',
-									statusText: '待审核',
-									statusClass: 'status-createPending',
-									id: item.id,
-									status: item.status,
-									auditType: item.auditType,
-									businessId: item.businessId,
-									businessType: item.businessType,
-									createTime: item.createTime,
-									initiatorName: item.initiatorName
-								}))
-								this.loading.myInitiate = false
-							}
-								
-							// 这里不再需要更新badge,因为已经在getBadgeData中更新过了
-						} else {
-							uni.showToast({
-								title: '获取审核列表失败',
-								icon: 'none'
-							})
-						}
-					} catch (e) {
-						console.error('加载数据失败', e)
+					const res = await getPendingAuditList(params)
+					if (res.code === 200 && res.data) {
+						const map = res.data.map || {}
+						// 更新badge
+						this.topTabs[0].badge = res.data.pendingDataCount || 0
+						this.topTabs[1].badge = res.data.completedDataCount || 0
+						this.topTabs[2].badge = res.data.myInitiationsCount || 0
+
+						// 标准化映射函数
+						const mapPending = (arr = []) => arr.map(item => ({
+							auditName: item.auditName || '未知审核',
+							statusText: '待审核',
+							statusClass: 'status-createPending',
+							id: item.id,
+							status: item.status,
+							auditType: item.auditType,
+							businessId: item.businessId,
+							businessType: item.businessType,
+							createTime: item.createTime,
+							initiatorName: item.initiatorName
+						}))
+						const mapCompleted = (arr = []) => arr.map(item => ({
+							auditName: item.auditName || '未知审核',
+							statusText: item.status === 1 ? '已通过' : '已驳回',
+							statusClass: item.status === 1 ? 'status-finish' : 'status-rejected',
+							id: item.id,
+							status: item.status,
+							auditType: item.auditType,
+							businessId: item.businessId,
+							businessType: item.businessType,
+							createTime: item.createTime,
+							initiatorName: item.initiatorName
+						}))
+						const mapMyInitiations = (arr = []) => arr.map(item => ({
+							auditName: item.auditName || '未知审核',
+							statusText: '待审核',
+							statusClass: 'status-createPending',
+							id: item.id,
+							status: item.status,
+							auditType: item.auditType,
+							businessId: item.businessId,
+							businessType: item.businessType,
+							createTime: item.createTime,
+							initiatorName: item.initiatorName
+						}))
+
+						// 更新三个列表
+						this.loading.todo = true
+						this.loading.done = true
+						this.loading.myInitiate = true
+						const pendingRaw = map.pendingData || map['pendingData'] || map['pendingData '] || []
+						const completedRaw = map.completedData || map['completedData'] || map['completedData '] || []
+						const myInitiationsRaw = map.myInitiations || map['myInitiations'] || map['myInitiations '] || []
+						this.todoList = mapPending(pendingRaw)
+						this.doneList = mapCompleted(completedRaw)
+						this.myInitiateList = mapMyInitiations(myInitiationsRaw)
+						this.loading.todo = false
+						this.loading.done = false
+						this.loading.myInitiate = false
+						this.hasLoadedOnce = true
+						this.isInitializing = false
+					} else {
 						uni.showToast({
-							title: '加载数据失败',
+							title: '获取审核列表失败',
 							icon: 'none'
 						})
-						// 重置加载状态
-							this.loading.todo = false
-							this.loading.done = false
-							this.loading.myInitiate = false
-						}
-					},
-					// 格式化时间
-					formatTime(timeStr) {
-									if (!timeStr) return ''
-									const date = new Date(timeStr)
-									const year = date.getFullYear()
-									const month = String(date.getMonth() + 1).padStart(2, '0')
-									const day = String(date.getDate()).padStart(2, '0')
-									const hours = String(date.getHours()).padStart(2, '0')
-									const minutes = String(date.getMinutes()).padStart(2, '0')
-									return `${year}-${month}-${day} ${hours}:${minutes}`
-								},
-								getBusinessTypeLabel(businessType) {
-										if (!businessType || !this.processTemplate) {
-											return '未设置'
-										}
-										const dictItem = this.processTemplate.find(item => item.dictValue === businessType)
-										return dictItem ? dictItem.dictLabel : businessType
-										}
+						this.isInitializing = false
+					}
+				} catch (e) {
+					console.error('加载数据失败', e)
+					uni.showToast({
+						title: '加载数据失败',
+						icon: 'none'
+					})
+					// 重置加载状态
+					this.loading.todo = false
+					this.loading.done = false
+					this.loading.myInitiate = false
+					this.isInitializing = false
 				}
+			},
+			// 格式化时间
+			formatTime(timeStr) {
+				if (!timeStr) return ''
+				const date = new Date(timeStr)
+				const year = date.getFullYear()
+				const month = String(date.getMonth() + 1).padStart(2, '0')
+				const day = String(date.getDate()).padStart(2, '0')
+				const hours = String(date.getHours()).padStart(2, '0')
+				const minutes = String(date.getMinutes()).padStart(2, '0')
+				return `${year}-${month}-${day} ${hours}:${minutes}`
+			},
+			getBusinessTypeLabel(businessType) {
+				if (!businessType || !this.processTemplate) {
+					return '未设置'
+				}
+				const dictItem = this.processTemplate.find(item => item.dictValue === businessType)
+				return dictItem ? dictItem.dictLabel : businessType
+			}
+		}
 	}
 </script>
 <style lang="scss" scoped>
@@ -768,10 +753,10 @@ import utils from '@/utils/common.js'
 			box-sizing: border-box;
 
 			&.active {
-				background: rgba(56,139,255,0.15);
+				background: rgba(56, 139, 255, 0.15);
 				color: #ffffff;
 				color: #388BFF;
-				border: 1rpx solid #388BFF ;
+				border: 1rpx solid #388BFF;
 			}
 		}
 
@@ -1018,4 +1003,4 @@ import utils from '@/utils/common.js'
 			}
 		}
 	}
-</style>
+</style>

+ 71 - 15
pages_task/pointsSettings.vue

@@ -112,7 +112,7 @@
 </template>
 
 <script>
-import { checkIntegralLimit } from '@/api/task.js'
+import { getCompanyIntegralRanges } from '@/api/task.js'
 	import Step from '@/pages_task/components/step.vue'
 	import { addInfo} from '@/api/task.js';
 	export default {
@@ -175,7 +175,7 @@ import { checkIntegralLimit } from '@/api/task.js'
 								disabled: false
 							}))
 						}
-						this.checkIntegralLimitApi();//检查积分是否超出限制
+						this.getCompanyIntegralRanges();//检查积分是否超出限制
 					} catch (e) {
 						console.error('解析客户数据失败:', e)
 					}
@@ -192,17 +192,43 @@ import { checkIntegralLimit } from '@/api/task.js'
 			}
 		},
 		methods: {
-			checkIntegralLimitApi(){
+			getCompanyIntegralRanges(){
+				// 提取所有客户的id作为doctorIds数组,并确保都是数字类型
+				const doctorIds = this.customerList.map(customer => parseInt(customer.id) || 0);
 				let params = {
 					companyId: this.userInfo.companyId,
-					projectId: this.userInfo.projectId,
-					doctorId: this.userInfo.userId,
-					pointNum: this.totalIntegral
+					projectId: this.taskFormData.projectId,
+					doctorIds: doctorIds
 				}
-				checkIntegralLimit(params).then(res => {
-					if (res.code === 200 && res.data) {
-						// 将接口返回的数据映射为页面需要的格式
-						this.customerList = res.rows;
+				console.log('传递的doctorIds:', doctorIds);
+				getCompanyIntegralRanges(params).then(res => {
+					if (res.code === 200) {
+						const ranges = res.data || res.rows || [];
+						// 建立 doctorId -> 范围配置 的映射
+						const rangeMap = {};
+						ranges.forEach(item => {
+							const key = parseInt(item.doctorId || item.id);
+							if (!isNaN(key)) {
+								rangeMap[key] = item;
+							}
+						});
+						// 合并到现有客户列表,保留已有积分值
+						this.customerList = this.customerList.map(customer => {
+							const id = parseInt(customer.id) || 0;
+							const cfg = rangeMap[id] || {};
+							const min = typeof cfg.minIntegral === 'number' ? cfg.minIntegral : customer.minIntegral;
+							const max = typeof cfg.maxIntegral === 'number' ? cfg.maxIntegral : customer.maxIntegral;
+							return {
+								...customer,
+								level: cfg.levelName || customer.level,
+								minIntegral: min,
+								maxIntegral: max,
+								placeholder: (typeof min === 'number' && typeof max === 'number')
+									? `请输入${min}-${max}`
+									: (customer.placeholder || '请输入积分'),
+								disabled: cfg.available === false ? true : customer.disabled
+							}
+						});
 					}
 				})
 			},
@@ -221,10 +247,23 @@ import { checkIntegralLimit } from '@/api/task.js'
 				this.$set(customer, 'integral', '')
 			},
 			onIntegralInput(customer) {
-				// 积分输入验证
-				if (customer.integral && parseInt(customer.integral) < 0) {
-					this.$set(customer, 'integral', '0')
+				// 积分输入验证与范围限制
+				let val = parseInt(customer.integral);
+				if (isNaN(val)) {
+					this.$set(customer, 'integral', '');
+					return;
+				}
+				const hasMin = typeof customer.minIntegral === 'number';
+				const hasMax = typeof customer.maxIntegral === 'number';
+				if (hasMin && val < customer.minIntegral) {
+					val = customer.minIntegral;
+					uni.showToast({ icon: 'none', title: `不得少于${customer.minIntegral}` });
+				}
+				if (hasMax && val > customer.maxIntegral) {
+					val = customer.maxIntegral;
+					uni.showToast({ icon: 'none', title: `不得高于${customer.maxIntegral}` });
 				}
+				this.$set(customer, 'integral', String(val));
 			},
 			handlePrev() {
 				uni.navigateBack()
@@ -243,7 +282,7 @@ import { checkIntegralLimit } from '@/api/task.js'
 					// 验证积分是否为数字
 					const invalidCustomers = this.customerList.filter(customer => {
 						const integral = parseInt(customer.integral)
-						return isNaN(integral) || integral < 0
+						return isNaN(integral)
 					})
 
 					if (invalidCustomers.length > 0) {
@@ -253,6 +292,23 @@ import { checkIntegralLimit } from '@/api/task.js'
 						})
 						return
 					}
+					
+					// 验证是否在范围内
+					const outOfRange = this.customerList.find(customer => {
+						const v = parseInt(customer.integral);
+						if (typeof customer.minIntegral === 'number' && v < customer.minIntegral) return true;
+						if (typeof customer.maxIntegral === 'number' && v > customer.maxIntegral) return true;
+						return false;
+					});
+					if (outOfRange) {
+						const min = outOfRange.minIntegral;
+						const max = outOfRange.maxIntegral;
+						uni.showToast({
+							icon: 'none',
+							title: `${outOfRange.name || '该客户'}积分需在${min}-${max}`
+						});
+						return;
+					}
 
 					// 获取所有三个页面的数据
 					const taskFormDataStr = uni.getStorageSync('taskFormData')
@@ -748,4 +804,4 @@ import { checkIntegralLimit } from '@/api/task.js'
 	.h40 {
 		height: 40rpx;
 	}
-</style>
+</style>

+ 5 - 6
pages_task/selectCustomer.vue

@@ -65,6 +65,7 @@
 </template>
 
 <script>
+import { getAppliedList } from '@/api/task.js'
 	import Step from '@/pages_task/components/step.vue'
 	import { speakerList } from '@/api/speaker.js'
 	export default {
@@ -114,15 +115,13 @@
 			}
 		},
 		methods: {
-			
 			async loadCustomerData() {
 				try {
 					this.loading = true
-					let params = {
-						companyId: uni.getStorageSync('userInfo').companyId
-					}
-					// 调用speakerList接口获取数据
-					const res = await speakerList(params)
+					let  companyId=uni.getStorageSync('userInfo').companyId
+					
+					// getAppliedList 查询到 定义审核通过了的医生
+					const res = await getAppliedList(companyId)
 					if (res.code === 200 && res.rows) {
 						// 将接口返回的数据映射为页面需要的格式
 						this.customerList = res.rows;