Commit adc3faf5 by yuzhenWang

修复清单bug

parent cac1af8d
<template>
<view class="search-container">
<!-- 输入框 -->
<view class="inputBox">
<input
class="search-input"
v-model="searchText"
@input="handleInput"
@focus="showDropdown = true"
style="text-align: right;"
:disabled="isClick"
placeholder="请输入关键词"
/>
<uni-icons @click="openDropdown" type="right" size="20" ></uni-icons>
</view>
<!-- 下拉框 -->
<view v-if="showDropdown" class="dropdown">
<view class="cancle" @click="showDropdown = false">
取消
</view>
<scroll-view scroll-y class="dropdown-list" :style="{ maxHeight: dropdownMaxHeight }">
<view
v-for="(item, index) in displayedList"
:key="index"
class="dropdown-item"
@click.stop="handleSelect(item)"
>
{{ item.label }}
</view>
<!-- 无数据提示 -->
<view v-if="displayedList.length === 0" class="empty">无匹配结果</view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
props: {
// 后端返回的全部数据(格式:[{ label: '名称', value: 'id' }, ...])
allData: {
type: Array,
default: () => [],
},
isClick: {
type: Boolean,
default: false,
},
},
data() {
return {
searchText: '', // 输入框内容
showDropdown: false, // 控制下拉显示
displayedList: [], // 当前展示的数据
dropdownMaxHeight: '500rpx', // 下拉框最大高度
};
},
methods: {
openDropdown(){
if(this.isClick) return
this.showDropdown = true
},
// 输入处理(含防抖)
handleInput() {
clearTimeout(this.debounceTimer);
this.debounceTimer = setTimeout(() => {
this.filterData();
}, 300);
},
// 过滤数据
filterData() {
const keyword = this.searchText.trim().toLowerCase();
if (!keyword) {
// 无关键词时显示前10条
this.displayedList = this.allData.slice(0, 10);
} else {
// 有关键词时过滤全部数据
this.displayedList = this.allData.filter(item =>
item.label.toLowerCase().includes(keyword)
);
}
},
// 选择项
handleSelect(item) {
this.searchText = item.label;
this.showDropdown = false;
this.$emit('select', item); // 向父组件传递选中项
console.log('item',item);
console.log(' this.searchText', this.searchText);
},
},
mounted() {
if(this.allData[0].show){
this.searchText = this.allData[0].label;
}
// 初始展示前10条
this.displayedList = this.allData.slice(0, 8);
},
};
</script>
<style lang="scss" scoped>
.search-container {
position: relative;
width: 100%; /* 按需调整宽度 */
box-sizing: border-box;
padding-right: 0rpx;
}
.inputBox{
display: flex;
align-items: center;
justify-content: flex-start;
}
.search-input {
width: 100%;
font-size: 28rpx;
}
.dropdown {
position: absolute;
width: 100%;
margin-top: 10rpx;
background: #ffffff;
// border: 2rpx solid #e0e0e0;
border-radius: 8rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
z-index: 1000;
.cancle{
height: 60rpx;
box-sizing: border-box;
padding-right: 30rpx;
background-color: rgba(235, 239, 247, .8);
display: flex;
align-items: center;
justify-content: flex-end;
}
}
.dropdown-list {
width: 100%;
}
.dropdown-item {
padding: 24rpx 20rpx;
font-size: 28rpx;
border-bottom: 2rpx solid #f5f5f5;
}
.dropdown-item:last-child {
border-bottom: none;
}
.empty {
padding: 24rpx;
color: #999;
text-align: center;
}
</style>
\ No newline at end of file
<template>
<view class="container">
<view class="top">
<text class="iconfont icon-youjiantou zuojiantou" @click="goBack()"></text>
<text>申请加盟</text>
</view>
<view class="page">
<text class="num actived pass">1</text>
<text class="line line_pass"></text>
<text class="num actived pass">2</text>
<text class="line line_pass"></text>
<text class="num actived">3</text>
<text class="line"></text>
<text class="num">4</text>
<text class="line"></text>
<text class="num">5</text>
<text class="line"></text>
<text class="num">6</text>
<text class="line"></text>
<text class="num">7</text>
<!-- <text class="line"></text>
<text class="num">8</text> -->
<view class="container" style="height: 1000rpx;">
<view >
<view class="top">
<text class="iconfont icon-youjiantou zuojiantou" @click="goBack()"></text>
<text>申请加盟</text>
</view>
<view class="page">
<text class="num actived pass">1</text>
<text class="line line_pass"></text>
<text class="num actived pass">2</text>
<text class="line line_pass"></text>
<text class="num actived">3</text>
<text class="line"></text>
<text class="num">4</text>
<text class="line"></text>
<text class="num">5</text>
<text class="line"></text>
<text class="num">6</text>
<text class="line"></text>
<text class="num">7</text>
<!-- <text class="line"></text>
<text class="num">8</text> -->
</view>
</view>
<view class="wrapper">
<view class="title">
......@@ -30,9 +32,34 @@
</view>
<view class="content">
<view class="contentDetail employ">
<view class="contentItem">
<view class="contentItem yinhang">
<text>开户行</text>
<input class="form-control" name="" placeholder="请输入开户行" v-model="backForm.bankAccountOpening"
<!-- :disabled="this.backForm.approvalStatus!= 0 && this.backForm.approvalStatus != 2" -->
<!-- <input
class="form-control"
name=""
placeholder="请输入开户行"
v-model="backForm.bankAccountOpening"
/> -->
<view class="searchInput" >
<searchInput
v-if="bankList.length>0"
:allData="bankList"
@select="onSelect"
:isClick="this.backForm.approvalStatus!= 0 && this.backForm.approvalStatus != 2"
/>
</view>
</view>
<view class="contentItem" v-if="showBank">
<text></text>
<input
class="form-control"
placeholder="请输入开户行名称"
v-model="backForm.bankAccountOpening"
auto-blur=true
:disabled="this.backForm.approvalStatus!= 0 && this.backForm.approvalStatus != 2" />
</view>
<view class="contentItem">
......@@ -58,13 +85,15 @@
<script>
import api from '@/api/api';
import searchInput from '@/components/searchInput/searchInput.vue';
export default {
data() {
return {
showBank:false,
shareId: null,
sureBankAccountId: '',
applyParam: {},
bankList:{},
bankList:[],
backForm: {
bankAccountOpening: '',
bankAccountId: '',
......@@ -72,10 +101,10 @@
}
}
},
components: {},
components: { searchInput },
onLoad(options) {
this.shareId = options.shareId
this.bankQry();
},
onShow() {
uni.showLoading({
......@@ -93,6 +122,16 @@
}
},
methods: {
onSelect(item){
if(item.id == '1'){
this.showBank = true
}else {
this.showBank = false
}
this.backForm.bankAccountOpening = item.bankName
console.log(this.backForm);
},
goBack() {
uni.navigateBack({
delta: 1
......@@ -118,6 +157,7 @@
this.sureBankAccountId = '';
}
}
this.bankQry();
uni.hideLoading()
})
},
......@@ -127,8 +167,21 @@
userId: userId
}).then((res) => {
if (res['success']) {
this.bankList = res['data']['bankList'];
console.log(this.bankList);
this.bankList= res['data']['bankList'];
if(this.bankList.length>0){
this.bankList.forEach(item=>{
item.label = item.bankName
item.id = item.bankId
})
//兼容以前的旧数据,以前开户行有值并且不在银行列表里通通显示自定义
if(this.backForm.bankAccountOpening && this.bankList.filter(item=>item.bankName==this.backForm.bankAccountOpening).length<=0) {
this.bankList.unshift({label:'自定义',id:'1',show:true})
this.showBank = true
}else {
this.showBank = false
this.bankList.unshift({label:'自定义',id:'1',show:false})
}
}
}
})
},
......@@ -202,10 +255,24 @@
}
</script>
<style lang="scss">
<style lang="scss" scoped>
@import 'applyCommon.scss';
.container{
display: flex;
flex-direction: column;
// height: 100%;
.wrapper{
flex: 1;
}
}
.form-control {
min-width: 440rpx;
}
.yinhang{
.searchInput{
width: 80%;
}
}
</style>
......@@ -76,8 +76,14 @@
</view>
<view class="contentItem">
<text>证件类型</text>
<picker @change="changeIdType" :value="idTypeIdx" :range="idTypesList" range-key="name"
:disabled="this.applyParam.approvalStatus!= 0 && this.applyParam.approvalStatus != 2">
<picker
@change="changeIdType"
:value="idTypeIdx"
:range="idTypesList"
range-key="name"
:disabled="this.applyParam.approvalStatus!= 0 && this.applyParam.approvalStatus != 2"
>
<view class="uni-input">{{idTypesList[idTypeIdx]['name']}}
<text class="iconfont icon-youjiantou"></text>
</view>
......@@ -93,11 +99,18 @@
</view>
<view class="contentItem">
<text>出生日期</text>
<picker mode="date" :value="applyParam.birthday" @change="bindBirthday" :end="maxDate"
:disabled="this.applyParam.approvalStatus!= 0 && this.applyParam.approvalStatus != 2">
<!-- :disabled="this.applyParam.approvalStatus!= 0 && this.applyParam.approvalStatus != 2" -->
<picker
mode="date"
:value="applyParam.birthday"
@change="bindBirthday"
:end="maxDate"
:disabled="this.applyParam.approvalStatus!= 0 && this.applyParam.approvalStatus != 2"
>
<view v-if="!applyParam.birthday">请选择 <text class="iconfont icon-youjiantou"></text> </view>
<view class="uni-input" v-if="applyParam.birthday">{{this.applyParam.birthday}} <text
class="iconfont icon-youjiantou"></text></view>
<view class="uni-input" v-if="applyParam.birthday">
{{this.applyParam.birthday}}
<text class="iconfont icon-youjiantou"></text></view>
</picker>
</view>
<view class="contentItem">
......@@ -122,6 +135,7 @@
export default {
data() {
return {
showBank:false,
identityIdx: 0,
identityArr: [{
partnerLevel: 'A1',
......@@ -256,6 +270,14 @@
},
bindBirthday: function(e) {
this.applyParam.birthday = e.detail.value;
if(!util.isAdult(this.applyParam.birthday)){
uni.showToast({
title: '未满18岁不可申请',
duration: 2000,
icon: 'none'
})
return
}
},
changeArea: function(e) {
this.areaIdIdx = e.detail.value;
......@@ -408,6 +430,14 @@
})
return;
}else{
if(!util.isAdult(this.applyParam.birthday)){
uni.showToast({
title: '未满18岁不可申请',
duration: 2000,
icon: 'none'
})
return
}
// uni.showToast({
// title: '未满18岁不可申请',
......@@ -416,6 +446,8 @@
// })
// return;
}
this.applyParam = {
...this.applyParam,
applyType: this.applyParam.inviterInvitationCode ? '1' : '2',
......@@ -445,6 +477,16 @@
uni.hideLoading()
})
} else {
// if(!util.isAdult(this.applyParam.birthday)){
// uni.showToast({
// title: '未满18岁不可申请',
// duration: 2000,
// icon: 'none'
// })
// return
// }
// uni.navigateTo({
// // url:`work-experience?id=${res['data']['id']}`
// url: `work-experience`
......@@ -460,7 +502,7 @@
}
</script>
<style lang="scss">
<style lang="scss" scoped>
@import 'applyCommon.scss';
.form-control{
min-width: 400rpx;
......
......@@ -31,29 +31,29 @@
<view class="content" style="padding-bottom: 150rpx;">
<view class="content_wrapper">
<view class="photo" v-if="!cardForm.idFrontPageOssPath" @click="upLoadPhoto('front')">
<image src="../../static/front.png" alt="身份证正面" mode="widthFix"></image>
<image v-if="cardForm.idType == '身份证'" src="../../static/front.png" alt="身份证正面" mode="widthFix"></image>
<text class="iconfont icon-weibiaoti553"></text>
<view class="choseBtn">点击添加身份证正面</view>
<view class="choseBtn">点击添加{{cardForm.idType}}正面</view>
</view>
<!-- <view class="content_w" v-if="cardForm.idFrontPageOssPath"> -->
<image class="picImg" v-if="cardForm.idFrontPageOssPath" :src="cardForm.idFrontPageOssPath" @click="upLoadPhoto('front')" mode="widthFix"></image>
<!-- </view> -->
<view class="tips">
<view>(正确示例:身份证正面,字体清晰)</view>
<view>(正确示例:{{cardForm.idType}}正面,字体清晰)</view>
<view>(jpg,png 文件大小不大于1mb)</view>
</view>
</view>
<view class="content_wrapper" style="margin-top: 25px;">
<view class="photo" v-if="!cardForm.idBackPageOssPath" @click="upLoadPhoto('back')">
<image src="../../static/back.png" alt="身份证反面" mode="widthFix"></image>
<image v-if="cardForm.idType == '身份证'" src="../../static/back.png" alt="身份证反面" mode="widthFix"></image>
<text class="iconfont icon-weibiaoti553"></text>
<view class="choseBtn">点击添加身份证反面</view>
<view class="choseBtn">点击添加{{cardForm.idType}}反面</view>
</view>
<!-- <view class="content_w" v-if="cardForm.idBackPageOssPath"> -->
<image class="picImg" v-if="cardForm.idBackPageOssPath" :src="cardForm.idBackPageOssPath" @click="upLoadPhoto('back')" mode="widthFix"></image>
<!-- </view> -->
<view class="tips">
<view>(正确示例:身份证反面,字体清晰)</view>
<view>(正确示例:{{cardForm.idType}}反面,字体清晰)</view>
<view>(jpg,png 文件大小不大于1mb)</view>
</view>
</view>
......@@ -143,8 +143,10 @@
}
this.cardForm.approvalStatus = this.applyParam.approvalStatus
this.cardForm.id = this.applyParam.id
this.cardForm.idType = this.applyParam.idType
uni.setStorageSync('cardForm',this.cardForm)
}
uni.hideLoading()
})
},
......@@ -175,7 +177,7 @@
if (this.cardForm.approvalStatus == 0 || this.cardForm.approvalStatus == 2) {
if (!this.cardForm.idFrontPageOssPath) {
uni.showToast({
title: '请上传身份证正面照片',
title: `请上传${this.cardForm.idType}正面照片`,
duration: 2000,
icon: 'none'
})
......@@ -183,7 +185,7 @@
}
if (!this.cardForm.idBackPageOssPath) {
uni.showToast({
title: '请上传身份证反面照片',
title: `请上传${this.cardForm.idType}反面照片`,
duration: 2000,
icon: 'none'
})
......@@ -252,6 +254,7 @@
font-size: 12px;
color: #333;
width: 75%;
height: 400rpx;
background-size: contain;
background-repeat: no-repeat;
position: relative;
......
......@@ -132,10 +132,11 @@
},
saveInfo() {
if (this.personalForm.approvalStatus == 0 || this.personalForm.approvalStatus == 2) {
const selectedPersonalStatement = this.dropOptionsInfoList.filter((item) => {
let selectedPersonalStatement = []
selectedPersonalStatement = this.dropOptionsInfoList.filter((item) => {
return item.status == 1;
});
if (!selectedPersonalStatement.length && selectedPersonalStatement.length < this.dropOptionsInfoList.length) {
if (selectedPersonalStatement.length < this.dropOptionsInfoList.length) {
uni.showToast({
title: '需全部符合条件才可申请加盟',
duration: 2000,
......
......@@ -52,5 +52,44 @@ export default{
}else {
return val;
}
},
// 年龄是否大于18
isAdult(birthDateString) {
if(!birthDateString) return
// 拆分日期字符串
const parts = birthDateString.split('-');
if (parts.length !== 3) return false;
const year = parseInt(parts[0], 10);
const month = parseInt(parts[1], 10);
const day = parseInt(parts[2], 10);
// 检查年月日是否为有效数字
if (isNaN(year) || isNaN(month) || isNaN(day)) return false;
// 创建日期对象(月份从0开始)
const birthDate = new Date(year, month - 1, day);
// 验证日期有效性
if (
birthDate.getMonth() + 1 !== month ||
birthDate.getDate() !== day
) {
return false;
}
const currentDate = new Date();
// 检查出生日期是否在当前日期之后
if (birthDate > currentDate) {
return false;
}
// 计算18年后的日期
const eighteenYearsLater = new Date(birthDate);
eighteenYearsLater.setFullYear(eighteenYearsLater.getFullYear() + 18);
// 判断是否已满18岁
return eighteenYearsLater <= currentDate;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment