<template>
	<u-navbar title="系统设置" bgColor='#D3832A' leftIconColor='#ffffff' titleStyle='color:#ffffff' placeholder
		:autoBack="true" leftIconSize='35'></u-navbar>
	<view class="uni-list">
		<!-- 		<view class="uni-list-cell" style="display: flex;">
			<view class="uni-list-cell-left">
				扫描版本选择
			</view>
			<view class="uni-list-cell-db">
				<picker @change="bindPickerChange" :value="pda.pdaChooseIndex"
					:range="pda.padVersionList.map(val => val.title)">
					<view class="uni-input">{{pda.padVersionList.map(val => val.title)[pda.pdaChooseIndex]}}</view>
				</picker>
			</view>
		</view> -->
	</view>
</template>

<script lang="ts" setup>
	import {
		onShow,
		onLoad,
		onHide,
		onPullDownRefresh
	} from '@dcloudio/uni-app'
	import { reactive, ref, toRefs } from 'vue';
	import usePdaStore from '../../../store/uaePdaStore';
	const { HANDLE_PDABROADCAS } = usePdaStore()

	onPullDownRefresh(() => {
		const timer = setTimeout(() => {
			// 关闭下拉刷新
			uni.stopPullDownRefresh()
			clearTimeout(timer)
		}, 500)
	})

	const details = reactive({
		pda: {
			// pda版本列表
			padVersionList: [
				{ title: '新版本', value: 'newPdaVersion' },
				{ title: '老版本', value: 'oldPdaVersion' },
			],
			// 选中的索引
			pdaChooseIndex: 0
		}

	})

	const array = reactive(['中国', '美国', '巴西', '日本'])
	const index = ref(0)
	function bindPickerChange(e) {
		console.log('picker发送选择改变，携带值为', e.detail.value)
		pda.value.pdaChooseIndex = e.detail.value
		HANDLE_PDABROADCAS(details.pda.padVersionList[details.pda.pdaChooseIndex].value)
	}

	const { pda } = toRefs(details)
</script>

<style lang="scss" scoped>

</style>