mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-24 03:15:32 +08:00
347 lines
17 KiB
HTML
347 lines
17 KiB
HTML
<!--
|
||
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
|
||
|
||
Licensed under the Apache License, Version 2.0 (the "License");
|
||
you may not use this file except in compliance with the License.
|
||
You may obtain a copy of the License at
|
||
|
||
http://www.apache.org/licenses/LICENSE-2.0
|
||
|
||
Unless required by applicable law or agreed to in writing, software
|
||
distributed under the License is distributed on an "AS IS" BASIS,
|
||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
See the License for the specific language governing permissions and
|
||
limitations under the License.
|
||
-->
|
||
|
||
<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;}
|
||
.select_div { width:auto; height:28px; line-height:28px; }
|
||
</style>
|
||
<div id="auto_activeOrder" class="tableform">
|
||
<{if $all_dlycorp==3}>
|
||
<div class="division notify" style="padding-left:20px;padding-bottom: 15px;text-align:left">
|
||
<h3>系统检测到原来的"自动审单规则",<br/><{img app='ome' src='dlycorp.png' }><br>
|
||
原先“启用”全境物流,但未设置到具体收货地区的分组订单将进入<font color="red">人工审单</font><br><br></h3>
|
||
<h3><font color="red">请及时检查和修改“自动选物流规则”!</font></h3>
|
||
</div>
|
||
<{/if}>
|
||
<{if $is_allow}>
|
||
<{ if $orderCnt<1 }>
|
||
<div class="notice" style="padding-top: 15px;padding-bottom: 15px;">
|
||
<br/>
|
||
当前订单暂存区中没有可处理的订单,请稍后再试……
|
||
<br/>
|
||
</div>
|
||
<{area inject=".mainFoot"}>
|
||
<div class="table-action">
|
||
<{button label="关闭" type="botton" isCloseDialogBtn="true" }>
|
||
</div>
|
||
<{/area}>
|
||
<{ elseif $config }>
|
||
<div class="notice" style="padding-top: 15px;padding-bottom: 15px;">
|
||
你还没有完成自动审单的全部设置,你可通过下面的信息和链接进行调整后再操作:
|
||
<br/>
|
||
<br/>
|
||
<{ if $config.noOrderDefined }>
|
||
<a href="index.php?app=omeauto&ctl=order_type&act=index" target="_top">订单分组设置</a>
|
||
<{ /if }>
|
||
<{ if $config.noAutoConfirmDefaultRole }>
|
||
<a href="index.php?app=omeauto&ctl=autoconfirm&act=index" target="_top">自动审单设置</a>
|
||
<{ /if }>
|
||
<{ if $config.noAutoBranchRole }>
|
||
<a href="index.php?app=omeauto&ctl=autobranch&act=index" target="_top">仓库分配规则</a>
|
||
<{ /if }>
|
||
</div>
|
||
<{ else }>
|
||
<div class="note">
|
||
缓存区可操作订单共 <font color="red"><span id="bufferOrderCnt"><{$bufferOrderCnt}></span></font>,本次操作订单 <font color="red"><span id="orderCnt"><{$orderCnt}></span></font> 个,
|
||
预计其中 <font color="red"><span id="orderGroupOrdCnt"><{$orderGroupOrdCnt}></span></font> 个订单可合并为 <font color="red"><span id="orderGroupCnt"><{$orderGroupCnt}></span></font> 个发货。
|
||
</div>
|
||
<div class="division">
|
||
<form method="post" action="index.php?app=ome&ctl=admin_order_auto&act=ajaxDoAuto" id="form-setting">
|
||
<div class='division' id="config">
|
||
<div><h5 style="padding-left:0px;">获取订单选项:</h5></div>
|
||
<div class="select_div">
|
||
店铺范围: <select name="shop_id" id="select_shop" style="max-width:90px;_width:90px;">
|
||
<option value="all">全部店铺</option>
|
||
<{foreach from=$shopList item=item}>
|
||
<option value="<{$item.shop_id}>"><{$item.name}></option>
|
||
<{/foreach}>
|
||
</select>
|
||
</div>
|
||
<div class="select_div">
|
||
订单类型:
|
||
<label><input type="radio" name="order_type" id="order_type_all" value="all" checked />全部订单</label>
|
||
<label><input type="radio" name="order_type" id="order_type_normal" value="normal" />普通订单</label>
|
||
<label><input type="radio" name="order_type" id="order_type_presale" value="presale" />预售订单</label>
|
||
</div>
|
||
<div class="select_div">
|
||
是否指定数量:
|
||
<label><input type="radio" name="fetchType" id="fetchAll" checked />获取所有可操作订单</label>
|
||
<label><input type="radio" name="fetchType" id="fetchCustom" />获取<input type="text" id="fetchNum" name="fetchNum" value="100" size="3"/> 条 </label>
|
||
</div>
|
||
</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">
|
||
|
||
</div>
|
||
</div>
|
||
<div class="table-action">
|
||
<{button label="开始" type="botton" name="Start" id="btn-run"}>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<script>
|
||
/*一次JS调用产生20个订单组的调用*/
|
||
var MaxProcessOrderNum = 10;
|
||
var OrderGroups = <{$orderGroup}>;
|
||
var currentTime = <{$currentTime}>;
|
||
var process_id = <{$process_id|default:0}>;
|
||
var OrderQueue = new Array();
|
||
|
||
var doTotal = 0;
|
||
var doSucc = 0;
|
||
var doFail = 0;
|
||
var all_dlycorp = '<{$all_dlycorp}>';
|
||
|
||
/*选择店铺时更新操作数据*/
|
||
if($('select_shop')){
|
||
$('select_shop').addEvent('change', function() {
|
||
if(this.value){
|
||
var shopId = this.value;
|
||
var order_type = $E('input[name="order_type"]:checked').value;
|
||
|
||
new Request({url:'index.php?app=ome&ctl=admin_order_auto&act=ajaxGetAutoData',method:'post',data:'shopId='+shopId+'&order_type='+order_type,
|
||
onComplete:function(result){
|
||
$('btn-run').disabled = false;
|
||
$('btn-run').set('html', '<span><span>开始</span></span>');
|
||
|
||
if(!result){ return;}
|
||
ret = JSON.decode(result);
|
||
if(ret['orderCnt']>0){
|
||
OrderQueue = new Array();
|
||
OrderGroups = ret['OrderGroups'];
|
||
currentTime = ret['currentTime'];
|
||
|
||
$('bufferOrderCnt').set('html', ret['bufferOrderCnt']);
|
||
$('orderCnt').set('html', ret['orderCnt']);
|
||
$('orderGroupOrdCnt').set('html', ret['orderGroupOrdCnt']);
|
||
$('orderGroupCnt').set('html', ret['orderGroupCnt']);
|
||
}else{
|
||
OrderQueue = new Array();
|
||
OrderGroups = '';
|
||
currentTime = '';
|
||
|
||
$('bufferOrderCnt').set('html', 0);
|
||
$('orderCnt').set('html', 0);
|
||
$('orderGroupOrdCnt').set('html', 0);
|
||
$('orderGroupCnt').set('html', 0);
|
||
return MessageBox.error('没有可操作数据!');
|
||
}
|
||
},
|
||
onRequest:function(){
|
||
$('btn-run').disabled = true;
|
||
$('btn-run').set('html', '<span><span>数据计算中,请稍候!</span></span>');
|
||
}
|
||
}).send();
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 执行AJAX调用并开始获取订单
|
||
*
|
||
* @param void
|
||
* @return void
|
||
*/
|
||
function doRun() {
|
||
if (OrderGroups == '') return;
|
||
|
||
var OrderHash = '';
|
||
var OrderNum = 0;
|
||
var MaxProcessOrderNum = getTotal();
|
||
|
||
for ( OrderKey in OrderGroups) {
|
||
if (OrderNum>=MaxProcessOrderNum) {break;}
|
||
|
||
if (OrderHash == '')
|
||
OrderHash = OrderKey + '||' + OrderGroups[OrderKey]['orders'];
|
||
else
|
||
OrderHash = OrderHash + ';' + OrderKey + '||' + OrderGroups[OrderKey]['orders'];
|
||
|
||
OrderNum ++;
|
||
}
|
||
if (!OrderHash) return;
|
||
|
||
//禁用开始按钮
|
||
doTotal = 0;
|
||
doSucc = 0;
|
||
doFail = 0;
|
||
|
||
displayProcessInfo();
|
||
$('config').style.display = 'none';
|
||
$('information').style.display = '';
|
||
$('btn-run').disabled = true;
|
||
$('btn-run').set('html', '<span><span>数据处理中,请稍候!</span></span>');
|
||
|
||
new Request({url:'index.php?app=ome&ctl=admin_order_auto&act=ajaxDoAuto',method:'post',data:'ajaxParams='+OrderHash+'&pageBn='+currentTime,
|
||
onComplete:function(result){
|
||
if(!result) return;
|
||
ret = JSON.decode(result);
|
||
// doTotal = ret['total'];
|
||
// doSucc = ret['succ'];
|
||
// doFail = ret['fail'];
|
||
process_id = ret['process_id'];
|
||
// displayProcessInfo();
|
||
|
||
if (ret['status'] == 'finish') {
|
||
$('processBar').setStyle('width', '100%');
|
||
$('btn-run').set('html', '<span><span>处理已完成,本窗口将在3秒后自动关闭!</span></span>');
|
||
setTimeout("$('btn-run').getParent('.dialog').retrieve('instance').close();finderGroup['<{$env.get.finder_id}>'].refresh();",2000);
|
||
} else {
|
||
setTimeout('getResult()',3000);
|
||
}
|
||
}
|
||
}).send();
|
||
}
|
||
|
||
function getTotal() {
|
||
if ($('fetchAll').checked) {
|
||
displayTotal= <{$orderCnt}>;
|
||
} else {
|
||
displayTotal = $('fetchNum').value;
|
||
}
|
||
return displayTotal;
|
||
}
|
||
|
||
/**
|
||
* 显示信息进度
|
||
*/
|
||
function displayProcessInfo() {
|
||
|
||
$('iTotal').set('html', getTotal());
|
||
$('iSucc').set('html', doSucc);
|
||
$('iFail').set('html', doFail);
|
||
}
|
||
|
||
function getResult(){
|
||
if (!$defined($('btn-run'))) return;
|
||
|
||
new Request({url:'index.php?app=ome&ctl=admin_order_auto&act=getResult&p[0]='+process_id,method:'post',
|
||
onComplete:function(result){
|
||
if(!result) return;
|
||
ret = JSON.decode(result);
|
||
|
||
$('iTotal').set('html',ret['all']);
|
||
$('iSucc').set('html', ret['succ']);
|
||
$('iFail').set('html', ret['fail']);
|
||
$('processBar').setStyle('width', (ret['total']*100/ret['all']) + '%');
|
||
|
||
if (ret['status'] == 'finish') {
|
||
$('processBar').setStyle('width', '100%');
|
||
$('btn-run').set('html', '<span><span>处理已完成,本窗口将在3秒后自动关闭!</span></span>');
|
||
setTimeout("$('btn-run').getParent('.dialog').retrieve('instance').close();finderGroup['<{$env.get.finder_id}>'].refresh();",2000);
|
||
}else{
|
||
setTimeout('getResult()',3000);
|
||
}
|
||
}
|
||
}).send();
|
||
}
|
||
|
||
//初始化
|
||
$('btn-run').addEvent('click', function(){
|
||
var allDlycorpnotify = '<{$allDlycorpnotify}>';
|
||
if(all_dlycorp==3 && allDlycorpnotify!='2'){
|
||
var url = 'index.php?app=ome&ctl=admin_order_auto&act=notify_allDlycorp';
|
||
new Dialog(url,{title:'设置物流规则提醒',width:800,height:350});
|
||
|
||
}else{
|
||
doRun();
|
||
}
|
||
});
|
||
|
||
if (process_id>0) {
|
||
doTotal = 0;
|
||
doSucc = 0;
|
||
doFail = 0;
|
||
|
||
displayProcessInfo();
|
||
$('config').style.display = 'none';
|
||
$('information').style.display = '';
|
||
$('btn-run').disabled = true;
|
||
$('btn-run').set('html', '<span><span>数据处理中,请稍候!</span></span>');
|
||
getResult();
|
||
};
|
||
|
||
/*选择订单类型时更新操作数据*/
|
||
if($$('input[name="order_type"]'))
|
||
{
|
||
$$('input[name="order_type"]').addEvent('click',function(e)
|
||
{
|
||
var shop_id = $("select_shop").value;
|
||
var order_type = $E('input[name="order_type"]:checked').value;
|
||
|
||
if(order_type)
|
||
{
|
||
new Request({url:'index.php?app=ome&ctl=admin_order_auto&act=ajaxGetAutoData',method:'post',data:'shopId='+shop_id+'&order_type='+order_type,
|
||
onComplete:function(result){
|
||
$('btn-run').disabled = false;
|
||
$('btn-run').set('html', '<span><span>开始</span></span>');
|
||
|
||
if(!result){ return;}
|
||
ret = JSON.decode(result);
|
||
if(ret['orderCnt']>0){
|
||
OrderQueue = new Array();
|
||
OrderGroups = ret['OrderGroups'];
|
||
currentTime = ret['currentTime'];
|
||
|
||
$('bufferOrderCnt').set('html', ret['bufferOrderCnt']);
|
||
$('orderCnt').set('html', ret['orderCnt']);
|
||
$('orderGroupOrdCnt').set('html', ret['orderGroupOrdCnt']);
|
||
$('orderGroupCnt').set('html', ret['orderGroupCnt']);
|
||
}else{
|
||
OrderQueue = new Array();
|
||
OrderGroups = '';
|
||
currentTime = '';
|
||
|
||
$('bufferOrderCnt').set('html', 0);
|
||
$('orderCnt').set('html', 0);
|
||
$('orderGroupOrdCnt').set('html', 0);
|
||
$('orderGroupCnt').set('html', 0);
|
||
return MessageBox.error('没有可操作数据!');
|
||
}
|
||
},
|
||
onRequest:function(){
|
||
$('btn-run').disabled = true;
|
||
$('btn-run').set('html', '<span><span>数据计算中,请稍候!</span></span>');
|
||
}
|
||
}).send();
|
||
}
|
||
})
|
||
}
|
||
</script>
|
||
|
||
<{/if}>
|
||
<{else}>
|
||
<div class="notice" style="padding-top: 15px;padding-bottom: 15px; text-align:center; font-size:25px; line-height:40px;">
|
||
上次执行获取订单时间:<font color="#FF0000"><{$lastGetOrderTime}></font><br>
|
||
本次距上次操作,时间还没有超过<font color="#FF0000"><{$getOrderIntervalTime}></font>分钟,请稍后重试!
|
||
</div>
|
||
<{area inject=".mainFoot"}>
|
||
<div class="table-action">
|
||
<{button label="关闭" type="botton" isCloseDialogBtn="true" }>
|
||
</div>
|
||
<{/area}>
|
||
<{/if}>
|
||
</div>
|