|
|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|