修正分润逻辑
This commit is contained in:
parent
d229c59859
commit
79911effa3
@ -315,8 +315,28 @@ class StoreOrderRepository extends BaseRepository
|
||||
|
||||
if($order->source==103){
|
||||
$_payPrice = $order->procure_price;
|
||||
$finance[] = [
|
||||
'order_id' => $order->order_id,
|
||||
'order_sn' => $order->order_sn,
|
||||
'user_info' => $groupOrder->user->nickname,
|
||||
'user_id' => $uid,
|
||||
'financial_type' => 'supply_chain',
|
||||
'financial_pm' => 0,
|
||||
'type' => 0,
|
||||
'number' => $_payPrice,
|
||||
'mer_id' => $order->mer_id,
|
||||
'financial_record_sn' => $financeSn . ($i++)
|
||||
];
|
||||
//计算手续费
|
||||
$_order_rate=bcsub($order->pay_price,$_payPrice,2);
|
||||
|
||||
//计算镇级供应链云仓实际获得金额
|
||||
if($_order_rate>0){
|
||||
$commission_rate = bcdiv(3,100,2);
|
||||
$_payPrice = bcmul($_order_rate, $commission_rate, 2);
|
||||
}else{
|
||||
$_payPrice=0;
|
||||
}
|
||||
}else{
|
||||
$_payPrice = $order->pay_price;
|
||||
$_order_rate = 0;
|
||||
|
@ -21,59 +21,60 @@ class StoreProcessing extends BaseController
|
||||
|
||||
|
||||
$merchant_two = Db::name('merchant')->where('mer_id', $order['mer_id'])->find();
|
||||
$order['uid'] = $merchant_two['uid'];
|
||||
$order['real_name'] =$merchant_two['mer_name'].'-'. $merchant_two['real_name'];
|
||||
$order['user_phone'] = $merchant_two['mer_phone'];
|
||||
$order['user_address'] = $merchant_two['mer_address'];
|
||||
|
||||
$store_group_order = Db::name('store_group_order')->where('group_order_id', $order['group_order_id'])->find();
|
||||
$store_group_order_other = Db::name('store_group_order_other')->where('group_order_sn', $order['order_sn'])->find();
|
||||
|
||||
if (!$store_group_order_other) {
|
||||
unset($store_group_order['group_order_id']);
|
||||
$group_order_id=Db::name('store_group_order_other')->insertGetId($store_group_order);
|
||||
$group_order_id = Db::name('store_group_order_other')->insertGetId($store_group_order);
|
||||
}
|
||||
$select = Db::name('store_order_product')->where('order_id', $order['order_id'])->select();
|
||||
if ($order['source'] == 103 && $select) {
|
||||
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
$financeSn = $financialRecordRepository->getSn();
|
||||
$finance[] = [
|
||||
'order_id' => $order['order_id'],
|
||||
'order_sn' => $order['order_sn'],
|
||||
'user_info' => $order['real_name'],
|
||||
'user_id' => $order['uid'],
|
||||
'financial_type' => 'supply_chain',
|
||||
'financial_pm' => 0,
|
||||
'type' => 0,
|
||||
'number' => $order['procure_price'],
|
||||
'mer_id' => $order['mer_id'],
|
||||
'financial_record_sn' => $financeSn .'1'
|
||||
];
|
||||
$finance[] = [
|
||||
'order_id' => $order['order_id'],
|
||||
'order_sn' => $order['order_sn'],
|
||||
'user_info' => $order['real_name'],
|
||||
'user_id' => $order['uid'],
|
||||
'financial_type' => 'supply_chain',
|
||||
'financial_pm' => 1,
|
||||
'type' => 0,
|
||||
'number' => $order['procure_price'],
|
||||
'mer_id' => $order['mer_id'],
|
||||
'financial_record_sn' => $financeSn .'2'
|
||||
];
|
||||
$arr=$select->toArray();
|
||||
unset($order['order_id'],$order['orderProduct'],$order['user'],$order['supply_chain_rate'],$order['logistics_code'],$order['logistics_phone']);
|
||||
$order['group_order_id']=$group_order_id;
|
||||
$order['mer_id']=$select[0]['product_mer_id'];
|
||||
$order['source']=104;
|
||||
$order_id=Db::name('store_order_other')->insertGetId($order);
|
||||
// $financialRecordRepository = app()->make(FinancialRecordRepository::class);
|
||||
// $financeSn = $financialRecordRepository->getSn();
|
||||
$arr = $select->toArray();
|
||||
$order['group_order_id'] = $group_order_id;
|
||||
$order['source'] = 104;
|
||||
//镇级支出
|
||||
// $finance[] = [
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'order_sn' => $order['order_sn'],
|
||||
// 'user_info' => $order['real_name'],
|
||||
// 'user_id' => $order['uid'],
|
||||
// 'financial_type' => 'supply_chain',
|
||||
// 'financial_pm' => 0,
|
||||
// 'type' => 0,
|
||||
// 'number' => $order['procure_price'],
|
||||
// 'mer_id' => $order['mer_id'],
|
||||
// 'financial_record_sn' => $financeSn . '1'
|
||||
// ];
|
||||
$order['mer_id'] = $select[0]['product_mer_id'];
|
||||
$order['uid'] = $merchant_two['uid'];
|
||||
$order['real_name'] = $merchant_two['mer_name'] . '-' . $merchant_two['real_name'];
|
||||
$order['user_phone'] = $merchant_two['mer_phone'];
|
||||
$order['user_address'] = $merchant_two['mer_address'];
|
||||
//市级获得
|
||||
// $finance[] = [
|
||||
// 'order_id' => $order['order_id'],
|
||||
// 'order_sn' => $order['order_sn'],
|
||||
// 'user_info' => $order['real_name'],
|
||||
// 'user_id' => $order['uid'],
|
||||
// 'financial_type' => 'supply_chain',
|
||||
// 'financial_pm' => 1,
|
||||
// 'type' => 0,
|
||||
// 'number' => $order['procure_price'],
|
||||
// 'mer_id' => $order['mer_id'],
|
||||
// 'financial_record_sn' => $financeSn . '2'
|
||||
// ];
|
||||
unset($order['order_id'], $order['orderProduct'], $order['user'], $order['supply_chain_rate'], $order['logistics_code'], $order['logistics_phone']);
|
||||
$order_id = Db::name('store_order_other')->insertGetId($order);
|
||||
|
||||
foreach ($arr as $key => $value) {
|
||||
$arr[$key]['order_id'] = $order_id;
|
||||
$arr[$key]['source'] = 104;
|
||||
unset($arr[$key]['order_product_id']);
|
||||
}
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
// $financialRecordRepository->insertAll($finance);
|
||||
Db::name('store_order_product_other')->insertAll($arr);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user