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