mui.plusReady(function() {
	var token = localStorage.getItem('token');

	mui('.down').on('tap', '#true', function() {
		var that = $(this)
		var oldPass = $('#oldPass').val();
		var newPass = $('#newPass').val();
		var newPass2 = $('#newPass2').val();

		if (oldPass == '') {
			mui.alert('原支付密码不能为空！');
			return;
		}
		if (newPass == '') {
			mui.alert('新支付密码不能为空！');
			return;
		}
		if (newPass.length != 6) {
			mui.alert('新支付密码长度为6位！');
			return;
		}
		if (!(newPass == newPass2)) {
			mui.alert('两次支付密码不一致！');
			return;
		}

		$(this).attr("disabled", true);
		mui.ajax(qlgUrl('app/users/editpayPwd'), {

			data: {
				oldPass: oldPass,
				newPass: newPass,
				reNewPass: newPass2
			},
			dataType: 'json', //服务器返回json格式数据
			type: 'post', //HTTP请求类型
			timeout: 10000, //超时时间设置为10秒
			success: function(data) {
				var data = toJson(data);
				//服务器返回响应，根据响应结果，分析是否登录成功;
				if (data.status == 1) {
					mui.alert(data.msg);
					mui.back();

				} else {
					mui.alert(data.msg);
				}
				that.removeAttr('disabled');
			},

			error: function(xhr, type, errorThrown) {
				//异常处理;
				//							mui.alert(type)
			}
		});
	})

})
