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

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

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

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

	.comInfoInput {
		width: 75%;
		margin-top: 2px;
		font-size: 13px;
		color: #808080;
		text-align: right;
	}

	.comInBtn {
		position: fixed;
		bottom: 0;
		width: 100%;
		height: 50px;
		color: #fff;
		z-index: 99;
		font-size: 16px;
		text-align: center;
		line-height: 50px;
		background-color: #0b0052;
	}
</style>
<template>
	<view class="compInformation">
		<view class="compInfoList">
			<view class="comInforName">
				采购品目<text>*</text>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.GoodsCategory" placeholder="采购商品类目" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				进口数量<text>*</text>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.ImportNum" placeholder="需要采购多少" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				产品说明<text>*</text>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.Describe" placeholder="输入采购产品的说明介绍" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				公司名称<text>*</text>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.CompanyName" placeholder="公司名称(中文)" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				公司名称
			</view>
			<input class="uni-input comInfoInput" v-model="msg.CompanyEnName" placeholder="公司名称(英文)" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				手机号码<text>*</text>
			</view>
			<input class="uni-input comInfoInput" type="number" v-model="msg.Mobile" placeholder="手机号码" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				E-mail<text>*</text>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.EMail" placeholder="E-mail" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				企业法人
			</view>
			<input class="uni-input comInfoInput" v-model="msg.LegalPerson" placeholder="输入法人姓名" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				负责人
			</view>
			<input class="uni-input comInfoInput" v-model="msg.Principal" placeholder="负责人" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				微信号码
			</view>
			<input class="uni-input comInfoInput" v-model="msg.WechatNo" placeholder="微信号" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				官网
			</view>
			<input class="uni-input comInfoInput" v-model="msg.DomainUrl" placeholder="https://www.examle.com" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				行业
			</view>
			<input class="uni-input comInfoInput" v-model="msg.Industry" placeholder="行业" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				成立时间
			</view>
			<view @click="showStart=true" style="width:75%;color:#808080;text-align:right;height:30px;">{{msg.FoundingTime}}</view>
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				员工人数
			</view>
			<input class="uni-input comInfoInput" v-model="msg.EmployeeNum" placeholder="输入数字" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				<view>年销售额</view>
				<view style="margin-left:8px;">(万元)</view>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.AnnualSales" placeholder="年销售额" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				<view>详细地址</view>
				<view style="margin-left:8px;">(中文)</view>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.Address" placeholder="街道门牌/楼层房间号等信息" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				<view>英文地址</view>
				<view style="margin-left:8px;">(英文)</view>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.EnAddress" placeholder="详细地址(英文)" />
		</view>
		<view class="compInfoList" style="display: none;">
			<view class="comInforName">
				<view>年进口额</view>
			</view>
			<input class="uni-input comInfoInput" v-model="msg.AnnualImport" placeholder="年进口额" />
		</view>
		<view class="compInfoList" style="display: none;">
			<view class="comInforName">
				主要进口品目
			</view>
			<input class="uni-input comInfoInput" v-model="msg.ImportCategory" placeholder="主要进口品目" />
		</view>
		<view class="compInfoList" style="display: none;">
			<view class="comInforName">
				主要进口国
			</view>
			<input class="uni-input comInfoInput" v-model="msg.ImportCountry" placeholder="中国/韩国/日本" />
		</view>
		<view class="compInfoList" style="display: none;">
			<view class="comInforName">
				主要出口国
			</view>
			<input class="uni-input comInfoInput" v-model="msg.ExportCountry" placeholder="中国/韩国/日本" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				公司介绍
			</view>
			<input class="uni-input comInfoInput" v-model="msg.CompanyIntro" placeholder="公司主营业务的简单介绍" />
		</view>
		<view class="compInfoList">
			<view class="comInforName">
				其他
			</view>
			<input class="uni-input comInfoInput" v-model="msg.OtherInfo" placeholder="其他内容" />
		</view>
		<view class="comInBtn" @click="saveInfo()">提交</view>
		<u-picker v-model="showStart" mode="time" :params="params" @confirm='btnStart' :default-time='defaultTime'></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: "采购需求",
				dataList: [],
				showStart: false,
				defaultTime: '',
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				msg: {
					Id: 0, //编号
					Type: 1,
					GoodsCategory: '', // 采购类目
					ImportNum: '', //进口数量
					Describe: '', //产品说明
					CompanyName: "", //公司名称
					CompanyEnName: "", //公司英文名称
					Mobile: "", //手机号码
					EMail: "", //EMail
					LegalPerson: "", //法人
					Principal: "", //联系人
					WechatNo: "", //公司微信
					DomainUrl: "", //官网
					Industry: "", //行业
					FoundingTime: '', //成立时间
					EmployeeNum: "", //员工人数
					AnnualSales: "", //年销售(万元)
					Address: "", //详细地址
					EnAddress: "", //详细地址(英文)
					AnnualImport: "", //年进口额
					ImportCategory: "", //主要进口类目
					ImportCountry: "", //主要进口国家
					ExportCountry: "", //主要出口国
					CompanyIntro: "", //公司介绍
					OtherInfo: "" //其他内容
				}
			};
		},
		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) {
								if(tempData.CompanyName){
									this.msg.CompanyName = tempData.CompanyName;
								}
								if(tempData.CompanyEnName){
									this.msg.CompanyEnName = tempData.CompanyEnName;
								}
								if(tempData.Mobile){
									this.msg.Mobile = tempData.Mobile;
								}
								if(tempData.EMail){
									this.msg.EMail = tempData.EMail;
								}
								if(tempData.LegalPerson){
									this.msg.LegalPerson = tempData.LegalPerson;
								}
								if(tempData.Principal){
									this.msg.Principal = tempData.Principal;
								}
								if(tempData.WechatNo){
									this.msg.WechatNo = tempData.WechatNo;
								}
								if(tempData.DomainUrl){
									this.msg.DomainUrl = tempData.DomainUrl;
								}
								if(tempData.Industry){
									this.msg.Industry = tempData.Industry;
								}
								if(tempData.FoundingTimeStr){
									this.msg.FoundingTime = tempData.FoundingTimeStr;
								}
								if(tempData.EmployeeNum){
									this.msg.EmployeeNum = tempData.EmployeeNum;
								}
								if(tempData.AnnualSales){
									this.msg.AnnualSales = tempData.AnnualSales;
								}
								if(tempData.Address){
									this.msg.Address = tempData.Address;
								}
								if(tempData.Address){
									this.msg.Address = tempData.Address;
								}
								if(tempData.EnAddress){
									this.msg.EnAddress = tempData.EnAddress;
								}
								if(tempData.AnnualImport){
									this.msg.AnnualImport = tempData.AnnualImport;
								}
								if(tempData.ImportCategory){
									this.msg.ImportCategory = tempData.ImportCategory;
								}
								if(tempData.ImportCountry){
									this.msg.ImportCountry = tempData.ImportCountry;
								}
								if(tempData.ExportCountry){
									this.msg.ExportCountry = tempData.ExportCountry;
								}
								if(tempData.CompanyIntro){
									this.msg.CompanyIntro = tempData.CompanyIntro;
								}
								if(tempData.OtherInfo){
									this.msg.OtherInfo = tempData.OtherInfo;
								}
							}
						}
					}
				);
			},
			//保存数据
			saveInfo() {
				if (this.msg.GoodsCategory == '') {
					uni.showToast({
						title: "请输入采购类目",
						icon: 'none'
					});
					return;
				}
				if (this.msg.ImportNum == '') {
					uni.showToast({
						title: "请输入进口数量",
						icon: 'none'
					});
					return;
				}
				if (this.msg.Describe == '') {
					uni.showToast({
						title: "请输入产品说明",
						icon: 'none'
					});
					return;
				}
				if (this.msg.CompanyName == '') {
					uni.showToast({
						title: "请输入公司名称",
						icon: 'none'
					});
					return;
				}
				if (this.msg.Mobile == '') {
					uni.showToast({
						title: "请输入手机号码",
						icon: 'none'
					});
					return;
				}
				if (this.msg.EMail == '') {
					uni.showToast({
						title: "请输入EMail",
						icon: 'none'
					});
					return;
				}
				this.request2({
						url: "/api/AppletTrade/SetInvestmentProcurement",
						data: this.msg,
					},
					(res) => {
						if (res.resultCode == 1) {
							uni.showToast({
								title: "保存成功",
							});
							this.getList();
							uni.navigateTo({
								url: '/pages/index/index'
							});
						}
					}
				);
			},
			btnStart(val) {
				uni.hideLoading();
				this.msg.FoundingTime = val.year + '-' + val.month + '-' + val.day;
 
			},
		},
	}
</script>

<style>
</style>
