添加ttl

parent 0d8576fa
Showing with 29 additions and 0 deletions
...@@ -17,6 +17,17 @@ use App\Models\CartModel; ...@@ -17,6 +17,17 @@ use App\Models\CartModel;
//订单服务层 //订单服务层
class OrderService class OrderService
{ {
#收款常量
static $bank_info = [
"paypal" => "Paypal@semour.com",
"ttl_bank_name" => "HSBC Hong Kong",
"ttl_bank_address" => "1 Queen's Road Central, Hong Kong",
"ttl_swift_code" => "HSBCHKHHHKH",
"ttl_company_name" => "SEMOUR ELECTRONICS CO., LIMITED",
"ttl_account_no" => "819-847187-838",
];
/* /*
* 新增订单 * 新增订单
address_id:0 address_id:0
...@@ -257,6 +268,19 @@ class OrderService ...@@ -257,6 +268,19 @@ class OrderService
$items = OrderItemsModel::where("order_id",$order_id)->get()->toArray(); $items = OrderItemsModel::where("order_id",$order_id)->get()->toArray();
$orderAddress = \Arr::get($orderAddressArr,$order_id,[]); $orderAddress = \Arr::get($orderAddressArr,$order_id,[]);
$merchandise_total = 0; //商品总额
foreach ($items as $a=>$b){
$ext_price = round($b["goods_number"]*$b["goods_price"],2);
$merchandise_total += $ext_price;
}
$priceInfo = OrderPriceModel::selectRaw("price_type,price")
->where("order_id",$order_id)
->get()->toArray(); //金额类型(正数ID大于0,负数ID小于0)-8活动优惠 -7支付优惠 -6运费优惠 -5尾款减款 -4优惠券优惠金额 -3尾款 -2预付款 -1付款,1货款 2附加费 3运费 4退款 5支付手续费
$priceArr = array_column($priceInfo,"price","price_type");
$temp[]=[ $temp[]=[
"order_id"=>$order_id, "order_id"=>$order_id,
"order_sn"=>$v["order_sn"], "order_sn"=>$v["order_sn"],
...@@ -268,10 +292,15 @@ class OrderService ...@@ -268,10 +292,15 @@ class OrderService
"email"=>\Arr::get($orderAddress,"email"), "email"=>\Arr::get($orderAddress,"email"),
"phone"=>\Arr::get($orderAddress,"phone"), "phone"=>\Arr::get($orderAddress,"phone"),
"shipping_address"=>\Arr::get($orderAddress,"detail_address"), "shipping_address"=>\Arr::get($orderAddress,"detail_address"),
"shipping"=>\Arr::get($priceArr,3,0), //运费
"payment_surcharge"=>\Arr::get($priceArr,5,0), //支付手续费
"merchandise_total"=>$merchandise_total, //商品总额
"sub_total "=>$v["order_amount"], //小计
]; ];
} }
return [ return [
"bank_info"=>self::$bank_info,
"total"=> $res["total"], //返回总条数 "total"=> $res["total"], //返回总条数
"page"=>$res["current_page"], //第几页 "page"=>$res["current_page"], //第几页
"page_size"=> \Arr::get($param,"page_size",10), //每页多少条 "page_size"=> \Arr::get($param,"page_size",10), //每页多少条
......
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