|
@@ -1194,6 +1194,9 @@ class OrderCreate
|
|
|
$order = new Order();
|
|
|
$order->save($orderData);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 添加收货地址信息
|
|
|
if ($result['user_address']) {
|
|
|
$this->createOrderAddress($order, $result);
|
|
@@ -1211,6 +1214,9 @@ class OrderCreate
|
|
|
$result['coupon']->allowField(true)->save();
|
|
|
}
|
|
|
|
|
|
+ //bill表args
|
|
|
+ $bill_args = [];
|
|
|
+
|
|
|
// 添加 订单 item
|
|
|
foreach ($result['goods_list'] as $key => $buyInfo) {
|
|
|
$goods = $buyInfo['goods'];
|
|
@@ -1263,10 +1269,22 @@ class OrderCreate
|
|
|
$ext['is_commission'] = $buyInfo['is_commission'];
|
|
|
}
|
|
|
|
|
|
+ //bill表args
|
|
|
+ $bill_args[] = [
|
|
|
+ 'goods_sku_price_id' => $orderItem->goods_sku_price_id,
|
|
|
+ 'goods_title' => $orderItem->goods_title,
|
|
|
+ 'goods_image' => $orderItem->goods_image,
|
|
|
+ 'goods_price' => $orderItem->goods_price,
|
|
|
+ 'goods_num' => $orderItem->goods_num,
|
|
|
+ ];
|
|
|
+
|
|
|
$orderItem->ext = $ext;
|
|
|
$orderItem->save();
|
|
|
}
|
|
|
|
|
|
+ //冗余到bill
|
|
|
+ $this->createBill($order->id,$orderData,$bill_args);
|
|
|
+
|
|
|
// 订单创建后
|
|
|
$hookData = [
|
|
|
'order' => $order,
|
|
@@ -1280,6 +1298,32 @@ class OrderCreate
|
|
|
return $order;
|
|
|
}
|
|
|
|
|
|
+ //冗余到bill表
|
|
|
+ public function createBill($order_id,$orderData,$bill_args){
|
|
|
+
|
|
|
+ $num_sum = array_sum(array_column($bill_args,'goods_num'));
|
|
|
+
|
|
|
+ $shopro_back_rate = config('site.shopro_back_rate');
|
|
|
+ $bill = [
|
|
|
+ 'user_id' => $orderData['user_id'],
|
|
|
+ 'order_no' => $orderData['order_sn'],
|
|
|
+ 'num' => $num_sum,
|
|
|
+ 'pay_amount' => $orderData['pay_fee'],
|
|
|
+ 'table_id' => $order_id,
|
|
|
+ 'table_name' => 'shopro_order',
|
|
|
+
|
|
|
+ 'shop_name' => '商城',
|
|
|
+ 'shop_logo' => '',
|
|
|
+ 'args' => json_encode($bill_args,JSON_UNESCAPED_UNICODE),
|
|
|
+ 'total_amount' => $orderData['order_amount'],
|
|
|
+ 'back_rate' => $shopro_back_rate,
|
|
|
+ 'back_amount' => bcdiv(bcmul($orderData['order_amount'],$shopro_back_rate,4),100,2),
|
|
|
+ 'createtime' => time(),
|
|
|
+ ];
|
|
|
+
|
|
|
+ Db::name('bill')->insertGetId($bill);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 添加收货地址信息
|