edit-admin-ck_pay

This commit is contained in:
lccsw
2021-11-18 16:30:51 +08:00
parent a867c1dec5
commit 5d7bee2db5
4 changed files with 50 additions and 6 deletions
+13 -2
View File
@@ -623,6 +623,16 @@ class Orders extends HD_Controller
if (!$bill['cardidA'] && !$bill['business_licence']) {
return $this->show_json(SYS_CODE_FAIL, '未上传用户身份证或营业执照!');
}
$where = [
'o_id' => $oid,
'status' => 1,
'pay_price!=' => 0
];
$sum = $this->app_liche_orders_model->sum('total_price',$where); //已收金额
$need_price = $this->orders_entity->recevable_price($oid); //应收金额
if($sum['total_price'] < $need_price){
return $this->show_json(SYS_CODE_FAIL, '修改失败,已收金额小于应收金额!');
}
$this->order_bills_model->update(['status' => 2], ['o_id' => $oid]);
$this->orders_model->update(['status' => 4], ['id' => $bill['o_id']]);
if (!$this->order_agents_model->get(['o_id' => $oid])) {
@@ -754,8 +764,9 @@ class Orders extends HD_Controller
];
}
}
$sum = $this->app_liche_orders_model->sum('total_price', $where);
$this->data['total_price'] = $sum['total_price'];
$sum = $this->app_liche_orders_model->sum('total_price',$where);
$this->data['pay_price'] = $sum['total_price'];
$this->data['need_price'] = $this->orders_entity->recevable_price($params['id']);
$this->data['list'] = $list;
$hasNext = ceil($count / $size) > $page ? 1 : 0;
$this->data['commonPage'] = array('page' => $page, 'pageLimit' => $size, 'pageCount' => $count, 'hasNext' => $hasNext);
+11 -1
View File
@@ -28,7 +28,7 @@ class OrdersList
!$params['qdjl_id'] && $params['qdjl_id'] = '';
!$params['cf_title'] && $params['cf_title'] = '';
!$params['cf_clues'] && $params['cf_clues'] = '';
!$params['payway'] && $params['payway'] = '';
!strlen($params['payway']) && $params['payway'] = '';
!$params['biz_type'] && $params['biz_type'] = '';
$fieldAry = $this->get_fields($status_pid);
$show_info['cfTitleAry'] = $this->ci->mdCustomers->get_sdata('cfrom');//来源类型
@@ -986,6 +986,16 @@ class OrdersList
$where["{$t1}.c_time <="] = strtotime($c_time[1] . ' 23:59:59');
}
}
//开票时间
if ($params['bill_time']) {
$bill_time = explode(' ~ ', $params['bill_time']);
if ($bill_time[0]) {
$where["bill_time >="] = $bill_time[0] . ' 00:00:00';
}
if ($bill_time[1]) {
$where["bill_time <="] = $bill_time[1] . ' 23:59:59';
}
}
if ($params['brand_id']) {//品牌
$where["{$t2}.brand_id"] = $params['brand_id'];
} else {
+5 -3
View File
@@ -40,7 +40,7 @@
</ul>
</nav>
</div>
<div class="align-r ml15" v-if="total_price">总额{{total_price}}</div>
<div class="align-r ml15" v-if="pay_price">收总额:{{need_price}},已收总额:{{pay_price}}&nbsp&nbsp</div>
</div>
</div>
@@ -52,7 +52,8 @@
id:<?=$id?$id:''?>,
page: [],
list:[],
total_price: ''
pay_price: '',
need_price: '',
},
mounted: function () {
this.getData(1);
@@ -64,7 +65,8 @@
if(result.code){
that.list = result.data.list;
that.page = result.data.commonPage;
that.total_price = result.data.total_price;
that.pay_price = result.data.pay_price;
that.need_price = result.data.need_price;
}
});
},
@@ -604,6 +604,27 @@ class Orders_entity{
}
return $res;
}
/**
* 计算订单应收金额
* @param $oid int 订单id
* return float
*/
public function recevable_price($oid){
!$this->order_row && $this->order_row = $this->ci->orders_model->get(['id'=>$oid]);
if(!$this->order_row){
return false;
}
$money_json = json_decode($this->order_row['money_json'],true);
$money_json['price_discount'] && $money_json['price_car'] = $money_json['price_car'] - $money_json['price_discount'];
$srv_money = $this->order_srv_money($oid);
$recevable_price = $money_json['price_car'] + $srv_money;
if(!$this->order_row['payway']){ //分期
$recevable_price -= $money_json['price_loan'];
}
return $recevable_price;
}
}
?>