正在显示
1 个修改的文件
包含
34 行增加
和
2 行删除
@@ -88,7 +88,7 @@ class Car extends Base | @@ -88,7 +88,7 @@ class Car extends Base | ||
88 | $phone = $this->request->param("phone");//联系手机号码 | 88 | $phone = $this->request->param("phone");//联系手机号码 |
89 | $user_name = $this->request->param("user_name");//联系人 | 89 | $user_name = $this->request->param("user_name");//联系人 |
90 | $position = $this->request->param("position");//上车地址 | 90 | $position = $this->request->param("position");//上车地址 |
91 | - $seat_no = $this->request->param("seat_no");//经度 | 91 | + $seat_no = $this->request->param("seat_no");//座位 |
92 | $lat = $this->request->param("lat");//经度 | 92 | $lat = $this->request->param("lat");//经度 |
93 | $lng = $this->request->param("lng");//维度 | 93 | $lng = $this->request->param("lng");//维度 |
94 | $remarks = $this->request->param("remarks");//备注 | 94 | $remarks = $this->request->param("remarks");//备注 |
@@ -131,10 +131,25 @@ class Car extends Base | @@ -131,10 +131,25 @@ class Car extends Base | ||
131 | } | 131 | } |
132 | 132 | ||
133 | //计算价格 | 133 | //计算价格 |
134 | + $seatres=Db::name("seat")->where("id",$car['seat_id'])->find(); | ||
135 | + $seat_no_array = explode(",", $seat_no); | ||
136 | + $seat=json_decode($seatres['seat'],true); | ||
137 | + $newseat=[]; | ||
134 | 138 | ||
139 | + foreach ($seat as $k=>$v){ | ||
140 | + | ||
141 | + if( in_array($seat[$k]['seat_no'],$seat_no_array)){ | ||
142 | + $newseat[$k]=$seat[$k]; | ||
143 | + | ||
144 | + } | ||
145 | + } | ||
146 | + $price=0; | ||
147 | + foreach ($newseat as $k=>$v){ | ||
148 | + $price=bcadd($price,$newseat[$k]['seat_price'],2); | ||
149 | + } | ||
135 | $data=[ | 150 | $data=[ |
136 | "order_no"=>getOrderSn(), | 151 | "order_no"=>getOrderSn(), |
137 | - "price"=>bcmul($route['price'],$number,2), | 152 | + "price"=>$price, |
138 | "is_pay"=>"2",//未支付 | 153 | "is_pay"=>"2",//未支付 |
139 | "car_id"=>$car_id, | 154 | "car_id"=>$car_id, |
140 | "order_review_id"=>$order_review_id, | 155 | "order_review_id"=>$order_review_id, |
@@ -151,6 +166,7 @@ class Car extends Base | @@ -151,6 +166,7 @@ class Car extends Base | ||
151 | "lng"=>$lng, | 166 | "lng"=>$lng, |
152 | "number"=>$number, | 167 | "number"=>$number, |
153 | "remarks"=>$remarks, | 168 | "remarks"=>$remarks, |
169 | + "seat_no"=>$seat_no, | ||
154 | "intended_driver_id"=>$intended_driver_id, | 170 | "intended_driver_id"=>$intended_driver_id, |
155 | ]; | 171 | ]; |
156 | $res=Db::name("order")->insertGetId($data); | 172 | $res=Db::name("order")->insertGetId($data); |
@@ -803,4 +819,20 @@ class Car extends Base | @@ -803,4 +819,20 @@ class Car extends Base | ||
803 | $content = config("site.aboutwe"); | 819 | $content = config("site.aboutwe"); |
804 | return $this->success("请求成功",$content); | 820 | return $this->success("请求成功",$content); |
805 | } | 821 | } |
822 | + | ||
823 | + | ||
824 | + /** | ||
825 | + * 创建订单 | ||
826 | + * @return void | ||
827 | + */ | ||
828 | + public function createcharterorder(){ | ||
829 | + $route_id = $this->request->param("route_id");//线路 | ||
830 | + $number = $this->request->param("number");//乘车人数 | ||
831 | + $reservation_time = $this->request->param("reservation_time");//预约时间 | ||
832 | + $phone = $this->request->param("phone");//联系电话 | ||
833 | + | ||
834 | + $this->success("请求成功"); | ||
835 | + | ||
836 | + | ||
837 | + } | ||
806 | } | 838 | } |
-
请 注册 或 登录 后发表评论