<template>
	<view class="editDetail">
		<uni-menubar title="编辑资料" />
		<view>
			<tm-sheet>
				<tm-input title="真实姓名" v-model="form.realname"></tm-input>
				<tm-input title="手机号" v-model="form.mobile"></tm-input>
				<tm-input title="微信" v-model="form.wxh"></tm-input>
				<tm-input title="公司" v-model="form.company"></tm-input>
				<tm-input :vertical="true" :height="100" input-type="textarea" :maxlength="200" title="备注"
					v-model="form.content"></tm-input>
				<view class="mt-50">
					<tm-button block theme="blue" @click="keepClick">提交</tm-button>
				</view>
			</tm-sheet>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					uid: "",
					realname: "",
					mobile: "",
					wxh: "",
					company: "",
					content: "",
				}
			}
		},
		onLoad(option) {
			if (option.item) {
				let detailObj = JSON.parse(option.item)
				Object.keys(this.form).forEach(key => {
					this.form[key] = detailObj[key]
				})
			}
		},
		methods: {
			keepClick() {
				this.$tm.request.post('user/update', this.form).then(res => {
					uni.showToast({
						title: "修改成功",
						icon: "success"
					});
					setTimeout(() => {
						uni.navigateBack({
							success:()=> {
								uni.$emit('refresh')
							}
						})
					}, 1000)

				})
			}
		},
	}
</script>

<style lang="scss" scoped>
</style>
