rabin vor 3 Jahren
Ursprung
Commit
ce8565121b

+ 78 - 12
app/factory/admin/Order.php

@@ -192,21 +192,74 @@ class Order extends Core
 
         # 退款
         $data['tui'] = Dever::url('lib/buy.refund_apply_info_one_commit?json=1', 'mshop');
+
+        # 导入物流单号
+        $data['import'] = Dever::load('upload/import.url', 'factory/admin/order.import', 10);
+
     	return $data;
     }
 
+    # 导入物流单号
+    public function import($file)
+    {
+        $file = Dever::local($file);
+        $data = Dever::excelImport($file, 1);
+        if ($data) {
+            $psinfo = array();
+            foreach ($data as $k => $v) {
+                if ($k == 2) {
+                    $order_num = $v['B'];
+                    if ($order_num) {
+                        $order = Dever::db('shop/buy_order')->find(array('order_num' => $order_num));
+                        if ($order && $order['status'] == 3) {
+                            if (!isset($psinfo[$order['id']])) {
+                                $psinfo[$order['id']] = array();
+                            }
+                            $psinfo[$order['id']][] = array($v['D'], $v['N'], $v['G']);
+                        }
+                    }
+                }
+            }
+
+            if ($psinfo) {
+                foreach ($psinfo as $k => $v) {
+                    $update = array();
+                    $update['order_id'] = $k;
+                    $service = array();
+                    foreach ($v as $k1 => $v1) {
+                        $update['cdate'] = Dever::maketime($v1[2]);
+                        $service_info = Dever::db('shop/service')->find($v1[1]);
+                        if (!$service_info) {
+                            $service_id = Dever::db('shop/service')->insert(array('name' => $v1[1], 'type' => 1));
+                        } else {
+                            $service_id = $service_info['id'];
+                        }
+                        $service[] = array
+                        (
+                            'order' => $k1,
+                            'service_id' => $service_id,
+                            'order_num' => $v1[0],
+                        );
+                    }
+                    if ($service) {
+                        $update['service'] = $service;
+                    }
+                    
+                    $this->send_action($update);
+                }
+            }
+        }
+    }
+
     # 发货
     public function send_api()
     {
     	$input = Dever::input();
-        $update = array();
+        $service = array();
 
         $order_id = Dever::input('update_where_id');
 
-        $where['order_id'] = $order_id;
-        $info = Dever::db('shop/buy_order_ps')->find($where);
-
-        $update = $where;
+        
         foreach ($input as $k => $v) {
             if (strpos($k, '_c_') !== false) {
                 if ($v == 'null') {
@@ -228,13 +281,17 @@ class Order extends Core
 
                     $num = $c[$k][$temp[1]];
 
-                    $update[$k][$num][$temp[1]] = $v;
+                    $service[$k][$num][$temp[1]] = $v;
                 }
             }
         }
-        if (isset($update['service'])) {
-            $update['service'] = Dever::array_encode($update['service']);
+        $update = array();
+        $update['order_id'] = $order_id;
+        if ($service) {
+            $update['service'] = $service;
         }
+        
+        $update['cdate'] = $input['update_cdate'];
         /*
         $update['service_id'] = $input['update_service_id'];
         $update['order_num'] = $input['update_order_num'];
@@ -245,7 +302,17 @@ class Order extends Core
         $update['tj'] = $input['update_tj'];
         $update['price'] = $input['update_price'];
         */
-        $update['cdate'] = $input['update_cdate'];
+        return $this->send_action($update);
+    }
+
+    private function send_action($update = array())
+    {
+        $info = Dever::db('shop/buy_order_ps')->find(array('order_id' => $update['order_id']));
+
+        if (isset($update['service'])) {
+            $update['service'] = Dever::array_encode($update['service']);
+        }
+        
         if ($info) {
             $update['where_id'] = $info['id'];
             Dever::db('shop/buy_order_ps')->update($update);
@@ -307,12 +374,11 @@ class Order extends Core
         }
 
         # 给仓库发消息
-        $order = Dever::db('shop/buy_order')->find($update['order_id']);
-        if (Dever::project('message') && $order) {
+        if (Dever::project('message') && $order && $order['type'] == 2) {
             $msg_param['type'] = 3;//消息头类型3是入库订单消息
             $msg_param['id'] = $order['id'];
             $msg_param = Dever::json_encode($msg_param);
-            $msg = '您有新的入库订货单已发货,请及时查收后确认。';
+            $msg = '您有新的入库订货单已发货,请及时查收后确认。';
             Dever::load('message/lib/data')->push(-1, $order['type_id'], '入库订货单通知', $msg, 7, 3, false, $msg_param);
         }
 

+ 1 - 1
app/factory/assets/pc/html/order.html

@@ -27,7 +27,7 @@
 
               <div class="layui-inline"><div class="layui-input-inline"><select lay-ignore="" xm-select-radio="" class="update_value form-control layui-input layui-select   " name="source_out_status" id="source_out_status"><option value="0" selected="">导出状态</option><option parent="" value="1">未导出</option><option parent="" value="2">已导出</option></select></div></div>
 
-              <div class="layui-inline"><input type="hidden" value="1" name="excel" id="excel" autocomplete="off"><button class="btn btn-primary layui-btn layuiadmin-btn-list" onclick="$('#excel').val(1);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">搜索</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-danger" onclick="out($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;display:none;">批量打印备货单</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-warm" onclick="$('#excel').val(2);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">导出</button></div></div></div></div>
+              <div class="layui-inline"><input type="hidden" value="1" name="excel" id="excel" autocomplete="off"><button class="btn btn-primary layui-btn layuiadmin-btn-list" onclick="$('#excel').val(1);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">搜索</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-danger" onclick="out($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;display:none;">批量打印备货单</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-warm" onclick="$('#excel').val(2);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">导出</button>&nbsp;&nbsp;<button class="btn btn-default layui-btn layuiadmin-btn-list" id="import" data-value="" href="javascript:;" onclick="fastEdit($(this), $(this).attr('data-value'),'导入物流单', '')">导入物流单</button></div></div></div></div>
             </div>
           </div>
         </div>

+ 2 - 0
app/factory/template/pc/order.php

@@ -21,5 +21,7 @@ $view
 
 ->fetch('#page','<{Dever::page("current")}>') 
 
+->fetch('#import@data-value', 'factory/admin/order.getConfig#import')
+
 # display
 ->display();

+ 4 - 4
app/mshop/lib/Buy.php

@@ -294,7 +294,7 @@ class Buy
                 foreach ($info['ps_info']['service'] as $k => $v) {
                     if (isset($v['order_num']) && $v['order_num']) {
                         $info['ps_info']['service'][$k]['service_name'] = '供应商自送';
-                        if ($v['service_id'] > 0) {
+                        if (isset($v['service_id']) && $v['service_id'] > 0) {
                             $service = Dever::db('shop/service')->find($v['service_id']);
                             $info['ps_info']['service'][$k]['service_name'] = $service['name'];
                         }
@@ -1163,7 +1163,7 @@ class Buy
                 foreach ($info['ps_info']['service'] as $k => $v) {
                     if (isset($v['order_num']) && $v['order_num']) {
                         $info['ps_info']['service'][$k]['service_name'] = '供应商自送';
-                        if ($v['service_id'] > 0) {
+                        if (isset($v['service_id']) && $v['service_id'] > 0) {
                             $service_info = Dever::db('shop/service')->find($v['service_id']);
                             $info['ps_info']['service'][$k]['service_name'] = $service_info['name'];
                         }
@@ -2263,7 +2263,7 @@ class Buy
                 foreach ($info['ps_info']['service'] as $k => $v) {
                     if (isset($v['order_num']) && $v['order_num']) {
                         $info['ps_info']['service'][$k]['service_name'] = '供应商自送';
-                        if ($v['service_id'] > 0) {
+                        if (isset($v['service_id']) && $v['service_id'] > 0) {
                             $service = Dever::db('shop/service')->find($v['service_id']);
                             $info['ps_info']['service'][$k]['service_name'] = $service['name'];
                         }
@@ -2330,7 +2330,7 @@ class Buy
                 foreach ($info['ps_info']['service'] as $k => $v) {
                     if (isset($v['order_num']) && $v['order_num']) {
                         $info['ps_info']['service'][$k]['service_name'] = '供应商自送';
-                        if ($v['service_id'] > 0) {
+                        if (isset($v['service_id']) && $v['service_id'] > 0) {
                             $service = Dever::db('shop/service')->find($v['service_id']);
                             $info['ps_info']['service'][$k]['service_name'] = $service['name'];
                         }

+ 1 - 0
app/shop/lib/Sign.php

@@ -71,6 +71,7 @@ Class Sign {
 		if (!$sign) {
 			Dever::alert('档案资料未上传');
 		}
+		$sign['bank_acct_no'] = str_replace(' ', '', $sign['bank_acct_no']);
 		switch($sign['step']) {
 			case -1;
 				# 提交资料

+ 84 - 18
app/store/admin/Order.php

@@ -200,21 +200,74 @@ class Order extends Core
 
         # 退款
         $data['tui'] = Dever::url('lib/buy.refund_apply_info_one_commit?json=1', 'mshop');
+
+        # 导入物流单号
+        $data['import'] = Dever::load('upload/import.url', 'store/admin/order.import', 10);
+
     	return $data;
     }
 
+    # 导入物流单号
+    public function import($file)
+    {
+        $file = Dever::local($file);
+        $data = Dever::excelImport($file, 1);
+        if ($data) {
+            $psinfo = array();
+            foreach ($data as $k => $v) {
+                if ($k == 2) {
+                    $order_num = $v['B'];
+                    if ($order_num) {
+                        $order = Dever::db('shop/buy_order')->find(array('order_num' => $order_num));
+                        if ($order && $order['status'] == 3) {
+                            if (!isset($psinfo[$order['id']])) {
+                                $psinfo[$order['id']] = array();
+                            }
+                            $psinfo[$order['id']][] = array($v['D'], $v['N'], $v['G']);
+                        }
+                    }
+                }
+            }
+
+            if ($psinfo) {
+                foreach ($psinfo as $k => $v) {
+                    $update = array();
+                    $update['order_id'] = $k;
+                    $service = array();
+                    foreach ($v as $k1 => $v1) {
+                        $update['cdate'] = Dever::maketime($v1[2]);
+                        $service_info = Dever::db('shop/service')->find($v1[1]);
+                        if (!$service_info) {
+                            $service_id = Dever::db('shop/service')->insert(array('name' => $v1[1], 'type' => 1));
+                        } else {
+                            $service_id = $service_info['id'];
+                        }
+                        $service[] = array
+                        (
+                            'order' => $k1,
+                            'service_id' => $service_id,
+                            'order_num' => $v1[0],
+                        );
+                    }
+                    if ($service) {
+                        $update['service'] = $service;
+                    }
+                    
+                    $this->send_action($update);
+                }
+            }
+        }
+    }
+
     # 发货
     public function send_api()
     {
-    	$input = Dever::input();
-        $update = array();
+        $input = Dever::input();
+        $service = array();
 
-    	$order_id = Dever::input('update_where_id');
+        $order_id = Dever::input('update_where_id');
 
-    	$where['order_id'] = $order_id;
-    	$info = Dever::db('shop/buy_order_ps')->find($where);
-
-    	$update = $where;
+        
         foreach ($input as $k => $v) {
             if (strpos($k, '_c_') !== false) {
                 if ($v == 'null') {
@@ -236,24 +289,37 @@ class Order extends Core
 
                     $num = $c[$k][$temp[1]];
 
-                    $update[$k][$num][$temp[1]] = $v;
+                    $service[$k][$num][$temp[1]] = $v;
                 }
             }
         }
-        if (isset($update['service'])) {
-            $update['service'] = Dever::array_encode($update['service']);
+        $update = array();
+        $update['order_id'] = $order_id;
+        if ($service) {
+            $update['service'] = $service;
         }
+        
+        $update['cdate'] = $input['update_cdate'];
         /*
-    	$update['service_id'] = $input['update_service_id'];
-    	$update['order_num'] = $input['update_order_num'];
+        $update['service_id'] = $input['update_service_id'];
+        $update['order_num'] = $input['update_order_num'];
         $update['num'] = $input['update_num'];
-    	$update['phy'] = $input['update_phy'];
-    	$update['dby'] = $input['update_dby'];
-    	$update['zl'] = $input['update_zl'];
-    	$update['tj'] = $input['update_tj'];
-    	$update['price'] = $input['update_price'];
+        $update['phy'] = $input['update_phy'];
+        $update['dby'] = $input['update_dby'];
+        $update['zl'] = $input['update_zl'];
+        $update['tj'] = $input['update_tj'];
+        $update['price'] = $input['update_price'];
         */
-    	$update['cdate'] = $input['update_cdate'];
+        return $this->send_action($update);
+    }
+
+    private function send_action($update = array())
+    {
+    	$info = Dever::db('shop/buy_order_ps')->find(array('order_id' => $update['order_id']));
+
+        if (isset($update['service'])) {
+            $update['service'] = Dever::array_encode($update['service']);
+        }
     	if ($info) {
     		$update['where_id'] = $info['id'];
     		Dever::db('shop/buy_order_ps')->update($update);

+ 1 - 1
app/store/assets/pc/html/order.html

@@ -32,7 +32,7 @@
               <div class="layui-inline"><div class="layui-input-inline"><select lay-ignore="" xm-select-radio="" class="update_value form-control layui-input layui-select   " name="source_out_status" id="source_out_status"><option value="0" selected="">导出状态</option><option parent="" value="1">未导出</option><option parent="" value="2">已导出</option></select></div></div>
 
 
-              <div class="layui-inline"><input type="hidden" value="1" name="excel" id="excel" autocomplete="off"><button class="btn btn-primary layui-btn layuiadmin-btn-list" onclick="$('#excel').val(1);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">搜索</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-danger" onclick="out($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;display:none;">批量打印备货单</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-warm" onclick="$('#excel').val(2);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">导出</button></div></div></div></div>
+              <div class="layui-inline"><input type="hidden" value="1" name="excel" id="excel" autocomplete="off"><button class="btn btn-primary layui-btn layuiadmin-btn-list" onclick="$('#excel').val(1);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">搜索</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-danger" onclick="out($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;display:none;">批量打印备货单</button>&nbsp;&nbsp;<button class="btn btn-primary layui-btn layuiadmin-btn-list layui-btn-warm" onclick="$('#excel').val(2);list_search($(this))" type="button" style="height: 38px;margin-left:0px;margin-top:-2px;">导出</button>&nbsp;&nbsp;<button class="btn btn-default layui-btn layuiadmin-btn-list" id="import" data-value="" href="javascript:;" onclick="fastEdit($(this), $(this).attr('data-value'),'导入物流单', '')">导入物流单</button></div></div></div></div>
             </div>
           </div>
         </div>

+ 2 - 0
app/store/template/pc/order.php

@@ -23,6 +23,8 @@ $view
 ->fetch('#parent_type@value', '<{Dever::input("parent_type")}>')  
 ->fetch('#source_type@value', '<{Dever::input("source_type")}>')  
 
+->fetch('#import@data-value', 'store/admin/order.getConfig#import')
+
 ->fetch('#page','<{Dever::page("current")}>') 
 
 # display

+ 8 - 0
service/agent/database/dh_order.php

@@ -56,6 +56,10 @@ $refund_status = array
     4 => '已退款',
 );
 $mid = Dever::input('search_option_mid');
+$mul = false;
+if (Dever::load('manage/auth')->checkFunc('agent.dh_order', 'piliangfafang', '批量收货')) {
+    $mul = '{status} == 4';
+}
 return array
 (
     # 表名
@@ -68,6 +72,7 @@ return array
     (
         //'insert' => 'agent/lib/manage.sellOrderUpdate',
         'update' => 'agent/lib/manage.sellOrderUpdate',
+        'updatemul' => 'agent/lib/manage.sellOrderUpdateMul',
     ),
     # 数据结构
     'struct' => array
@@ -302,6 +307,8 @@ return array
             'search'    => 'select',
             'list'      => true,
             'list_order' => 7,
+            'mul'   => true,
+            'mul_option' => array(5 => '确认收货'),
         ),
 
         'audit'        => array
@@ -388,6 +395,7 @@ return array
         'edit' => false,
         'insert' => false,
         'excel' => $excel,
+        'mul' => $mul,
         'button' => $button,
 
         'list_button' => array

+ 1 - 0
service/agent/database/member.php

@@ -101,6 +101,7 @@ if (Dever::load('manage/auth')->checkFunc('agent.member', 'agent_member_excel13'
 $search_auth = Dever::input('search_option_dever_auth', 1);
 $info = '';
 $button = array();
+//$button['导入订单'] = array('fast', '', 'import&project=upload&call=agent/lib/manage.import&key=4');
 $list_button = array();
 if($search_auth == 1){
     $list_button['list'] = array('查看详情', '"member_area&mid={id}&page_type=1&[refer]"');

+ 1 - 0
service/agent/lib/Dhorder.php

@@ -317,6 +317,7 @@ class Dhorder
     # 添加配送信息
     public function updatePs($order, $status = 1, $service_id = -1, $order_num = '')
     {
+        $order = Dever::db('agent/dh_order')->find($order['id']);
         $where['order_id'] = $order['id'];
         $where['clear'] = true;
         $data = Dever::db('agent/dh_order_ps')->find($where);

+ 27 - 0
service/agent/lib/Manage.php

@@ -6,6 +6,12 @@ use Dever;
 
 class Manage
 {
+    public function import($file)
+    {
+        $file = Dever::local($file);
+        echo $file;die;
+    }
+
     public function agentOut($data)
     {
         $file = Dever::input('excel_name');
@@ -965,6 +971,27 @@ class Manage
         }
     }
 
+    public function sellOrderUpdateMul($id, $name, $data)
+    {
+        Dever::config('base')->hook = true;
+        $status = Dever::param('status', $data);
+        if ($status == 5) {
+            $list = explode(',', $id);
+            if ($list) {
+                foreach ($list as $k => $v) {
+                    if (is_array($v)) {
+                        $id = $v['id'];
+                        $info = Dever::db('agent/dh_order')->one($id);
+                    } else {
+                        $id = $v;
+                        $info = Dever::db('agent/dh_order')->one($id);
+                    }
+                    Dever::load('agent/lib/dhorder')->finish($info, $info['shop_id']);
+                }
+            }
+        }
+    }
+
     # 确认收货
     public function setDhOrderStatus_api()
     {