mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 02:45:33 +08:00
85 lines
4.0 KiB
PHP
85 lines
4.0 KiB
PHP
<?php
|
||
/**
|
||
* Copyright © ShopeX (http://www.shopex.cn). All rights reserved.
|
||
* See LICENSE file for license details.
|
||
*/
|
||
|
||
class omeauto_finder_autodispatch {
|
||
|
||
static $orderTypes = null;
|
||
|
||
function __construct() {
|
||
|
||
if (self::$orderTypes === null) {
|
||
|
||
$types = app::get('omeauto')->model('order_type')->getList('tid,name,disabled');
|
||
foreach ((array) $types as $t) {
|
||
self::$orderTypes[$t['tid']] = $t;
|
||
}
|
||
}
|
||
}
|
||
|
||
var $addon_cols = "oid,config,memo,disabled,defaulted";
|
||
var $column_confirm = '操作';
|
||
var $column_confirm_width = "100";
|
||
|
||
function column_confirm($row) {
|
||
|
||
$btn = '';
|
||
if ($row['_0_defaulted'] == 'false') {
|
||
if ($row['_0_disabled'] == 'true') {
|
||
$btn .= " <a href='javascript:void(0);' target='download' onclick='if(confirm(\"你确定要启用指定规则的使用吗???\\n\\n注意:你还可以随时暂停指定规则。\")) {href=\"index.php?app=omeauto&ctl=autodispatch&act=setStatus&p[0]={$row['oid']}&p[1]=true&finder_id={$_GET['_finder']['finder_id']}\";}'>启用</a>";
|
||
} else {
|
||
$btn .= " <a href='javascript:void(0);' target='download' onclick='if(confirm(\"你确定要暂时停止指定规则的使用吗???\\n\\n注意:你还可以随时启用指定规则。\")) {href=\"index.php?app=omeauto&ctl=autodispatch&act=setStatus&p[0]={$row['oid']}&p[1]=false&finder_id={$_GET['_finder']['finder_id']}\";}'>暂停</a>";
|
||
}
|
||
$btn .= " <a href='javascript:void(0);' target='download' onclick='if(confirm(\"你确定要把当前规则设为默认分配规则???\")) {href=\"index.php?app=omeauto&ctl=autodispatch&act=setDefaulted&p[0]={$row['oid']}&finder_id={$_GET['_finder']['finder_id']}\";}'>默认</a>";
|
||
} else {
|
||
$btn .= " <a href='javascript:void(0);' target='download' onclick='if(confirm(\"你确定要取消当前规则作为默认分配规则的存在吗???\")) {href=\"index.php?app=omeauto&ctl=autodispatch&act=removeDefaulted&p[0]={$row['oid']}&finder_id={$_GET['_finder']['finder_id']}\";}'>取消默认</a>";
|
||
}
|
||
|
||
$btn .= " <a href='javascript:void(0);' onclick=\"new Dialog('index.php?app=omeauto&ctl=autodispatch&act=edit&p[0]={$row['oid']}&finder_id={$_GET['_finder']['finder_id']}',{width:760,height:400,title:'修改自动分派规则'}); \">修改</a>";
|
||
return $btn;
|
||
}
|
||
|
||
var $column_order = '订单分组';
|
||
var $column_order_width = "150";
|
||
|
||
function column_order($row) {
|
||
|
||
$html = '';
|
||
$title = '';
|
||
|
||
if ($row['_0_defaulted'] == 'true') {
|
||
|
||
$title = '所有未分组订单';
|
||
$html = '<a href="javascript:void(0);">所有未分组订单</a>';
|
||
} elseif (!empty($row['_0_config'])) {
|
||
|
||
foreach ($row['_0_config']['autoOrders'] as $tid) {
|
||
if (self::$orderTypes[$tid]['disabled'] == 'false') {
|
||
$title .= self::$orderTypes[$tid]['name'] . "<br/>";
|
||
$html .= sprintf("<a href=\"javascript:voide(0);\" onclick=\"new Dialog('index.php?app=omeauto&ctl=order_type&act=edit&p[0]=%s&finder_id=%s',{width:760,height:480,title:'修改分组规则'}); \">%s</a> ", $tid, $_GET['_finder']['finder_id'], self::$orderTypes[$tid]['name']);
|
||
} else {
|
||
$html .= "<span style='color:#DDDDDD;' title='该规则已经暂停使用'>" . self::$orderTypes[$tid]['name'] . "</span>";
|
||
}
|
||
}
|
||
}
|
||
if ($title <> '') {
|
||
return "<div onmouseover='bindFinderColTip(event)' rel='{$title}'>" . $html . "<div>";
|
||
} else {
|
||
return $html;
|
||
}
|
||
}
|
||
|
||
var $column_disabled = '是否启用';
|
||
var $column_disabled_width = "80";
|
||
|
||
function column_disabled($row) {
|
||
if ($row['_0_disabled'] == 'true') {
|
||
return "<span style='color:red;'>停用</span>";
|
||
} else {
|
||
return "<span style='color:green;'>启用</span>";
|
||
}
|
||
}
|
||
|
||
} |