<template>
	<view class="container">

		<form @submit="onSubmit">

			<view class="page-block">
				<view class="page-title-block">

				</view>
				<view class="content">
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>原密码</text>
						</view>
						<view class="desc">
							<input type="text" class="input-box" name="password_old"  placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>

				</view>
			</view>
			
			<view class="page-block">
				<view class="page-title-block">

				</view>
				<view class="content">
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>设置新密码</text>
						</view>
						<view class="desc">
							<input type="text" name="password" class="input-box"  placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>
					<view class="cell flex flex-y-center">
						<view class="title-block required">
							<text>确认新密码</text>
						</view>
						<view class="desc">
							<input type="text" name="password_confirm" class="input-box" password placeholder="请输入"
								placeholder-class="desc-placeholder">
						</view>
					</view>
				</view>
			</view>
			<view class="footer-bar">
				<view class="content flex flex-center" style="background: none;">
					<button class="btn" hover-class="none" form-type="submit">
						立即提交
					</button>
				</view>
			</view>
		</form>


	</view>
</template>

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

			}
		},
		methods: {
			onSubmit(e) {
				if (!e.detail.value.password_old||!e.detail.value.password||!e.detail.value.password_confirm) {
					uni.showToast({
						title: "必填项不能为空",
						icon: 'none'
					})
					return false
				}
				let data=e.detail.value;
				data.id=uni.getStorageSync("admin_id");
				this.request({
					url:"Smdcshop/editshoppassword",
					data,
				}).then(res => {
					if (res.code == 200) {
						uni.showToast({
							title: res.message,
							icon: 'none'
						})
						setTimeout(() => {
							uni.navigateBack()
						}, 2000)
					}
				}).catch((res) => {
					uni.showToast({
						title: res.message,
						icon: 'none'
					})
				});
			}
		}
	}
</script>

<style>
	@import url("../static/css/common.css");

	page {
		background-color: #F4F5F7;
	}

	.sub-btn {
		width: 690rpx;
		height: 100rpx;
		background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
		border-radius: 8rpx;
		box-shadow: 0px 0px 8rpx 0px rgba(51, 135, 255, 0.20);
		text-align: center;
		line-height: 100rpx;
		color: #fff;
		font-size: 36rpx;
		font-weight: bold;
		position: fixed;
		left: 50%;
		bottom: 70rpx;
		transform: translateX(-50%);
	}
</style>
