2025-09-10 14:07:14 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="page">
|
|
|
|
|
|
<uv-form ref="form" :model="userInfo" :rules="rules" labelPosition="left" labelWidth="auto">
|
|
|
|
|
|
<uv-form-item borderBottom label="电话:" prop="phone">
|
|
|
|
|
|
<uv-input v-model="userInfo.phone" border="none"></uv-input>
|
|
|
|
|
|
</uv-form-item>
|
|
|
|
|
|
<uv-form-item borderBottom label="地址:" prop="location">
|
|
|
|
|
|
<uv-input v-model="userInfo.location" border="none"></uv-input>
|
|
|
|
|
|
</uv-form-item>
|
|
|
|
|
|
<uv-form-item borderBottom label="主体名称:" prop="name">
|
|
|
|
|
|
<uv-input v-model="userInfo.name" border="none"></uv-input>
|
|
|
|
|
|
</uv-form-item>
|
|
|
|
|
|
<uv-form-item borderBottom label="统一社会信用代码:" prop="code">
|
|
|
|
|
|
<uv-input v-model="userInfo.code" border="none"></uv-input>
|
|
|
|
|
|
</uv-form-item>
|
2025-09-11 15:52:45 +08:00
|
|
|
|
<view class="license">
|
|
|
|
|
|
<text>营业执照</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<uv-form-item>
|
2025-09-10 14:07:14 +08:00
|
|
|
|
<image-uploader
|
|
|
|
|
|
ref="uploader"
|
2025-09-11 15:52:45 +08:00
|
|
|
|
:height="'400rpx'"
|
|
|
|
|
|
:width="'auto'"
|
2025-09-10 14:07:14 +08:00
|
|
|
|
@success="handleUploadSuccess"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</uv-form-item>
|
2025-09-11 15:52:45 +08:00
|
|
|
|
<!-- <text>签名区域</text>-->
|
|
|
|
|
|
<!-- <uv-form-item>-->
|
|
|
|
|
|
<!-- <view style="width: auto; height: 500rpx; background-color: #8f939c">-->
|
|
|
|
|
|
<!-- <l-signature-->
|
|
|
|
|
|
<!-- ref="signatureRef"-->
|
|
|
|
|
|
<!-- :openSmooth="openSmooth"-->
|
|
|
|
|
|
<!-- :penColor="penColor"-->
|
|
|
|
|
|
<!-- :penSize="penSize"-->
|
|
|
|
|
|
<!-- disableScroll-->
|
|
|
|
|
|
<!-- ></l-signature>-->
|
|
|
|
|
|
<!-- </view>-->
|
|
|
|
|
|
<!-- </uv-form-item>-->
|
2025-09-10 16:48:44 +08:00
|
|
|
|
<view class="btn-signature">
|
|
|
|
|
|
<uv-button
|
|
|
|
|
|
customStyle="margin-top: 10px"
|
2025-09-11 15:52:45 +08:00
|
|
|
|
throttleTime="1000"
|
|
|
|
|
|
type="primary "
|
|
|
|
|
|
@click="openProtocol"
|
|
|
|
|
|
>点击查看协议
|
|
|
|
|
|
</uv-button>
|
2025-09-10 16:48:44 +08:00
|
|
|
|
<uv-button
|
|
|
|
|
|
customStyle="margin-top: 10px"
|
2025-09-11 15:52:45 +08:00
|
|
|
|
text="已阅读协议并去签名"
|
2025-09-10 16:48:44 +08:00
|
|
|
|
type="primary"
|
2025-09-11 15:52:45 +08:00
|
|
|
|
@click="goToSignature"
|
|
|
|
|
|
>
|
|
|
|
|
|
</uv-button>
|
|
|
|
|
|
<!-- <uv-button-->
|
|
|
|
|
|
<!-- customStyle="margin-top: 10px"-->
|
|
|
|
|
|
<!-- text="清空签名"-->
|
|
|
|
|
|
<!-- type="error"-->
|
|
|
|
|
|
<!-- @click="onClick('clear')"-->
|
|
|
|
|
|
<!-- ></uv-button>-->
|
|
|
|
|
|
<!-- <uv-button-->
|
|
|
|
|
|
<!-- customStyle="margin-top: 10px"-->
|
|
|
|
|
|
<!-- text="确认签名"-->
|
|
|
|
|
|
<!-- type="primary"-->
|
|
|
|
|
|
<!-- @click="onClick('save')"-->
|
|
|
|
|
|
<!-- ></uv-button>-->
|
|
|
|
|
|
<!-- <uv-button-->
|
|
|
|
|
|
<!-- customStyle="margin-top: 10px"-->
|
|
|
|
|
|
<!-- text="提交协议"-->
|
|
|
|
|
|
<!-- type="primary"-->
|
|
|
|
|
|
<!-- @click="submit"-->
|
|
|
|
|
|
<!-- ></uv-button>-->
|
2025-09-10 16:48:44 +08:00
|
|
|
|
</view>
|
2025-09-10 14:07:14 +08:00
|
|
|
|
</uv-form>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-09-10 15:38:56 +08:00
|
|
|
|
import { tempUrlToRealUrl } from '../../utils/tempUrl-to-realUrl'
|
|
|
|
|
|
|
2025-09-10 14:07:14 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-09-10 15:38:56 +08:00
|
|
|
|
tempUrl: '',
|
2025-09-10 14:07:14 +08:00
|
|
|
|
userInfo: {
|
|
|
|
|
|
name: '',
|
|
|
|
|
|
code: '',
|
|
|
|
|
|
phone: '',
|
|
|
|
|
|
location: '',
|
2025-09-10 16:48:44 +08:00
|
|
|
|
businessLicenseUrl: '',
|
2025-09-10 15:38:56 +08:00
|
|
|
|
signatureUrl: '',
|
2025-09-10 14:07:14 +08:00
|
|
|
|
},
|
2025-09-10 15:38:56 +08:00
|
|
|
|
|
2025-09-10 14:07:14 +08:00
|
|
|
|
rules: {
|
|
|
|
|
|
name: {
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: '请填写主体名称',
|
|
|
|
|
|
trigger: ['blur', 'change'],
|
|
|
|
|
|
},
|
|
|
|
|
|
phone: {
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
// pattern: /^1[3-9]\d{9}$/,
|
|
|
|
|
|
message: '请填写正确的手机号码',
|
|
|
|
|
|
trigger: ['blur', 'change'],
|
|
|
|
|
|
},
|
|
|
|
|
|
location: {
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
message: '请填写地址',
|
|
|
|
|
|
trigger: ['blur', 'change'],
|
|
|
|
|
|
},
|
|
|
|
|
|
code: {
|
|
|
|
|
|
type: 'string',
|
|
|
|
|
|
required: true,
|
|
|
|
|
|
// pattern: /^[0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}$/,
|
|
|
|
|
|
message: '请填写正确的统一社会信用代码',
|
|
|
|
|
|
trigger: ['blur', 'change'],
|
|
|
|
|
|
},
|
2025-09-10 16:48:44 +08:00
|
|
|
|
// license: {
|
|
|
|
|
|
// type: 'string',
|
|
|
|
|
|
// required: true,
|
|
|
|
|
|
// message: '请上传营业执照',
|
|
|
|
|
|
// trigger: ['blur', 'change'],
|
|
|
|
|
|
// },
|
|
|
|
|
|
// signature: {
|
|
|
|
|
|
// type: 'string',
|
|
|
|
|
|
// required: true,
|
|
|
|
|
|
// message: '请签名',
|
|
|
|
|
|
// trigger: ['blur', 'change'],
|
|
|
|
|
|
// },
|
2025-09-10 14:07:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
radio: '',
|
|
|
|
|
|
switchVal: false,
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2025-09-11 14:52:11 +08:00
|
|
|
|
openProtocol() {
|
|
|
|
|
|
uni.downloadFile({
|
|
|
|
|
|
url: 'https://api.ccttiot.com/安装协议(准备好)-1757570264575.pdf',
|
|
|
|
|
|
success: function (res) {
|
|
|
|
|
|
var filePath = res.tempFilePath
|
|
|
|
|
|
uni.openDocument({
|
|
|
|
|
|
filePath: filePath,
|
|
|
|
|
|
showMenu: true,
|
|
|
|
|
|
success: function (res) {},
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
2025-09-11 15:52:45 +08:00
|
|
|
|
goToSignature() {
|
|
|
|
|
|
uni.navigateTo(/pages/)
|
|
|
|
|
|
},
|
2025-09-10 14:07:14 +08:00
|
|
|
|
handleUploadSuccess(result) {
|
|
|
|
|
|
console.log('图片上传成功:', result.url)
|
2025-09-10 16:48:44 +08:00
|
|
|
|
this.userInfo.businessLicenseUrl = result.url
|
2025-09-10 14:07:14 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
title: '上传成功',
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 提交
|
2025-09-10 16:48:44 +08:00
|
|
|
|
async submit() {
|
|
|
|
|
|
// await this.onClick('save')
|
|
|
|
|
|
|
|
|
|
|
|
if (this.userInfo.businessLicenseUrl === '') {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'error',
|
|
|
|
|
|
title: '请上传营业执照',
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.userInfo.signatureUrl === '') {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'error',
|
|
|
|
|
|
title: '请确认签名',
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-10 14:07:14 +08:00
|
|
|
|
// 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true
|
|
|
|
|
|
this.$refs.form
|
|
|
|
|
|
.validate()
|
|
|
|
|
|
.then(res => {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'success',
|
|
|
|
|
|
title: '校验通过',
|
|
|
|
|
|
})
|
|
|
|
|
|
// 这里可以添加实际的提交逻辑
|
|
|
|
|
|
console.log('表单数据:', this.userInfo)
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(errors => {
|
|
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'error',
|
|
|
|
|
|
title: '校验失败',
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log('验证错误:', errors)
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
// 重置
|
|
|
|
|
|
reset() {
|
|
|
|
|
|
this.$refs.form.resetFields()
|
|
|
|
|
|
this.$refs.form.clearValidate()
|
2025-09-10 16:48:44 +08:00
|
|
|
|
this.userInfo.businessLicenseUrl = ''
|
2025-09-10 14:07:14 +08:00
|
|
|
|
},
|
2025-09-10 15:04:34 +08:00
|
|
|
|
|
2025-09-10 14:07:14 +08:00
|
|
|
|
hideKeyboard() {
|
|
|
|
|
|
uni.hideKeyboard()
|
|
|
|
|
|
},
|
2025-09-10 16:48:44 +08:00
|
|
|
|
async onClick(type) {
|
2025-09-10 15:38:56 +08:00
|
|
|
|
if (type === 'openSmooth') {
|
2025-09-10 14:07:14 +08:00
|
|
|
|
this.openSmooth = !this.openSmooth
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-09-10 15:38:56 +08:00
|
|
|
|
if (type === 'save') {
|
2025-09-10 16:48:44 +08:00
|
|
|
|
await this.$refs.signatureRef.canvasToTempFilePath({
|
2025-09-10 15:38:56 +08:00
|
|
|
|
success: async res => {
|
2025-09-10 14:07:14 +08:00
|
|
|
|
// 是否为空画板 无签名
|
2025-09-10 16:48:44 +08:00
|
|
|
|
console.log('签名返回是否为空', res.isEmpty)
|
|
|
|
|
|
if (res.isEmpty) {
|
|
|
|
|
|
this.userInfo.signatureUrl = ''
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-09-10 15:38:56 +08:00
|
|
|
|
|
2025-09-10 14:07:14 +08:00
|
|
|
|
// 生成图片的临时路径
|
|
|
|
|
|
// H5 生成的是base64
|
2025-09-10 15:38:56 +08:00
|
|
|
|
this.tempUrl = res.tempFilePath
|
|
|
|
|
|
console.log('临时路径', res.tempFilePath)
|
|
|
|
|
|
|
|
|
|
|
|
this.userInfo.signatureUrl = await tempUrlToRealUrl(res.tempFilePath)
|
|
|
|
|
|
console.log('签名路径', this.userInfo.signatureUrl)
|
2025-09-10 16:48:44 +08:00
|
|
|
|
console.log('签名上传成功')
|
|
|
|
|
|
uni.showToast({ title: '签名上传成功', icon: 'success' })
|
2025-09-10 14:07:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-09-10 16:48:44 +08:00
|
|
|
|
if (type === 'clear') {
|
|
|
|
|
|
this.userInfo.signatureUrl = ''
|
|
|
|
|
|
}
|
2025-09-10 14:07:14 +08:00
|
|
|
|
if (this.$refs.signatureRef) this.$refs.signatureRef[type]()
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.page {
|
|
|
|
|
|
padding: 10rpx 30rpx;
|
|
|
|
|
|
}
|
2025-09-10 16:48:44 +08:00
|
|
|
|
|
|
|
|
|
|
.btn-signature {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
|
}
|
2025-09-11 15:52:45 +08:00
|
|
|
|
|
|
|
|
|
|
.license {
|
|
|
|
|
|
margin-top: 50rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
|
}
|
2025-09-10 14:07:14 +08:00
|
|
|
|
</style>
|