求组:请问这个代码哪里有问题? 设为默认联系人提示:正在处理...
<script type="text/javascript">var from='{$_GPC['from']}';
var returnurl = '{$_GPC['returnurl']}';
cascdeInit('','','');
function saveAddress() {
var realname = $('#realname').val();
var mobile = $('#mobile').val();
var province = $('#sel-provance').val();
var city = $('#sel-city').val();
var area = $('#sel-area').val();
var address = $('#address').val();
if (!realname) {
alert('请输入您的真实姓名!');
return false;
}
if (!mobile) {
alert('请输入您的手机号码!');
return false;
}
if (mobile.search(/^({11})?$/) == -1) {
alert('请输入正确的手机号码!');
return false;
}
// if (!address) {
// alert('请输入您的详细地址!');
// return false;
// }
tip("正在处理数据...");
$.post('{php echo $this->createMobileUrl('lianxi')}', {
'op' : 'post',
'realname' : realname,
'mobile' : mobile,
'id' : $('#addressid').val()
}, function(s) {
tip_close();
if (s.message != 0) {
if (from == 'book') {
if (returnurl != '') {
window.location.href = decodeURIComponent(returnurl);;
return;
}
window.location.href = '{php echo $this->createMobileUrl('book')}';
}
$("input ").attr('checked', false);
var html='<div class="shopcart-main1 img-rounded" style="margin:0;padding:10px;margin-bottom:10px;cursor:pointer">';
var html1='<span>' +realname+', '+mobile+'</span>' +
'<span style="float:right">' +
' <a href="javascript:;">设置为默认收货地址</a></span>';
var html2= '</div>';
if ($('#address_'+s.message).get(0)) {
$('#address_'+s.message).html(html1);
} else {
$(".address_item").removeClass("shopcart-main1").addClass("shopcart-main");
$('#myaddress').append($(html + html1 + html2));
}
$('#realname').val('');
$('#mobile').val('');
$('#address').val('');
cascdeInit('','','');
}
$('#addAddressPanel').hide();
}, 'json');
}
function addAddress() {
$('#addAddressPanel').show();
$('#realname').val('');
$('#mobile').val('');
$('#address').val('');
cascdeInit('','','');
$('#addressid').val('');
}
function saveDefaultAddress(e,id) {
tip("正在处理数据...");
$.post('{php echo $this->createMobileUrl('lianxi', array('op' => 'default'))}', {
'id' : id,
}, function(s) {
$(".address_item").removeClass("shopcart-main1").addClass("shopcart-main");
$("#address_"+id).addClass("shopcart-main1");
tip_close();
}, 'json');
e.stopPropagation() ;
}
function removeAddress(e,id){
if(confirm('确认要删除此收货地址吗?')){
tip("正在处理数据...");
$.post('{php echo $this->createMobileUrl('lianxi', array('op' => 'remove'))}',
{ 'id' : id,},
function(s) {
$("#address_"+id).remove();
if(s.maxid!='0'){
$(".address_item").removeClass("shopcart-main1").addClass("shopcart-main");
$("#address_"+s.maxid).addClass("shopcart-main1");
}
tip_close();
},
'json');
e.stopPropagation() ;
}
}
var isdef = 0;
function editAddress(id) {
if (false && from == 'confirm'){
tip("正在处理数据...");
$.post('{php echo $this->createMobileUrl('address', array('op' => 'default'))}', {'id' : id}, function(s) {
tip_close();
if (returnurl != '') {
window.location.href = returnurl;
return;
}
window.location.href = '{php echo $this->createMobileUrl('confirm')}';
});
return;
}
tip("正在处理数据...");
$.get('{php echo $this->createMobileUrl('address', array('op' => 'detail'))}', {'id' : id}, function(s){
tip_close();
if (s.message) {
$('#addAddressPanel').show();
$('#realname').val(s.message.username);
$('#mobile').val(s.message.mobile);
$('#address').val(s.message.address);
cascdeInit(s.message.province,s.message.city,s.message.district);
$('#addressid').val(s.message.id);
}
}, 'json');
}
</script>
完整网页代码: xfsmylq 发表于 2020-4-15 11:19
完整网页代码:
求助下载还扣吾爱币 culprit 发表于 2020-4-15 19:01
求助下载还扣吾爱币
不会弄 啊。怎么要扣的呢
页:
[1]