qlg.frontend/js/cancellation.js

134 lines
3.5 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mui.plusReady(function(){
var wait = 120;
function time() {
if(wait == 0) {
$('#mobileCode').removeAttr("disabled");
$('#mobileCode').val("重新发送");
wait = 120;
} else {
$('#mobileCode').attr("disabled", true);
$('#mobileCode').val("重新发送(" + wait + ")");
wait--;
setTimeout(function() {
time();
},
1000)
}
}
$(".photos").on("tap", 'img', function() {
var _input = $(this).parent().parent().parent().prev()[0];
UP.init(_input.id, "test", this.id)
openCamera()
})
var token = localStorage.getItem('token');
mui.ajax(qlgUrl('app/users/editPhone'), {
headers: {
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
var data = toJson(data);
if (data.status == 1) {
data = data.data;
if (data.userPhone) {
$('#userPhone').val(data.userPhone);
}
}
},
})
mui('.row').on('tap', '#mobileCode', function() {
var that = $(this);
that.attr("disabled", true);
mui.ajax(hyhUrl('app/users/backpayCode'), { 
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
var data = toJson(data);
//服务器返回响应,根据响应结果,分析是否登录成功;
if(data.status == 1) {
time();
} else {
alert(data.msg)
}
that.removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {
//异常处理;
// alert(type)
// alert(type);      
}
}); 
})
mui('.down').on('tap', '#true', function() {
var phoneCode = $('#phoneCode').val();
var op_content = $('#reason').val();
var op_user = $('#userName').val();
var that = $(this);
if(phoneCode == '') {
alert('验证码不能为空!');
return;
} else if(phoneCode.length < 4) {
alert('验证码格式不正确!');
return;
}
if (op_user == '') {
alert('操作用户不能为空!');
return;
}
$.ajax({
url: qlgUrl('app/users/unregister'),
method: 'POST',
data: {
op_user: op_user,
op_content: op_content,
code: phoneCode,
},
dataType: 'json',
success(res) {
mui.alert(res.msg, '提示')
mui.ajax(qlgUrl('app/users/logout'), {
headers: {
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
// //console.log(data.data.goodsFavoritesNum)
localStorage.removeItem("token");
localStorage.removeItem("userId");
localStorage.removeItem("userName");
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
mui.fire(plus.webview.getWebviewById('templete/shoppingcart_warp.html'), 'refresh');
mui.fire(self.parent, 'refresh');
mui.back();
var data = toJson(data, 1);
if(data.status == 1) {
}
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(type);
}
});
},
error(err) {
mui.alert('请求异常', '提示')
}
})
})
})