【功能优化】PAY:微信支付使用 certSerialNo 替代 privateCertContent

pull/487/head
YunaiV 2024-07-25 23:46:07 +08:00
parent 145226deed
commit 188b4033ba
1 changed files with 9 additions and 48 deletions

View File

@ -52,9 +52,6 @@
v-model="formData.config.mchKey"
placeholder="请输入商户密钥"
clearable
:style="{ width: '100%' }"
type="textarea"
:autosize="{ minRows: 8, maxRows: 8 }"
/>
</el-form-item>
<el-form-item
@ -92,9 +89,6 @@
v-model="formData.config.apiV3Key"
placeholder="请输入 API V3 密钥"
clearable
:style="{ width: '100%' }"
type="textarea"
:autosize="{ minRows: 8, maxRows: 8 }"
/>
</el-form-item>
<el-form-item
@ -126,35 +120,13 @@
</el-button>
</el-upload>
</el-form-item>
<el-form-item
label-width="180px"
label="apiclient_cert.pem证书"
prop="config.privateCertContent"
>
<el-form-item label-width="180px" label="证书序列号" prop="config.certSerialNo">
<el-input
v-model="formData.config.privateCertContent"
type="textarea"
placeholder="请上传apiclient_cert.pem证书"
readonly
:autosize="{ minRows: 8, maxRows: 8 }"
:style="{ width: '100%' }"
v-model="formData.config.certSerialNo"
placeholder="请输入证书序列号"
clearable
/>
</el-form-item>
<el-form-item label-width="180px" label="" prop="privateCertContentFile">
<el-upload
ref="privateCertContentFile"
:limit="1"
accept=".pem"
action=""
:before-upload="pemFileBeforeUpload"
:http-request="privateCertContentUpload"
>
<el-button type="primary">
<Icon icon="ep:upload" class="mr-5px" />
点击上传
</el-button>
</el-upload>
</el-form-item>
</div>
<el-form-item label-width="180px" label="备注" prop="remark">
<el-input v-model="formData.remark" :style="{ width: '100%' }" />
@ -193,7 +165,7 @@ const formData = ref<any>({
mchKey: '',
keyContent: '',
privateKeyContent: '',
privateCertContent: '',
certSerialNo: '',
apiV3Key: ''
}
})
@ -210,8 +182,8 @@ const formRules = {
'config.privateKeyContent': [
{ required: true, message: '请上传 apiclient_key.pem 证书', trigger: 'blur' }
],
'config.privateCertContent': [
{ required: true, message: '请上传 apiclient_cert.pem证 书', trigger: 'blur' }
'config.certSerialNo': [
{ required: true, message: '请输入证书序列号', trigger: 'blur' }
],
'config.apiV3Key': [{ required: true, message: '请上传 api V3 密钥值', trigger: 'blur' }]
}
@ -278,7 +250,7 @@ const resetForm = (appId, code) => {
mchKey: '',
keyContent: '',
privateKeyContent: '',
privateCertContent: '',
certSerialNo: '',
apiV3Key: ''
}
}
@ -286,7 +258,7 @@ const resetForm = (appId, code) => {
}
/**
* apiclient_cert.p12apiclient_cert.pemapiclient_key.pem 上传前的校验
* apiclient_cert.p12apiclient_key.pem 上传前的校验
*/
const fileBeforeUpload = (file, fileAccept) => {
let format = '.' + file.name.split('.')[1]
@ -321,17 +293,6 @@ const privateKeyContentUpload = async (event) => {
readFile.readAsText(event.file)
}
/**
* 读取 apiclient_cert.pem privateCertContent 字段
*/
const privateCertContentUpload = async (event) => {
const readFile = new FileReader()
readFile.onload = (e: any) => {
formData.value.config.privateCertContent = e.target.result
}
readFile.readAsText(event.file)
}
/**
* 读取 apiclient_cert.p12 keyContent 字段
*/