更新订单详情

parent 2b37a451
......@@ -133,6 +133,20 @@ class OrderService
$orderAmount += round($buy_number*$buy_price,2);
$standard_brand = data_get($skuInfo,"standard_brand");
#查询英文品牌缩写
$brandName = $skuInfo["brand_name"];
$standard_brand_id = \Arr::get($standard_brand,"standard_brand_id",0);
$standardBrandInfo = $redis->hget("standard_brand",$standard_brand_id);
if ($standardBrandInfo){
$standardBrandInfoArr = json_decode($standardBrandInfo,true);
#深贸商城的品牌字段需展示该SKU对应基石标准品牌列表的英文简称,无则取英文名称、都无则取品牌名称
if ($standardBrandInfoArr["brand_short_name_en"]){
$brandName = $standardBrandInfoArr["brand_short_name_en"];
}else if ($standardBrandInfoArr["brand_name_en"]){
$brandName = $standardBrandInfoArr["brand_name_en"];
}
}
//订单明细
$orderItems[] = [
"order_id"=>$order_id, //订单ID
......@@ -140,17 +154,17 @@ class OrderService
"goods_id"=>$goods_id, //商品ID
"supplier_id"=>\Arr::get($skuInfo,"supplier_id",0), //供应商ID(=company_id)
"brand_id"=>$skuInfo["brand_id"], //品牌ID
"standard_brand_id"=>\Arr::get($standard_brand,"standard_brand_id",0), //标准品牌ID
"standard_brand_id"=>$standard_brand_id, //标准品牌ID
"goods_name"=>\Arr::get($skuInfo,"goods_name",0), //型号
"class_id2"=>\Arr::get($skuInfo,"class_id2",0), //商品二级分类id
"batch"=>\Arr::get($skuInfo,"batch_sn",0), //批次
"class_id2_name"=>"", //商品二级分类名称
"supplier_name"=>\Arr::get($skuInfo,"supplier_name",0), //供应商名(=company_name)
"brand_name"=>\Arr::get($skuInfo,"brand_name",0), //品牌名
"brand_name"=>$brandName, //品牌名
"standard_brand_name"=>\Arr::get($standard_brand,"brand_name",""), //标准品牌
"goods_type"=>2, //商品类型 联营:1专卖 2联营 自营 :3自营 4寄售 5第三方仓库
"goods_number"=>$buy_number, //购买数量
"goods_price"=>\Arr::get($skuInfo,"buy_price",0), //商品单价
"goods_price"=>$buy_price, //商品单价
"goods_unit"=>"pcs", //商品单位
"delivery_time"=>\Arr::get($skuInfo,"hk_delivery_time",""), //交货时间
"canal"=>\Arr::get($skuInfo,"canal",""), //渠道标签
......@@ -301,7 +315,7 @@ class OrderService
"shipping"=>\Arr::get($priceArr,3,0), //运费
"payment_surcharge"=>\Arr::get($priceArr,5,0), //支付手续费
"merchandise_total"=>$merchandise_total, //商品总额
"sub_total"=>$v["order_amount"], //小计
"sub_total"=>OrderPriceModel::getOrderSubTotal($order_id), //小计
"create_time"=>date('Y-m-d H:i:s', $v['create_time']), //下单时间
"over_time"=> $v["status"] == OrderModel::status_waiting_pay ? date('Y-m-d H:i:s', $v['create_time']+48*3600):"", //截止时间
];
......@@ -400,7 +414,7 @@ class OrderService
"order_id"=>$order_id,
"order_sn"=>$orderInfo["order_sn"],
"order_amount"=>$orderInfo["order_amount"],
"sub_total"=>$orderInfo["order_amount"], //小计
"sub_total"=>OrderPriceModel::getOrderSubTotal($order_id), //小计
"created_time"=>timeToDate($orderInfo["create_time"]), //创建时间
"reviewed_time"=>timeToDate($orderInfo["confirm_time"]), //审核时间
"paid_time"=>timeToDate($orderInfo["pay_time"]), //支付时间
......
......@@ -17,5 +17,12 @@ class OrderPriceModel extends Model
return ($res) ? $res->toArray() : [];
}
//计算订单总金额
public static function getOrderSubTotal($order_id)
{
return self::where("order_id",$order_id)->wherein("price_type",[1,3,5])->sum("price");
}
}
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