<template>
	<view class="userInfo">
		<scroll-view :scroll-y="true" :style="{ height: phoneHight }">
			<view class="p30">
				<image :src="imgfixUrls + 'merchant/ts.png'" class="tspng verCenter"></image>
				<span class="font24 color666666 verCenter pL18">{{languageStatus!=1?'请填写真实有效的信息！':'진실유효된 정보를 입력하세요'}}</span>
			</view>
			<view class="backColorW backColorW">
				<span class="font28 color333333 verCenter pL30 width148 disInline ">{{languageStatus!=1?'姓名':'성명'}}：</span>
				<input placeholder="请输入姓名" class="font28 height107 color333333 verCenter disInline pL30" v-model="userInfo.realname"/>
			</view>
			<view class="inputView backColorW" v-if="userInfo.bankstatus == 1 || userInfo.alipaystatus == 1">
				<view class="backColorW marT20 height108" v-if="userInfo.bankstatus == 1">
					<span class="font28 color333333 verCenter pL30 width148 disInline ">{{examineing == 0?(languageStatus!=1?'开户行':'개설은행'):'备注信息1'}}：</span>
					<input :placeholder="examineing == 0?(languageStatus!=1?'请输入银行卡开户行':'개설은행명칭을 입력하세요'):'请输入备注信息1'" class="font28 height107 color333333 verCenter disInline pL30" v-model="userInfo.bank_name"/>
					<view class="Bottline"></view>
				</view>
				<view class="backColorW height108" v-if="userInfo.bankstatus == 1">
					<span class="font28 color333333 verCenter pL30 width148 disInline ">{{examineing == 0?(languageStatus!=1?'开户人':'예금주 '):'备注信息2'}}：</span>
					<input :placeholder="examineing == 0?(languageStatus!=1?'请输入银行卡开户行人姓名':'예금주 이름을 입력하세요'):'请输入备注信息2'"  class="font28 height107 color333333 verCenter disInline pL30" v-model="userInfo.bank_username"/>
					<view class="Bottline"></view>
				</view>
				<view class="backColorW height108" v-if="userInfo.bankstatus == 1">
					<span class="font28 color333333 verCenter pL30 width148 disInline ">{{examineing == 0?(languageStatus!=1?'银行卡账号':'은행카드 계좌번호'):'备注信息3'}}：</span>
					<input type="number" :placeholder="examineing == 0?(languageStatus!=1?'请输入银行卡账号':'은행카드 계좌번호를 입력하세요'):'请输入备注信息3'" class="font28 height107 color333333 verCenter disInline pL30" v-model="userInfo.card_number"/>
					<view class="Bottline"></view>
				</view>
				<view class="backColorW height108" v-if="userInfo.alipaystatus == 1">
					<span class="font28 color333333 verCenter pL30 width148 disInline ">{{examineing == 0?(languageStatus!=1?'支付宝账号':'즈푸보 계좌번호'):'备注信息4'}}：</span>
					<input :placeholder="examineing == 0?(languageStatus!=1?'请输入支付宝账号':'계좌번호를 입력하세요'):'请输入备注信息4'"  class="font28 height107 color333333 verCenter disInline pL30" v-model="userInfo.alipay"/>
					<view class="Bottline"></view>
				</view>
				<!-- <view class="backColorW height108">
					<span class="font28 color333333 verCenter pL30 width148 disInline ">{{examineing == 0?'支付密码':'备注信息5'}}：</span>
					<input :placeholder="examineing == 0?'请输入支付密码':'请输入备注信息4'"  class="font28 height107 color333333 verCenter disInline pL30" v-model="userInfo.integralpwd"/>
					<view class="Bottline"></view>
				</view> -->
				<view class="submitBotton marT80 textC" @click="setUserInfo">
					<span class="line96 font30 colorW">{{languageStatus!=1?'保存':'저장'}}</span>
				</view>
			</view>
			<view class="inputView backColorW" v-else>
				
				<view class="submitBotton marT80 textC" @click="setUserInfo">
					<span class="line96 font30 colorW">保存</span>
				</view>
			</view>
		</scroll-view>
		<far-bottom></far-bottom>
	</view>
</template>

<script>
import App from '@/common/js/app.js'	
	
export default {
	data() {
		return {
			phoneHight: null,
			userInfo:{},
			examineing:1
		};
	},
	onLoad(e) {
		let _this = this;
		let TextSubstitution = uni.getStorageSync('TextSubstitution');
		_this.examineing = TextSubstitution.examineing || 0;
		_this.init();
	},
	methods: {
		init() {
			let _this = this;
			uni.getSystemInfo({
				success(res) {
					_this.phoneHight = res.windowHeight + 'px';
				}
			});
			_this.getUserInfo();
		},
		// 修改个人信息
		getUserInfo(){
			let _this=this
			let data={
				type:'get',
			}
			
			App._post_form('&p=member&do=setUserInfo',data,res=>{
				_this.userInfo=res.data
				// _this.userInfo.bankstatus = 1;
				// _this.userInfo.alipaystatus = 1;
			})
		},
		setUserInfo(){
			let _this=this
			let data={
				type:'set',
				realname:_this.userInfo.realname,
				bank_name:_this.userInfo.bank_name,
				card_number:_this.userInfo.card_number,
				bank_username:_this.userInfo.bank_username,
				alipay:_this.userInfo.alipay
			}
			if(_this.userInfo.realname=='' && _this.examineing == 0){
				uni.showToast({
					icon:"none",
				    title: '姓名不能为空',
				    duration: 2000
				});
				return;
			}
			if(_this.userInfo.bankstatus == 1 || _this.userInfo.alipaystatus == 1){
				if((_this.userInfo.card_number.length < 13 || _this.userInfo.card_number.length > 25) && _this.examineing == 0) {
					uni.showToast({
						icon:"none",
					    title: '请输入正确银行卡号',
					    duration: 2000
					});
					return;
				}
			}
			
			App._post_form('&p=member&do=setUserInfo',data,res=>{
				uni.showToast({
					title: '修改成功'
				})
				setTimeout(()=>{
					uni.navigateBack({
					    delta: 1
					});
				}, 1000)
			})
		}
	}
};
</script>

<style lang="less">
.userInfo {
	background: #f8f8f8;
	font-size: 0;
}
.inputView {
	height: 890upx;
}
.tspng {
	width: 40upx;
	height: 40upx;
}
.font24 {
	font-size: 24upx;
}
.color666666 {
	color: #666666;
}
.pL18 {
	padding-left: 18upx;
}
.verCenter {
	vertical-align: middle;
}
.p30 {
	padding: 30upx;
}
.font28 {
	font-size: 28upx;
}
.height107 {
	height: 107upx;
	width: 400upx;
}
.height108 {
	height: 109upx;
}
.backColorW {
	background: rgba(255, 255, 255, 1);
}
.color333333 {
	color: #333333;
}
.disInline {
	display: inline-block;
}
.pL30 {
	padding-left: 30upx;
}
.width148 {
	width: 168upx;
}
.textRight {
	text-align: right;
}
.marT20 {
	margin-top: 20upx;
}
.Bottline {
	height: 1upx;
	width: 690upx;
	background: rgba(238, 238, 238, 1);
	margin: auto;
}
.submitBotton{
	width:690upx;
	height:96upx;
	background:rgba(255,68,68,1);
	border-radius:10upx;
}
.line96{
	line-height: 96upx;
}
.marT80{
	margin: 80upx auto 0 auto;
}
.textC{
	text-align: center;
}
.font30{
	font-size: 30upx;
}
.colorW{
	color:rgba(255,255,255,1);
}
</style>
