科恒数字网-持续研发、集成、交付、运营方案资源库

标题: 给ecshop订单流程增加拣货状态,最新版本,支持ECSHOP3.6系统 [打印本页]

作者: admin    时间: 2020-6-12 09:15
标题: 给ecshop订单流程增加拣货状态,最新版本,支持ECSHOP3.6系统
针对ecshop订单中的物品,需要支持拣货的状态,比如未拣货、拣货中、拣货完成,以及显示拣货人姓名。( ]# S( _: G1 W& _6 Y$ t$ j) f: m; \

0 w* Q- C! R1 ~1.SQL操作:
: M' p4 M8 X7 U; z8 M& ^
; \8 @3 K5 s: E4 b1 a2.在文件languages\zh_cn\admin\order.php中增加:
2 ]: i8 c1 \( C6 |4 G  l2 ^( v
) H3 N  {8 O- m5 N: t# y/* 拣货 */# w7 h7 P( z6 f; C  h/ X- l
$_LANG['order_picking_status'] = '拣货状态';7 |0 B/ F( N+ }, S) [% G1 \
$_LANG['order_picking_status_none'] = '未拣货';
7 I) V1 O2 r% H$_LANG['order_picking_status_processing'] = '拣货中';$ ^/ d5 v) m" q5 T
$_LANG['order_picking_status_finish'] = '拣货完成';! u$ u5 ?& X! o+ M, q7 U" @, F
$_LANG['invalid_order_picking_status'] = '拣货状态无效。0:未拣货;1:拣货中;2:拣货完成';
/ S' m# I! c  [' l. F4 P5 h5 }
4 U3 q6 t& e2 X* d" M( o1 [; t; R" x5 w. a1 X
3.文件admin\templates\order_list.htm中在一下两行之间:8 b# u+ t0 V4 e* X
    第一个地方
" z" l; h2 M1 a<th>{$lang.all_status}</th>
1 y5 y* r& ]$ F3 S3 `/ x/ l( ?8 Q<th>{$lang.handler}</th>2 q3 l6 w- }4 b& o1 l
中间加上, k: t5 i3 T) a: i
<th>{$lang.order_picking_status}</th>) Y% i: ?8 q: ]$ p0 ~
& e* }* P. K; H& |& K0 _) K# Z9 L
第二个地方
( L. b7 A5 P' e1 y& ?) _/ l7 g. ]在<td align="center" valign="top" nowrap="nowrap">{$lang.os[$order.order_status]},{$lang.ps[$order.pay_status]},{$lang.ss[$order.shipping_status]}</td>  r3 j' I2 z& O% h6 E
后面加上
" G) G4 J5 |! \; r<td align="right" valign="top"nowrap="nowrap"><span>{$order.user_name}【{if $order.order_picking_status == 1}{$lang.order_picking_status_processing}{elseif $order.order_picking_status ==2} {$lang.order_picking_status_finish} {else}{$lang.order_picking_status_none}{/if}】</span></td>
4 \$ j) w6 W5 J& w% V, \4 @! D: h  o

, }) N! f+ R' j5 v9 E- H. K5 s  S5 Y* E0 F, Z+ |0 E2 b
4.admin\js\listtable.js中,listTable.edit的响应函数修改如下:
0 ^/ t) V, ?( m+ A6 K7 I, l! M
) X% ~+ T7 G# F3 z9 Y: a4 A) g8 `. A

/**

* 创建一个可编辑区

*/

listTable.edit = function(obj, act, id)

