hookehuyr

refactor(用户认证): 移除银行卡照片和身份证有效期字段

简化用户认证流程,移除银行卡正面照上传和身份证有效期相关字段
更新相关组件、存储和API调用以适配字段变更
切换测试服务器配置
......@@ -40,12 +40,9 @@ export const payCheckAPI = (params) => fn(fetch.post(Api.PAY_CHECK, params));
* @param name 真实姓名
* @param bank_id 开户行id
* @param bank_no 银行卡号
* @param bank_img 银行卡正面照
* @param idcard 身份证号
* @param idcard_1_img 身份证正面照
* @param idcard_2_img 身份证反面照
* @param idcard_effect_begin 身份证有效期开始
* @param idcard_effect_end 身份证有效期结束
* @param idcard_address 身份证地址
* @param is_signed 是否阅读协议
* @param division_agree_pic 分账协议照片
......
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-01 15:04:35
* @LastEditTime: 2025-08-13 17:16:45
* @FilePath: /jgdl/src/pages/auth/index.vue
* @Description: 文件描述
-->
......@@ -92,6 +92,10 @@ export default {
if (process.env.NODE_ENV === 'development') {
// requestData.openid = 'h-008';
// requestData.openid = 'h-009';
// requestData.openid = 'h-010';
// requestData.openid = 'h-011';
// requestData.openid = 'h-012';
// requestData.openid = 'h-013';
requestData.openid = 'oWbdFvkD5VtloC50wSNR9IWiU2q8';
}
......
......@@ -17,8 +17,8 @@
</view>
<view class="setting-right">
<text class="setting-status"
:class="{ 'status-set': accountInfo.bankName && accountInfo.bankAccount && accountInfo.bankImg }">
{{ accountInfo.bankName && accountInfo.bankAccount && accountInfo.bankImg ? '已设置' : '未设置' }}
:class="{ 'status-set': accountInfo.bankName && accountInfo.bankAccount }">
{{ accountInfo.bankName && accountInfo.bankAccount ? '已设置' : '未设置' }}
</text>
<!-- <text class="arrow">></text> -->
<RectRight color="#999" size="10" />
......@@ -32,9 +32,9 @@
</view>
<view class="setting-right">
<text class="setting-status"
:class="{ 'status-set': identityInfo.userName && identityInfo.idCard && identityInfo.idcard_1_img && identityInfo.idcard_2_img && identityInfo.idcard_effect_begin && identityInfo.idcard_effect_end && (identityInfo.idcard_province && identityInfo.idcard_city && identityInfo.idcard_district && identityInfo.idcard_address) }">
:class="{ 'status-set': identityInfo.userName && identityInfo.idCard && identityInfo.idcard_1_img && identityInfo.idcard_2_img && (identityInfo.idcard_province && identityInfo.idcard_city && identityInfo.idcard_district && identityInfo.idcard_address) }">
{{ identityInfo.userName && identityInfo.idCard && identityInfo.idcard_1_img && identityInfo.idcard_2_img &&
identityInfo.idcard_effect_begin && identityInfo.idcard_effect_end && (identityInfo.idcard_province && identityInfo.idcard_city && identityInfo.idcard_district && identityInfo.idcard_address) ? '已设置' :
(identityInfo.idcard_province && identityInfo.idcard_city && identityInfo.idcard_district && identityInfo.idcard_address) ? '已设置' :
'未设置' }}
</text>
<!-- <text class="arrow">></text> -->
......@@ -70,23 +70,7 @@
<text v-if="bankAccountError" class="error-text">{{ bankAccountError }}</text>
</view>
<!-- 银行卡正面照片上传 -->
<view class="form-item">
<text class="form-label"><text class="required-mark">*</text>银行卡正面照</text>
<view class="bank-img-container">
<view v-if="tempAccountInfo.bankImg" class="bank-img-preview">
<image :src="tempAccountInfo.bankImg" class="bank-img-image" mode="aspectFill" @tap="previewBankImg" />
<view class="bank-img-actions">
<text class="change-img-btn" @tap="changeBankImg">重新上传</text>
<text class="delete-img-btn" @tap="deleteBankImg">删除</text>
</view>
</view>
<view v-else class="bank-img-upload" @tap="changeBankImg">
<text class="upload-icon">+</text>
<text class="upload-text">上传银行卡正面照</text>
</view>
</view>
</view>
</view>
<view class="modal-footer">
......@@ -94,7 +78,7 @@
关闭
</nut-button>
<nut-button type="primary" @click="saveAccountInfo" color="#ffa500"
:disabled="!tempAccountInfo.bankName || !tempAccountInfo.bankAccount || !tempAccountInfo.bankImg"
:disabled="!tempAccountInfo.bankName || !tempAccountInfo.bankAccount"
class="footer-btn footer-btn-save">
保存
</nut-button>
......@@ -167,29 +151,9 @@
</view>
</view>
<!-- 证件有效期开始日期 -->
<view class="form-item">
<text class="form-label"><text class="required-mark">*</text>证件有效期开始</text>
<view class="date-selector" @click="showIdcardBeginDatePicker">
<text class="date-text" :class="{ 'date-selected': tempIdentityInfo.idcard_effect_begin }">
{{ tempIdentityInfo.idcard_effect_begin || '请选择开始日期' }}
</text>
<!-- <text class="arrow-down">></text> -->
<RectRight color="#999" size="10" />
</view>
</view>
<!-- 证件有效期结束日期 -->
<view class="form-item">
<text class="form-label"><text class="required-mark">*</text>证件有效期结束</text>
<view class="date-selector" @click="showIdcardEndDatePicker">
<text class="date-text" :class="{ 'date-selected': tempIdentityInfo.idcard_effect_end }">
{{ tempIdentityInfo.idcard_effect_end || '请选择结束日期' }}
</text>
<!-- <text class="arrow-down">></text> -->
<RectRight color="#999" size="10" />
</view>
</view>
<!-- 身份证地址 -->
<view class="form-item">
......@@ -212,7 +176,7 @@
关闭
</nut-button>
<nut-button type="primary" @click="saveIdentityInfo" color="#ffa500"
:disabled="!tempIdentityInfo.userName || !tempIdentityInfo.idCard || !tempIdentityInfo.idcard_1_img || !tempIdentityInfo.idcard_2_img || !tempIdentityInfo.idcard_effect_begin || !tempIdentityInfo.idcard_effect_end || !tempIdentityInfo.idcard_province || !tempIdentityInfo.idcard_city || !tempIdentityInfo.idcard_district || !tempIdentityInfo.idcard_address || !!idCardError"
:disabled="!tempIdentityInfo.userName || !tempIdentityInfo.idCard || !tempIdentityInfo.idcard_1_img || !tempIdentityInfo.idcard_2_img || !tempIdentityInfo.idcard_province || !tempIdentityInfo.idcard_city || !tempIdentityInfo.idcard_district || !tempIdentityInfo.idcard_address || !!idCardError"
class="footer-btn footer-btn-save">
保存
</nut-button>
......@@ -220,23 +184,7 @@
</view>
</nut-popup>
<!-- 身份证有效期开始日期选择器 -->
<nut-popup v-model:visible="showIdcardBeginDate" position="bottom" :style="{ height: '50%' }">
<nut-date-picker v-model="idcardBeginDate" type="date" title="选择证件有效期开始日期" :max-date="maxYearDate"
:min-date="minYearDate" @confirm="onIdcardBeginDateConfirm" @cancel="showIdcardBeginDate = false" />
</nut-popup>
<!-- 证件有效期结束类型选择器弹窗 -->
<nut-popup v-model:visible="showEndDateTypeModal" position="bottom">
<nut-picker v-model="endDateTypePickerValue" :columns="endDateTypeOptions" title="选择证件有效期类型"
@confirm="onEndDateTypeConfirm" @cancel="showEndDateTypeModal = false"></nut-picker>
</nut-popup>
<!-- 身份证有效期结束日期选择器 -->
<nut-popup v-model:visible="showIdcardEndDate" position="bottom" :style="{ height: '50%' }">
<nut-date-picker v-model="idcardEndDate" type="date" title="选择证件有效期结束日期" :max-date="maxYearDate"
:min-date="minYearDate" @confirm="onIdcardEndDateConfirm" @cancel="showIdcardEndDate = false" />
</nut-popup>
<!-- 固定返回按钮 - 只有当参数target=sell时才显示 -->
<view v-if="showBackButton" class="fixed-back-btn" @click="goBack">
......@@ -294,7 +242,7 @@ const showBackButton = computed(() => {
const accountInfo = ref({
bankName: '',
bankAccount: '',
bankImg: ''
// bankImg字段已移除
});
/**
......@@ -305,8 +253,7 @@ const identityInfo = ref({
idCard: '',
idcard_1_img: '',
idcard_2_img: '',
idcard_effect_begin: '',
idcard_effect_end: '',
// idcard_effect_begin和idcard_effect_end字段已移除
idcard_address: ''
});
......@@ -315,8 +262,7 @@ const identityInfo = ref({
*/
const tempAccountInfo = ref({
bankName: '',
bankAccount: '',
bankImg: ''
bankAccount: ''
});
/**
......@@ -327,8 +273,6 @@ const tempIdentityInfo = ref({
idCard: '',
idcard_1_img: '',
idcard_2_img: '',
idcard_effect_begin: '',
idcard_effect_end: '',
// 身份证地址相关字段(显示用中文名称)
province: '',
city: '',
......@@ -361,43 +305,9 @@ const idCardError = ref('');
*/
const bankAccountError = ref('');
/**
* 日期选择器相关状态
*/
const idcardBeginDate = ref(new Date());
const idcardEndDate = ref(new Date());
/**
* 日期选择器的最大日期(当前年份后80年)
*/
const currentYear = new Date().getFullYear();
const maxYearDate = ref(new Date(currentYear + 80, 11, 31)); // 80年后的12月31日
/**
* 日期选择器的最小日期(当前年份前80年)
*/
const minYearDate = ref(new Date(currentYear - 80, 0, 1)); // 80年前的1月1日
// 银行选择器当前选中的值
const bankPickerValue = ref([]);
// 证件有效期结束类型选择器当前选中的值
const endDateTypePickerValue = ref([]);
/**
* 证件有效期结束类型选项
*/
const endDateTypeOptions = ref([
{
text: '长期',
value: 'long_term'
},
{
text: '选择日期',
value: 'select_date'
}
]);
/**
* 银行列表数据(从接口获取)
*/
......@@ -434,8 +344,7 @@ const getUserInfo = async () => {
if (userInfo.bank_id && userInfo.bank_no) {
accountInfo.value = {
bankName: userInfo.bank_id, // 存储银行ID
bankAccount: userInfo.bank_no, // 存储银行账号
bankImg: userInfo.bank_img || '' // 存储银行卡图片
bankAccount: userInfo.bank_no // 存储银行账号
};
}
......@@ -453,8 +362,6 @@ const getUserInfo = async () => {
idCard: userInfo.idcard,
idcard_1_img: userInfo.idcard_1_img || '',
idcard_2_img: userInfo.idcard_2_img || '',
idcard_effect_begin: userInfo.idcard_effect_begin || '',
idcard_effect_end: userInfo.idcard_effect_end || '',
// 地址字段(用于显示的中文名称)
province: areaText.province,
city: areaText.city,
......@@ -626,7 +533,7 @@ const openAccountModal = () => {
*/
const closeAccountModal = () => {
showAccountModal.value = false;
tempAccountInfo.value = { bankName: '', bankAccount: '', bankImg: '' };
tempAccountInfo.value = { bankName: '', bankAccount: '' };
bankAccountError.value = '';
};
......@@ -646,8 +553,7 @@ const saveAccountInfo = async () => {
// 调用API保存收款账号信息
const result = await updateProfileAPI({
bank_id: tempAccountInfo.value.bankName, // 发送银行ID
bank_no: String(tempAccountInfo.value.bankAccount), // 转换为字符串传给接口
bank_img: tempAccountInfo.value.bankImg // 发送银行卡图片
bank_no: String(tempAccountInfo.value.bankAccount) // 转换为字符串传给接口
});
if (result.code) {
......@@ -656,8 +562,7 @@ const saveAccountInfo = async () => {
// 更新全局用户状态
userStore.updateUserInfo({
bank_id: tempAccountInfo.value.bankName, // 存储银行ID
bank_no: tempAccountInfo.value.bankAccount, // 保持数字类型存储到全局状态
bank_img: tempAccountInfo.value.bankImg // 存储银行卡图片
bank_no: tempAccountInfo.value.bankAccount // 保持数字类型存储到全局状态
});
closeAccountModal();
......@@ -726,8 +631,7 @@ const closeIdentityModal = () => {
idCard: '',
idcard_1_img: '',
idcard_2_img: '',
idcard_effect_begin: '',
idcard_effect_end: '',
// idcard_effect_begin和idcard_effect_end字段已移除
province: '',
city: '',
county: '',
......@@ -739,110 +643,9 @@ const closeIdentityModal = () => {
idCardError.value = '';
};
/**
* 上传银行卡正面照
*/
const changeBankImg = () => {
Taro.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: function (res) {
const tempFilePath = res.tempFilePaths[0]
uploadBankImage(tempFilePath)
},
fail: function () {
Taro.showToast({
title: '选择图片失败',
icon: 'none'
})
}
})
}
// 银行卡图片上传相关函数已完全移除
/**
* 上传银行卡图片到服务器
* @param {String} filePath - 图片文件路径
*/
const uploadBankImage = (filePath) => {
// 显示上传中提示
Taro.showLoading({
title: '上传中',
mask: true
})
// 上传图片
wx.uploadFile({
url: BASE_URL + '/admin/?m=srv&a=upload',
filePath,
name: 'file',
header: {
'content-type': 'multipart/form-data',
},
success: function (res) {
let upload_data = JSON.parse(res.data);
Taro.hideLoading({
success: () => {
if (res.statusCode === 200) {
tempAccountInfo.value.bankImg = upload_data.data.src;
Taro.showToast({
title: '上传成功',
icon: 'success'
})
} else {
Taro.showToast({
icon: 'error',
title: '服务器错误,稍后重试!',
mask: true
})
}
},
});
},
fail: function (res) {
Taro.hideLoading({
success: () => {
Taro.showToast({
icon: 'error',
title: '上传失败,稍后重试!',
mask: true
})
},
});
}
})
}
/**
* 预览银行卡图片
*/
const previewBankImg = () => {
if (tempAccountInfo.value.bankImg) {
Taro.previewImage({
urls: [tempAccountInfo.value.bankImg],
current: tempAccountInfo.value.bankImg
})
}
}
/**
* 删除银行卡图片
*/
const deleteBankImg = () => {
Taro.showModal({
title: '确认删除',
content: '确定要删除银行卡照片吗?',
success: function (res) {
if (res.confirm) {
tempAccountInfo.value.bankImg = ''
Taro.showToast({
title: '删除成功',
icon: 'success'
})
}
}
})
}
// 银行卡图片预览和删除功能已移除
/**
* 选择身份证人像面照片
......@@ -1020,49 +823,7 @@ const showIdcardEndDatePicker = () => {
showEndDateTypeModal.value = true
}
/**
* 确认选择身份证有效期开始日期
* @param {Object} param - 日期选择器返回的参数
*/
const onIdcardBeginDateConfirm = (param) => {
const { selectedValue } = param
const year = selectedValue[0]
const month = selectedValue[1].toString().padStart(2, '0')
const day = selectedValue[2].toString().padStart(2, '0')
tempIdentityInfo.value.idcard_effect_begin = `${year}-${month}-${day}`
showIdcardBeginDate.value = false
}
/**
* 证件有效期结束类型选择确认回调
* @param {Object} param - 选择器返回的参数
*/
const onEndDateTypeConfirm = ({ selectedValue }) => {
const selectedType = selectedValue[0];
if (selectedType === 'long_term') {
// 选择长期,直接设置为"长期"
tempIdentityInfo.value.idcard_effect_end = '长期';
showEndDateTypeModal.value = false;
} else if (selectedType === 'select_date') {
// 选择日期,打开日期选择器
showEndDateTypeModal.value = false;
showIdcardEndDate.value = true;
}
};
/**
* 确认选择身份证有效期结束日期
* @param {Object} param - 日期选择器返回的参数
*/
const onIdcardEndDateConfirm = (param) => {
const { selectedValue } = param
const year = selectedValue[0]
const month = selectedValue[1].toString().padStart(2, '0')
const day = selectedValue[2].toString().padStart(2, '0')
tempIdentityInfo.value.idcard_effect_end = `${year}-${month}-${day}`
showIdcardEndDate.value = false
}
// 证件有效期相关的日期选择器确认函数已移除
/**
* 保存身份信息
......@@ -1089,11 +850,9 @@ const saveIdentityInfo = async () => {
// 调用API保存身份信息
const result = await updateProfileAPI({
name: tempIdentityInfo.value.userName,
idcard: tempIdentityInfo.value.idCard,
idcard_1_img: tempIdentityInfo.value.idcard_1_img,
idcard_2_img: tempIdentityInfo.value.idcard_2_img,
idcard_effect_begin: tempIdentityInfo.value.idcard_effect_begin,
idcard_effect_end: tempIdentityInfo.value.idcard_effect_end,
idcard: tempIdentityInfo.value.idCard,
idcard_1_img: tempIdentityInfo.value.idcard_1_img,
idcard_2_img: tempIdentityInfo.value.idcard_2_img,
// 使用真实的身份证地址字段名
idcard_province: tempIdentityInfo.value.idcard_province,
idcard_city: tempIdentityInfo.value.idcard_city,
......@@ -1107,11 +866,9 @@ const saveIdentityInfo = async () => {
// 更新全局用户状态
userStore.updateUserInfo({
name: tempIdentityInfo.value.userName,
idcard: tempIdentityInfo.value.idCard,
idcard_1_img: tempIdentityInfo.value.idcard_1_img,
idcard_2_img: tempIdentityInfo.value.idcard_2_img,
idcard_effect_begin: tempIdentityInfo.value.idcard_effect_begin,
idcard_effect_end: tempIdentityInfo.value.idcard_effect_end,
idcard: tempIdentityInfo.value.idCard,
idcard_1_img: tempIdentityInfo.value.idcard_1_img,
idcard_2_img: tempIdentityInfo.value.idcard_2_img,
// 身份证地址字段
idcard_province: tempIdentityInfo.value.idcard_province,
idcard_city: tempIdentityInfo.value.idcard_city,
......
......@@ -1165,7 +1165,7 @@ const checkUserPermission = async () => {
Taro.redirectTo({
url: '/pages/register/index?target=sell'
})
} else if (permissionResult.missingFields.includes('name') || permissionResult.missingFields.includes('bank_id') || permissionResult.missingFields.includes('bank_no') || permissionResult.missingFields.includes('idcard') || permissionResult.missingFields.includes('bank_img') || permissionResult.missingFields.includes('idcard_1_img') || permissionResult.missingFields.includes('idcard_2_img') || permissionResult.missingFields.includes('idcard_effect_begin') || permissionResult.missingFields.includes('idcard_effect_end') || permissionResult.missingFields.includes('idcard_address')) {
} else if (permissionResult.missingFields.includes('name') || permissionResult.missingFields.includes('bank_id') || permissionResult.missingFields.includes('bank_no') || permissionResult.missingFields.includes('idcard') || permissionResult.missingFields.includes('idcard_1_img') || permissionResult.missingFields.includes('idcard_2_img') || permissionResult.missingFields.includes('idcard_address')) {
// 收款信息未填写
Taro.redirectTo({
url: '/pages/collectionSettings/index?target=sell'
......
......@@ -29,11 +29,8 @@ export const useUserStore = defineStore('user', {
bank_no: '',
idcard: '',
is_signed: false,
bank_img: '',
idcard_1_img: '',
idcard_2_img: '',
idcard_effect_begin: '',
idcard_effect_end: '',
// 身份证地址字段
idcard_province: '',
idcard_city: '',
......@@ -61,7 +58,6 @@ export const useUserStore = defineStore('user', {
return !!(
state.userInfo.bank_id &&
state.userInfo.bank_no &&
state.userInfo.bank_img &&
state.userInfo.idcard_1_img &&
state.userInfo.idcard_2_img &&
state.userInfo.name &&
......@@ -69,9 +65,7 @@ export const useUserStore = defineStore('user', {
state.userInfo.idcard_province &&
state.userInfo.idcard_city &&
state.userInfo.idcard_district &&
state.userInfo.idcard_address &&
state.userInfo.idcard_effect_begin &&
state.userInfo.idcard_effect_end
state.userInfo.idcard_address
)
},
......@@ -144,11 +138,8 @@ export const useUserStore = defineStore('user', {
bank_no: '',
idcard: '',
is_signed: false,
bank_img: '',
idcard_1_img: '',
idcard_2_img: '',
idcard_effect_begin: '',
idcard_effect_end: '',
// 身份证地址字段
idcard_province: '',
idcard_city: '',
......
/*
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-08-12 09:21:10
* @LastEditTime: 2025-08-12 15:09:48
* @FilePath: /jgdl/src/utils/config.js
* @Description: 文件描述
*/
// TAG:服务器环境配置
// const BASE_URL = "https://oa-dev.onwall.cn"; // 测试服务器
const BASE_URL = "https://oa.onwall.cn"; // 正式服务器
const BASE_URL = "https://oa-dev.onwall.cn"; // 测试服务器
// const BASE_URL = "https://jiangedianlv.onwall.cn"; // 正式服务器
export default BASE_URL
......
......@@ -40,7 +40,7 @@ const PERMISSION_CONFIG = {
[PERMISSION_TYPES.SELL_CAR]: {
message: '发布车源需要先完善个人信息',
redirectUrl: '/pages/register/index',
checkFields: ['phone', 'name', 'bank_id', 'bank_no', 'idcard', 'bank_img', 'idcard_1_img', 'idcard_2_img', 'idcard_effect_begin', 'idcard_effect_end', 'idcard_address']
checkFields: ['phone', 'name', 'bank_id', 'bank_no', 'idcard', 'idcard_1_img', 'idcard_2_img', 'idcard_address']
},
[PERMISSION_TYPES.BUY_CAR]: {
message: '购买车辆需要先完善个人信息',
......