mui.ready(function() {
	var showCityPickerButton = dc('showCityPicker3');
	$.ajax({
		data: {},
		dataType: "json",
		type: 'post',
		url: base_path + '/placeInfo/get_placeInfo_detail',
		timeout: 10000,
		xhrFields: {
			withCredentials: true
		},
		crossDomain: true,
		success: function(data) {
			if(data.isRedirect) {
				location.href = data.redirectURL;
			} else {
				console.log(data);
				var tips = "";
				var roleName = data.returnMsg.placeInfo.roleName;
				var placeInfoStus = data.returnMsg.placeInfo.placeInfoStus;
				if(placeInfoStus == 1) {
					$('#updateBtn').show()
				}
				if(data.resultCode == "200") {
					var btn = dc('btn_submit');
					switch(data.returnCode) {
						case 2002:
							btn.setAttribute('disabled', 'disabled');
							break;
						default:
							btn.removeAttribute('disabled');
							btn.className = 'mui-btn mui-btn-block mui-btn-red';
							btn.innerText = '马上修改';
							break
					}
					dc('nickname').innerText = decodeURI(data.returnMsg.placeInfo.userNickname);
					dc('userhead').src = data.returnMsg.placeInfo.userHead;
					dc('userRoleName').innerText = data.returnMsg.placeInfo.roleName;
					var tel = data.returnMsg.placeInfo.tel;
					tel == null ? '' : dc('ipt-phone').innerText = tel;
					var name = data.returnMsg.placeInfo.name;
					name == null ? '' : dc('ipt-shop-name').innerText = name;
					var areaName = data.returnMsg.placeInfo.areaName;
					areaName == null ? '' : dc('city').innerText = areaName;
					var detailsAdress = data.returnMsg.placeInfo.addr;
					detailsAdress == null ? '' : dc('ipt-address').innerText = detailsAdress;
					var username = data.returnMsg.placeInfo.userName;
					username == null ? '' : dc('ipt-name').innerText = username;
					console.log("页面加载完毕");
					document.querySelector('.loading-bg').style.display = 'none'
				} else {
					mui.alert('获取信息失败,请刷新重试!')
				}
			}
		},
		error: function(xhr, type, errorThrown) {
			console.log(xhr)
		}
	})
});
mui('body').on('tap', '#btn_submit', function() {
	mui.openWindow({
		url: base_path + '/drp/placeInfo_update?dates=' + new Date().getTime()
	})
});

function toDrpCenter() {
	window.location.href = base_path + "/drp/indexPage?dates=" + new Date().getTime()
};