实现可签署代理商协议

This commit is contained in:
WindowBird 2025-09-12 14:48:29 +08:00
parent f4eea7b26f
commit a4e863a872
5 changed files with 255 additions and 43 deletions

View File

@ -134,6 +134,13 @@
"style": { "style": {
"navigationBarTitleText": "请横屏签名" "navigationBarTitleText": "请横屏签名"
} }
},
{
"path" : "pages/partnerProtocol/partnerProtocol",
"style" :
{
"navigationBarTitleText" : "签订代理商协议"
}
} }
], ],
"subPackages": [ "subPackages": [

View File

@ -79,7 +79,7 @@ import { tempUrlToRealUrl } from '../../utils/tempUrl-to-realUrl'
export default { export default {
onLoad() { onLoad() {
this.openProtocol() // this.openProtocol()
}, },
data() { data() {
return { return {
@ -91,6 +91,7 @@ export default {
location: '', location: '',
businessLicenseUrl: '', businessLicenseUrl: '',
signatureUrl: '', signatureUrl: '',
templateId: '1',
}, },
rules: { rules: {

View File

@ -84,63 +84,61 @@
<!-- 协议同意 --> <!-- 协议同意 -->
<view class="agreement-section"> <view class="agreement-section">
<view class="agreement-item" @click="toggleAgreement"> <view class="agreement-item">
<view :class="{ checked: formData.agreed }" class="checkbox"> <view :class="{ checked: formData.agreed }" class="checkbox">
<text v-if="formData.agreed" class="checkmark"></text> <text v-if="formData.agreed" class="checkmark"></text>
</view> </view>
<text class="agreement-text"> <text class="agreement-text">
我已阅读并同意 <text v-if="formData.agreed">我已签署</text>
<text class="agreement-link" @click.stop="showAgreement">代理商协议</text> <text v-else>去签署</text>
<text class="agreement-link" @click="goToProtocol">代理商协议</text>
</text> </text>
</view> </view>
</view> </view>
<!-- 提交按钮 --> <!-- 提交按钮 -->
<view class="submit-section"> <view class="submit-section">
<button <button :disabled="submitting" class="submit-btn" @click="submitApplication">
:disabled="!canSubmit || submitting"
class="submit-btn"
@click="submitApplication"
>
{{ submitting ? '提交中...' : '申请成为代理商' }} {{ submitting ? '提交中...' : '申请成为代理商' }}
</button> </button>
</view> </view>
</view> </view>
</view> </view>
<!-- 代理商协议模态框 --> <!-- &lt;!&ndash; 代理商协议模态框 &ndash;&gt;-->
<view v-if="showAgreementModal" class="agreement-modal-overlay" @click="hideAgreement"> <!-- <view v-if="showAgreementModal" class="agreement-modal-overlay" @click="hideAgreement">-->
<view class="agreement-modal" @click.stop> <!-- <view class="agreement-modal" @click.stop>-->
<view class="agreement-modal-header"> <!-- <view class="agreement-modal-header">-->
<text class="agreement-modal-title">代理商协议</text> <!-- <text class="agreement-modal-title">代理商协议</text>-->
<text class="agreement-modal-close" @click="hideAgreement">×</text> <!-- <text class="agreement-modal-close" @click="hideAgreement">×</text>-->
</view> <!-- </view>-->
<scroll-view class="agreement-modal-content" scroll-y> <!-- <scroll-view class="agreement-modal-content" scroll-y>-->
<rich-text :nodes="agreementContent"></rich-text> <!-- <rich-text :nodes="agreementContent"></rich-text>-->
</scroll-view> <!-- </scroll-view>-->
<view class="agreement-modal-footer"> <!-- <view class="agreement-modal-footer">-->
<view class="agreement-modal-checkbox" @click="toggleAgreement"> <!-- <view class="agreement-modal-checkbox" @click="toggleAgreement">-->
<view :class="{ checked: formData.agreed }" class="modal-checkbox"> <!-- <view :class="{ checked: formData.agreed }" class="modal-checkbox">-->
<text v-if="formData.agreed" class="checkmark"></text> <!-- <text v-if="formData.agreed" class="checkmark"></text>-->
</view> <!-- </view>-->
<text class="modal-checkbox-text">我已阅读并同意代理商协议</text> <!-- <text class="modal-checkbox-text">我已阅读并同意代理商协议</text>-->
</view> <!-- </view>-->
<button <!-- <button-->
:class="{ disabled: !formData.agreed }" <!-- :class="{ disabled: !formData.agreed }"-->
class="agreement-modal-btn" <!-- class="agreement-modal-btn"-->
@click="hideAgreement" <!-- @click="hideAgreement"-->
> <!-- >-->
{{ formData.agreed ? '确定' : '请先同意协议' }} <!-- {{ formData.agreed ? '确定' : '请先同意协议' }}-->
</button> <!-- </button>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
</view> <!-- </view>-->
</view> </view>
</template> </template>
<script> <script>
import commonEnum from '../../enum/commonEnum' import commonEnum from '../../enum/commonEnum'
import { applyForAgent, getAgentAgreement, getServiceAreas } from '@/api/agents' import { applyForAgent, getAgentAgreement, getServiceAreas } from '@/api/agents'
import { isSignProtocolPartner } from '../../api/protocol/protocol'
export default { export default {
name: 'AgentsPage', name: 'AgentsPage',
@ -165,6 +163,7 @@ export default {
}, },
onLoad() { onLoad() {
// //
this.getIsSignProtocolOnshow()
this.loadServiceAreas() this.loadServiceAreas()
this.loadAgreement() this.loadAgreement()
}, },
@ -192,6 +191,20 @@ export default {
} }
}, },
methods: { methods: {
async getIsSignProtocolOnshow() {
let res = await isSignProtocolPartner()
console.log('res', res)
console.log('res.data', res.data)
this.formData.agreed = res.data
console.log('this.hasAgreed', this.formData.agreed)
},
goToProtocol() {
if (!this.formData.agreed) {
uni.navigateTo({
url: '/pages/partnerProtocol/partnerProtocol',
})
}
},
// //
async loadServiceAreas() { async loadServiceAreas() {
try { try {
@ -353,7 +366,7 @@ export default {
if (!this.formData.agreed) { if (!this.formData.agreed) {
uni.showToast({ uni.showToast({
title: '请先同意代理商协议', title: '请签署代理商协议',
icon: 'none', icon: 'none',
}) })
return false return false
@ -368,7 +381,7 @@ export default {
if (!this.formData.agreed) { if (!this.formData.agreed) {
this.showAgreement() this.showAgreement()
uni.showToast({ uni.showToast({
title: '请先阅读并同意代理商协议', title: '请签署代理商协议',
icon: 'none', icon: 'none',
}) })
return return

View File

@ -0,0 +1,185 @@
<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>
<view class="license">
<text>营业执照</text>
</view>
<uv-form-item>
<image-uploader
ref="uploader"
:height="'400rpx'"
:width="'auto'"
@success="handleUploadSuccess"
/>
</uv-form-item>
<view class="btn-signature">
<uv-button
customStyle="margin-top: 10px"
throttleTime="1000"
type="primary "
@click="openProtocol"
>点击查看协议
</uv-button>
<uv-button
customStyle="margin-top: 10px"
text="确认协议并去签名"
type="primary"
@click="submit"
>
</uv-button>
</view>
</uv-form>
</view>
</template>
<script>
export default {
onLoad() {
// this.openProtocol()
},
data() {
return {
tempUrl: '',
userInfo: {
name: '',
code: '',
phone: '',
location: '',
businessLicenseUrl: '',
signatureUrl: '',
templateId: '2',
},
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'],
},
},
radio: '',
switchVal: false,
}
},
methods: {
openProtocol() {
uni.downloadFile({
url: 'https://api.ccttiot.com/hhrxy-1757582246358.pdf',
success: function (res) {
var filePath = res.tempFilePath
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function (res) {},
})
},
})
},
handleUploadSuccess(result) {
console.log('图片上传成功:', result.url)
this.userInfo.businessLicenseUrl = result.url
uni.showToast({
title: '上传成功',
icon: 'success',
})
},
//
async submit() {
if (this.userInfo.businessLicenseUrl === '') {
uni.showToast({
icon: 'error',
title: '请上传营业执照',
})
return
}
this.$refs.form
.validate()
.then(res => {
uni.showToast({
icon: 'success',
title: '校验通过',
})
//
console.log('表单数据:', this.userInfo)
uni.navigateTo({
url: `/pages/signature/signature?${Object.entries(this.userInfo)
.map(([key, val]) => `${key}=${encodeURIComponent(val)}`)
.join('&')}`,
})
})
.catch(errors => {
uni.showToast({
icon: 'error',
title: '校验失败',
})
console.log('验证错误:', errors)
})
},
//
reset() {
this.$refs.form.resetFields()
this.$refs.form.clearValidate()
this.userInfo.businessLicenseUrl = ''
},
hideKeyboard() {
uni.hideKeyboard()
},
},
}
</script>
<style lang="scss" scoped>
.page {
padding: 10rpx 30rpx;
}
.btn-signature {
display: flex;
align-items: center;
justify-content: space-around;
}
.license {
margin-top: 50rpx;
display: flex;
align-items: center;
justify-content: center;
width: 690rpx;
}
</style>

View File

@ -20,7 +20,7 @@
<script> <script>
import { tempUrlToRealUrl } from '../../utils/tempUrl-to-realUrl' import { tempUrlToRealUrl } from '../../utils/tempUrl-to-realUrl'
import { postProtocolInstallation } from '../../api/protocol/protocol' import { postProtocolInstallation, postProtocolPartner } from '../../api/protocol/protocol'
export default { export default {
onLoad(options) { onLoad(options) {
@ -31,6 +31,7 @@ export default {
location: decodeURIComponent(options.location || ''), location: decodeURIComponent(options.location || ''),
businessLicenseUrl: decodeURIComponent(options.businessLicenseUrl || ''), businessLicenseUrl: decodeURIComponent(options.businessLicenseUrl || ''),
signatureUrl: decodeURIComponent(options.signatureUrl || ''), signatureUrl: decodeURIComponent(options.signatureUrl || ''),
templateId: decodeURIComponent(options.templateId || ''),
// ... // ...
} }
}, },
@ -41,7 +42,8 @@ export default {
penSize: 5, penSize: 5,
url: '', url: '',
openSmooth: true, openSmooth: true,
resProtocolPartnerUrl: '', resProtocolUrl: '',
resProtocol: '',
} }
}, },
methods: { methods: {
@ -79,12 +81,16 @@ export default {
title: '正在生成协议', title: '正在生成协议',
mask: 'true', mask: 'true',
}) })
let resProtocolPartner = await postProtocolInstallation(this.userInfo) if (this.userInfo.templateId === '1') {
this.resProtocol = await postProtocolInstallation(this.userInfo)
} else if (this.userInfo.templateId === '2') {
this.resProtocol = await postProtocolPartner(this.userInfo)
}
uni.hideLoading() uni.hideLoading()
this.resProtocolPartnerUrl = resProtocolPartner.msg
uni.downloadFile({ uni.downloadFile({
url: this.resProtocolPartnerUrl, url: this.resProtocol.msg,
success: function (res) { success: function (res) {
var filePath = res.tempFilePath var filePath = res.tempFilePath
uni.openDocument({ uni.openDocument({