<template>
		<view  v-for="(item,index) in state.customerInfoList" @click="change(item.customerId,item.userType)">
			<view class="content">{{item.agentName?item.agentName:item.customerName}}</view>
		</view>
</template>
<script setup lang="ts">
	import {
		reactive
	} from "vue";
	import {
		msg,
		navTo
	} from "@/utils/utils";
	import {
		editablePage
	} from "@/utils/network/api.js";
	import {
		getItem
	} from "@/utils/storage.ts"
	import {
		requestNew
	} from "@/utils/network/request.js";
	const fieldStyle = {
		height: '60rpx',
		color: '#333333',
		fontSize: '28rpx'
	};
	import { onLoad } from "@dcloudio/uni-app"
	const state = reactive({
		ocrData: {
			name: '',
			gender: '',
			userCardId: '',
			add: "",
			tel: ''

		},
		customerId: '',
		customerInfoList:[],
		type:1  //1修改EC预留手机号 2用户信息变更
	})

	const getUserinfo = () => {
		const options = {
			type: 2,
			data: { 
				openId: getItem('openId'),
			    mobile: getItem("mobile"),
			 },
			method: "POST",
			showLoading: true,
		};
		requestNew(editablePage, options).then((res) => {
			state.customerInfoList = res.customerInfoList;
		});
	}

    const change = (customerId,userType) => {
		if(state.type==2){
			navTo(`/subpackage/personal-center/setting/personal-information/user-change?customerId=${customerId}`)
		}else{
			if(userType==1){
				navTo(`/subpackage/personal-center/setting/personal-information/choice-verification-way?userType=${userType}&customerId=${customerId}`)
			}else{
				navTo(`/subpackage/personal-center/setting/personal-information/choice-phone?userType=${userType}&customerId=${customerId}`)
			}
			console.log("state.修改EC预留手机号",)
		}
    }


	onLoad((options) => {
		getUserinfo()
		state.type=options.type
	})
</script>

<style>
	page {
		background-color: #EEF7F7;
		padding-top: 30rpx;
	}
</style>

<style lang="scss" scoped>
	.content {
		background-color: white;
		padding: 20rpx;
		margin: 20rpx;
		border-radius: 10rpx;
		font-size: 28rpx;
	}
</style>