订单列表

parent 9b0887a5
...@@ -287,13 +287,14 @@ class OrderService ...@@ -287,13 +287,14 @@ class OrderService
$result = $res["data"]; $result = $res["data"];
$orderAddressArr = OrderAddressModel::where("order_address_type",1)->whereIn("order_id", array_column($result, "order_id"))->get()->keyBy("order_id")->toArray(); //地址信息 $orderAddressArr = OrderAddressModel::whereIn("order_id", array_column($result, "order_id"))->get()->keyBy("order_address_type")->toArray(); //地址信息
$temp = []; $temp = [];
foreach ($result as $k=>$v){ foreach ($result as $k=>$v){
$order_id = $v["order_id"]; $order_id = $v["order_id"];
$items = OrderItemsModel::where("order_id",$order_id)->get()->toArray(); $items = OrderItemsModel::where("order_id",$order_id)->get()->toArray();
$orderAddress = \Arr::get($orderAddressArr,$order_id,[]); $receiveAddress = \Arr::get($orderAddressArr,OrderAddressModel::order_address_type_receive,[]);
$piaoAddress = \Arr::get($orderAddressArr,OrderAddressModel::order_address_type_piao,[]);
$merchandise_total = 0; //商品总额 $merchandise_total = 0; //商品总额
foreach ($items as $a=>$b){ foreach ($items as $a=>$b){
...@@ -317,10 +318,10 @@ class OrderService ...@@ -317,10 +318,10 @@ class OrderService
"goods_name_arr"=>array_column($items,"goods_name"), "goods_name_arr"=>array_column($items,"goods_name"),
"status"=>$v["status"], "status"=>$v["status"],
"status_en"=>\Arr::get(OrderModel::$status,$v["status"],""), "status_en"=>\Arr::get(OrderModel::$status,$v["status"],""),
"receiver"=>\Arr::get($orderAddress,"consignee"), "receiver"=>\Arr::get($receiveAddress,"consignee"),
"email"=>\Arr::get($orderAddress,"email"), "email"=>\Arr::get($receiveAddress,"email"),
"phone"=>\Arr::get($orderAddress,"phone"), "phone"=>\Arr::get($receiveAddress,"phone"),
"shipping_address"=>\Arr::get($orderAddress,"detail_address"), "shipping_address"=>\Arr::get($receiveAddress,"detail_address"),
"shipping"=>\Arr::get($priceArr,3,0), //运费 "shipping"=>\Arr::get($priceArr,3,0), //运费
"payment_surcharge_paypal"=>$payment_surcharge_paypal, //paypal 支付手续费 "payment_surcharge_paypal"=>$payment_surcharge_paypal, //paypal 支付手续费
"payment_surcharge_ttl"=>35, //ttl 支付手续费 "payment_surcharge_ttl"=>35, //ttl 支付手续费
......
...@@ -10,6 +10,10 @@ class OrderAddressModel extends Model ...@@ -10,6 +10,10 @@ class OrderAddressModel extends Model
protected $primaryKey = 'order_address_id'; protected $primaryKey = 'order_address_id';
public $timestamps = false; public $timestamps = false;
// `order_address_type` '1收货信息 2账单邮寄信息',
const order_address_type_receive = 1;
const order_address_type_piao = 2;
//获取订单地址详情 //获取订单地址详情
public static function getOrderAddressInfo($where) public static function getOrderAddressInfo($where)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment