Files
OMS/app/brush/view/admin/confirm.html
2025-12-28 23:13:25 +08:00

205 lines
6.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
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.
<!--
Copyright © ShopeX http://www.shopex.cn. All rights reserved.
See LICENSE file for license details.
-->
<style>
.notice a {
color: blue;
font-size: 12px;
font-weight: 700;
margin-left: 4px;
margin-right: 4px;
}
.notify {
border-color: #FFD324;
font-size: 12px;
}
.processBarBg {
border: 1px solid #999999;
width: 98%;
margin: 5px;
height: 25px;
line-height: 25px;
padding: 1px;
background: #EEEEEE;
}
.processBar {
background: #3366cc;
width: 0px;
padding-bottom: 1px;
overflow: hidden;
}
</style>
<div class="division">
<h4>当前共<{$orderCount}>个订单</h4>
<div class="gridlist">
<table class="nosplit" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<th>是否需要物流:</th>
<td>
<input type="radio" name="need_delivery" value="1" checked="checked" />&nbsp;&nbsp;&nbsp;
<input type="radio" name="need_delivery" value="0" />&nbsp;
</td>
</tr>
<tr id="delivery">
<th>选择物流:</th>
<td>
<select name='corp_id' id='corp_id'>
<{foreach from=$corpList item=corp}>
<option value=<{$corp.corp_id}>><{$corp.name}></option>
<{/foreach}>
</select>
</td>
</tr>
</table>
</div>
<div class="division" style="display:none;" id="information">
本次获取大约 <span id="iTotal" style="color:#083E96"></span> 个订单,
<span id="iSucc" style="color:green"></span> 个审核成功,
<span id="iFail" style="color:red"></span> 个失败,请稍候……
</div>
<div id="processBarBg" class="processBarBg">
<div id="processBar" class="processBar">
&nbsp;
</div>
</div>
<div class="table-action">
<{button label="开始" type="botton" name="Start" id="btn-run"}>
<{button label="关闭" type="botton" isCloseDialogBtn="true" }>
</div>
</div>
<div style="color:red">
&nbsp;&nbsp;注:选择【否】代表虚拟发货,仅限淘宝平台
</div>
<script>
(function(){
$$('[name="need_delivery"]').addEvent('click', function(){
if(this.value == 1) {
$('delivery').style.display = '';
} else {
$('delivery').style.display = 'none';
}
});
$('btn-run').addEvent('click', function(){
doRun();
});
var MaxProcessOrderNum = 10;
var OrderGroups = <{$orderGroup}>;
var total = <{$orderCount}>;
var OrderQueue = new Array();
var doTotal = 0;
var doFailInfo = '';
function doRun(){
initOptQueue();
if (OrderQueue.length == 0) {
return ;
}
//禁用开始按钮
doTotal = 0;
doSucc = 0;
doFail = 0;
displayProcessInfo();
$('information').style.display ='';
$('btn-run').disabled = true;
$('btn-run').set('html', '<span><span>数据处理中,请稍候!</span></span>');
doAjaxProcess(1);
}
function initOptQueue() {
var OrderHash = '';
var OrderNum = 0;
var OrderKey = '';
if (OrderGroups == '') {
return;
}
var LeaveProcessOrderNum = total;
if (MaxProcessOrderNum > LeaveProcessOrderNum) {
MaxProcessOrderNum = LeaveProcessOrderNum;
}
var groupNum = OrderGroups.length;
for (var i=0;i<groupNum;i++) {
if (OrderHash == '')
OrderHash = OrderGroups[i];
else
OrderHash = OrderHash + ';' + OrderGroups[i];
OrderNum ++;
if (OrderNum >= MaxProcessOrderNum) {
OrderQueue.push(OrderHash);
OrderNum =0;
OrderHash = '';
LeaveProcessOrderNum = LeaveProcessOrderNum - MaxProcessOrderNum;
if (MaxProcessOrderNum > LeaveProcessOrderNum) {
MaxProcessOrderNum = LeaveProcessOrderNum;
}
}
}
if (OrderHash != '') {
OrderQueue.push(OrderHash);
}
}
/**
* 执行一次AJAX调用
*/
function doAjaxProcess(idx) {
if (idx > OrderQueue.length || doTotal >= getTotal()) {
$('processBar').setStyle('width', '100%');
$('btn-run').set('html', '<span><span>处理已完成本窗口将在5秒后自动关闭</span></span>');
setTimeout("$('btn-run').getParent('.dialog').retrieve('instance').close();finderGroup['<{$env.get.finder_id}>'].refresh();", 5000);
} else {
var params = OrderQueue[idx-1];
new Request({url:'index.php?app=brush&ctl=admin_delivery&act=ajaxDoAuto',method:'post',data:'ajaxParams='+params+'&need_delivery='+$E('[name="need_delivery"]:checked').getValue()+'&corp_id='+$('corp_id').value,
onComplete:function(result){
if(!result) return;
ret = JSON.decode(result);
doTotal = doTotal + ret['total'];
doSucc = doSucc + ret['succ'];
doFail = doFail + ret['fail'];
displayProcessInfo();
$('processBar').setStyle('width', (doTotal*100/(getTotal())) + '%');
//error_msg
if(doFail > 0 && ret['error_msg']){
alert(ret['error_msg']);
}
doAjaxProcess(idx+1);
}
}).send();
}
}
/**
* 显示信息进度
*/
function displayProcessInfo() {
$('iTotal').set('html', getTotal());
$('iSucc').set('html', doSucc);
$('iFail').set('html', doFail);
}
function getTotal() {
displayTotal= <{$orderCount}>;
return displayTotal;
}
}());
</script>