<template>
	<!-- 添加收获地址 OK -->
	<!-- 添加收货地址呀 -->
	<view class="content addddd yicode">
		<view class="row b-b">
			<text class="tit">收货人</text>
			<input class="input" type="text" v-model="name" placeholder="请填写收货人姓名" placeholder-class="placeholder" />
		</view>
		<view class="row b-b">
			<text class="tit">手机号码</text>
			<input class="input" type="number" v-model="mobile" placeholder="请填写手机号码" placeholder-class="placeholder" />
		</view>
		<view class="row b-b">
			<text class="tit">收货地址</text>
			<input class="input" type="text" v-model="address" placeholder="请填写详细地址" placeholder-class="placeholder s24" @input="doorplate" />
		</view>
		<view class="submitbtn active" @tap="refundExamine">确定</view>
	</view>
</template>

<script>
import { shopExamine } from '@/utils/api/api.js';
	
export default {
	data() {
		return {
			name: '',
			mobile: '',
			address: '',
			type: 1,//同意
			refund_id: ''
		}
	},

	onShow() {

	},
	onHide() {

	},
	onUnload(){

	},
	onLoad(option){
		console.log(option)
		this.refund_id = option.refund_id;
	},
	methods: {
		refundExamine(){//提交
			
			if(!this.name){
				this.$api.msg('请填写收货人姓名');
				return;
			}
			if(!/(^1[3|4|5|7|8|9][0-9]{9}$)/.test(this.mobile)){
				this.$api.msg('请输入正确的手机号码');
				return;
			}
			if(!this.address){
				this.$api.msg('请输入详细收货地址');
				return;
			}

			// 参数
			let params = {
				contacts: this.name,//收货联系人
				contact_number	: this.mobile,//收货联系电话
				addr: this.address,//收货地址
				type: this.type,
				refund_id: this.refund_id,
			}
			shopExamine(params).then(res=>{
				// console.log(res)
				if(res.code == 0){
					uni.$emit('isDelorder', { action: 'shopExamine' });//监听操作成功后跳回上一页自动刷新列表
					uni.showToast({
						title: '退款审核成功',
						duration: 2000,
						icon: 'none'
					});
					uni.navigateBack({})
				}else{
					this.$api.msg(res.msg);
				}
			})
		},
	}
}
</script>

<style lang="scss">
page {
	background: $page-color-base;
	padding-top: 16upx;
	// margin-top: 20upx;
}

.row {
	display: flex;
	align-items: center;
	position: relative;
	padding: 0 30upx;
	height: 88upx;
	background: #fff;
	.immgs {
		width: 13upx;
		height: 24upx;
		opacity: 0.5;
	}
	.tit {
		flex-shrink: 0;
		//width: 120upx;
		width: 200upx;
		font-size: 30upx;
		color: $font-color-dark;
	}
	.input {
		flex: 1;
		font-size: 30upx;
		color: $font-color-dark;
	}
	.icon-shouhuodizhi {
		font-size: 36upx;
		color: $font-color-light;
	}
}
.default-row {
	margin-top: 16upx;
	.tit {
		flex: 1;
	}
	switch {
		transform: translateX(16upx) scale(0.9);
	}
}
.add-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 690upx;
	height: 80upx;
	margin: 60upx auto;
	font-size: $font-lg;
	color: #fff;
	background-color: $base-color;
	border-radius: 10upx;
	box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
}
.addddd{
	// margin-top: 40upx;
}
</style>
