<template>
	<view class="boxcon">
		<view class="container">
			<view class="titleall">
				<text class="pl">供应商</text>
				<text class="pr">{{form.name}}</text>
			</view>
			<view class="titleall">
				<text class="pl">统一社会信用代码</text>
				<text class="pr">{{form.socialCode}}</text>
			</view>
			<view class="titleall">
				<text class="pl">法人姓名</text>
				<text class="pr">{{form.socialCode}}</text>
			</view>
			<view class="titleall">
				<text class="pl">联系人</text>
				<text class="pr">{{form.contacts}}</text>
			</view>
			<view class="titleall">
				<text class="pl">联系电话</text>
				<text class="pr">{{form.contactsMobile}}</text>
			</view>
			<view class="titleall">
				<text class="pl">账号</text>
				<text class="pr">{{form.account}}</text>
			</view>
			<view class="titleall">
				<text class="pl">密码</text>
				<view style="display: flex;justify-content: center;align-items: center;" @click="show=true">
					<text class="pr">重置</text>
					<u-icon name="arrow-right" color="" size="15" bold="true"></u-icon>
				</view>

			</view>
			<view class="titleall ">
				<text class="pl psa ">认证照片</text>
				<text class="pr" v-if="!form.identifyPicList">暂无</text>
				<view class="fanuppic" v-if="form.identifyPicList.length>0">
					<view class="picbox" v-for="item in form.identifyPicList">
						<image :src="item" mode="aspectFill"></image>
					</view>
				</view>
			</view>
			<view class="titleall ">
				<text class="pl psa ">授权委托书</text>
				<text class="pr" v-if="!form.proxyFileList">暂无</text>
				<view class="fanuppic" v-if="form.proxyFileList.length>0">
					<view class="picbox" v-for="item in form.proxyFileList">
						<image src="/static/img/upuer.png" mode="aspectFill"></image>
					</view>
				</view>
			</view>
			<view class="titleall">
				<text class="pl">认证状态</text>
				<text class="pr">{{form.statusText}}</text>
			</view>
		</view>
		<view style="width: 100%;height: 80rpx;"></view>
		<view class="newbill flex1" @click="tryAgain">
			<view class="newbillbtn">
				<text>复原</text>
			</view>
		</view>
		<!-- 弹出层 -->
		<u-popup :show="show" @close="close" @open="open" mode="center">
			<view class="forgetbox">
				<!-- <view class="ciclebg">
					<image src="../../static/img/forpwdbg.png" mode="aspectFill"></image>
				</view> -->
				<!-- <view class="keybox">
					<image src="../../static/img/foricon.png" mode="aspectFill"></image>
				</view> -->
				<text class="keytitle">重置密码</text>
				<u--form labelPosition="left" :model="model1" :rules="rules" ref="form1" labelWidth="50">
					<u-form-item label="旧密码" prop="pwd.oldPassword" borderBottom ref="item1">
						<u--input v-model="pwd.oldPassword" border="none" password></u--input>
					</u-form-item>
					<u-form-item label="新密码" prop="pwd.newPassword" borderBottom ref="item1">
						<u--input v-model="pwd.newPassword" border="none" password></u--input>
					</u-form-item>
				</u--form>
				<!-- <text class="remindtitle">请电联系管理员，进行密码确定</text> -->
				<view class="surebtn" @click="makeSurePwd()">确认</view>
			</view>
		</u-popup>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {

				},
				pwd: {
					oldPassword: '',
					newPassword: ''
				},
				show: false,
				rules: {
					'pwd.oldPassword': {
						type: 'string',
						required: true,
						message: '请填写旧密码',
						trigger: ['blur', 'change']
					},
					'pwd.newPassword': {
						type: 'string',
						required: true,
						message: '请填写新密码',
						trigger: ['blur', 'change']
					},
				},

			}
		},
		onLoad(o) {
			if (o.id) {
				this.id = o.id
			}
			this.init()
		},
		methods: {
			close() {
				this.show = false
			},
			open() {
				this.show = true
			},
			tryAgain() {

			},
			init() {
				uni.showLoading()
				uni.$u.http.get(`/api/Supplier/${this.id}`, {
					custom: {
						auth: true
					}
				}).then((res) => {
					uni.hideLoading()
					this.form = res

				}).catch((err) => {
					uni.hideLoading()
					console.log(err)
				})
			},
			makeSurePwd(){
				uni.showLoading()
				uni.$u.http.post('/api/Supplier/password', {
					custom: {
						auth: true
					}
				}).then((res) => {
					uni.hideLoading()
					this.$toast("申请成功")
					this.show = false
				}).catch((err) => {
					console.log(err)
					uni.hideLoading()
					this.$toast(err.msg)
					this.show = false
				})
			}

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F6F6F6 !important;
	}

	.boxcon {
		margin: 20rpx 20rpx;
		padding: 50rpx 20rpx;
		border-radius: 20rpx;
		background: #fff;

		.titlename {
			font-size: 36rpx;
			font-weight: 600;
			padding-bottom: 30rpx;
			display: block;
			margin-bottom: 30rpx;
			border-bottom: 1rpx solid #E8E8E8;
		}

		.container {
			.bod {
				border-bottom: 1rpx solid #E8E8E8;
				box-sizing: border-box;
			}

			.ptin {
				padding-top: 50rpx;
			}

			.plas {
				padding-left: 65rpx;
				word-wrap: wrap;
				box-sizing: border-box;
			}

			.ds {
				padding-top: 30rpx;
			}

			.psa {
				padding-right: 30rpx;
			}

			.cls {
				color: #68625B;
			}

			.titleall {
				display: flex;
				justify-content: space-between;
				font-size: 28rpx;
				padding-bottom: 30rpx;

				.pl {
					// width: 180rpx;
					color: #BEBDBB;
					flex-shrink: 0;
					// margin-right: 30rpx;
				}

				.pr {
					word-wrap: wrap;
					display: block;
					display: -webkit-box;
				}

				.uppic {
					display: flex;
					flex-wrap: wrap;
					justify-content: flex-end;


				}

				.picbox {
					width: 150rpx;
					height: 150rpx;
					margin-left: 20rpx;
					border-radius: 20rpx;

					image {
						width: 100%;
						height: 100%;
					}
				}

				.fanuppic {
					display: flex;
					flex-wrap: wrap;
				}
			}

		}
	}

	.forgetbox {
		width: 600rpx;
		height: 600rpx;
		background-color: #fff;
		display: flex;
		flex-direction: column;
		align-items: center;
		position: relative;
		background-image: url("@/static/img/forpwdbg.png");
		background-repeat: no-repeat;
		background-position: right 0 top 0;
		background-size: 367rpx 225rpx;

		.ciclebg {
			position: relative;
			right: 0;
			top: 0;
			width: 367rpx;
			height: 225rpx;

		}

		.keybox {
			margin-top: 84rpx;
			width: 196rpx;
			height: 161rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.keytitle {
			color: #1F242A;
			padding-top: 70rpx;
			padding-bottom: 70rpx;
			font-size: 36rpx;
			font-weight: 600;
		}

		.remindtitle {
			color: #68625B;
			font-size: 28rpx;
			padding-top: 30rpx;
		}

		.surebtn {
			width: 314rpx;
			height: 84rpx;
			line-height: 84rpx;
			border-radius: 43rpx;
			background: linear-gradient(to right, #FFE1AD, #D8AB5A);
			color: #412900;
			margin-top: 86rpx;
			text-align: center;
		}
	}
</style>
