| 
					
					
						
							
						
					
					
				 | 
				@ -156,7 +156,9 @@ class OrderController extends Controller | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
						//0:单品销售;1:组合销售
 | 
				 | 
				 | 
						//0:单品销售;1:组合销售
 | 
			
		
		
	
		
			
				 | 
				 | 
						if ($ap->type == 0) { | 
				 | 
				 | 
						if ($ap->type == 0) { | 
			
		
		
	
		
			
				 | 
				 | 
							$spec = AgentProductSpec::where('agent_product_id', $formData['id'])->find($formData['spec_id']); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							$spec = AgentProductSpec::with('productSpec') | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								->where('agent_product_id', $formData['id']) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								->find($formData['spec_id']); | 
			
		
		
	
		
			
				 | 
				 | 
							if (!$spec) { | 
				 | 
				 | 
							if (!$spec) { | 
			
		
		
	
		
			
				 | 
				 | 
								return $this->error('你选择的产品规格不存在'); | 
				 | 
				 | 
								return $this->error('你选择的产品规格不存在'); | 
			
		
		
	
		
			
				 | 
				 | 
							} | 
				 | 
				 | 
							} | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -314,25 +316,20 @@ class OrderController extends Controller | 
			
		
		
	
		
			
				 | 
				 | 
								'info' => $order_info, | 
				 | 
				 | 
								'info' => $order_info, | 
			
		
		
	
		
			
				 | 
				 | 
							]); | 
				 | 
				 | 
							]); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
							//存入订单产品表
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$supplier_product_info = Product::whereIn('id', $product_ids) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								->orderBy('id')->get(['type', 'id AS product_id', 'supplier_id', 'price', 'service_persons'])->toArray(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$order_id = $order->id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$agent_id = $this->agent_id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$agent_product_id = $ap->id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							foreach ($supplier_product_info as &$v) { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								$v['order_id'] = $order_id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								$v['agent_id'] = $agent_id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								$v['agent_product_id'] = $agent_product_id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								$v['num'] = $formData['num']; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								if ($v['type'] == 0) { //TODO 此处未处理组合产品
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
									$v['product_spec_id'] = $formData['spec_id']; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								} | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
								unset($v['type']); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							} | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							OrderProductItem::insert($supplier_product_info); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							//存入订单产品表,TODO 此处不考虑组合产品
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							OrderProductItem::insert([ | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'order_id' => $order->id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'agent_id' => $this->agent_id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'agent_product_id' => $ap->id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'supplier_id' => $ap->product->supplier_id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'product_id' => $ap->product->id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'num' => $formData['num'], | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'price' => $ap->product->price, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'agent_product_spec_id' => $formData['spec_id'], | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'product_type' => $ap->product->type, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'product_spec_id' => $spec->productSpec->id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								'service_persons' => $ap->product->service_persons, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							]); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
							DB::commit(); | 
				 | 
				 | 
							DB::commit(); | 
			
		
		
	
		
			
				 | 
				 | 
						} catch (\Exception $e) { | 
				 | 
				 | 
						} catch (\Exception $e) { | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -341,7 +338,7 @@ class OrderController extends Controller | 
			
		
		
	
		
			
				 | 
				 | 
						} | 
				 | 
				 | 
						} | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
						if ($formData['pay_type'] == PayType::OFFLINE) { //线下支付
 | 
				 | 
				 | 
						if ($formData['pay_type'] == PayType::OFFLINE) { //线下支付
 | 
			
		
		
	
		
			
				 | 
				 | 
							return $this->success(['id' => $order_id], '操作成功,请及时联系客服付款'); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							return $this->success(['id' => $order->id], '操作成功,请及时联系客服付款'); | 
			
		
		
	
		
			
				 | 
				 | 
						} else { //在线支付或定金支付
 | 
				 | 
				 | 
						} else { //在线支付或定金支付
 | 
			
		
		
	
		
			
				 | 
				 | 
							/*$config = $this->payConfig($order, $price); | 
				 | 
				 | 
							/*$config = $this->payConfig($order, $price); | 
			
		
		
	
		
			
				 | 
				 | 
							if (!empty($config['paySign'])) { | 
				 | 
				 | 
							if (!empty($config['paySign'])) { | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -526,7 +523,7 @@ class OrderController extends Controller | 
			
		
		
	
		
			
				 | 
				 | 
						$id = (int)request()->input('id'); | 
				 | 
				 | 
						$id = (int)request()->input('id'); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
						$fields = ['id', 'agent_id', 'order_no', 'agent_product_id', 'num', 'price', 'name', 'mobile', 'title', 'picture', 'status', | 
				 | 
				 | 
						$fields = ['id', 'agent_id', 'order_no', 'agent_product_id', 'num', 'price', 'name', 'mobile', 'title', 'picture', 'status', | 
			
		
		
	
		
			
				 | 
				 | 
							'pay_type', 'coupon_id', 'paid_money', 'paid_at', 'refund_info', 'verify_code', 'created_at']; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							'pay_type', 'coupon_id', 'paid_money', 'paid_at', 'refund_info', 'verify_code', 'info', 'created_at']; | 
			
		
		
	
		
			
				 | 
				 | 
						$order = Order::with('agent:id,appid,appsecret') | 
				 | 
				 | 
						$order = Order::with('agent:id,appid,appsecret') | 
			
		
		
	
		
			
				 | 
				 | 
							->where('user_id', $this->user_id) | 
				 | 
				 | 
							->where('user_id', $this->user_id) | 
			
		
		
	
		
			
				 | 
				 | 
							->find($id, $fields); | 
				 | 
				 | 
							->find($id, $fields); | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
					
				 | 
				
  |