<template>
	<view>
		<myForm ref="nameAndphone"></myForm>
		<view style="height: 168rpx;"></view>
		<u-button type="success" text="确定" color="#0EBB5B" @click="handleSureClick()"></u-button>
		<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
			<rich-text :nodes="content"></rich-text>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: '',
				phone: '',
				showM: false,
				content: `您的申请已提交<br>
								   请静待人工审核`
			}
		},
		methods: {
			handleSureClick() {
				let name = this.$refs.nameAndphone.model.userInfo.name
				let phone = this.$refs.nameAndphone.model.userInfo.phone
				this.$apiServe.bindComponyAndUpdate({
					uid: 1,
					type: 1,
					companyName: name,
					companyPhone: phone
				}).then(res => {
					console.log('绑定公司', res.data);
					if (res.data.code == 20003) {
						this.showM = true
					} else if (res.data.code == 20005) {
						this.$toast.warn('请完善数据')
					}
				}).finally(_ => {})
			},
			confirm() {
				this.showM = false
				// uni.switchTab({
				// 	url: '/pages/my/my'
				// })
			}
		}
	}
</script>

<style lang="scss">
	.u-button {
		width: 644rpx !important;
		height: 86rpx !important;
		background: #0EBB5B;
		border-radius: 20rpx !important;
	}

	.u-modal__button-group__wrapper--hover {
		background: #0EBB5B !important;
	}
</style>
