977e4581 by lttnew

注册引导

1 parent cfdea69e
......@@ -1321,10 +1321,11 @@ export function checkBusinessLicense(data) {
}
// 生成单位订单renewYear
export function certifiedNew(renewYear) {
export function certifiedNew(data) {
return request({
url: `/system/certifiedNew/commit?renewYear=${renewYear}`,
method: 'post'
url: `/system/certifiedNew/commit`,
method: 'post',
params: data
})
}
......
<template>
<view class="container">
<view class="content">
<!-- 缴费单位和所属协会 -->
<view class="card info-card">
<view class="info-row">
<text class="info-label">缴费单位</text>
<text class="info-value">{{ payName || '-' }}</text>
</view>
<view class="info-row" v-if="assoName">
<text class="info-label">所属协会</text>
<text class="info-value">{{ assoName || '-' }}</text>
</view>
</view>
<view class="card">
<view class="yearRow">
<view class="label">缴费年限</view>
<view class="control">
<image v-if="form.renewYear > 1" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/slices/dd_02.png'"
<image v-if="form.renewYear > 1" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/dd_02.png'"
@click="minusYear"></image>
<image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/slices/dd_02_g.png'"></image>
<image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/dd_02_g.png'"></image>
<text class="num">{{ form.renewYear }}</text>
<image v-if="form.renewYear < 5" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/slices/btn_03.png'"
<image v-if="form.renewYear < 5" class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/btn_03.png'"
@click="plusYear"></image>
<image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/slices/btn_03_g.png'"></image>
<image v-else class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/btn_03_g.png'"></image>
</view>
</view>
</view>
......@@ -35,7 +47,7 @@
<label class="radioItem">
<radio :checked="payType === '1'" class="custom-radio" value="1"/>
<view class="payInfo">
<image class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/slices/min.png'"></image>
<image class="icon" mode="widthFix" :src="config.baseUrl_api + '/fs/static/min.png'"></image>
<text>民生付</text>
</view>
</label>
......@@ -82,6 +94,8 @@ const preferentialData = ref({
})
const payType = ref('1')
const isPaying = ref(false)
const payName = ref('')
const assoName = ref('')
const memberTotalFee = computed(() => {
if (preferentialPolicy.value) {
......@@ -126,15 +140,19 @@ const handelPay = async () => {
})
isPaying.value = true
// 创建订单
const [orderErr, orderRes] = await to(api.certifiedNew(form.value.renewYear))
// 创建订单 - 参考PC端逻辑
const [orderErr, orderRes] = await to(api.certifiedNew({
renewYear: form.value.renewYear,
type: '1',
url: ''
}))
if (orderErr) {
uni.hideLoading()
isPaying.value = false
// uni.showToast({
// title: '创建订单失败',
// icon: 'none'
// })
uni.showToast({
title: '创建订单失败',
icon: 'none'
})
return
}
......@@ -148,27 +166,32 @@ const handelPay = async () => {
})
return
}
if (data.payResult.encryptedData) {
const res = minShengPay(data.orderId, data.payResult.encryptedData)
console.log(res)
if (data.payResult && data.payResult.encryptedData) {
try {
await minShengPay(data.orderId, data.payResult.encryptedData)
// 支付成功,跳转到成功页面
uni.redirectTo({
url: `/myCenter/sucPay?orderId=${data.orderId}`
})
} catch (e) {
console.error('支付失败', e)
uni.hideLoading()
isPaying.value = false
}
// 需要支付回调
// if (data.orderId) {
// await to(api.callBack2(data.orderId))
// uni.hideLoading()
// isPaying.value = false
//
// uni.redirectTo({
// url: `/myCenter/sucPay?orderId=${data.orderId}`
// })
// }
return
}
uni.hideLoading()
isPaying.value = false
}
onLoad((option) => {
console.log(66,option)
// 接收年限
form.value.renewYear = Number(option.renewYear || 1)
// 接收缴费单位和所属协会
payName.value = decodeURIComponent(option.payName || '')
console.log(77,payName.value)
assoName.value = decodeURIComponent(option.assoName || '')
// 初始化获取费用和优惠
init()
})
......@@ -214,7 +237,7 @@ async function getZtxDiscountPolicyApi() {
}
</script>
<style scoped>
<style scoped lang="scss">
/* 整体容器 */
.container {
min-height: 100vh;
......@@ -234,6 +257,32 @@ async function getZtxDiscountPolicyApi() {
margin-bottom: 20rpx;
}
/* 缴费单位和所属协会信息 */
.info-card {
.info-row {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
.info-label {
font-size: 28rpx;
color: #666;
}
.info-value {
font-size: 28rpx;
color: #333;
font-weight: 500;
}
}
}
/* 缴费年限行 */
.yearRow {
display: flex;
......
......@@ -7,7 +7,7 @@
<view style="width: 60vw;overflow:auto;">
<uni-data-picker v-model="form.parentId" :localdata="tree"
:readonly="type&&parentId!=-1&&parentId!=0" :clear-icon="false"
:map="{text:'label',value:'id'}" popup-title="请选择">
:map="{text:'label',value:'id'}" popup-title="请选择" @change="changCase">
</uni-data-picker>
</view>
</uni-forms-item>
......@@ -195,6 +195,7 @@
const imgBack = ref({})
const creditCode = ref()
const parentId = ref()
const assoFullName = ref('') // 协会完整路径名称
const legalIdcPhoto1 = ref('')
const legalIdcPhoto2 = ref('')
const companyName = ref('')
......@@ -338,6 +339,7 @@
}
api.certifiedDeptTree(obj).then(res => {
tree.value = res.data
restoreAssoFullName()
})
} else {
var obj = {
......@@ -348,6 +350,7 @@
}
api.deptTreeSelect(obj).then(res => {
tree.value = res.data
restoreAssoFullName()
})
}
}
......@@ -573,8 +576,9 @@
})
} else {
api.editMyMemberCertifiedInfo(dataInfo).then(res => {
// 使用完整的协会路径名称
uni.navigateTo({
url: `/myCenter/goPay`
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoFullName.value)}`
})
}).catch(err => {
......@@ -586,6 +590,84 @@
}
}
// 根据协会ID获取协会名称
function getAssoName(parentId) {
if (!parentId || !tree.value || tree.value.length === 0) {
return ''
}
// 递归查找协会名称
function findInTree(list) {
for (const item of list) {
if (item.id === parentId) {
return item.label || ''
}
if (item.children && item.children.length > 0) {
const found = findInTree(item.children)
if (found) return found
}
}
return null
}
return findInTree(tree.value) || ''
}
// 协会选择 - 获取完整路径名称
function changCase(e) {
const valueArr = e.detail?.value || e;
// 取最后一级的value(纯ID)
const lastNode = valueArr[valueArr.length - 1];
form.value.parentId = lastNode?.value || '';
console.log('最终提交的parentId:', form.value.parentId);
assoFullName.value = getAssoFullName(valueArr)
console.log('协会完整路径:', assoFullName.value);
}
// 获取协会完整路径名称
function getAssoFullName(valueArr) {
if (!valueArr || valueArr.length === 0) return ''
// valueArr 是 {value: id} 数组
const names = []
let currentLevel = tree.value
for (const item of valueArr) {
const found = currentLevel?.find(v => v.id === item.value || v.value === item.value)
if (found) {
names.push(found.label)
currentLevel = found.children
} else {
break
}
}
return names.join('/')
}
// 查找协会节点及其父路径
function findAssoNodeWithPath(list, targetId, currentPath) {
for (const item of list) {
const newPath = [...currentPath, item.value || item.id]
if ((item.value || item.id) === targetId) {
return { node: item, path: newPath }
}
if (item.children && item.children.length > 0) {
const found = findAssoNodeWithPath(item.children, targetId, newPath)
if (found) return found
}
}
return null
}
// 恢复协会完整路径名称
function restoreAssoFullName() {
if (!form.value.parentId || !tree.value || tree.value.length === 0) {
return
}
// 查找节点及其路径
const result = findAssoNodeWithPath(tree.value, form.value.parentId, [])
if (result) {
// 使用路径数组重建完整名称
assoFullName.value = getAssoFullName(result.path.map(id => ({ value: id })))
}
}
function changeCoordinates1(e) {
form.value.provinceId = e?.[0]?.toString()
form.value.cityId = e?.[1]?.toString()
......
......@@ -12,7 +12,7 @@
<view class="success-subtitle">支付成功,请等待审核</view>
<!-- 订单信息卡片(带阴影) -->
<view class="info-card">
<!-- <view class="info-card">
<view class="info-item">
<text class="label">交易流水号</text>
<text class="value">{{ orderInfo.tradeNo || '--' }}</text>
......@@ -25,7 +25,7 @@
<text class="label">订单金额</text>
<text class="value amount">{{ orderInfo.price ? orderInfo.price + '元' : '--' }}</text>
</view>
</view>
</view> -->
<!-- 确定按钮(渐变+动效) -->
<view class="confirm-btn-area">
......@@ -58,14 +58,14 @@
}
onLoad(async (option) => {
if (option.orderId) {
const [err, res] = await to(api.getOrderInfo(option.orderId))
if (!err && res.data) {
orderInfo.value = res.data
} else {
orderInfo.value.orderId = option.orderId
}
}
// if (option.orderId) {
// const [err, res] = await to(api.getOrderInfo(option.orderId))
// if (!err && res.data) {
// orderInfo.value = res.data
// } else {
// orderInfo.value.orderId = option.orderId
// }
// }
})
</script>
......
......@@ -201,6 +201,7 @@
// 协会树
const assoList = ref([])
const assoFullName = ref('') // 协会完整路径名称
// 步骤相关
const active = ref(0)
......@@ -255,18 +256,36 @@
// 获取详情
function getDetail() {
api.getMyOwnMemberInfo().then(res => {
if (res.data.memberInfo) {
Object.assign(form.value, res.data.memberInfo)
}
// if (res.data.memberInfo) {
// Object.assign(form.value, res.data.memberInfo)
// }
form.value = { ...res.data.dept, ...res.data.memberInfo }
authenticationStatusa.value = res.data.authenticationStatus
result.value = res.data.result
// 处理地址
// 处理地址 - 需要用对象数组格式
coordinates1.value = []
if (form.value.provinceId) coordinates1.value.push(form.value.provinceId)
if (form.value.cityId) coordinates1.value.push(form.value.cityId)
if (form.value.regionId) coordinates1.value.push(form.value.regionId)
// 处理协会 - 设置完整路径名称
if (form.value.parentId) {
// 尝试从协会树中查找完整路径
const result = findAssoNodeWithPath(assoList.value, form.value.parentId, [])
if (result) {
assoFullName.value = getAssoFullName(result.path.map(id => ({ value: id })))
} else {
// 如果树还没加载完,延迟设置
setTimeout(() => {
const res = findAssoNodeWithPath(assoList.value, form.value.parentId, [])
if (res) {
assoFullName.value = getAssoFullName(res.path.map(id => ({ value: id })))
}
}, 500)
}
}
// 处理身份证
if (form.value.legalIdcPhoto) {
const photos = form.value.legalIdcPhoto.split(',')
......@@ -297,7 +316,6 @@
legalIdcCode.value = form.value.legalIdcCode
coordinates1.value = form.value.provinceId
adress.value = form.value.adress
form.value.deptType = res.data.dept.deptType
form.value.name = form.value.baseName
})
}
......@@ -334,6 +352,12 @@
isBlack: 0
}).then(res => {
assoList.value = res.data.map(item => formatTree(item))
// 树加载完成后,如果有parentId,设置完整路径名称
if (form.value.parentId) {
setTimeout(() => {
restoreAssoFullName()
}, 100)
}
})
}
......@@ -349,6 +373,34 @@
return result
}
// 恢复协会完整路径名称
function restoreAssoFullName() {
if (!form.value.parentId || !assoList.value || assoList.value.length === 0) {
return
}
// 查找节点及其路径
const result = findAssoNodeWithPath(assoList.value, form.value.parentId, [])
if (result) {
// 使用路径数组重建完整名称
assoFullName.value = getAssoFullName(result.path.map(id => ({ value: id })))
}
}
// 查找协会节点及其父路径
function findAssoNodeWithPath(list, targetId, currentPath) {
for (const item of list) {
const newPath = [...currentPath, item.value]
if (item.value === targetId) {
return { node: item, path: newPath }
}
if (item.children && item.children.length > 0) {
const found = findAssoNodeWithPath(item.children, targetId, newPath)
if (found) return found
}
}
return null
}
// 协会选择(修复:100%对齐PC端el-cascader emitPath: false逻辑,只取最后一级ID)
function changCase(e) {
const valueArr = e.detail?.value || e;
......@@ -356,6 +408,8 @@
const lastNode = valueArr[valueArr.length - 1];
form.value.parentId = lastNode?.value || '';
console.log('最终提交的parentId:', form.value.parentId);
assoFullName.value = getAssoFullName(valueArr)
console.log('协会完整路径:', assoFullName.value);
}
// 地址选择(核心修复:从对象中提取纯value,对齐PC端格式)
......@@ -564,7 +618,7 @@
cityId: form.value.cityId.value,
provinceId: form.value.provinceId.value,
adress: form.value.adress,
deptType: form.value.deptType,
deptType: app.globalData.deptType,
legalIdcPhoto: [form.value.legalIdcPhoto1, form.value.legalIdcPhoto2].join(','),
applyPoints: '0',
siteContact: form.value.siteContact,
......@@ -577,8 +631,11 @@
uni.showToast({ title: '提交成功', duration: 1500, icon: 'success' })
// 跳转缴费页面
setTimeout(() => {
const assoName = assoFullName.value
console.log(888,assoName)
// 跳转到缴费页面
uni.navigateTo({
url: '/myCenter/goPay'
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}`
})
}, 1500)
} else {
......@@ -727,12 +784,57 @@
})
return
}
// 使用完整的协会路径名称
const assoName = assoFullName.value || getAssoName(form.value.parentId)
// 跳转到缴费页面
uni.navigateTo({
url: '/myCenter/goPay'
url: `/myCenter/goPay?payName=${encodeURIComponent(form.value.name || '')}&assoName=${encodeURIComponent(assoName)}`
})
}
// 根据协会ID获取协会名称(只获取最后一级)
function getAssoName(parentId) {
if (!parentId || !assoList.value || assoList.value.length === 0) {
return ''
}
// 递归查找协会名称
function findInTree(list) {
for (const item of list) {
if (item.value === parentId) {
return item.text || ''
}
if (item.children && item.children.length > 0) {
const found = findInTree(item.children)
if (found) return found
}
}
return null
}
return findInTree(assoList.value) || ''
}
// 根据选择的值数组获取完整的协会路径名称
function getAssoFullName(valueArr) {
if (!valueArr || valueArr.length === 0 || !assoList.value || assoList.value.length === 0) {
return ''
}
const pathNames = []
let currentList = assoList.value
for (let i = 0; i < valueArr.length; i++) {
const node = valueArr[i]
const found = currentList.find(item => item.value === node?.value || item.value === node)
if (found) {
pathNames.push(found.text || found.label || '')
if (found.children) {
currentList = found.children
}
} else {
break
}
}
return pathNames.join('/')
}
// 去认证 - 提交认证信息
function doCertification() {
submitStep2()
......@@ -770,8 +872,9 @@
width: 48rpx;
height: 48rpx;
border-radius: 50%;
background: rgba(173, 24, 31, 0.3);
color: #AD181F;
background: #fff;
border: 2rpx solid #999;
color: #999;
font-size: 24rpx;
display: flex;
align-items: center;
......@@ -787,8 +890,9 @@
}
&.active .step-circle {
background: #AD181F;
color: #fff;
background: #fff;
color: #AD181F;
border-color: #AD181F;
}
&.active .step-text {
......@@ -835,7 +939,6 @@
align-items: center;
justify-content: space-between;
padding: 20rpx 0;
border-bottom: 1rpx solid #eee;
margin-bottom: 20rpx;
}
......@@ -1087,6 +1190,9 @@
overflow: hidden;
text-overflow: ellipsis;
}
:deep(.selected-list) {
justify-content: start;
}
/* 修复高度统一 */
.custom-picker {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!