{

  var tag =obj.firstChild.tagName;

  if (typeof(tag) !="undefined" && tag.toLowerCase() == "input")

  {

    return;

  }

  /* 保存原始的内容 */

  var org = obj.innerHTML;

  var val = Browser.isIE ?obj.innerText : obj.textContent;

  /* 创建一个输入框 */

  var txt =document.createElement("INPUT");

  txt.value = (val == 'N/A') ?'' : val;

  txt.style.width =(obj.offsetWidth + 12) + "px" ;

  /* 隐藏对象中的内容,并将输入框加入到对象中 */

  obj.innerHTML ="";

  obj.appendChild(txt);

  txt.focus();

  txt.select();

  /* 编辑区输入事件处理函数 */

  txt.onkeypress = function(e)

  {

    var evt =Utils.fixEvent(e);

    var obj =Utils.srcElement(e);

    if (evt.keyCode == 13)//www.zuimoban.com

    {

      obj.blur();

      return false;

    }

    if (evt.keyCode == 27)

    {

      obj.parentNode.innerHTML= org;

    }

  }

  /* 编辑区失去焦点的处理函数 */

  txt.onblur = function(e)

  {

    if(Utils.trim(txt.value).length > 0)

    {

      res =Ajax.call(listTable.url, "act="+act+"&val=" +encodeURIComponent(Utils.trim(txt.value)) + "&id=" +id, null,"POST", "JSON", false);

      if (res.message)

      {

        alert(res.message);

      }

      if(res.id &&(res.act == 'goods_auto' || res.act == 'article_auto'))

      {

         document.getElementById('del'+res.id).innerHTML = "<ahref=\""+ thisfile +"?goods_id="+ res.id+"&act=del\" onclick=\"returnconfirm('"+deleteck+"');\">"+deleteid+"</a>";

      }

      obj.innerHTML = (res.error== 0) ? res.content : org;

    }

    else

    {

      obj.innerHTML = org;

    }

   

    if (act =='edit_is_validated')

    {

         var content = obj.innerHTML.trim();

        

         if (content == '1' || content.indexOf("yes") >= 0)

         {

            obj.innerHTML = '<imgsrc="images/yes.gif">';

         }

         else

        {

            obj.innerHTML ='<img src="images/no.gif">';

        }

    }

    else if (act =='edit_order_picking_status')

    {

         if (org == obj.innerHTML)

         {

            return true;

         }

        

         if (obj.innerHTML == '1')

         {

            obj.innerHTML ="【拣货中】";

         }

         else if (obj.innerHTML == '2')

        {

            obj.innerHTML ="【拣货完成】";

        }

         else

         {

            obj.innerHTML ="【未拣货】";

         }

    }

    else

    {

        

    }

  }

8 E# W+ J1 z* R+ T

}

- q/ Z5 S3 C& A% B) N$ }2 l
5.admin\order.php文件中增加下面的函数:# X" K  c  r# a- k# H
: b: ?- i1 b) T) \  q
/*------------------------------------------------------ */* g) B1 j( d1 S) V4 ?$ Z2 x1 Q; V
//-- 订单拣货状态查询
+ q# M) H: _" S) D" C! _) K5 E1 j7 a/*------------------------------------------------------ */7 A9 Q& C4 E0 C+ Z# N

