<template>
	<view>
		<dHeader :title="$lang.lang.companyInfo.info"></dHeader>
		<view class="start-bar"></view>
		<view class="consultAdd">
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.name}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyName" type="text" :placeholder="$lang.lang.notices.company">
				</view>			
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.nameEn}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyEnName" type="text" :placeholder="$lang.lang.notices.companyEn">
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.address}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyAddress" type="text" :placeholder="$lang.lang.notices.addressCom">
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.remark}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyDesc" type="text" :placeholder="$lang.lang.notices.remark">
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.web}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyWebsite" type="text" :placeholder="$lang.lang.notices.web">
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.stall}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyStall" type="text" :placeholder="$lang.lang.notices.stall">
				</view>
			</view>
			<view class="consult-item">
				<view class="consult-item-label">
					<text>{{$lang.lang.companyInfo.brand}}</text>
				</view>
				<view class="consult-item-put">
					<input v-model="params.companyBand" type="text" :placeholder="$lang.lang.notices.brand">
				</view>
			</view>
		</view>
		<view class="consult-btn">
			<view class="" @click="submitForm">{{$lang.lang.companyInfo.edit}}</view>
		</view>
	</view>
</template>

<script>
	import dHeader from '../../components/dHeader/index.vue'
	export default {
		components: {
			dHeader
		},
		data() {
			return {
				params:{
					id:0
				},
			}
		},
		onLoad() {
			this.getCompnyInfo()
		},

		methods: {
			submitForm(){
			    var url = ''
				if(this.params.id){
					url="/app-api/member/user/updateCompanyInfo"
					this.$request.put(url,this.params).then(res => {
						if(res.code == 0){
							uni.showToast({
								title:this.$lang.lang.notices.operation,
								icon:'none'
							})
							this.getCompnyInfo()
						}else{
							uni.showToast({
								title:res.msg,
								icon:'none'
							})
						}
					})
				}else{
					url="/app-api/member/user/createCompanyInfo"
					this.$request.post(url,this.params).then(res => {
						if(res.code == 0){
							uni.showToast({
								title:this.$lang.lang.notices.operation,
								icon:'none'
							})
							this.getCompnyInfo()
						}else{
							uni.showToast({
								title:res.msg,
								icon:'none'
							})
						}
					})
				}
			},
			getCompnyInfo(){
				this.$request.get('/app-api/member/user/getCompanyInfo').then(res => {
					if(res.code == 0&&res.data){
						this.params = res.data
					}
				})
			},
		}
	}
</script>

<style>
page{
	padding-top: 190upx;
}
.consultAdd{
	width: 90%;
	margin: 0 auto 30upx;
	background-color: var(--c0);
	border-radius: 24upx;
	padding: 20upx 0;
	font-size: var(--f26);
}
.consult-item{
	display: flex;
	width: 92%;
	margin: 0 auto;
	margin-bottom: 20upx;
	position: relative;
}
.consult-item-2{
	width: 100%;
	padding: 20upx 0 0 0;
}
.consult-item image{
	width: 44upx;
	height: 44upx;
	vertical-align: middle;
}
.consult-item-2 image{
	width: 44upx;
	height: 44upx;
	vertical-align: middle;
	margin-right: 14upx;
	margin-left: 40upx;
}
.consult-item-label{
	width: 180upx;
	display: flex;
	align-items: center;
}
.consult-item-put {
	height: 70upx;
	border: 1px solid var(--cdf);
	display: flex;
	align-items: center;
	padding-left: 20upx;
	border-radius: 10upx;
	flex: 1;
}
.consult-item-put input{
	font-size: var(--f26);
}

.consult-item-label-2{
	padding: 0 0 0 0upx;
	display: flex;
	align-items: center;
	width: 100%;
}
.consult-item-put-2{
	padding: 30upx 40upx 30upx 40upx;
	display: flex;
	align-items: center;
	border-radius: 1px solid var(--cdf);
}
.consult-item-put-2 .textarea{
	font-size: var(--f26);
	width: 100%;
	height: 200upx;
	padding: 20upx;
	border: 1px solid var(--cdf);
	border-radius: 10upx;
}
.noborder{
	border: none;
}
.radio{
	margin-right: 50upx;
}
radio{
	margin-right: 10upx;
}

.consult-btn{
	width: 90%;
	margin: 50upx auto 0;
}
.consult-btn view{
	width: 100%;
	height: 94upx;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--c036);
	color: var(--c0);
	font-size: var(--f36);
	font-weight: 700;
	margin-bottom: 40upx;
	border-radius: 8upx;
}
.v-picker{
	width: 100%;
}
 .v-picker-2 .uni-input{
	color: #666666
}
 .login-area{
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: var(--f30);
	/* background-color: #27417C; */
	border-radius: 60upx;
	height: 50upx;
	padding: 0 10upx;
	margin-right: 20upx;
	font-size: var(--f26);
}
.login-area text{
	margin-right: 10upx;
}
 .rgt{
	position: absolute;
	right: 20upx;
}
</style>
