diff --git a/admin/src/app/api/service_logs.js b/admin/src/app/api/service_logs.js new file mode 100644 index 00000000..9eec98b6 --- /dev/null +++ b/admin/src/app/api/service_logs.js @@ -0,0 +1,13 @@ +import request from '@/utils/request' + + +// USER_CODE_BEGIN -- service_logs +/** + * + * @param params + * @returns + */ +export function getServiceLogsList(params) { + return request.get(`service_logs/service_logs`, {params}) +} + diff --git a/admin/src/app/views/customer_resources/components/UserProfile.vue b/admin/src/app/views/customer_resources/components/UserProfile.vue new file mode 100644 index 00000000..666f903a --- /dev/null +++ b/admin/src/app/views/customer_resources/components/UserProfile.vue @@ -0,0 +1,141 @@ + + + + + + + + + {{ user.name }} + ID: {{ user.id }} + 电话: {{ user.phone }} + + + + + + + + + + + + + + + + 六要素信息 + + 需求购买力:{{ info.purchasePower }} + 认知理念:{{ info.knowledge }} + 距离:{{ info.distance }} + + + 可谈上课时间:{{ info.canTalkDate }} + 承诺到访时间:{{ info.promisedVisitDate }} + 实际到访时间:{{ info.actualVisitDate }} + + + 电话后的意向程度:{{ info.phoneIntention }} + 是否关单: + {{ info.isClosed ? '是' : '否' }} + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/admin/src/app/views/customer_resources/customer_resources.vue b/admin/src/app/views/customer_resources/customer_resources.vue index fd0a598b..e8d0d138 100644 --- a/admin/src/app/views/customer_resources/customer_resources.vue +++ b/admin/src/app/views/customer_resources/customer_resources.vue @@ -127,6 +127,9 @@ 客户信息修改记录 + + 客户详情 + {{ t('edit') }} @@ -180,6 +183,7 @@ + @@ -195,6 +199,8 @@ import Fp from '@/app/views/customer_resources/components/fp.vue' import Order from '@/app/views/order_table/components/order-table-edit.vue' import Tc from '@/app/views/tc_dialog/tc_dialog.vue' + import User from '@/app/views/customer_resources/components/UserProfile.vue' + import { ArrowDown } from '@element-plus/icons-vue' import { getMemberLabelAll } from '@/app/api/member' @@ -244,6 +250,9 @@ case 'deleteEvent': deleteEvent(row.id) break + case 'UserProfile': + UserProfile(row) + break } } @@ -276,7 +285,8 @@ editOrderTableDialog.value.setFormData(row) editOrderTableDialog.value.showDialog = true } - + + const TcCustomerResourcesDialog : Record | null = ref(null) const tcEvent = (row : any) => { @@ -290,8 +300,13 @@ } + const UserProfileDialog : Record | null = ref(null) - + const UserProfile = (row : any) => { + UserProfileDialog.value.setFormData(row) + UserProfileDialog.value.showDialog = true + } + const searchFormRef = ref() // 选中数据 diff --git a/admin/src/app/views/school_approval/process/index.vue b/admin/src/app/views/school_approval/process/index.vue index e1e95ea6..cad1d932 100644 --- a/admin/src/app/views/school_approval/process/index.vue +++ b/admin/src/app/views/school_approval/process/index.vue @@ -52,9 +52,9 @@ > - + - + @@ -202,14 +202,14 @@ {{ state.detailDialog.info.process_name }} - - {{ state.detailDialog.info.applicant_id }} + + {{ state.detailDialog.info.applicant_name }} {{ state.detailDialog.info.application_time }} - - {{ state.detailDialog.info.current_approver_id }} + + {{ state.detailDialog.info.current_approver_name }} @@ -237,7 +237,7 @@ {{ '参与者' + (index + 1) }} - {{ '参与者ID' }}:{{ node.participant_id }} + {{ '参与者' }}:{{ node.name }} {{ '顺序' }}:{{ node.sequence }} diff --git a/admin/src/app/views/service_logs/service_logs.vue b/admin/src/app/views/service_logs/service_logs.vue new file mode 100644 index 00000000..72cad48a --- /dev/null +++ b/admin/src/app/views/service_logs/service_logs.vue @@ -0,0 +1,165 @@ + + + + + {{ pageName }} + + + + + + + + + + + + + + + + {{ + t('search') + }} + {{ + t('reset') + }} + + + + + + + + {{ + !studentCourseUsageTable.loading ? t('emptyData') : '' + }} + + + + + + + + + + + + 是 + 否 + + + + + + + + + + + + + + + + + + + + + diff --git a/admin/src/app/views/student_course_usage/student_course_usage.vue b/admin/src/app/views/student_course_usage/student_course_usage.vue index 98cbf43d..7bec15fc 100644 --- a/admin/src/app/views/student_course_usage/student_course_usage.vue +++ b/admin/src/app/views/student_course_usage/student_course_usage.vue @@ -3,9 +3,6 @@ {{ pageName }} - - {{ t('addStudentCourseUsage') }} - - + - - - - - - + + + + + + + + + {{ @@ -58,41 +58,23 @@ !studentCourseUsageTable.loading ? t('emptyData') : '' }} - - - - - - - - - {{ - t('edit') - }} - {{ - t('delete') - }} - - + + + + + + + + + + + + + + + + + service->getList($where, (int)$page, (int)$limit); - + return success($data); } @@ -72,12 +72,12 @@ class Process extends BaseAdminController if (empty($id)) { return fail('参数错误'); } - + $info = $this->service->getInfo((int)$id); if (empty($info)) { return fail('审批流程不存在'); } - + return success($info); } @@ -88,19 +88,19 @@ class Process extends BaseAdminController { $data = Request::only(['process_name', 'remarks']); $config_id = input('config_id', 0); - + // 验证参数 if (empty($data['process_name'])) { return fail('流程名称不能为空'); } - + if (empty($config_id)) { return fail('请选择审批流配置'); } - + // 设置申请人ID $data['applicant_id'] = $this->request->uid(); - + try { $process_id = $this->service->create($data, $config_id); return success(['id' => $process_id]); @@ -117,15 +117,15 @@ class Process extends BaseAdminController $process_id = input('process_id', 0); $status = input('status', ''); $remarks = input('remarks', ''); - + if (empty($process_id)) { return fail('参数错误'); } - + if (empty($status) || !in_array($status, ['approved', 'rejected'])) { return fail('请选择审批结果'); } - + try { $result = $this->service->approve((int)$process_id, $this->request->uid(), $status, $remarks); return success($result); @@ -140,11 +140,11 @@ class Process extends BaseAdminController public function cancel() { $process_id = input('process_id', 0); - + if (empty($process_id)) { return fail('参数错误'); } - + try { $result = $this->service->cancel($process_id, $this->request->uid()); return success($result); @@ -152,4 +152,4 @@ class Process extends BaseAdminController return fail($e->getMessage()); } } -} \ No newline at end of file +} diff --git a/niucloud/app/adminapi/controller/service_logs/ServiceLogs.php b/niucloud/app/adminapi/controller/service_logs/ServiceLogs.php new file mode 100644 index 00000000..f420285b --- /dev/null +++ b/niucloud/app/adminapi/controller/service_logs/ServiceLogs.php @@ -0,0 +1,39 @@ +request->params([ + ["name",""], + ["score",""] + ]); + return success((new ServiceLogsService())->getPage($data)); + } + +} diff --git a/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php b/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php index c9005c68..0ccad9ac 100644 --- a/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php +++ b/niucloud/app/adminapi/controller/student_course_usage/StudentCourseUsage.php @@ -28,9 +28,9 @@ class StudentCourseUsage extends BaseAdminController */ public function lists(){ $data = $this->request->params([ - ["student_course_id",""], - ["used_hours",""], - ["usage_date",""] + ["emergency_contact",""], + ["student_name",""], + ["contact_phone",""] ]); return success((new StudentCourseUsageService())->getPage($data)); } @@ -87,5 +87,5 @@ class StudentCourseUsage extends BaseAdminController return success('DELETE_SUCCESS'); } - + } diff --git a/niucloud/app/adminapi/route/service_logs.php b/niucloud/app/adminapi/route/service_logs.php new file mode 100644 index 00000000..e4d15e1e --- /dev/null +++ b/niucloud/app/adminapi/route/service_logs.php @@ -0,0 +1,31 @@ +middleware([ + AdminCheckToken::class, + AdminCheckRole::class, + AdminLog::class +]); +// USER_CODE_END -- service diff --git a/niucloud/app/model/service_logs/ServiceLogs.php b/niucloud/app/model/service_logs/ServiceLogs.php new file mode 100644 index 00000000..b0d2aafa --- /dev/null +++ b/niucloud/app/model/service_logs/ServiceLogs.php @@ -0,0 +1,44 @@ +pageQuery($search_model, function ($item, $key) { $item = $this->makeUp($item); + + $sixSpeed = new SixSpeed(); + $data = $sixSpeed->where(['resource_id' => $item['id']])->findOrEmpty()->toArray(); + $item['six'] = $data; }); } diff --git a/niucloud/app/service/admin/service_logs/ServiceLogsService.php b/niucloud/app/service/admin/service_logs/ServiceLogsService.php new file mode 100644 index 00000000..447f66fb --- /dev/null +++ b/niucloud/app/service/admin/service_logs/ServiceLogsService.php @@ -0,0 +1,60 @@ +model = new ServiceLogs(); + } + + /** + * 获取学员课时消费记录列表 + * @return array + */ + public function getPage(array $data = []) + { + $where = []; + if($data['name']){ + $where[] = ['b.name','like','%'.$data['name'].'%']; + } + + if($data['score']){ + $where[] = ['a.score','=',$data['score']]; + } + + $search_model = $this->model + ->alias("a") + ->join(['school_customer_resources' => 'b'],'a.resource_id = b.id','left') + ->join(['school_personnel' => 'c'],'a.staff_id = c.id','left') + ->join(['school_service' => 'd'],'a.service_id = d.id','left') + ->where($where) + ->field("a.*,b.name,c.name as staff_name,d.service_name,d.customer_confirmation") + ->order("a.id desc"); + $list = $this->pageQuery($search_model); + return $list; + } + + +} diff --git a/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php b/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php index 82435bbe..b4d7fc7d 100644 --- a/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php +++ b/niucloud/app/service/admin/student_course_usage/StudentCourseUsageService.php @@ -31,15 +31,31 @@ class StudentCourseUsageService extends BaseAdminService /** * 获取学员课时消费记录列表 - * @param array $where * @return array */ - public function getPage(array $where = []) + public function getPage(array $data = []) { - $field = 'id,student_course_id,used_hours,usage_date,created_at,updated_at'; - $order = 'id desc'; - - $search_model = $this->model->withSearch(["id","student_course_id","used_hours","usage_date"], $where)->field($field)->order($order); + $where = []; + if($data['emergency_contact']){ + $where[] = ['c.emergency_contact','like','%'.$data['emergency_contact'].'%']; + } + + if($data['student_name']){ + $where[] = ['c.name','like','%'.$data['student_name'].'%']; + } + + if($data['contact_phone']){ + $where[] = ['c.contact_phone','=',$data['contact_phone']]; + } + + $search_model = $this->model + ->alias("a") + ->join(['school_student_courses' => 'b'],'a.student_course_id = b.id','left') + ->join(['school_student' => 'c'],'b.student_id = c.id','left') + ->join(['school_course' => 'd'],'b.course_id = d.id','left') + ->where($where) + ->field("a.*,c.name as student_name,c.emergency_contact,d.course_name,b.total_hours,ROUND(b.total_hours - b.use_total_hours) as sy_time,ROUND(b.gift_hours - b.use_gift_hours) as gift_hours") + ->order("a.id desc"); $list = $this->pageQuery($search_model); return $list; } @@ -94,6 +110,6 @@ class StudentCourseUsageService extends BaseAdminService return $res; } - + } diff --git a/niucloud/app/service/school_approval/SchoolApprovalProcessService.php b/niucloud/app/service/school_approval/SchoolApprovalProcessService.php index f79a28d2..68f0e735 100644 --- a/niucloud/app/service/school_approval/SchoolApprovalProcessService.php +++ b/niucloud/app/service/school_approval/SchoolApprovalProcessService.php @@ -3,6 +3,7 @@ declare(strict_types=1); namespace app\service\school_approval; +use app\model\personnel\Personnel; use app\model\school_approval\SchoolApprovalConfig; use app\model\school_approval\SchoolApprovalConfigNode; use app\model\school_approval\SchoolApprovalParticipants; @@ -26,25 +27,28 @@ class SchoolApprovalProcessService */ public function getList(array $where = [], int $page = 1, int $limit = 10): array { - $field = 'id, process_name, applicant_id, application_time, current_approver_id, approval_status, approval_time, remarks, created_at, updated_at'; - $order = 'id desc'; - + $field = 'a.*,b.name as applicant_name,c.name as current_approver_name'; + $order = 'a.id desc'; + $list = (new SchoolApprovalProcess()) + ->alias("a") + ->join(['school_personnel' => 'b'],'a.applicant_id = b.id','left') + ->join(['school_personnel' => 'c'],'a.current_approver_id = c.id','left') ->where($where) ->field($field) ->order($order) ->page($page, $limit) ->select() ->toArray(); - + $count = (new SchoolApprovalProcess())->where($where)->count(); - + return [ 'list' => $list, 'count' => $count ]; } - + /** * 获取审批流程详情 * @param int $id @@ -52,14 +56,26 @@ class SchoolApprovalProcessService */ public function getInfo(int $id): array { - $info = (new SchoolApprovalProcess())->with(['participants'])->where(['id' => $id])->find(); + $info = (new SchoolApprovalProcess()) + ->alias("a") + ->join(['school_personnel' => 'b'],'a.applicant_id = b.id','left') + ->join(['school_personnel' => 'c'],'a.current_approver_id = c.id','left') + ->with(['participants']) + ->where(['a.id' => $id]) + ->field('a.*,b.name as applicant_name,c.name as current_approver_name') + ->find(); if (empty($info)) { return []; } - - return $info->toArray(); + $info = $info->toArray(); + $Personnel = new Personnel(); + foreach ($info['participants'] as $key => $value) { + $info['participants'][$key]['name'] = $Personnel->where(['id' => $value['participant_id']])->value('name'); + } + + return $info; } - + /** * 创建审批流程 * @param array $data @@ -76,7 +92,7 @@ class SchoolApprovalProcessService if (empty($config_info)) { throw new Exception('审批配置不存在'); } - + // 创建审批流程 $process = [ 'process_name' => $data['process_name'], @@ -86,9 +102,9 @@ class SchoolApprovalProcessService 'approval_status' => SchoolApprovalProcess::STATUS_PENDING, 'remarks' => $data['remarks'] ?? '' ]; - + $process_id = (new SchoolApprovalProcess())->insertGetId($process); - + // 创建审批参与人 $participants = []; foreach ($config_info['nodes'] as $sequence => $node) { @@ -103,22 +119,22 @@ class SchoolApprovalProcessService ]; } } - + if (!empty($participants)) { (new SchoolApprovalParticipants())->insertAll($participants); - + // 更新当前审批人为第一个审批人 $first_participant = (new SchoolApprovalParticipants()) ->where(['process_id' => $process_id]) ->order('sequence', 'asc') ->find(); - + if (!empty($first_participant)) { (new SchoolApprovalProcess())->where(['id' => $process_id]) ->update(['current_approver_id' => $first_participant['participant_id']]); } } - + Db::commit(); return $process_id; } catch (\Exception $e) { @@ -126,7 +142,7 @@ class SchoolApprovalProcessService throw new Exception($e->getMessage()); } } - + /** * 审批 * @param int $process_id 流程ID @@ -145,17 +161,17 @@ class SchoolApprovalProcessService if (empty($process_info)) { throw new Exception('审批流程不存在'); } - + // 检查是否当前审批人 if ($process_info['current_approver_id'] != $approver_id) { throw new Exception('您不是当前审批人'); } - + // 检查流程状态 if ($process_info['approval_status'] != SchoolApprovalProcess::STATUS_PENDING) { throw new Exception('该审批流程已完成'); } - + // 获取当前审批节点 $current_participant = (new SchoolApprovalParticipants()) ->where([ @@ -164,18 +180,18 @@ class SchoolApprovalProcessService 'status' => SchoolApprovalParticipants::STATUS_PENDING ]) ->find(); - + if (empty($current_participant)) { throw new Exception('审批节点信息错误'); } - + // 更新当前审批人状态 (new SchoolApprovalParticipants())->where(['id' => $current_participant['id']]) ->update([ 'status' => $status, 'remarks' => $remarks ]); - + // 如果拒绝,直接更新整个流程状态为拒绝 if ($status == SchoolApprovalParticipants::STATUS_REJECTED) { (new SchoolApprovalProcess())->where(['id' => $process_id]) @@ -184,11 +200,11 @@ class SchoolApprovalProcessService 'approval_time' => time(), 'remarks' => $remarks ]); - + Db::commit(); return true; } - + // 检查当前节点是否需要会签 $same_sequence_participants = (new SchoolApprovalParticipants()) ->where([ @@ -197,14 +213,14 @@ class SchoolApprovalProcessService 'status' => SchoolApprovalParticipants::STATUS_PENDING ]) ->select(); - + // 如果是会签且还有其他人未审批,则等待 if ($current_participant['sign_type'] == SchoolApprovalParticipants::SIGN_TYPE_AND && !$same_sequence_participants->isEmpty()) { // 不做任何处理,等待其他人审批 Db::commit(); return true; } - + // 获取下一个审批节点 $next_participant = (new SchoolApprovalParticipants()) ->where([ @@ -213,7 +229,7 @@ class SchoolApprovalProcessService ]) ->order('sequence', 'asc') ->find(); - + if (empty($next_participant)) { // 没有下一个审批人,流程结束,标记为已通过 (new SchoolApprovalProcess())->where(['id' => $process_id]) @@ -226,7 +242,7 @@ class SchoolApprovalProcessService (new SchoolApprovalProcess())->where(['id' => $process_id]) ->update(['current_approver_id' => $next_participant['participant_id']]); } - + Db::commit(); return true; } catch (\Exception $e) { @@ -234,7 +250,7 @@ class SchoolApprovalProcessService throw new Exception($e->getMessage()); } } - + /** * 撤销审批流程 * @param int $process_id 流程ID @@ -251,17 +267,17 @@ class SchoolApprovalProcessService if (empty($process_info)) { throw new Exception('审批流程不存在'); } - + // 检查是否申请人 if ($process_info['applicant_id'] != $applicant_id) { throw new Exception('您不是该流程的申请人'); } - + // 检查流程状态 if ($process_info['approval_status'] != SchoolApprovalProcess::STATUS_PENDING) { throw new Exception('该审批流程已完成,无法撤销'); } - + // 更新流程状态为已拒绝(撤销) (new SchoolApprovalProcess())->where(['id' => $process_id]) ->update([ @@ -269,7 +285,7 @@ class SchoolApprovalProcessService 'approval_time' => time(), 'remarks' => '申请人撤销' ]); - + // 更新所有待审批节点为已拒绝 (new SchoolApprovalParticipants())->where([ 'process_id' => $process_id, @@ -278,7 +294,7 @@ class SchoolApprovalProcessService 'status' => SchoolApprovalParticipants::STATUS_REJECTED, 'remarks' => '申请人撤销' ]); - + Db::commit(); return true; } catch (\Exception $e) { @@ -286,4 +302,4 @@ class SchoolApprovalProcessService throw new Exception($e->getMessage()); } } -} \ No newline at end of file +}
ID: {{ user.id }}
电话: {{ user.phone }}