|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\H5;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\API\AspNetZhuanController;
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Services\ConfigService;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
@ -226,6 +227,12 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
|
|
|
|
|
$duo_xuan_yi = request('duo_xuan_yi'); //多选1
|
|
|
|
|
$group_id = request('group_id'); //团检登记id
|
|
|
|
|
$wj_flag= request('wj'); //问卷标记
|
|
|
|
|
$coupon_id=request('coupon_id'); //代金券id
|
|
|
|
|
|
|
|
|
|
$person_id = request('person_id'); //就诊人id
|
|
|
|
|
$person=DB::table('web_user_person')->where(['id' => $person_id,'is_del'=>0])->first();
|
|
|
|
|
if(!$person) return \Yz::echoError1("用户不存在");
|
|
|
|
|
|
|
|
|
|
if (!isset($hospital_id)) return \Yz::echoError1("医院id不能为空");
|
|
|
|
|
$hospital = DB::table('hospitals')->where(['id' => 1, 'status' => 1, 'is_del' => 0])->first();
|
|
|
|
|
if(isset($wj_flag) and $wj_flag==1){
|
|
|
|
|
@ -377,7 +384,6 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
|
|
|
|
|
$save_money = 150;//预存款抵扣金额
|
|
|
|
|
$coupon_money = 50;//优惠券抵扣金额
|
|
|
|
|
|
|
|
|
|
//用户真实支付价格,应减去抵扣(二期实现)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$group_info = false;
|
|
|
|
|
@ -401,6 +407,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
|
|
|
|
|
$true_price = $true_price + $group_info[0]['sixi_zong_ji_jin_e'];
|
|
|
|
|
$true_price = ($true_price - $group_info[0]['tongshou_xiane']) > 0 ? $true_price - $group_info[0]['tongshou_xiane'] : 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$all_items = DB::table('items')->where(['status' => 1])->get();
|
|
|
|
|
$item_new = [];
|
|
|
|
|
foreach ($group_info[0]['items'] as $item) {
|
|
|
|
|
@ -452,6 +459,53 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果使用了代金券
|
|
|
|
|
if(isset($coupon_id) and !empty($coupon_id)){
|
|
|
|
|
if($true_price==0) return \Yz::echoError1("无需使用代金券");
|
|
|
|
|
$quanInfo=false;
|
|
|
|
|
$env=config('app.globals.Env');
|
|
|
|
|
if($env=='pro') { //如果是正式环境
|
|
|
|
|
$AspNet=new AspNetZhuanController();
|
|
|
|
|
|
|
|
|
|
$data=[
|
|
|
|
|
'ghzid'=>$person->ghzid,
|
|
|
|
|
'ghzid'=>"5a798c097bc64bd79c22050175e6236a",
|
|
|
|
|
'action'=>1,
|
|
|
|
|
];
|
|
|
|
|
$YouHuiQuanList=$AspNet::YouHuiQuan($data);
|
|
|
|
|
foreach ($YouHuiQuanList as $key=>$quan){
|
|
|
|
|
if($quan['DZJID']==$coupon_id){
|
|
|
|
|
$quanInfo=$quan;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($quanInfo['是否在有效内']===true and $quanInfo['TimeNuZTTextm']=="有效" and $quanInfo['ZT']==1){
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
return \Yz::echoError1("此代金券不可用");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$quanType=false;
|
|
|
|
|
$YouHuiQuanType=$AspNet::YouHuiQuan(['action'=>2]);
|
|
|
|
|
foreach ($YouHuiQuanType as $key=>$type){
|
|
|
|
|
if($quanInfo['DZJLBID']==$type['DZJLBID']){
|
|
|
|
|
$quanType=$type;
|
|
|
|
|
}
|
|
|
|
|
// if($type['TJXCXHX']==1 and ($type['MKJE']===0 || $type['MKJE']>=$true_price)){
|
|
|
|
|
// $YouHuiQuanType_ids[]=$type['DZJLBID'];
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
if($quanType===false or $quanInfo===false) return \Yz::echoError1("此代金券不可用");
|
|
|
|
|
if($quanType['TJXCXHX']!=1 ) return \Yz::echoError1("此代金券不可用");
|
|
|
|
|
if($quanType['MKJE']==0 or $quanType['MKJE']>=$true_price){
|
|
|
|
|
//抵扣代金券金额,折扣暂未实现
|
|
|
|
|
$true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = [
|
|
|
|
|
'group_info' => $group_info,
|
|
|
|
|
'combo_info' => $combo_info,
|
|
|
|
|
|