cost add estimated_rebate about

This commit is contained in:
qianhy
2023-06-01 15:42:06 +08:00
committed by lccsw
parent e16fff5074
commit d6807455f2
+19 -1
View File
@@ -573,11 +573,12 @@ class Order extends CI_Controller{
echo "<br><br>";
}
$cost = $srv_json_cost = $cost_json_cost = array();
$cost = $srv_json_cost = $cost_json_cost = $promotion_json_cost = array();
if ($recost || $debug){
$cost = $this->items_cost_model->get(array('o_id'=>$item['id']));
$srv_json_cost = json_decode($cost['srv_json'], true);
$cost_json_cost = $cost['cost_json'] ? json_decode($cost['cost_json'], true) : array();
$promotion_json_cost = $cost['promotion_json'] ? json_decode($cost['promotion_json'], true) : array();
echo "get cost: <br>";
echo $this->items_cost_model->db->last_query()."<br>";
if($debug){
@@ -1181,6 +1182,23 @@ class Order extends CI_Controller{
# 已标记为齐款的,不能设置为0
$srv_json_cost['if_pay'] && $srv_json['if_pay'] = 1;
}
# 预估返利 写入到 厂家补贴
$this->load->model('items/items_model');
$item_row = $this->items_model->get(['id'=>$item['item_id']]);
if ($item_row['estimated_rebate']){
$promotion_json = $recost ? $promotion_json_cost : array();
$promotion_json['factory_price'] = $item_row['estimated_rebate'];
$add_data['promotion_json'] = json_encode($promotion_json,JSON_UNESCAPED_UNICODE);
if ($debug){
echo $this->items_model->db->last_query();
echo "estimated_rebate: {$item_row['estimated_rebate']}"."<br>";
echo "promotion_json_cost: ";var_dump($promotion_json_cost);echo "<br>";
echo "promotion_json: ";var_dump($promotion_json);echo "<br>";
echo "<br><br>";
}
}
$add_data['srv_json'] = json_encode($srv_json,JSON_UNESCAPED_UNICODE);
if ($debug){
echo "------------------------------"."<br>";