8 I- _, ]: w. r, [# S' i, n* }: ^if ($_REQUEST['act'] == 'edit_order_picking_status')4 Z0 p* w7 H1 {+ D. b9 T# U
{
- Y* y/ ]' q& ~) p6 e    /* 检查权限 */
" c% L$ u9 {3 `& n; x7 ?6 c   check_authz_json('users_manage');, |, A5 Z1 o% G

3 ?4 n; H' {" [7 O) n9 _- w    $id =empty($_REQUEST['id']) ? 0 : intval($_REQUEST['id']);
& A- O. v# Z2 Y" c7 m% U    $order_picking_status =empty($_REQUEST['val']) ? '' : json_str_iconv(trim($_REQUEST['val']));, Z/ E0 n: S  m- w, B
; B. o3 `$ ?  T" }. v
    $sql = "DELETE fromorder_picking_status WHERE order_id = '". $id ."' LIMIT 1";
- y( z9 t( j( c5 t7 W    $db->query($sql);5 B/ l' y5 A& L% n+ T" L. F5 {
   % c& Y1 @& e8 T5 R: N' J; D
    $sql = "INSERT INTOorder_picking_status (order_id, user_name, order_picking_status) VALUES('". $id ."', '". $_SESSION['admin_name'] ."', '".$order_picking_status ."')";
/ D8 y; ^% Q0 A" J    $db->query($sql);
( @! [5 e; W' d* {3 i   5 \; t1 C1 Q. ~! x" J! F+ b
    if ($order_picking_status> 2 || $order_picking_status < 0)$ n# z/ O0 M. g1 u- X1 F" k
    {
, W7 e5 i/ x& q8 J/ d0 w$ K         make_json_error($GLOBALS['_LANG']['invalid_order_picking_status']);( _' H! E$ Q! D4 x
    }+ a; y0 F! A! Y( f. y, ?2 f% {
    else) j* L3 j4 L8 e0 R6 k, j
    {
5 e$ ?8 r0 @0 T) ^8 i  o6 g( p         make_json_result($order_picking_status);
( z9 W' f' C* o* V    }3 [) H7 \. }4 ]8 O* d- ?$ f# o. I5 n8 I
}
" R) g4 Z% Y- M5 G" P

" J, r0 W# e/ H+ Y6、admin\order.php文件中增加下面的函数将以下代码
% m8 k8 I' H9 }+ \$ l4 C /* 查询 */0 a) k7 F% t, @  J3 j2 a  d( a1 f, b
$sql = "SELECT o.*," .
: P5 U1 u8 Y5 b                    "o.pay_status, o.consignee, o.firstname, o.lastname, o.address, o.email, o.tel, o.extension_code, o.extension_id, " .; {5 k; e9 m7 V5 r7 ?
                    "(" . order_amount_field('o.') . ") AS total_fee, " .1 f& g5 q% D; d. M( n1 J& Q/ \
                    "IFNULL(u.user_name, '" .$GLOBALS['_LANG']['anonymous']. "') AS buyer ".
, T. ^8 T5 X* j# c0 v- h8 N9 I0 ^                " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .0 u/ a% c$ d& e& M8 N
                " LEFT JOIN " .$GLOBALS['ecs']->table('users'). " AS u ON u.user_id=o.user_id ". $where .                        , s( O9 ?$ D' w2 d. {- |: c
                " ORDER BY $filter[sort_by] $filter[sort_order] ".1 Z/ D) H5 }5 u7 S  z
                " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",$filter[page_size]";  
8 h2 p# o; y* r! k9 u修改为:
+ `" |: C2 M/ [) _2 ?8 U //* 查询 */: ?2 _; K+ Q* G: b! v
      $sql = "SELECT o.*," .6 k" n4 o7 y1 g6 F0 Z3 z" ^
                    "o.pay_status, o.consignee, o.firstname, o.lastname, o.address, o.email, o.tel, o.extension_code, o.extension_id, " ., _6 h) K2 |& p- W. S! D: T
                    "(" . order_amount_field('o.') . ") AS total_fee, " .
) D$ ?" e, }# M+ W                    "IFNULL(u.user_name, '" .$GLOBALS['_LANG']['anonymous']. "') AS buyer , p.user_name, p.order_picking_status, r.order_reply_status ".
. t% D' i/ x) S5 @                " FROM " . $GLOBALS['ecs']->table('order_info') . " AS o " .2 t7 o0 e' {( M! K& Z, n
                " LEFT JOIN " .$GLOBALS['ecs']->table('users'). " AS u ON u.user_id=o.user_id ".        7 j4 P/ l# J- m6 g/ @, u
        " LEFT JOIN order_reply_status AS r ON r.order_id = o.order_id ".
+ f4 [% [6 ?) l) W+ G" LEFT JOIN order_picking_status AS p ON p.order_id = o.order_id ". $where .' @1 ^# Z0 J, M8 ]/ n
                " ORDER BY $filter[sort_by] $filter[sort_order] ".              ; C2 |, G1 V% J$ U' y! h1 B2 R+ \
                " LIMIT " . ($filter['page'] - 1) * $filter['page_size'] . ",$filter[page_size]";
$ b5 v2 g3 G) O9 R! @
5 ]: t/ T! N7 M% \5 s$ [
' V  s9 J5 [2 f% F& n

% `; n2 @' t( ]: E* L. Z1 L( v$ n5 x




欢迎光临 科恒数字网-持续研发、集成、交付、运营方案资源库 (https://www.khcic.com/) Powered by Discuz! X3.5