<style>
	.fatContent {
		background-color: #fff;
		margin-bottom:80px;
	}

	.fatContent .compInfoList {
		width: 100%;
		display: flex;
		height: 60px;
		align-items: center;
		padding: 0 20px;
		border-bottom: 1px solid #F2F3F6;
	}

	.fatContent .comInforName {
		width: 25%;
		color: #000;
	}

	.fatContent .comInforName text {
		color: red;
		margin-left:3px;
	}

	.fatContent .fatInfoInput {
		width: 75%;
		margin-top: 2px;
		color:#000000;
		text-align: right;
	}
	.fatContent .fatInBtn{
		position: fixed;
		bottom:0;
		width:100%;
		height:50px;
		color:#fff;
		z-index:99;
		font-size: 16px;
		text-align: center;
		line-height: 50px;
		background-color: #000450;
	}
	.fatContent .inputM{
		margin: 15rpx;
		width: 89%;
		padding:15px;
		background-color: #F7F7F7;
	}
</style>
<template>
	<view class="fatContent">
		<view class="compInfoList">
			<view class="comInforName">
				公司名称<text>*</text>
			</view>
			<input class="uni-input fatInfoInput" v-model="msg.CompanyName" placeholder="请输入公司名称" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				联系人<text>*</text>
			</view>
			<input class="uni-input fatInfoInput" v-model="msg.Principal" placeholder="请输入联系人" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				联系方式<text>*</text>
			</view>
			<input class="uni-input fatInfoInput" type="number" v-model="msg.Mobile" placeholder="请输入联系方式" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				E-mail<text>*</text>
			</view>
			<input class="uni-input fatInfoInput" v-model="msg.EMail" placeholder="请输入邮箱" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				FAT海关编码
			</view>
			<input class="uni-input fatInfoInput" v-model="msg.FatCode" placeholder="FAT海关编码" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				咨询标题<text>*</text>
			</view>
			<input class="uni-input fatInfoInput" v-model="msg.FatTitle" placeholder="请输入标题" />
		</view>
		<view class="compInfoList" style="border-bottom:0;height:30px;margin-top:15px;">
			<view class="comInforName">
				咨询问题<text>*</text>
			</view>
		</view>
		<!-- <input type="textarea" class="uni-input fatInfoInput" v-model="msg.FatQuestion" placeholder="请输入具体咨询问题" /> -->
		<textarea style="height: 120px;" class="inputM" v-model="msg.FatQuestion" placeholder="请输入具体咨询问题"  />
		<view class="fatInBtn" @click="saveInfo()">提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: "FAT咨询",
				dataList: [],
				msg: {
					CompanyName:'', //公司名称
					Principal:'', //联系人
					Mobile:'', //联系电话
					EMail:'', //邮箱
					FatCode:'', //海关编码
					FatTitle:'', //咨询标题
					FatQuestion:'' //咨询问题
				}
			};
		},
		mounted() {
			uni.setNavigationBarTitle({
				title: this.pageTitle,
			});
		},
		onLoad(options) {
			
		},
		created() {
			this.getList();
		},
		onShow() {

		},
		methods: {
			//获取数据
			//获取数据
			getList() {
				uni.showLoading({
					title: '加载中'
				});
				this.request2({
						url: "/api/AppletTrade/GetUserCompany",
						data: {},
					},
					(res) => {
						uni.hideLoading();
						if (res.resultCode == 1) {
							let tempData = res.data;
							if (tempData) {
								this.msg.CompanyName = tempData.CompanyName;
								this.msg.Principal = tempData.Principal;
								this.msg.Mobile = tempData.Mobile;
								this.msg.EMail = tempData.EMail;
							}
						}
					}
				);
			},
			//保存数据
			saveInfo(){
				if(this.msg.CompanyName==''){
					uni.showToast({
					  title: "请输入公司名称",
					  icon:'none'
					});
					return;
				}
				if(this.msg.Principal==''){
					uni.showToast({
					  title: "请输入联系人",
					  icon:'none'
					});
					return;
				}
				if(this.msg.Mobile==''){
					uni.showToast({
					  title: "请输入联系方式",
					  icon:'none'
					});
					return;
				}
				if(this.msg.EMail==''){
					uni.showToast({
					  title: "请输入邮箱",
					  icon:'none'
					});
					return;
				}
				if(this.msg.FatTitle==''){
					uni.showToast({
					  title: "请输入咨询标题",
					  icon:'none'
					});
					return;
				}
				if(this.msg.FatQuestion==''){
					uni.showToast({
					  title: "请输入咨询问题",
					  icon:'none'
					});
					return;
				}
				this.request2({
						url: "/api/AppletTrade/SetCommerceAsk",
						data: this.msg,
					},
					(res) => {
						if (res.resultCode == 1) {
							uni.showToast({
							  title: "保存成功",
							});
							this.getList();
							uni.navigateTo({
								url: '/pages/index/index'
							});
						}
					}
				);
			}
		},
	}
</script>
