修改提交签署协议的逻辑,先提交签名后提交协议

This commit is contained in:
WindowBird 2025-09-10 16:48:44 +08:00
parent feb12dee06
commit 8c16aef2a4
2 changed files with 73 additions and 37 deletions

View File

@ -33,33 +33,27 @@
></l-signature> ></l-signature>
</view> </view>
</uv-form-item> </uv-form-item>
<uv-button <view class="btn-signature">
customStyle="margin-top: 10px" <uv-button
text="清空签名" customStyle="margin-top: 10px"
type="error" text="清空签名"
@click="onClick('clear')" type="error"
></uv-button> @click="onClick('clear')"
<uv-button ></uv-button>
customStyle="margin-top: 10px" <uv-button
text="确认签名" customStyle="margin-top: 10px"
type="primary" text="确认签名"
@click="onClick('save')" type="primary"
></uv-button> @click="onClick('save')"
<uv-button ></uv-button>
customStyle="margin-top: 10px" <uv-button
text="提交协议" customStyle="margin-top: 10px"
type="primary" text="提交协议"
@click="submit" type="primary"
></uv-button> @click="submit"
></uv-button>
</view>
</uv-form> </uv-form>
<uv-action-sheet
ref="sexSelect"
:actions="actions"
description="如果选择保密会报错"
title="请选择性别"
@select="sexSelect"
>
</uv-action-sheet>
</view> </view>
</template> </template>
@ -75,7 +69,7 @@ export default {
code: '', code: '',
phone: '', phone: '',
location: '', location: '',
businessLicense: '', businessLicenseUrl: '',
signatureUrl: '', signatureUrl: '',
}, },
@ -106,6 +100,18 @@ export default {
message: '请填写正确的统一社会信用代码', message: '请填写正确的统一社会信用代码',
trigger: ['blur', 'change'], trigger: ['blur', 'change'],
}, },
// license: {
// type: 'string',
// required: true,
// message: '',
// trigger: ['blur', 'change'],
// },
// signature: {
// type: 'string',
// required: true,
// message: '',
// trigger: ['blur', 'change'],
// },
}, },
radio: '', radio: '',
switchVal: false, switchVal: false,
@ -114,15 +120,31 @@ export default {
methods: { methods: {
handleUploadSuccess(result) { handleUploadSuccess(result) {
console.log('图片上传成功:', result.url) console.log('图片上传成功:', result.url)
this.userInfo.businessLicense = result.url this.userInfo.businessLicenseUrl = result.url
uni.showToast({ uni.showToast({
title: '上传成功', title: '上传成功',
icon: 'success', icon: 'success',
}) })
}, },
// //
submit() { async submit() {
this.onClick('save') // await this.onClick('save')
if (this.userInfo.businessLicenseUrl === '') {
uni.showToast({
icon: 'error',
title: '请上传营业执照',
})
return
}
if (this.userInfo.signatureUrl === '') {
uni.showToast({
icon: 'error',
title: '请确认签名',
})
return
}
// catchthentrue // catchthentrue
this.$refs.form this.$refs.form
.validate() .validate()
@ -146,24 +168,26 @@ export default {
reset() { reset() {
this.$refs.form.resetFields() this.$refs.form.resetFields()
this.$refs.form.clearValidate() this.$refs.form.clearValidate()
this.userInfo.businessLicense = '' this.userInfo.businessLicenseUrl = ''
}, },
hideKeyboard() { hideKeyboard() {
uni.hideKeyboard() uni.hideKeyboard()
}, },
onClick(type) { async onClick(type) {
if (type === 'openSmooth') { if (type === 'openSmooth') {
this.openSmooth = !this.openSmooth this.openSmooth = !this.openSmooth
return return
} }
if (type === 'save') { if (type === 'save') {
this.$refs.signatureRef.canvasToTempFilePath({ await this.$refs.signatureRef.canvasToTempFilePath({
success: async res => { success: async res => {
// //
console.log(res.isEmpty) console.log('签名返回是否为空', res.isEmpty)
console.log('@@@@@') if (res.isEmpty) {
console.log('@@@@@', res) this.userInfo.signatureUrl = ''
return
}
// //
// H5 base64 // H5 base64
@ -172,10 +196,15 @@ export default {
this.userInfo.signatureUrl = await tempUrlToRealUrl(res.tempFilePath) this.userInfo.signatureUrl = await tempUrlToRealUrl(res.tempFilePath)
console.log('签名路径', this.userInfo.signatureUrl) console.log('签名路径', this.userInfo.signatureUrl)
console.log('签名上传成功')
uni.showToast({ title: '签名上传成功', icon: 'success' })
}, },
}) })
return return
} }
if (type === 'clear') {
this.userInfo.signatureUrl = ''
}
if (this.$refs.signatureRef) this.$refs.signatureRef[type]() if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
}, },
}, },
@ -186,4 +215,10 @@ export default {
.page { .page {
padding: 10rpx 30rpx; padding: 10rpx 30rpx;
} }
.btn-signature {
display: flex;
align-items: center;
justify-content: space-around;
}
</style> </style>

View File

@ -45,7 +45,8 @@ export const tempUrlToRealUrl = async (tempFilePath, options = {}) => {
const qiniuUrl = `${domain}/${uploadResult.key}` const qiniuUrl = `${domain}/${uploadResult.key}`
if (showToast) { if (showToast) {
uni.showToast({ title: '上传成功', icon: 'success' }) // console.log('签名上传成功')
// uni.showToast({ title: '签名上传成功', icon: 'success' })
} }
return qiniuUrl return qiniuUrl