|
@@ -195,7 +195,8 @@ class CommonController extends Controller
|
195
|
195
|
->orderBy('id', 'desc')->get();*/
|
196
|
196
|
$maternityMatronOrder = MaternityMatronOrder::where("wechat_id", $wechat_id)
|
197
|
197
|
->orderBy('id', 'desc')->get();
|
198
|
|
- $productOrder = ProductOrder::where("wechat_id", $wechat_id)
|
|
198
|
+
|
|
199
|
+ $productOrder = ProductOrder::with("products")->where("wechat_id", $wechat_id)
|
199
|
200
|
->orderBy('id', 'desc')->get();
|
200
|
201
|
|
201
|
202
|
$optionOrder = OptionOrder::where("wechat_id", $wechat_id)
|
|
@@ -238,21 +239,33 @@ class CommonController extends Controller
|
238
|
239
|
array_push($orders, $data);
|
239
|
240
|
}
|
240
|
241
|
}
|
|
242
|
+ $productData = [];
|
241
|
243
|
foreach ($productOrder as $order) {
|
242
|
244
|
$data = [];
|
243
|
245
|
$data["id"] = $order->id;
|
244
|
|
- $data["classify1"] = $order->product_name;
|
245
|
|
- $data["classify2"] = $order->color . "x" . $order->amount;
|
246
|
246
|
$data["status"] = $order->status;
|
247
|
247
|
$data["price"] = $order->price;
|
248
|
248
|
$data["order_type"] = "product_order";
|
249
|
|
- $data["photo"] = $order->photo;
|
250
|
249
|
$data["created_at"] = $order->created_at->toDateTimeString();
|
|
250
|
+ $data["products"] = [];
|
|
251
|
+ foreach ($order["products"] as $prd) {
|
|
252
|
+ $productTmp = [];
|
|
253
|
+ $productTmp["id"] = $prd["id"];
|
|
254
|
+ $productTmp["name"] = $prd["name"];
|
|
255
|
+ $productTmp["classify"] = $prd["classify"];
|
|
256
|
+ $productTmp["color"] = $prd["color"];
|
|
257
|
+ $productTmp["price"] = $prd["price"];
|
|
258
|
+ $productTmp["photo"] = $prd["photo"];
|
|
259
|
+ $productTmp["amount"] = $prd["pivot"]["product_amount"];
|
|
260
|
+ array_push($data["products"], $productTmp);
|
|
261
|
+ }
|
|
262
|
+
|
251
|
263
|
if($order->comment_id) {
|
252
|
264
|
$data["comment"] = true;
|
253
|
265
|
} else {
|
254
|
266
|
$data["comment"] = false;
|
255
|
267
|
}
|
|
268
|
+
|
256
|
269
|
// 未支付订单1小时后过期
|
257
|
270
|
if($order->status === 0) {
|
258
|
271
|
if(Carbon::now()->subHour()->gt($order->created_at)) {
|
|
@@ -263,11 +276,14 @@ class CommonController extends Controller
|
263
|
276
|
} else if($order->status === 3) {
|
264
|
277
|
continue;
|
265
|
278
|
}
|
266
|
|
- array_push($orders, $data);
|
|
279
|
+ array_push($productData, $data);
|
267
|
280
|
}
|
268
|
281
|
return Response()->json([
|
269
|
282
|
"status" => 0,
|
270
|
|
- "data" => $orders
|
|
283
|
+ "data" => [
|
|
284
|
+ "others" => $orders,
|
|
285
|
+ "product_orders" => $productData
|
|
286
|
+ ]
|
271
|
287
|
]);
|
272
|
288
|
}
|
273
|
289
|
|