| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <view class="container">
- <view class="body">
- <!-- 每一个小孩区域 -->
- <view class="body_box" v-for="item in list" :key="item.id" @click="change(item)">
- <radio class="box_radio" :checked="item.isCheck" color="#1E7DFB" />
- <view class="box_info">
- <view class="">{{ item.name }}</view>
- <view class="">{{ item.cardNo }}</view>
- </view>
- </view>
- <!-- 确认按钮区域 -->
- <view class="body_btn" @click="handleConfirm">确认</view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { onLoad } from '@dcloudio/uni-app'
- onLoad((options) => {
- list.value = JSON.parse(options.list) || []
- currentId.value = options.id
- list.value.forEach((ele) => {
- if (ele.id == currentId.value) {
- ele.isCheck = true
- }
- })
- })
- const currentId = ref()
- // 小孩列表数据
- const list = ref([])
- const change = (item) => {
- list.value.forEach((ele) => {
- ele.isCheck = false
- })
- item.isCheck = !item.isCheck
- }
- // 确认按钮回调
- const handleConfirm = () => {
- const temObj = list.value.find((ele) => ele.isCheck)
- uni.$emit('updateObj', temObj)
- uni.navigateBack(1)
- }
- </script>
- <style lang="scss" scoped>
- .container {
- display: flex;
- flex-direction: column;
- min-height: 100vh;
- background-color: #f1f6fe;
- .body {
- padding-left: 20rpx;
- margin-top: 20rpx;
- height: calc(100vh - 20rpx);
- background-color: #fff;
- .body_box {
- display: flex;
- align-items: center;
- height: 170rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .box_radio {
- margin-left: 20rpx;
- }
- .box_info {
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin-left: 40rpx;
- height: 95rpx;
- }
- }
- .body_btn {
- margin: auto;
- margin-top: 400rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 297rpx;
- height: 100rpx;
- color: #fff;
- font-size: 32rpx;
- border-radius: 8rpx;
- background-color: #1e7dfb;
- }
- }
- }
- </style>
|