diff --git a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php
index a6c3f07..e6af3c4 100644
--- a/Laravel/app/Http/Controllers/API/AspNetZhuanController.php
+++ b/Laravel/app/Http/Controllers/API/AspNetZhuanController.php
@@ -210,7 +210,7 @@ class AspNetZhuanController extends Controller
$table->string('mark', 50)->index();
$table->text('post_data');
$table->text('response_data')->nullable();
- $table->string('request_url', 1000);
+ $table->string('request_url', 2000);
$table->timestamps();
});
}
diff --git a/Laravel/app/Http/Controllers/API/H5/ComboController.php b/Laravel/app/Http/Controllers/API/H5/ComboController.php
index c6d38b8..9e2f1b2 100644
--- a/Laravel/app/Http/Controllers/API/H5/ComboController.php
+++ b/Laravel/app/Http/Controllers/API/H5/ComboController.php
@@ -367,10 +367,14 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
}
}
if(isset($wj_flag) and $wj_flag==1){
- $item_price=$item_price*$wj_zhekou;
-
+ $item_price=number_format($item_price*$wj_zhekou, 2, '.', '') ;
+ }
+ //使用优惠券
+ if(isset($coupon_id) and !empty($coupon_id)){
+ if($item_price==0) return \Yz::echoError1("自选项目金额为0,无需使用优惠券");
+ $item_price=$this->useYouHuiQuan($item_price,$person,$coupon_id);
}
- $items_info['price'] =number_format($item_price, 2, '.', '') ;
+ $items_info['price'] =$item_price;
$items_info['original_price'] = $items_original_price;
foreach ($groupedData as $keshiName => $children) {
$items_info['items'][] = [
@@ -463,57 +467,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4)
];
}
- $env=config('app.globals.Env');
- //如果使用了代金券
- if(isset($coupon_id) and !empty($coupon_id)){
- if($true_price==0) return \Yz::echoError1("无需使用代金券");
- $quanInfo=false;
-
- if($env=='pro') { //如果是正式环境
- $AspNet=new AspNetZhuanController();
-
- $data=[
- 'ghzid'=>$person->ghzid,
- 'action'=>1,
- ];
- $YouHuiQuanList=$AspNet::YouHuiQuan($data);
- foreach ($YouHuiQuanList as $key=>$quan){
- if($quan['DZJID']==$coupon_id){
- $quanInfo=$quan;
- }
- }
-
- if(!!$quanInfo and $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){
- //抵扣代金券金额
- if($quanType['YHLX']==1){//抵扣券
- $true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
- }
- if($quanType['YHLX']==2){//抵扣券
- $true_price=number_format($true_price*$quanType['DZBL'],2, '.', '');
- }
-
- }
- }
- }
$data = [
@@ -643,6 +597,7 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
return \Yz::Return(true, "查询完成", ['combos' => $list]);
}
+
function jaccard_similarity($set1, $set2) {
// 计算交集
$intersection = array_intersect($set1, $set2);
@@ -655,4 +610,58 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group
// 返回Jaccard相似度
return count($intersection) / count($union);
}
+ //使用优惠券
+ public function useYouHuiQuan($true_price,$person,$coupon_id){
+ $env=config('app.globals.Env');
+ //如果使用了代金券
+ if(isset($coupon_id) and !empty($coupon_id)){
+ if($true_price==0) return \Yz::echoError1("无需使用代金券");
+ $quanInfo=false;
+
+ if($env=='pro') { //如果是正式环境
+ $AspNet=new AspNetZhuanController();
+
+ $data=[
+ 'ghzid'=>$person->ghzid,
+ 'action'=>1,
+ ];
+ $YouHuiQuanList=$AspNet::YouHuiQuan($data);
+ foreach ($YouHuiQuanList as $key=>$quan){
+ if($quan['DZJID']==$coupon_id){
+ $quanInfo=$quan;
+ }
+ }
+
+ if(!!$quanInfo and $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){
+ //抵扣代金券金额
+ if($quanType['YHLX']==1){//抵扣券
+ $true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
+ }
+ if($quanType['YHLX']==2){//抵扣券
+ $true_price=number_format($true_price*$quanType['DZBL'],2, '.', '');
+ }
+
+ }
+ }
+ return $true_price;
+ }
+ }
}
diff --git a/Laravel/app/Http/Controllers/API/H5/OrderController.php b/Laravel/app/Http/Controllers/API/H5/OrderController.php
index e09371c..9ba7dc5 100644
--- a/Laravel/app/Http/Controllers/API/H5/OrderController.php
+++ b/Laravel/app/Http/Controllers/API/H5/OrderController.php
@@ -114,6 +114,7 @@ class OrderController extends Controller
if (!$person) return \Yz::echoError1('体检人不存在');
$title = "自选项目";
$price = 0;
+ $quanInfo=false;
$true_price = 0;//订单真实支付金额
$buy_info = [
'combo' => [
@@ -208,6 +209,14 @@ class OrderController extends Controller
if (isset($wj_flag) and $wj_flag == 1) {
$item_price = $item_price * $wj_zhekou;
}
+ //使用优惠券
+ if (isset($coupon_id) and !empty($coupon_id)) {
+ if($item_price==0) return \Yz::echoError1("自选项目金额为0,无需使用优惠券");
+ $use_quan=$this->useYouHuiQuan($item_price,$person,$coupon_id);
+ $quanInfo=$use_quan['quanInfo'];
+ $item_price=$use_quan['price'];
+ }
+
$price += $item_price;
$missingIds = array_diff($item_ids, $existingIds);
if (count($missingIds) > 0) return \Yz::echoError1("部分自选项目不可用,Id:" . implode(', ', $missingIds));
@@ -341,53 +350,7 @@ class OrderController extends Controller
if ($true_price < -1) return \Yz::echoError1("预抵扣金额超过订单金额,操作失败");
if ($true_price < 0) $true_price = 0;
- //如果使用了代金券
- $quanInfo = false;
- if (isset($coupon_id) and !empty($coupon_id)) {
- if ($true_price == 0) return \Yz::echoError1("无需使用代金券");
-
- $AspNet = new AspNetZhuanController();
- $data = [
- 'ghzid' => $person->ghzid,
- '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 => $qtype) {
- if ($quanInfo['DZJLBID'] == $qtype['DZJLBID']) {
- $quanType = $qtype;
- }
-// if($qtype['TJXCXHX']==1 and ($qtype['MKJE']===0 || $qtype['MKJE']>=$true_price)){
-// $YouHuiQuanType_ids[]=$qtype['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) {
- //抵扣代金券金额
- if($quanType['YHLX']==1){//抵扣券
- $true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
- }
- if($quanType['YHLX']==2){//抵扣券
- $true_price=number_format($true_price*$quanType['DZBL'],2, '.', '');
- }
- }
-
- }
if (isset($plan_nmr_info) and !empty($plan_nmr_info)) {
$plan_nmr_temp = [];
foreach ($plan_nmr_info as $key => $plan_nmr) {
@@ -640,6 +603,7 @@ class OrderController extends Controller
}
//如果是个检
if ($order_info->type == 1) {
+ $checkup_type=DB::table('checkup_type')->where(['id' => $order_info->checkup_type_id])->first();
$cad = [
'type' => 1,
"姓名" => $order_info->name,
@@ -651,7 +615,7 @@ class OrderController extends Controller
"预约时间" => $order_info->appointment_date . ' ' . $order_info->appointment_time,
"介绍人" => $order_info->referral,
'套餐Id' => $order_info->combo_id == 0 ? null : $order_info->combo_id,
-
+ '体检类型Id'=>isset($checkup_type->sx_id)?$checkup_type->sx_id:null,
"已收费" => true,
];
@@ -821,4 +785,54 @@ class OrderController extends Controller
$info = $peis::Post($url_code, $hospital, $data);
return $info;
}
+ public function useYouHuiQuan($true_price,$person,$coupon_id){
+ //如果使用了代金券
+ $quanInfo = false;
+ if (isset($coupon_id) and !empty($coupon_id)) {
+ if ($true_price == 0) return \Yz::echoError1("无需使用代金券");
+
+ $AspNet = new AspNetZhuanController();
+ $data = [
+ 'ghzid' => $person->ghzid,
+ '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 => $qtype) {
+ if ($quanInfo['DZJLBID'] == $qtype['DZJLBID']) {
+ $quanType = $qtype;
+ }
+// if($qtype['TJXCXHX']==1 and ($qtype['MKJE']===0 || $qtype['MKJE']>=$true_price)){
+// $YouHuiQuanType_ids[]=$qtype['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) {
+ //抵扣代金券金额
+ if($quanType['YHLX']==1){//抵扣券
+ $true_price=($true_price-$quanInfo['JE'])>0 ? $true_price-$quanInfo['JE']:0;
+ }
+ if($quanType['YHLX']==2){//抵扣券
+ $true_price=number_format($true_price*$quanType['DZBL'],2, '.', '');
+ }
+ }
+
+
+ }
+ return ['price'=>$true_price,'quanInfo'=>$quanInfo];
+ }
}
diff --git a/Laravel/app/Http/Controllers/API/Internal/PlanController.php b/Laravel/app/Http/Controllers/API/Internal/PlanController.php
index de1be37..acabf7b 100644
--- a/Laravel/app/Http/Controllers/API/Internal/PlanController.php
+++ b/Laravel/app/Http/Controllers/API/Internal/PlanController.php
@@ -37,7 +37,7 @@ class PlanController extends Controller
if(!$plan) return \Yz::echoError1("该号源不存在");
if($plan->status<>1) return \Yz::echoError1("该号源不已被占用,请重新选择");
- $u=DB::table('plans')->where(['id',$id,'status'=>1])->update(['status'=>2]);
+ $u=DB::table('plans')->where(['id'=>$id,'status'=>1])->update(['status'=>2]);
if($u){
return \Yz::Return(true,'操作成功',[]);
}else{
diff --git a/Laravel/app/Http/Controllers/API/Internal/SiXinPushController.php b/Laravel/app/Http/Controllers/API/Internal/SiXinPushController.php
index 0f7ebb7..1e50067 100644
--- a/Laravel/app/Http/Controllers/API/Internal/SiXinPushController.php
+++ b/Laravel/app/Http/Controllers/API/Internal/SiXinPushController.php
@@ -67,7 +67,7 @@ class SiXinPushController extends Controller
$table->string('mark', 50)->index();
$table->longText('post_data');
$table->text('response_data')->nullable();
- $table->string('request_url', 300);
+ $table->string('request_url', 2000);
$table->timestamps();
});
}
diff --git a/Laravel/app/Http/Controllers/API/PEISApiController.php b/Laravel/app/Http/Controllers/API/PEISApiController.php
index ebad587..f05f2b7 100644
--- a/Laravel/app/Http/Controllers/API/PEISApiController.php
+++ b/Laravel/app/Http/Controllers/API/PEISApiController.php
@@ -190,7 +190,7 @@ class PEISApiController extends Controller
$table->string('mark', 50)->index();
$table->text('post_data');
$table->text('response_data')->nullable();
- $table->string('request_url', 300);
+ $table->string('request_url', 2000);
$table->timestamps();
});
}
diff --git a/Laravel/app/Http/Controllers/API/XCXApiController.php b/Laravel/app/Http/Controllers/API/XCXApiController.php
index 56b5862..16f5748 100644
--- a/Laravel/app/Http/Controllers/API/XCXApiController.php
+++ b/Laravel/app/Http/Controllers/API/XCXApiController.php
@@ -97,7 +97,7 @@ class XCXApiController extends Controller
$table->string('mark', 50)->index();
$table->text('post_data');
$table->text('response_data')->nullable();
- $table->string('request_url', 300);
+ $table->string('request_url', 2000);
$table->timestamps();
});
}
diff --git a/Laravel/app/Http/Controllers/TestController.php b/Laravel/app/Http/Controllers/TestController.php
index 8596a7a..03fdeef 100644
--- a/Laravel/app/Http/Controllers/TestController.php
+++ b/Laravel/app/Http/Controllers/TestController.php
@@ -12,8 +12,8 @@ class TestController extends Controller
{
public function DBtest(){
echo DB::table('users')->count();
- //$order= new OrderService();
- // dd($order->DepartmentItemCount(33));
+// $order= new OrderService();
+// dd($order->DepartmentItemCount(147));
$aspnet=new AspNetZhuanController();
diff --git a/Laravel/app/Services/LogService.php b/Laravel/app/Services/LogService.php
index eaa933b..e99b1b6 100644
--- a/Laravel/app/Services/LogService.php
+++ b/Laravel/app/Services/LogService.php
@@ -99,7 +99,7 @@ class LogService
$table->text('get_data');
$table->text('header_data');
$table->text('response_data')->nullable();
- $table->string('request_url', 300);
+ $table->string('request_url', 2000);
$table->string('create_time', 30);
$table->string('update_time', 30);
$table->timestamps();
diff --git a/Laravel/app/Services/OrderService.php b/Laravel/app/Services/OrderService.php
index b144f8c..7949101 100644
--- a/Laravel/app/Services/OrderService.php
+++ b/Laravel/app/Services/OrderService.php
@@ -2,6 +2,7 @@
namespace App\Services;
use App\Http\Controllers\API\AspNetZhuanController;
+use App\Http\Controllers\API\PEISApiController;
use Illuminate\Support\Facades\DB;
class OrderService
@@ -12,6 +13,15 @@ class OrderService
{
$order=DB::table('orders')->where('id',$id)->first();
if(!$order) return ['status'=>false,'msg'=>'订单不存在'];
+ $wait_day=false;
+ if(isset($order->tj_number) and !empty($order->tj_number)){
+ $peis = new PEISApiController();
+ $wait=$peis::Get($peis::Api('报告时间计算',"2403020020"),"111111","报告时间计算");
+ if(isset($wait['Data']['预计所需天数'])){
+ $wait_day=$wait['Data']['预计所需天数'];
+ }
+ }
+
$buy_info=json_decode($order->buy_info,true);
$list=[];
$drop_ids = ['519', '603'];
@@ -72,7 +82,7 @@ class OrderService
'count'=>count($item),
];
}
- return ['department_list'=>$de_list,'wait_day'=>"10"];
+ return ['department_list'=>$de_list,'wait_day'=>$wait_day];
}
public function Cancel($orderInfo)
diff --git a/h5/pages/main/coupon/coupon.vue b/h5/pages/main/coupon/coupon.vue
index d15bdbc..6f59aab 100644
--- a/h5/pages/main/coupon/coupon.vue
+++ b/h5/pages/main/coupon/coupon.vue
@@ -51,6 +51,19 @@ const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e;
mountedAction();
+ uni.showModal({
+ title: '提示',
+ content: '优惠券仅可用于抵扣自选项目金额',
+ showCancel:false,
+ confirmText:'确定',
+ success: function (res) {
+ if (res.confirm) {
+
+ } else if (res.cancel) {
+
+ }
+ }
+ });
}
};
diff --git a/h5/pages/main/index/index.vue b/h5/pages/main/index/index.vue
index 4dc60b1..85eeaaf 100644
--- a/h5/pages/main/index/index.vue
+++ b/h5/pages/main/index/index.vue
@@ -281,7 +281,7 @@
- 10302313
+ 10312335