From 676c88eb0bc4f8328a8ad825cb1361231c97f020 Mon Sep 17 00:00:00 2001 From: zeyan <258785420@qq.com> Date: Tue, 5 Aug 2025 15:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/apiController/Contract.php | 32 + niucloud/app/api/route/route.php | 1 + .../api/apiService/ContractService.php | 262 +++++- uniapp/common/config.js | 4 +- .../pages-common/contract/contract_form.vue | 10 +- .../pages-common/contract/contract_sign.vue | 70 +- uniapp/pages-common/contract/my_contract.vue | 224 ++++- .../contract/staff-contract-sign.vue | 829 ++++++++++++++++++ uniapp/pages.json | 10 + uniapp/pages/common/profile/index.vue | 2 +- 10 files changed, 1407 insertions(+), 37 deletions(-) create mode 100644 uniapp/pages-common/contract/staff-contract-sign.vue diff --git a/niucloud/app/api/controller/apiController/Contract.php b/niucloud/app/api/controller/apiController/Contract.php index a9f94487..ef2438e3 100644 --- a/niucloud/app/api/controller/apiController/Contract.php +++ b/niucloud/app/api/controller/apiController/Contract.php @@ -152,6 +152,38 @@ class Contract extends BaseApiService } } + /** + * 获取员工合同签署表单配置 + * @param Request $request + * @return mixed + */ + public function getSignForm(Request $request) + { + $contract_id = $request->param('contract_id', 0); + + if (empty($contract_id)) { + return fail('合同ID不能为空'); + } + + $where = [ + 'contract_id' => $contract_id, + 'personnel_id' => $this->member_id + ]; + + try { + $service = new ContractService(); + $res = $service->getStaffContractSignForm($where); + + if (!$res['code']) { + return fail($res['msg']); + } + + return success($res['data']); + } catch (\Exception $e) { + return fail('获取签署表单失败:' . $e->getMessage()); + } + } + /** * 下载合同文件 * @param Request $request diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 11cd2eec..9766bf79 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -434,6 +434,7 @@ Route::group(function () { //合同管理 Route::get('contract/myContracts', 'apiController.Contract/myContracts'); Route::get('contract/detail', 'apiController.Contract/detail'); + Route::get('contract/signForm', 'apiController.Contract/getSignForm'); // 获取签署表单配置 Route::post('contract/sign', 'apiController.Contract/sign'); Route::get('contract/signStatus', 'apiController.Contract/signStatus'); Route::get('contract/download', 'apiController.Contract/download'); diff --git a/niucloud/app/service/api/apiService/ContractService.php b/niucloud/app/service/api/apiService/ContractService.php index 7a07df72..028e3a94 100644 --- a/niucloud/app/service/api/apiService/ContractService.php +++ b/niucloud/app/service/api/apiService/ContractService.php @@ -49,10 +49,12 @@ class ContractService extends BaseApiService } // 查询合同签订记录,关联合同表 + // type=1是给员工签的合同,关联的是school_personnel表 $contractSignModel = new ContractSign(); $list = $contractSignModel->alias('cs') ->join('school_contract c', 'cs.contract_id = c.id') ->where('cs.personnel_id', $personnel_id) + ->where('cs.type', 1) // 添加type=1条件,确保查询员工合同 ->where('cs.deleted_at', 0) ->where('c.deleted_at', 0) ->field([ @@ -114,6 +116,7 @@ class ContractService extends BaseApiService $contractSign = ContractSign::alias('cs') ->join('school_contract c', 'cs.contract_id = c.id') ->where('cs.id', $id) + ->where('cs.type', 1) // 添加type=1条件,确保查询员工合同 ->where('cs.deleted_at', 0) ->where('c.deleted_at', 0) ->field([ @@ -169,9 +172,11 @@ class ContractService extends BaseApiService try { $contract_id = $data['contract_id'] ?? 0; $personnel_id = $data['personnel_id'] ?? 0; - $sign_file = $data['sign_file'] ?? ''; + $form_data = $data['form_data'] ?? []; + $signature_image = $data['signature_image'] ?? ''; + $sign_file = $data['sign_file'] ?? ''; // 兼容旧版本 - if (empty($contract_id) || empty($personnel_id) || empty($sign_file)) { + if (empty($contract_id) || empty($personnel_id)) { $res['msg'] = '参数错误'; return $res; } @@ -182,6 +187,7 @@ class ContractService extends BaseApiService // 查询合同签订记录 $contractSign = ContractSign::where('contract_id', $contract_id) ->where('personnel_id', $personnel_id) + ->where('type', 1) // 添加type=1条件,确保查询员工合同 ->where('deleted_at', 0) ->find(); @@ -205,21 +211,30 @@ class ContractService extends BaseApiService return $res; } + // 验证必填字段(如果有表单数据) + if ($form_data) { + $this->validateStaffFormData($contract_id, $form_data); + } + // 生成签署后的合同文档 $generatedFile = null; - if ($sign_file) { - $generatedFile = $this->generateStaffSignedContract($contract_id, $personnel_id, $sign_file); + $useSignatureImage = $signature_image ?: $sign_file; // 优先使用新的signature_image字段 + + if ($useSignatureImage || $form_data) { + $generatedFile = $this->generateStaffSignedContract($contract_id, $personnel_id, $form_data, $useSignatureImage); } // 更新签订信息 $updateData = [ - 'sign_file' => $generatedFile ?: $sign_file, + 'status' => 2, // 已签署 + 'sign_file' => $generatedFile ?: $useSignatureImage, 'sign_time' => date('Y-m-d H:i:s'), + 'fill_data' => $form_data ? json_encode($form_data, JSON_UNESCAPED_UNICODE) : null, 'updated_at' => date('Y-m-d H:i:s') ]; - if ($generatedFile) { - $updateData['signature_image'] = $sign_file; + if ($useSignatureImage) { + $updateData['signature_image'] = $useSignatureImage; } $updateResult = ContractSign::where('id', $contractSign['id'])->update($updateData); @@ -237,6 +252,7 @@ class ContractService extends BaseApiService 'code' => 1, 'msg' => '签订成功', 'data' => [ + 'sign_id' => $contractSign['id'], 'contract_id' => $contract_id, 'sign_time' => $updateData['sign_time'], 'generated_file' => $generatedFile @@ -275,6 +291,7 @@ class ContractService extends BaseApiService $contractSign = ContractSign::where('contract_id', $contract_id) ->where('personnel_id', $personnel_id) + ->where('type', 1) // 添加type=1条件,确保查询员工合同 ->where('deleted_at', 0) ->field('id,sign_file,status,sign_time') ->find(); @@ -303,6 +320,98 @@ class ContractService extends BaseApiService return $res; } + /** + * 获取员工合同签署表单配置 + * @param array $where + * @return array + */ + public function getStaffContractSignForm(array $where) + { + $res = [ + 'code' => 0, + 'msg' => '获取签署表单失败', + 'data' => [] + ]; + + try { + $contract_id = $where['contract_id'] ?? 0; + $personnel_id = $where['personnel_id'] ?? 0; + + if (empty($contract_id) || empty($personnel_id)) { + $res['msg'] = '参数错误'; + return $res; + } + + // 查询合同签署记录 + $contractSign = ContractSign::alias('cs') + ->join('school_contract c', 'cs.contract_id = c.id') + ->where('cs.contract_id', $contract_id) + ->where('cs.personnel_id', $personnel_id) + ->where('cs.type', 1) // 员工合同 + ->where('cs.deleted_at', 0) + ->where('c.deleted_at', 0) + ->field([ + 'cs.id as sign_id', + 'cs.status', + 'cs.fill_data', + 'c.contract_name', + 'c.contract_type', + 'c.contract_content', + 'c.contract_template' + ]) + ->find(); + + if (!$contractSign) { + $res['msg'] = '合同不存在或无权限访问'; + return $res; + } + + $contractData = $contractSign->toArray(); + + // 获取表单字段配置 + $formFields = Db::table('school_document_data_source_config') + ->where('contract_id', $contract_id) + ->order('id', 'asc') + ->select() + ->toArray(); + + // 处理表单字段 + $processedFields = []; + foreach ($formFields as $field) { + $processedFields[] = [ + 'name' => str_replace(['{{', '}}'], '', $field['placeholder']), + 'placeholder' => str_replace(['{{', '}}'], '', $field['placeholder']), + 'field_type' => $field['field_type'] ?: 'text', + 'data_type' => $field['data_type'], + 'is_required' => $field['is_required'] ? true : false, + 'default_value' => $field['default_value'] ?: '', + 'sign_party' => $field['sign_party'] ?: null + ]; + } + + $res = [ + 'code' => 1, + 'msg' => '获取成功', + 'data' => [ + 'sign_id' => $contractData['sign_id'], + 'contract_id' => $contract_id, + 'contract_name' => $contractData['contract_name'], + 'contract_type' => $contractData['contract_type'], + 'contract_content' => $contractData['contract_content'] ?: '', + 'form_fields' => $processedFields, + 'contract_template_url' => $contractData['contract_template'] ? '/upload/' . $contractData['contract_template'] : '', + 'status' => $contractData['status'], + 'existing_data' => $contractData['fill_data'] ? json_decode($contractData['fill_data'], true) : [] + ] + ]; + + } catch (\Exception $e) { + $res['msg'] = '获取签署表单异常:' . $e->getMessage(); + } + + return $res; + } + /** * 下载合同文件 * @param array $where @@ -330,6 +439,7 @@ class ContractService extends BaseApiService ->join('school_contract c', 'cs.contract_id = c.id') ->where('cs.contract_id', $contract_id) ->where('cs.personnel_id', $personnel_id) + ->where('cs.type', 1) // 添加type=1条件,确保查询员工合同 ->where('cs.deleted_at', 0) ->where('c.deleted_at', 0) ->field([ @@ -367,14 +477,40 @@ class ContractService extends BaseApiService return $res; } + /** + * 验证员工表单数据 + * @param int $contractId + * @param array $formData + * @throws \Exception + */ + private function validateStaffFormData($contractId, $formData) + { + // 获取数据源配置 + $configs = Db::table('school_document_data_source_config') + ->where('contract_id', $contractId) + ->where('is_required', 1) + ->select() + ->toArray(); + + foreach ($configs as $config) { + $placeholder = str_replace(['{{', '}}'], '', $config['placeholder']); + $value = $formData[$placeholder] ?? ''; + + if (empty($value)) { + throw new \Exception("必填字段 {$placeholder} 不能为空"); + } + } + } + /** * 生成员工签署后的合同文档 * @param int $contractId * @param int $personnelId + * @param array $formData * @param string $signatureImage * @return string|null */ - private function generateStaffSignedContract($contractId, $personnelId, $signatureImage) + private function generateStaffSignedContract($contractId, $personnelId, $formData = [], $signatureImage = '') { try { // 获取合同模板信息 @@ -401,7 +537,7 @@ class ContractService extends BaseApiService } // 获取员工信息并准备填充数据 - $fillData = $this->prepareStaffFillData($contractId, $personnelId); + $fillData = $this->prepareStaffFillData($contractId, $personnelId, $formData); // 使用PhpWord处理模板 $templateProcessor = new TemplateProcessor($templatePath); @@ -440,27 +576,64 @@ class ContractService extends BaseApiService * 准备员工填充数据 * @param int $contractId * @param int $personnelId + * @param array $formData * @return array */ - private function prepareStaffFillData($contractId, $personnelId) + private function prepareStaffFillData($contractId, $personnelId, $formData = []) { $fillData = []; try { - // 获取员工信息 - $personnel = Db::table('school_personnel')->where('id', $personnelId)->find(); - if ($personnel) { - $fillData['员工姓名'] = $personnel['name'] ?? ''; - $fillData['员工编号'] = $personnel['employee_number'] ?? ''; - $fillData['员工电话'] = $personnel['phone'] ?? ''; - $fillData['员工邮箱'] = $personnel['email'] ?? ''; - $fillData['入职时间'] = $personnel['join_time'] ?? ''; + // 获取数据源配置 + $configs = Db::table('school_document_data_source_config') + ->where('contract_id', $contractId) + ->select() + ->toArray(); + + foreach ($configs as $config) { + $placeholder = str_replace(['{{', '}}'], '', $config['placeholder']); + $value = ''; + + switch ($config['data_type']) { + case 'database': + $value = $this->getStaffDataFromDatabase($config['table_name'], $config['field_name'], $personnelId); + break; + case 'system': + $value = $this->getSystemValue($config['system_function']); + break; + case 'user_input': + case 'signature': + case 'sign_img': + default: + $value = $formData[$placeholder] ?? $config['default_value'] ?? ''; + break; + } + + $fillData[$placeholder] = $value; } - // 添加系统信息 - $fillData['签署日期'] = date('Y-m-d'); - $fillData['签署时间'] = date('Y-m-d H:i:s'); - $fillData['合同编号'] = $contractId . date('Ymd') . $personnelId; + // 如果没有配置,使用默认填充逻辑 + if (empty($fillData)) { + // 获取员工信息 + $personnel = Db::table('school_personnel')->where('id', $personnelId)->find(); + if ($personnel) { + $fillData['员工姓名'] = $personnel['name'] ?? ''; + $fillData['员工编号'] = $personnel['employee_number'] ?? ''; + $fillData['员工电话'] = $personnel['phone'] ?? ''; + $fillData['员工邮箱'] = $personnel['email'] ?? ''; + $fillData['入职时间'] = $personnel['join_time'] ?? ''; + } + + // 添加系统信息 + $fillData['签署日期'] = date('Y-m-d'); + $fillData['签署时间'] = date('Y-m-d H:i:s'); + $fillData['合同编号'] = $contractId . date('Ymd') . $personnelId; + + // 合并表单数据 + if ($formData) { + $fillData = array_merge($fillData, $formData); + } + } } catch (\Exception $e) { // 记录错误日志但不中断流程 @@ -469,6 +642,51 @@ class ContractService extends BaseApiService return $fillData; } + /** + * 从数据库获取员工数据 + * @param string $tableName + * @param string $fieldName + * @param int $personnelId + * @return string + */ + private function getStaffDataFromDatabase($tableName, $fieldName, $personnelId) + { + try { + switch ($tableName) { + case 'school_personnel': + $data = Db::table('school_personnel')->where('id', $personnelId)->find(); + return $data[$fieldName] ?? ''; + default: + return ''; + } + } catch (\Exception $e) { + return ''; + } + } + + /** + * 获取系统值 + * @param string $systemFunction + * @return string + */ + private function getSystemValue($systemFunction) + { + switch ($systemFunction) { + case 'current_date': + return date('Y-m-d'); + case 'current_time': + return date('Y-m-d H:i:s'); + case 'current_year': + return date('Y'); + case 'current_month': + return date('m'); + case 'current_day': + return date('d'); + default: + return ''; + } + } + /** * 处理员工签名图片 * @param string $signatureImage diff --git a/uniapp/common/config.js b/uniapp/common/config.js index c98a2253..2459f37b 100644 --- a/uniapp/common/config.js +++ b/uniapp/common/config.js @@ -1,6 +1,6 @@ // 环境变量配置 -const env = 'development' -// const env = 'prod' +// const env = 'development' +const env = 'prod' const isMockEnabled = false // 默认禁用Mock优先模式,仅作为回退 const isDebug = false // 默认启用调试模式 const devurl = 'http://localhost:20080/api' diff --git a/uniapp/pages-common/contract/contract_form.vue b/uniapp/pages-common/contract/contract_form.vue index 5b00e656..f1f6a29b 100644 --- a/uniapp/pages-common/contract/contract_form.vue +++ b/uniapp/pages-common/contract/contract_form.vue @@ -120,13 +120,15 @@ export default { return { contractId: 0, studentId: 0, + personnelId: 0, contractName: '', contractInfo: {}, formFields: [], formData: {}, signatures: {}, submitting: false, - loading: false + loading: false, + isStaffMode: false // 标识是否为员工端模式 } }, @@ -153,9 +155,13 @@ export default { onLoad(options) { this.contractId = parseInt(options.contract_id) || 0 this.studentId = parseInt(options.student_id) || 0 + this.personnelId = parseInt(options.personnel_id) || 0 this.contractName = options.contractName ? decodeURIComponent(options.contractName) : '合同签署' - if (this.contractId && this.studentId) { + // 判断是员工端还是学员端 + this.isStaffMode = this.personnelId > 0 + + if (this.contractId && (this.studentId > 0 || this.personnelId > 0)) { this.loadSignForm() } else { uni.showToast({ diff --git a/uniapp/pages-common/contract/contract_sign.vue b/uniapp/pages-common/contract/contract_sign.vue index 01e7ab13..ad405d2a 100644 --- a/uniapp/pages-common/contract/contract_sign.vue +++ b/uniapp/pages-common/contract/contract_sign.vue @@ -125,6 +125,8 @@ export default { fieldName: '', // 字段名称 fieldPlaceholder: '', // 字段占位符 isFormField: false, // 是否来自表单字段 + isStaff: false, // 是否为员工端 + personnelId: 0, // 员工ID canvas: null, ctx: null, isDrawing: false, @@ -147,16 +149,22 @@ export default { } }, onLoad(options) { - // 兼容两种调用方式 + // 兼容多种调用方式 if (options.id) { // 原有的合同签署方式 this.contractId = parseInt(options.id) this.isFormField = false } if (options.contract_id) { - // 新的表单字段签名方式 + // 新的表单字段签名方式或员工端签名方式 this.contractId = parseInt(options.contract_id) - this.isFormField = true + this.isFormField = !options.isStaff // 员工端直接签名,不是表单字段 + } + + // 员工端模式 + if (options.isStaff === 'true') { + this.isStaff = true + this.personnelId = parseInt(options.personnel_id) || 0 } if (options.contractName) { @@ -373,6 +381,9 @@ export default { if (this.isFormField) { // 表单字段签名 - 返回签名数据 this.returnSignatureData() + } else if (this.isStaff) { + // 员工端合同签署 - 直接提交 + this.uploadStaffSignature() } else { // 原有合同签署 - 直接提交 this.uploadSignature() @@ -433,6 +444,59 @@ export default { } }, + // 员工端上传签名 + async uploadStaffSignature() { + if (!this.signatureImageUrl) { + uni.showToast({ + title: '签名生成失败,请重试', + icon: 'none' + }) + return + } + + this.submitting = true + + try { + // 先上传签名图片 + const uploadResult = await this.uploadSignatureFile() + + if (!uploadResult.success) { + throw new Error(uploadResult.message || '上传签名文件失败') + } + + // 提交员工端合同签名 + const response = await apiRoute.post('/contract/sign', { + contract_id: this.contractId, + sign_file: uploadResult.url + }) + + if (response.code === 1) { + uni.showToast({ + title: '合同签署成功', + icon: 'success', + duration: 2000 + }) + + setTimeout(() => { + // 返回到合同列表页面 + uni.navigateBack({ + delta: 1 + }) + }, 2000) + } else { + throw new Error(response.msg || '合同签署失败') + } + } catch (error) { + console.error('员工端合同签署失败:', error) + uni.showToast({ + title: error.message || '网络错误,请稍后重试', + icon: 'none' + }) + } finally { + this.submitting = false + } + }, + // 返回签名数据给表单页面 returnSignatureData() { if (!this.signatureImageUrl) { diff --git a/uniapp/pages-common/contract/my_contract.vue b/uniapp/pages-common/contract/my_contract.vue index 8ab22be3..7f9cd6a2 100644 --- a/uniapp/pages-common/contract/my_contract.vue +++ b/uniapp/pages-common/contract/my_contract.vue @@ -69,10 +69,21 @@ - - + + + + + + @@ -143,12 +154,17 @@ export default { limit: this.pageSize }) if (response.code === 1) { + console.log('API响应成功,完整数据:', response) + console.log('response.data:', response.data) + console.log('response.data.data:', response.data.data) const newContracts = response.data.data || [] + console.log('提取的合同数据:', newContracts) if (refresh) { this.contracts = newContracts } else { this.contracts = [...this.contracts, ...newContracts] } + console.log('更新后的contracts:', this.contracts) // 检查是否还有更多数据 this.hasMore = newContracts.length === this.pageSize @@ -199,10 +215,60 @@ export default { }, // 前往签名页面 - goToSign(contract) { - uni.navigateTo({ - url: `/pages-common/contract/contract_sign?id=${contract.id}&contractName=${encodeURIComponent(contract.contract_name)}` - }) + async goToSign(contract) { + try { + console.log('开始获取签署配置:', contract) + + // 先获取签署表单配置 + const response = await apiRoute.get('/contract/signForm', { + contract_id: contract.contract_id + }) + + console.log('获取签署配置响应:', response) + + if (response.code === 1) { + const formConfig = response.data + console.log('签署配置获取成功:', formConfig) + + // 构建跳转URL + const jumpUrl = `/pages-common/contract/staff-contract-sign?contract_id=${contract.contract_id}&contract_name=${encodeURIComponent(contract.contract_name)}&personnel_id=${this.getMemberId()}` + console.log('准备跳转到:', jumpUrl) + + // 跳转到合同签署页面,传递必要参数 + uni.navigateTo({ + url: jumpUrl, + success: (res) => { + console.log('页面跳转成功:', res) + }, + fail: (err) => { + console.error('页面跳转失败:', err) + uni.showToast({ + title: '页面跳转失败: ' + JSON.stringify(err), + icon: 'none', + duration: 3000 + }) + } + }) + } else { + console.error('获取签署配置失败:', response.msg) + uni.showToast({ + title: response.msg || '获取签署配置失败', + icon: 'none' + }) + } + } catch (error) { + console.error('获取签署配置异常:', error) + // 降级处理:跳转到原来的签名页面 + uni.navigateTo({ + url: `/pages-common/contract/contract_sign?contract_id=${contract.contract_id}&personnel_id=${this.getMemberId()}&contractName=${encodeURIComponent(contract.contract_name)}&isStaff=true` + }) + } + }, + + // 获取当前用户ID(员工ID) + getMemberId() { + const userInfo = uni.getStorageSync('userInfo') + return userInfo ? userInfo.member_id || userInfo.id : 0 }, // 判断是否需要显示签订按钮 @@ -211,6 +277,115 @@ export default { }, + // 预览合同 + async previewContract(contract) { + try { + // 获取合同详情,包含文件信息 + const response = await apiRoute.get('/contract/detail', { + id: contract.id + }) + + if (response.code === 1) { + const contractData = response.data + + // 跳转到合同预览页面 + uni.navigateTo({ + url: `/pages-common/contract/contract_preview?contract_id=${contract.contract_id}&contract_name=${encodeURIComponent(contract.contract_name)}&sign_file=${encodeURIComponent(contractData.sign_file || '')}&contract_template=${encodeURIComponent(contractData.contract_template || '')}` + }) + } else { + uni.showToast({ + title: response.msg || '获取合同信息失败', + icon: 'none' + }) + } + } catch (error) { + console.error('预览合同失败:', error) + uni.showToast({ + title: '预览合同失败', + icon: 'none' + }) + } + }, + + // 下载合同 + async downloadContract(contract) { + try { + uni.showLoading({ title: '获取下载链接...' }) + + const response = await apiRoute.get('/contract/download', { + contract_id: contract.contract_id + }) + + if (response.code === 1) { + const downloadData = response.data + + // 构建完整的下载URL + let downloadUrl = downloadData.download_url + if (downloadUrl && !downloadUrl.startsWith('http')) { + downloadUrl = 'http://localhost:20080' + (downloadUrl.startsWith('/') ? downloadUrl : '/' + downloadUrl) + } + + if (downloadUrl) { + // #ifdef MP-WEIXIN + // 小程序端下载文件 + uni.downloadFile({ + url: downloadUrl, + success: (res) => { + if (res.statusCode === 200) { + uni.openDocument({ + filePath: res.tempFilePath, + success: () => { + console.log('打开文档成功') + }, + fail: (err) => { + console.error('打开文档失败:', err) + uni.showToast({ + title: '文件打开失败', + icon: 'none' + }) + } + }) + } + }, + fail: (err) => { + console.error('下载失败:', err) + uni.showToast({ + title: '下载失败', + icon: 'none' + }) + } + }) + // #endif + + // #ifndef MP-WEIXIN + // H5端直接打开链接 + if (typeof window !== 'undefined') { + window.open(downloadUrl, '_blank') + } + // #endif + } else { + uni.showToast({ + title: '文件链接不存在', + icon: 'none' + }) + } + } else { + uni.showToast({ + title: response.msg || '获取下载链接失败', + icon: 'none' + }) + } + } catch (error) { + console.error('下载合同失败:', error) + uni.showToast({ + title: '下载合同失败', + icon: 'none' + }) + } finally { + uni.hideLoading() + } + }, + // 格式化日期 formatDate(dateString) { if (!dateString) return '-' @@ -347,7 +522,7 @@ export default { .contract-actions { margin-top: 24rpx; padding-top: 24rpx; - border-top: 1rpx solid #f0f0f0; + border-top: 1rpx solid #444; .sign-btn { width: 100%; @@ -366,6 +541,41 @@ export default { background-color: #22b39a; } } + + .signed-actions { + display: flex; + gap: 16rpx; + + .preview-btn, .download-btn { + flex: 1; + height: 64rpx; + border: none; + border-radius: 8rpx; + font-size: 26rpx; + font-weight: 500; + display: flex; + align-items: center; + justify-content: center; + } + + .preview-btn { + background-color: #409eff; + color: #fff; + + &:active { + background-color: #337ecc; + } + } + + .download-btn { + background-color: #67c23a; + color: #fff; + + &:active { + background-color: #529b2e; + } + } + } } /* 加载状态 */ diff --git a/uniapp/pages-common/contract/staff-contract-sign.vue b/uniapp/pages-common/contract/staff-contract-sign.vue new file mode 100644 index 00000000..fc7545da --- /dev/null +++ b/uniapp/pages-common/contract/staff-contract-sign.vue @@ -0,0 +1,829 @@ + + + + + + \ No newline at end of file diff --git a/uniapp/pages.json b/uniapp/pages.json index 3609ff97..b43e5811 100644 --- a/uniapp/pages.json +++ b/uniapp/pages.json @@ -630,6 +630,16 @@ "backgroundColor": "#181A20" } }, + { + "path": "contract/staff-contract-sign", + "style": { + "navigationBarTitleText": "员工合同签署", + "navigationStyle": "custom", + "navigationBarBackgroundColor": "#1a1a1a", + "navigationBarTextStyle": "white", + "backgroundColor": "#1a1a1a" + } + }, { "path": "profile/personal_info", "style": { diff --git a/uniapp/pages/common/profile/index.vue b/uniapp/pages/common/profile/index.vue index 51c0f855..0ce0b7a9 100644 --- a/uniapp/pages/common/profile/index.vue +++ b/uniapp/pages/common/profile/index.vue @@ -57,7 +57,7 @@ title: '我的合同', icon: 'compose', desc: '查看签署合同', - path: '/pages-common/contract/list' + path: '/pages-common/contract/my_contract' }, { title: '我的工资',