作者 刘朕
1 个管道 的构建 通过 耗费 0 秒

订单添加、编辑优化

... ... @@ -265,60 +265,56 @@
var btn = $(this);
var text = btn.text();
if(submit_common('.form_data',form_data)) {
allow_submit = false;
var data = {
id: "{$orderInfo.id}",
param: form_data.join(',')
};
console.log(data);
// _common("{:url('submit_form')}",data,[$('.num').html(res.data),$('.mask').show()])
$.ajax({
url: "{:url('submit_form_edit')}",
type: "POST",
data: data,
dataType: "JSON",
beforeSend: function(){
btn.text(text+'中...').prop('disabled', true);
},
success: function (res) {
console.log(res);
if (res.code == 1) {
if(res.data == 1) {
$('.change_text_o').html('订单修改成功');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('.change_text_t').hide();
}
if(res.data == 2) {
$('.change_text_o').html('抱歉,客户已支付订单');
$('.mask').find('.change_class').addClass('change_text');
$('.mask').find('.change_class').removeClass('change_text_single');
$('.change_text_t').html('您无法进行修改');
}
if(res.data == 3) {
$('.change_text_o').html('对不起,当前功能已暂停');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('.change_text_t').hide();
if(allow_submit) {
allow_submit = false;
var data = {
id: "{$orderInfo.id}",
param: form_data.join(',')
};
$.ajax({
url: "{:url('submit_form_edit')}",
type: "POST",
data: data,
dataType: "JSON",
beforeSend: function(){
btn.text(text+'中...');
},
success: function (res) {
console.log(res);
if (res.code == 1) {
if(res.data == 1) {
$('.change_text_o').html('订单修改成功');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('.change_text_t').hide();
}
if(res.data == 2) {
$('.change_text_o').html('抱歉,客户已支付订单');
$('.mask').find('.change_class').addClass('change_text');
$('.mask').find('.change_class').removeClass('change_text_single');
$('.change_text_t').html('您无法进行修改');
}
if(res.data == 3) {
$('.change_text_o').html('对不起,当前功能已暂停');
$('.mask').find('.change_class').removeClass('change_text');
$('.mask').find('.change_class').addClass('change_text_single');
$('.change_text_t').hide();
}
$('.mask').show()
} else {
_error(res.msg);
}
$('.mask').show()
// setTimeout(function() {
// window.location.href = res.url;
// },1000);
} else {
_error(res.msg);
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
allow_submit = true;
btn.text(text);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
allow_submit = true;
btn.text(text).prop('disabled', false);
}
});
});
}
}
// $('.mask').show()
});
$('.order_long').click(function() {
... ...
... ... @@ -232,36 +232,38 @@
var btn = $(this);
var text = btn.text();
if(submit_common('.form_data',form_data)) {
allow_submit = false;
var data = {
id: "{$typeInfo.id}",
param: form_data.join(',')
};
$.ajax({
url: "{:url('submit_form')}",
type: "POST",
data: data,
dataType: "JSON",
beforeSend: function(){
btn.text(text+'中...').prop('disabled', true);
},
success: function (res) {
// console.log(res);
if (res.code == 1) {
$('.num').html(res.data);
$('.mask').show()
} else {
_error(res.msg);
if(allow_submit) {
allow_submit = false;
var data = {
id: "{$typeInfo.id}",
param: form_data.join(',')
};
$.ajax({
url: "{:url('submit_form')}",
type: "POST",
data: data,
dataType: "JSON",
beforeSend: function(){
btn.text(text+'中...');
},
success: function (res) {
// console.log(res);
if (res.code == 1) {
$('.num').html(res.data);
$('.mask').show()
} else {
_error(res.msg);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
allow_submit = true;
btn.text(text);
}
},
error: function(XHR,errorMsg,errorType) {
_error(errorMsg);
},
complete: function(XHR,TS) {
allow_submit = true;
btn.text(text).prop('disabled', false);
}
});
});
}
}
});
... ...