lease页面安装协议跳转逻辑

This commit is contained in:
WindowBird 2025-09-12 12:03:18 +08:00
parent d877c68f8e
commit 74051e4831
3 changed files with 72 additions and 5 deletions

45
api/protocol/protocol.js Normal file
View File

@ -0,0 +1,45 @@
import request from '../../utils/request'
export function postProtocolPartner(userInfo) {
return request({
url: '/app/agreement/hhrxy',
method: 'POST',
data: {
name: userInfo.name,
phone: userInfo.phone,
address: userInfo.location,
businessLicense: userInfo.businessLicenseUrl,
code: userInfo.code,
autographImg: userInfo.signatureUrl,
templateId: 1,
},
})
}
export function postProtocolInstallation(userInfo) {
return request({
url: '/app/agreement/azxy',
method: 'POST',
data: {
name: userInfo.name,
phone: userInfo.phone,
address: userInfo.location,
businessLicense: userInfo.businessLicenseUrl,
code: userInfo.code,
autographImg: userInfo.signatureUrl,
templateId: 2,
},
})
}
export function isSignProtocolInstallation() {
return request({
url: '/app/agreement/isSignAzxy',
})
}
export function isSignProtocolPartner() {
return request({
url: '/app/agreement/isSignHhrxy',
})
}

View File

@ -104,7 +104,10 @@
<text v-if="hasAgreed"></text>
</view>
<!-- <text class="text">去签署</text>-->
<text class="link" @click="goToInstallationProtocol">去签署安装协议</text>
<text v-if="!hasAgreed" class="link" @click="goToInstallationProtocol"
>去签署安装协议
</text>
<text v-else class="link" @click="goToInstallationProtocol">已签署安装协议</text>
</view>
<view class="payment-details">
@ -182,6 +185,7 @@ import {
createLeaseOrder,
} from '@/api/lease/lease.js'
import { checkLoginStatus } from '../../utils/checkLogin'
import { isSignProtocolInstallation } from '../../api/protocol/protocol'
export default {
name: 'LeasePage',
@ -198,6 +202,7 @@ export default {
},
},
onShow() {
this.getIsSignProtocolInstallationOnshow()
// if (!this.hasAgreed) {
// uni.navigateTo({
// url: '/pages/InstallationAgreement/InstallationAgreement',
@ -205,7 +210,8 @@ export default {
// }
},
onLoad() {
this.goToInstallationProtocol()
this.getIsSignProtocolInstallation()
uni.authorize({
scope: 'scope.userLocation',
success: function () {
@ -241,6 +247,23 @@ export default {
}
},
methods: {
async getIsSignProtocolInstallationOnshow() {
let res = await isSignProtocolInstallation()
console.log('res', res)
console.log('res.data', res.data)
this.hasAgreed = res.data
console.log('this.hasAgreed', this.hasAgreed)
},
async getIsSignProtocolInstallation() {
let res = await isSignProtocolInstallation()
console.log('res', res)
console.log('res.data', res.data)
this.hasAgreed = res.data
console.log('this.hasAgreed', this.hasAgreed)
this.goToInstallationProtocol()
},
goToInstallationProtocol() {
if (!this.hasAgreed) {
uni.navigateTo({

View File

@ -20,7 +20,7 @@
<script>
import { tempUrlToRealUrl } from '../../utils/tempUrl-to-realUrl'
import { postProtocolPartner } from '../../api/protocol/protocol'
import { postProtocolInstallation } from '../../api/protocol/protocol'
export default {
onLoad(options) {
@ -31,7 +31,6 @@ export default {
location: decodeURIComponent(options.location || ''),
businessLicenseUrl: decodeURIComponent(options.businessLicenseUrl || ''),
signatureUrl: decodeURIComponent(options.signatureUrl || ''),
templateId: 1,
// ...
}
},
@ -75,7 +74,7 @@ export default {
console.log('签名上传成功')
//uni.showToast({ title: '', icon: 'success' })
console.log('表单数据:', this.userInfo)
let resProtocolPartner = await postProtocolPartner(this.userInfo)
let resProtocolPartner = await postProtocolInstallation(this.userInfo)
this.resProtocolPartnerUrl = resProtocolPartner.msg
uni.hideLoading()
uni.downloadFile({