<template>
	<view class="">
		<navBar name="修改密码"></navBar>
		<view class="changePassword-page">
			
		    <ZxInput
		        v-model="form.old_passwd"
		        :placeholder="$t('请输入旧密码')"
		        isPassword
		    />
		    <ZxInput
		        v-model="form.new_passwd"
		        :placeholder="$t('请输入新密码')"
		        isPassword
		    />
		    <ZxInput
		        v-model="form.second_passwd"
		        :placeholder="$t('请再次输入新密码')"
		        isPassword
		    />
		   
		    <view :class="['zx-form-btn', isSubmit && 'is-submit']" style="margin-top: 64rpx;" @tap="changePassword">
		        {{ $t('确认修改') }}
		    </view>
		</view>
		
	</view>

</template>


<script>
import common from '../../common/common';
import ZxInput from './components/ZxInput.vue'
var config = require('../../common/config_gyq.js');
	var http = require('../../common/request.js');
export default {
    data() {
        return {
            form: {

            }
        }
    },
    components: {
        ZxInput
    },
    computed: {
        isSubmit({ form }) {
            return form.old_passwd && form.new_passwd && form.second_passwd
        }
    },
    methods: {
        async changePassword() {
			if(!this.isSubmit) return
			let res = await uni.showModal({
				confirmText:this.$t('确定'),
				cancelText:this.$t('取消'),
				title:this.$t('是否确认修改密码？')
			})
			if(res[1].confirm){
				let {data} = await http.postApi(config.API_FLK_ACCOUNT_IMODIFY_PASSWD,this.form)
				if(data.code == 200){
					common.simpleToast(this.$t('修改成功'))
					setTimeout(()=>{
						uni.navigateBack({
							delta:1
						})
					},800)
				}else{
					common.simpleToast(data.msg)
				}
			}
			
			
        }
    }
}
</script>

<style lang="scss" scoped>
 @import "@/libs/css/layout.scss";

.changePassword-page {
    padding: 0 32rpx 58rpx ;
    min-height: 100vh;
    width: 100%;
    background: #F1F3F4;
	margin-top: 20rpx;
}
</style>