diff --git a/api/controllers/wxapp/licheb/CusorderV2.php b/api/controllers/wxapp/licheb/CusorderV2.php index ca1d9f35..becdfb7b 100644 --- a/api/controllers/wxapp/licheb/CusorderV2.php +++ b/api/controllers/wxapp/licheb/CusorderV2.php @@ -774,28 +774,36 @@ class CusorderV2 extends Wxapp $int_is_pay = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'type' => 4, 'status>=' => 0]); //意向金 $p_row = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'pid' => 0], 'id'); //父订单 $last_row = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'pid' => $p_row['id'], 'type' => 3], 'id'); //尾款订单 + $last_row = $this->app_liche_orders_model->get(['o_id' => $val['id'], 'pid' => $p_row['id'], 'type' => 6], 'id'); //后台添加车款订单 //除去尾款已支付金额 $total_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $p_row['id'], 'o_id' => $val['id'], 'status' => 1, 'id!=' => $last_row['id']]); + //后台添加已支付金额 + $ht_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $p_row['id'], 'o_id' => $val['id'], 'status' => 1, 'type' => 6]); //已支付尾款 $last_pay = $this->app_liche_orders_model->sum('total_price', ['pid' => $last_row['id'], 'status' => 1]); - $is_pay_price = $total_pay['total_price'] + $last_pay['total_price']; + $is_pay_price = $total_pay['total_price'] + $last_pay['total_price'] + $ht_pay['total_price']; $need_pay = $this->orders_v2_entity->recevable_price($val['id'], false); //需要支付车款 - $need_last_pay = $need_pay - $money_json['price_book']; + $need_last_pay = $book_is_pay ? $need_pay - $money_json['price_book'] : $need_pay; if ($int_is_pay['status']) { - $price_book_text = $int_is_pay['total_price'] . "(已支付)"; + $price_book_text = number_format($int_is_pay['total_price'],2) . "(已支付)"; $other_data['意向金金额'] = ['type' => 'text', 'value' => $price_book_text, 'bg_color' => '']; } if ($book_is_pay) { $book_is_pay_text = $book_is_pay['status'] ? '已支付' : '未支付'; - $price_book_text = $money_json['price_book'] . "($book_is_pay_text)"; + $price_book_text = number_format($money_json['price_book'],2) . "($book_is_pay_text)"; $other_data['定金金额'] = ['type' => 'text', 'value' => $price_book_text, 'bg_color' => '']; } + if($ht_pay['total_price']){ + $ht_price = number_format($ht_pay['total_price'],2); + $other_data['车款金额'] = ['type' => 'text', 'value' => "{$ht_price}(已支付)", 'bg_color' => '']; + $need_last_pay -= $ht_pay['total_price']; + } $last_is_pay_text = $is_pay_price >= $need_pay ? '已支付' : '未支付'; - $last_text = $need_last_pay . "($last_is_pay_text)"; + $last_text = number_format($need_last_pay,2) . "($last_is_pay_text)"; $other_data['尾款金额'] = ['type' => 'text', 'value' => $last_text, 'bg_color' => '']; if ($srv_is_pay) { $last_is_pay_text = $srv_is_pay['status'] ? '已支付' : '未支付'; - $srv_text = intval($srv_is_pay['total_price']) . "($last_is_pay_text)"; + $srv_text = number_format($srv_is_pay['total_price'],2) . "($last_is_pay_text)"; $other_data['服务费'] = ['type' => 'text', 'value' => $srv_text, 'bg_color' => '']; } if ($int_is_pay['status'] || $book_is_pay['status'] || $this->app_liche_orders_model->count(['o_id' => $val['id'], 'type' => 6, 'status' => 1])) { @@ -1147,4 +1155,4 @@ class CusorderV2 extends Wxapp } return $allot; } -} \ No newline at end of file +} diff --git a/common/libraries/receiver/Orders_v2_entity.php b/common/libraries/receiver/Orders_v2_entity.php index b4e4196f..6445af53 100644 --- a/common/libraries/receiver/Orders_v2_entity.php +++ b/common/libraries/receiver/Orders_v2_entity.php @@ -414,7 +414,6 @@ class Orders_v2_entity{ }else{ $recevable_price = $total_price; } - if(!$this->order_row['payway']){ //分期 $recevable_price -= $money_json['price_loan']; }