From 2f2e11cc6b1ccfdf268b7058a8d579ea47f38fd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Fri, 5 Dec 2025 10:09:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=95=86=E6=88=B7=E5=88=86?= =?UTF-8?q?=E8=B4=A6=E4=BF=A1=E6=81=AF=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/customerService/addMer/index.vue | 2 +- .../customerService/applyLedgerMer/index.css | 15 +- .../customerService/applyLedgerMer/index.vue | 291 ++++++++++-------- 3 files changed, 169 insertions(+), 139 deletions(-) diff --git a/packages/customerService/addMer/index.vue b/packages/customerService/addMer/index.vue index 62f65966..376e5613 100644 --- a/packages/customerService/addMer/index.vue +++ b/packages/customerService/addMer/index.vue @@ -638,7 +638,7 @@ export default { ecQuery() { const storeValue = uni.getStorageSync('storeValue'); - if (!storeValue || !storeValue.ec_apply_id) { + if (!storeValue || !storeValue.contractId) { uni.showToast({ title: '请先提交申请', icon: 'none' diff --git a/packages/customerService/applyLedgerMer/index.css b/packages/customerService/applyLedgerMer/index.css index ac834248..364a5dab 100644 --- a/packages/customerService/applyLedgerMer/index.css +++ b/packages/customerService/applyLedgerMer/index.css @@ -218,12 +218,13 @@ page { .submit-section { margin-top: 40rpx; margin-bottom: 20rpx; + display: flex; } -.submit-btn { +.submit-btn, +.submit-btn1 { width: 100%; height: 80rpx; - background-color: #007aff; color: #fff; font-size: 28rpx; border-radius: 8rpx; @@ -232,6 +233,16 @@ page { box-shadow: 0 4rpx 12rpx rgba(0, 122, 255, 0.3); } +.submit-btn { + background-color: #007aff; + margin-left: 5rpx; +} + +.submit-btn1 { + background-color: #ff4016; + margin-right: 5rpx; +} + .submit-btn:active { background-color: #0051d5; transform: scale(0.98); diff --git a/packages/customerService/applyLedgerMer/index.vue b/packages/customerService/applyLedgerMer/index.vue index f6103c95..6513d14b 100644 --- a/packages/customerService/applyLedgerMer/index.vue +++ b/packages/customerService/applyLedgerMer/index.vue @@ -5,30 +5,32 @@ - + - + - + - + - + - + - +

附件上传(可选)

@@ -49,19 +51,21 @@
- + + - + 选择附件类型 - + {{ type.label }} @@ -95,10 +99,10 @@ export default { } ] // 文件数据(可选) }, - + // 弹窗控制 showFileAttachTypePopup: -1, - + // 文件附件类型选项(示例数据,实际应从API获取) fileAttachTypeOptions: [ { value: 'BUSINESS_LICENSE', label: '营业执照' }, @@ -110,122 +114,122 @@ export default { ] }; }, - + methods: { // 添加附件 - addFile() { - this.formData.fileData.push({ - attType: '', - attFileId: '', - attachName: '' + addFile() { + this.formData.fileData.push({ + attType: '', + attFileId: '', + attachName: '' + }); + }, + + // 选择文件附件类型 + selectFileAttachType(index, type) { + this.formData.fileData[index].attType = type.value; + this.showFileAttachTypePopup = -1; + }, + + // 获取附件类型标签 + getAttachTypeLabel(typeValue) { + if (!typeValue) return ''; + const option = this.fileAttachTypeOptions.find(type => type.value === typeValue); + return option ? option.label : ''; + }, + + // 删除附件 + removeFile(index) { + this.formData.fileData.splice(index, 1); + }, + + // 上传文件 + uploadFile(index) { + const fileData = this.formData.fileData[index]; + + // 检查是否选择了附件类型 + if (!fileData.attType) { + uni.showToast({ + title: '请先选择附件类型', + icon: 'none' }); - }, - - // 选择文件附件类型 - selectFileAttachType(index, type) { - this.formData.fileData[index].attType = type.value; - this.showFileAttachTypePopup = -1; - }, - - // 获取附件类型标签 - getAttachTypeLabel(typeValue) { - if (!typeValue) return ''; - const option = this.fileAttachTypeOptions.find(type => type.value === typeValue); - return option ? option.label : ''; - }, - - // 删除附件 - removeFile(index) { - this.formData.fileData.splice(index, 1); - }, - - // 上传文件 - uploadFile(index) { - const fileData = this.formData.fileData[index]; - - // 检查是否选择了附件类型 - if (!fileData.attType) { + return; + } + + // 调用 uni.chooseMessageFile API 选择文件 + uni.chooseMessageFile({ + count: 1, + type: 'file', + extension: ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png'], // 支持的文件类型 + success: (res) => { + const tempFile = res.tempFiles[0]; + console.log("选择的文件:", tempFile); + + // 设置文件名 + fileData.attachName = tempFile.name; + + // 显示上传中提示 + uni.showLoading({ + title: '上传中', + mask: true + }); + + // 直接使用uni.uploadFile上传文件 + uni.uploadFile({ + url: RequsetUrl + apiArr.upload, // 完整的上传接口URL + filePath: tempFile.path, // 文件路径 + name: 'file', // 文件对应的key,根据后端要求设置 + formData: { + attType: fileData.attType // 附件类型 + }, + header: { + Authorization: uni.getStorageSync("ctoken") // 添加认证信息 + }, + success: (uploadRes) => { + // 解析响应数据 + const res = JSON.parse(uploadRes.data); + + // 更新附件信息 + fileData.attFileId = res.data.respData.attFileId; + fileData.attachName = tempFile.name; // 文件名 + + uni.showToast({ + title: '上传成功', + icon: 'success' + }); + }, + fail: (error) => { + console.error('文件上传失败:', error); + uni.showToast({ + title: '上传失败', + icon: 'none' + }); + }, + complete: () => { + uni.hideLoading(); // 隐藏加载提示 + } + }); + }, + fail: (err) => { + console.error('选择文件失败:', err); uni.showToast({ - title: '请先选择附件类型', + title: '选择文件失败', icon: 'none' }); - return; } - - // 调用 uni.chooseMessageFile API 选择文件 - uni.chooseMessageFile({ - count: 1, - type: 'file', - extension: ['pdf', 'doc', 'docx', 'jpg', 'jpeg', 'png'], // 支持的文件类型 - success: (res) => { - const tempFile = res.tempFiles[0]; - console.log("选择的文件:", tempFile); - - // 设置文件名 - fileData.attachName = tempFile.name; - - // 显示上传中提示 - uni.showLoading({ - title: '上传中', - mask: true - }); - - // 直接使用uni.uploadFile上传文件 - uni.uploadFile({ - url: RequsetUrl + apiArr.upload, // 完整的上传接口URL - filePath: tempFile.path, // 文件路径 - name: 'file', // 文件对应的key,根据后端要求设置 - formData: { - attType: fileData.attType // 附件类型 - }, - header: { - Authorization: uni.getStorageSync("ctoken") // 添加认证信息 - }, - success: (uploadRes) => { - // 解析响应数据 - const res = JSON.parse(uploadRes.data); - - // 更新附件信息 - fileData.attFileId = res.data.respData.attFileId; - fileData.attachName = tempFile.name; // 文件名 - - uni.showToast({ - title: '上传成功', - icon: 'success' - }); - }, - fail: (error) => { - console.error('文件上传失败:', error); - uni.showToast({ - title: '上传失败', - icon: 'none' - }); - }, - complete: () => { - uni.hideLoading(); // 隐藏加载提示 - } - }); - }, - fail: (err) => { - console.error('选择文件失败:', err); - uni.showToast({ - title: '选择文件失败', - icon: 'none' - }); - } - }); - }, - + }); + }, + // 表单验证 validateForm() { const { formData } = this; - + // 验证必需字段 if (!formData.mch_id) { uni.showToast({ title: '请输入商户号', icon: 'none' }); return false; } - + if (!formData.contactMobile) { uni.showToast({ title: '请输入联系手机号', icon: 'none' }); return false; @@ -233,22 +237,49 @@ export default { uni.showToast({ title: '请输入有效的手机号', icon: 'none' }); return false; } - + return true; }, + ecQuery() { + // const storeValue = uni.getStorageSync('storeValue'); + // if (!storeValue || !storeValue.contractId) { + // uni.showToast({ + // title: '请先提交申请', + // icon: 'none' + // }); + // return; + // } + // const params = { + // contractId: storeValue.contractId + // } + request(apiArr.queryLedgerMer, "POST", {}).then(res => { + if (res.respData.splitStatus === 'VALID') { + uni.showToast({ + title: '审核通过', + icon: 'success' + }); + } else if (res.respData.contractStatus === 'INVALID') { + uni.showToast({ + title: '审核未通过', + icon: 'none' + }); + } + }) + }, + // 表单提交逻辑 submitForm() { // 验证表单 if (!this.validateForm()) { return; } - + uni.showLoading({ title: '提交中...', mask: true }); - + // 准备请求参数 const submitData = { mch_id: this.formData.mch_id, @@ -258,7 +289,7 @@ export default { eleContractNo: this.formData.eleContractNo, attachments: [] }; - + // 只添加有attFileId的文件到attachments const validFiles = this.formData.fileData.filter(file => file.attFileId); if (validFiles.length > 0) { @@ -268,28 +299,16 @@ export default { attachStorePath: file.attFileId })); } - + console.log('提交的数据:', submitData); - - // 调用applyLedgerMer接口提交数据 + request(apiArr.applyLedgerMer, "POST", submitData).then(res => { uni.hideLoading(); - - if (res && res.cmdRetCode === 'SUCCESS') { - uni.showToast({ - title: '提交成功', - icon: 'success' - }); - - setTimeout(() => { - uni.navigateBack(); - }, 1500); - } else { - uni.showToast({ - title: res?.retMsg || '提交失败', - icon: 'none' - }); - } + uni.showToast({ + title: '提交成功', + icon: 'success' + }); + uni.setStorageSync('storeValue', { fz_apply_id: res.resp_data.ec_apply_id }); }).catch(error => { uni.hideLoading(); console.error('提交失败:', error);