diff --git a/Laravel/app/Http/Controllers/API/H5/ComboController.php b/Laravel/app/Http/Controllers/API/H5/ComboController.php index bde2a77..9c5fd64 100644 --- a/Laravel/app/Http/Controllers/API/H5/ComboController.php +++ b/Laravel/app/Http/Controllers/API/H5/ComboController.php @@ -333,6 +333,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) 'children' => $children ]; } + $combo_info['items']= $this->KeShiPaiXu($combo_info['items']); $pay_item_count += $combo->item_count; $true_price += $combo_info['price']; $combo_info['tags'][0]['text']=$comboItemCount. '个项目'; @@ -355,6 +356,10 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) $items = DB::table('items')->whereIn('item_id', $item_ids)->where(['status' => 1])->get(); $groupedData = []; foreach ($items as $item) { + //判断套餐项目和自选项目是否冲突 + foreach ($combo_items as $comboitem) { + if($comboitem['id']==$item->item_id) return \Yz::echoError1($item->name."已经存在,不可重复选择"); + } $item_price = bcadd($item_price, $item->price, 2); // $all_original_price+=$item->original_price; $all_original_price = bcadd($all_original_price, $item->original_price, 2); @@ -378,6 +383,7 @@ 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=number_format($item_price*$wj_zhekou, 2, '.', '') ; } + //使用优惠券 if(isset($coupon_id) and !empty($coupon_id)){ if($item_price==0) return \Yz::echoError1("自选项目金额为0,无需使用优惠券"); @@ -391,6 +397,7 @@ select combo_id as c_id,count(*) as sale_count from orders where status in(2,4) 'children' => $children ]; } + $items_info['items']= $this->KeShiPaiXu($items_info['items']); $pay_item_count += count($items); $true_price += $items_info['price']; @@ -691,4 +698,27 @@ select combo_id as c_id,count(*) as count from orders where status in(2,4) group return $true_price; } } + public function KeShiPaiXu($data) + { + // 给定的科室顺序 + $sortedOrder = config('app.globals.KeShiPaiXu'); + +// 创建一个科室到其在期望顺序中位置的映射 + $sortedOrderMap = array_flip($sortedOrder); + +// 使用 usort 函数进行排序 + usort($data, function($a, $b) use ($sortedOrderMap) { + // 获取两个科室在期望顺序中的位置 + + $posA = isset($sortedOrderMap[$a['keshi_name']]) ? $sortedOrderMap[$a['keshi_name']] : PHP_INT_MAX; + $posB = isset($sortedOrderMap[$b['keshi_name']]) ? $sortedOrderMap[$b['keshi_name']] : PHP_INT_MAX; + + + + + // 比较两个位置,确定排序 + return $posA - $posB; + }); + return $data; + } } diff --git a/Laravel/app/Http/Controllers/API/H5/ItemController.php b/Laravel/app/Http/Controllers/API/H5/ItemController.php index 54fc223..43643a9 100644 --- a/Laravel/app/Http/Controllers/API/H5/ItemController.php +++ b/Laravel/app/Http/Controllers/API/H5/ItemController.php @@ -22,6 +22,7 @@ class ItemController extends Controller $list = []; $group_arr = []; $group_list = []; + $items= $this->KeShiPaiXu($items); foreach ($items as $item) { if($item->sex <> $person->sex and $item->sex<>0){ continue; @@ -71,4 +72,17 @@ class ItemController extends Controller } return \Yz::Return(true,"查询成功",['list'=>$group_list]); } + public function KeShiPaiXu($data){ + $sortOrder =config('app.globals.KeShiPaiXu'); + +// 创建一个映射,用于快速查找每个科室名称在排序数组中的位置 + $sortMap = array_flip($sortOrder); + +// 使用 sortBy 方法进行排序 + $sortedData = $data->sortBy(function ($data) use ($sortMap) { + // 如果科室名称存在于映射中,则返回其位置;否则返回一个很大的数字,使其排在最后 + return isset($sortMap[$data->keshi_name]) ? $sortMap[$data->keshi_name] : PHP_INT_MAX; + }); + return $sortedData; + } } diff --git a/Laravel/app/Http/Controllers/API/H5/QuestionnairesLogsController.php b/Laravel/app/Http/Controllers/API/H5/QuestionnairesLogsController.php index 4fdffee..f37c085 100644 --- a/Laravel/app/Http/Controllers/API/H5/QuestionnairesLogsController.php +++ b/Laravel/app/Http/Controllers/API/H5/QuestionnairesLogsController.php @@ -172,6 +172,7 @@ class QuestionnairesLogsController extends Controller } else { $combo = 0; } + $zhekou = config('app.globals.Wj_ZheKou'); return number_format((($combo + $sum + $check_sum) * $zhekou), 2, '.', ''); } diff --git a/Laravel/app/Http/Controllers/TestController.php b/Laravel/app/Http/Controllers/TestController.php index 3ece3c0..673c091 100644 --- a/Laravel/app/Http/Controllers/TestController.php +++ b/Laravel/app/Http/Controllers/TestController.php @@ -15,10 +15,11 @@ class TestController extends Controller // echo DB::table('users')->count(); // $order= new OrderService(); // dd($order->DepartmentItemCount(173)); + //退款------------------ $data = [ - 'orderid' => '20241102173349589IKvqRo', - 'refund_order_id' => 'T' . '20241102173349589IKvqRo', - 'refund_amount' => 200, + 'orderid' => '20241108112106776eslNJ2', + 'refund_order_id' => 'T' . '20241108112106776eslNJ2', + 'refund_amount' => 74900, 'refund_reason' => "体检H5订单退款", ]; $XCX = new XCXApiController(); @@ -26,8 +27,20 @@ class TestController extends Controller if ($res['data']['refund_state'] != 'SUCCESS') { return \Yz::echoError1("退款失败" . $res['data']['refund_state']); } + //-------------- $aspnet=new AspNetZhuanController(); +//优惠券----------------- +// $data=[ +// 'action'=>4, +// 'ghzid'=>'3da338777513487fa65f918dad7719d8', +// 'dzjid'=>'995315997321979250097', +// 'hxbz'=>"H5撤销核销", +// 'yyid'=>6 +// ]; +// $aspnet::YouHuiQuan($data); + + // $temp_list=[]; // $nmr=$aspnet::GetNmrList(['yyid'=>6,'data'=>['2024-10-25']],uniqid()); // diff --git a/Laravel/config/app.php b/Laravel/config/app.php index 78fa796..e741544 100644 --- a/Laravel/config/app.php +++ b/Laravel/config/app.php @@ -9,8 +9,8 @@ return [ // 'Env'=>'pro', 'Env'=>'dev', 'Wj_ZheKou'=>1,//问卷带出项目,折扣率 - 'erxian_kuadu'=>3//二线时间跨度,单位天 - + 'erxian_kuadu'=>3,//二线时间跨度,单位天 + 'KeShiPaiXu'=>["数据采集室", "内科", "外科", "妇科","妇科(化验)","妇科(病理)", "幽门螺旋杆菌检测室", "心电图室", "超声科", "影像科"] ], /* diff --git a/h5/pages/main/tj/tjxq.vue b/h5/pages/main/tj/tjxq.vue index bf96e0b..e192031 100644 --- a/h5/pages/main/tj/tjxq.vue +++ b/h5/pages/main/tj/tjxq.vue @@ -182,6 +182,15 @@ losePrice.value = response.data.lose_price; comboInfo.value = response.data.combo_info; itemsInfo.value = response.data.items_info; + if(itemsInfo.value.items?.length){ + itemsInfo.value.itemscount=0; + let itemscount=0 + itemsInfo.value.items.forEach((v,i)=>{ + if(v.keshi_name!="材料费") + itemscount=itemscount+v.children.length + }) + itemsInfo.value.itemscount=itemscount + } totalPrice.value = response.data.true_price; tabIndex.value = 0; uni.hideLoading(); @@ -195,6 +204,9 @@ if (groupId.value) { query += "&groupId=" + groupId.value; } + if($props.wj){ + query +="&wj="+$props.wj + } uni.navigateTo({ url: "/pages/main/tj/tjzx?" + query, }); @@ -399,7 +411,7 @@ - 自选项目({{ itemsInfo.items?.length }}项) + 自选项目({{ itemsInfo.itemscount }}项) 检查项目 检查指标意义 diff --git a/h5/pages/main/tj/tjzx.vue b/h5/pages/main/tj/tjzx.vue index 500054d..5c0ebb8 100644 --- a/h5/pages/main/tj/tjzx.vue +++ b/h5/pages/main/tj/tjzx.vue @@ -29,10 +29,15 @@ const $props = defineProps({ type: String, default: "", }, + wj: { + type: String, + default: "", + }, }); const $store = useStore(); +let wj = ref(""); // let leftList = ref({}); // 左侧列表 let tabIndex = ref(""); // 默认选中 let rightLeft = ref([]); // 右侧列表 @@ -100,12 +105,14 @@ const getBuyInfo = async () => { person_id: personId.value, group_id: groupId.value, combo_id: comboId.value, + wj: wj.value, }; if (comboId.value) { obj.combo_id = comboId.value; } const response = await $api("BuyInfo", obj); $response(response, () => { + groupLength.value = response.data.group_info ? response.data.group_info[0]?.items?.length : 0; @@ -180,6 +187,9 @@ const toDetails = (state) => { if (groupId.value) { query += "&groupId=" + groupId.value; } + if($props.wj){ + query +="&wj="+$props.wj + } console.log($props.comboId || $props.itemIds ? 2 : 1); let delta = 0; if (groupId.value) { @@ -230,7 +240,8 @@ const mountedAction = async () => { comboId.value = $props.comboId || ""; personId.value = $store.getUser().person_id || ""; groupId.value = $props.groupId || ""; - + wj.value = $props.wj || ""; + if (groupId.value) { if (comboId.value) { // 团检套餐 @@ -263,7 +274,18 @@ const configRef = (e) => { mountedAction(); } }; +const XuanZeItem= (item)=>{ + if(selectIds.value.includes(item.id)){ + selectIds.value.splice(selectIds.value.indexOf(item.id),1); + + }else{ + selectIds.value.push(item.id); + + } + getBuyInfo() + +} onShow(() => { if (!!config_ref.value) { mountedAction(); @@ -472,16 +494,9 @@ onShow(() => { ¥ {{ item.price }} { itemsInfo.value = response.data.items_info; truePrice.value = response.data.true_price; netReceiptsPrice.value = response.data.true_price; + if(itemsInfo.value.items?.length){//合并显示材料费 + let cailiao_price=0 + let cailiao_keshi_key=false; + itemsInfo.value.items.forEach((v,i)=>{ + if(v.keshi_name=="材料费"){ + cailiao_keshi_key=i + v.children.forEach((v2,i2)=>{ + cailiao_price=(Number(cailiao_price)+Number(v2.price)).toFixed(2); + }) + } + + }) + if(cailiao_keshi_key){ + itemsInfo.value.items[cailiao_keshi_key]={keshi_name:"材料费",children:[{name:"材料",desc:"",price:cailiao_price}]} + } + + } if (yytjInfo.value.couponPrice) { // 优惠券 // netReceiptsPrice.value = (