<template>
	<view :style="'background-color: '+theme.bg+';color: '+theme.text" style="height: 100vh;">
		<myNav :title="i18n.newWord.business"></myNav>
		
		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.mine.safety.email}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30 nummedium-font" type="text" v-model="mailbox" :placeholder="i18n.mine.safety.phoneTag"/>
			</view>
		</view>
		
		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.mine.safety.username}}</text>
			</view>
			<view class="width-100b height-96">
				<input class="width-100b height-96 font-30" type="text" v-model="name" :placeholder="i18n.mine.safety.input1"/>
			</view>
		</view>
		
		<view class="listBox">
			<view class="width-100b height-96 line-height-96">
				<text class="font-30 bold-font">{{i18n.mine.address.remark}}</text>
			</view>
			<view class="width-100b padding-b-20">
				<textarea class="width-100b height-200 font-30" v-model="remark" :placeholder="i18n.mine.address.p2"/>
			</view>
		</view>
		
		<button @click="real" class="cu-btn loginBtn">{{i18n.mine.safety.tijiao}}</button>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mailbox:'',
				name: "",
				remark: "",
				
				flag:true,
				theme: '',
			}
		},
		computed: {
			i18n() {
				return this.$t('message');
			},
		},
		onShow() {
			if (uni.getStorageSync("theme") == "dark") {
				this.theme = this.$store.state.darkTheme
			} else {
				this.theme = this.$store.state.lightTheme
			}
		},
		methods: {
			real() {
				if(!this.flag) return
				if(this.mailbox == ''){
					this.tos(this.i18n.mine.safety.phoneTag)
					return
				}
				if(this.name == ''){
					this.tos(this.i18n.mine.safety.input1)
					return
				}
				if(this.remark == ''){
					this.tos(this.i18n.mine.address.p2)
					return
				}
				this.flag = false
				this.post('/index/cooperation', {
					email:this.mailbox,
					username:this.name,
					notice:this.remark,
				},true).then(res => {
					this.flag = true
					console.log('商务合作',res)
					if (res.code == 1) {
						this.tos(res.msg)
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},500)
					}
				})
			}
			
		}
	}
</script>

<style>
	.listBox{
		width: 100%;
		/* height: 96rpx; */
		padding: 0 45rpx;
		margin-bottom: 1rpx;
		/* background-color: #FFFFFF; */
	}
	
	.loginBtn {
		width: 600rpx;
		height: 96rpx;
		background: #0165EE !important;
		border-radius: 12rpx;
		line-height: 96rpx;
		color: #FFFFFF;
		font-size: 32rpx;
		text-align: center;
		position: absolute;
		bottom: 5%;
		left: 50%;
		margin-left: -300rpx;
	}
</style>
