uniapp 弹窗带搜索列表

uniapp yekong 1008℃

uniapp微信小程序开发 弹窗选择车牌
uniapp 弹窗带搜索列表

代码

<template>
	<view>
		<view @click="show=true">
			<slot></slot>
		</view>
		<u-popup :show="show" mode="bottom" bgColor="transparent">
			<view class="popupwin">
				<div class="popTitle">
					平台车辆选择
				</div>
				<div class="close" @click="getHide">
					<u-icon name="close"></u-icon>
				</div>
				<div class="search">
					<image
						src="https://images.wanjunshijie.com/mini/buildingMaterialsCloud/home/addressBook/icon_search.png"
						mode=""></image>
					<input @confirm="getdata" type="text" v-model="CarNum" placeholder="请输入车牌号"
						placeholder-style="color:#B8BACB" />
				</div>
				<scroll-view class="searchbody" scroll-y>
					<div class="list">
						<div @click="getactive(index)" :class="{active:active==index}" class="listitem"
							v-for="(item,index) in list" :key="index">
							<text>{{item.CarNum}}</text>
							<div v-if="active==index" class="icon">
								<image
									src="https://images.wanjunshijie.com/mini/buildingMaterialsCloud/home/icon_selected.png"
									mode="widthFix">
								</image>
							</div>
						</div>
					</div>
				</scroll-view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		GetRegCarList
	} from '@/config/api.js'
	export default {
		data() {
			return {
				show: false,
				active: 0,
				list: [],
				CarNum: ''
			}
		},
		props: {
			datastr: {
				type: String,
				default () {
					return '';
				}
			}
		},
		mounted() {
			this.getdata()
		},
		methods: {
			getHide() {
				this.show = false
			},
			getShow() {
				this.show = true
			},
			getdata() {
				var that = this;
				GetRegCarList({
					params: {
						CarNum: that.CarNum
					},
					custom: {
						auth: true
					}
				}).then(res => {
					if (res.Code == 200) {
						that.list = res.Data
					}
				}).catch(err => {

				})
			},
			getactive(index) {
				var that = this;
				that.active = index
				that.getHide()
				that.$emit('getdata', that.list[that.active])
			},
		}
	}
</script>

<style scoped lang="scss">
	.popupwin {
		width: 750rpx;
		// height: 750rpx;
		background: #FFFFFF;
		border-radius: 20rpx 20rpx 0px 0px;
		opacity: 1;
		position: relative;
		z-index: 1000;
	}

	.line {
		width: 100rpx;
		height: 4rpx;
		opacity: 1;
		background: #7D7D7D;
		margin: 25rpx auto;
	}

	.list {
		width: 694rpx;
		margin: 0 auto;

		.listitem {
			width: 694rpx;
			height: 112rpx;
			margin: auto;
			display: flex;
			justify-content: space-between;
			align-items: center;
			flex-wrap: nowrap;
			flex-direction: row;
			align-content: flex-start;
			background: rgba(216, 216, 216, 0);
			box-shadow: 0px 1px 0px 0px #F2F2F2;

			text {
				font-size: 34rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #2C2F63;
			}
		}

		.listitem.active {
			text {
				color: #4087FF;
			}
		}
	}

	.nodata {
		font-size: 34rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #7D7D7D;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		margin: 64rpx auto;
	}

	.searchbody {
		height: 550rpx;
	}

	.close {
		position: absolute;
		right: 30rpx;
		top: 30rpx;
		z-index: 10;
	}

	
	.popTitle {
		height: 100rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		font-size: 32rpx;
		color: #000;
		margin-left: 28rpx;
	}

	.popbut {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		align-content: flex-start;
		// height: 60rpx;
		// background: #F5F6FC;
		// border-radius: 8rpx;
		// padding-left: 20rpx;
		// padding-right: 20rpx;

		text {
			font-size: 28rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #424474;
			margin-right: 12rpx;
		}

		image {
			width: 21rpx;
			height: 13rpx;
		}
	}

	.icon {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		align-content: flex-start;
		width: 36rpx;

		image {
			width: 36rpx;
		}
	}

	.search {
		width: 686rpx;
		height: 80rpx;
		background: #F5F6FA;
		border-radius: 20rpx;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		flex-wrap: nowrap;
		flex-direction: row;
		margin: 0 auto;
		align-content: flex-start;

		image {
			width: 30rpx;
			height: 30rpx;
			margin-right: 8rpx;
			margin-left: 28rpx;
			margin-right: 16rpx;
		}

		text {
			font-size: 30rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #9D9EB7;
		}

		input {
			font-size: 30rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #4C4F7B;
			width: 500rpx;
		}
	}
</style>

gitee

uniapp 弹窗带搜索列表

喜欢 (0)