| 
					
				 | 
			
			
				@@ -181,6 +181,17 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $info['ps_info'] = Dever::db('shop/sell_order_ps')->find(array('order_id' => $info['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if ($info['ps_info']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $info['ps_info']['service_name'] = '商家自送';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $info['ps_info']['cdate'] = date('Y-m-d H:i', $info['ps_info']['cdate']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ($info['ps_info']['qu_date']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $info['ps_info']['qu_date'] = date('Y-m-d H:i', $info['ps_info']['qu_date']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ($info['ps_info']['qs_date']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $info['ps_info']['qs_date'] = date('Y-m-d H:i', $info['ps_info']['qs_date']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $status = Dever::db('shop/sell_order_ps')->config['status'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $info['ps_info']['status_name'] = $status[$info['ps_info']['status']];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if ($info['ps_info']['service_id'] > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //暂时还没有
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -188,7 +199,10 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $info['goods'] = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $info['user'] = Dever::load('passport/api')->info($info['uid']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($info['uid'] && $info['uid'] > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $info['user'] = Dever::load('passport/api')->info($info['uid']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $info['shop'] = Dever::db('shop/info')->getOne($info['shop_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $info['cdate'] = date('Y-m-d H:i', $info['cdate']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -196,9 +210,23 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $info['operdate'] = date('Y-m-d H:i', $info['operdate']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($info['status'] == 6 || $info['status'] == 7 || $info['status'] == 8) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $info['tk_cash'] = 0;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $goods_status = Dever::db('shop/sell_order_goods')->config['status'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if ($this->view == 2) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             foreach ($info['goods'] as $k => $v) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $info['goods'][$k]['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ($v['status'] > 2 && $v['tk_cash'] > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $info['tk_cash'] += $v['tk_cash'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $info['goods'][$k]['status_name'] = $goods_status[$v['status']];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if ($info['address_id']) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $info['address'] = Dever::db('passport/address')->find($info['address_id']);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -219,6 +247,12 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $goods = Dever::db('goods/info')->one($v['goods_id']);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $info['goods'][$k]['name'] = $goods['name'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 $info['goods'][$k]['cover'] = $goods['cover'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if ($v['status'] > 2 && $v['tk_cash'] > 0) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    $info['tk_cash'] += $v['tk_cash'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $info['goods'][$k]['status_name'] = $goods_status[$v['status']];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -799,7 +833,7 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     $msg = '您有一件外送商品已订购成功,核销码:' . $update['code'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     # 分配配送信息
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    $this->updatePs($order);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //$this->updatePs($order);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 # 发消息
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -822,7 +856,7 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     # 添加配送信息
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public function updatePs($order)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function updatePs($order, $status = 1)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $where['order_id'] = $order['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $data = Dever::db('shop/sell_order_ps')->find($where);
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -833,9 +867,24 @@ class Sell 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $insert['shop_id'] = $order['shop_id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $insert['service_id'] = -1;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $insert['price'] = 0;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $insert['status'] = $status;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $insert['num'] = $order['num'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($status == 2) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $insert['qu_date'] = time();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Dever::db('shop/sell_order_ps')->insert($insert);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $update = $where;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $update['where_id'] = $data['id'];
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $update['status'] = $status;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($status == 2) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $update['qu_date'] = time();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($status == 3) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                $update['qs_date'] = time();
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Dever::db('shop/sell_order_ps')->update($update);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 |