调整价格显示,科室排序,数量显示,合并材料费。同一个项目进行限制

main
yanzai 1 year ago
parent 1dd0d0e5b9
commit 6d0e37b4cd

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

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

@ -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, '.', '');
}

@ -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());
//

@ -9,8 +9,8 @@ return [
// 'Env'=>'pro',
'Env'=>'dev',
'Wj_ZheKou'=>1,//问卷带出项目,折扣率
'erxian_kuadu'=>3//二线时间跨度,单位天
'erxian_kuadu'=>3,//二线时间跨度,单位天
'KeShiPaiXu'=>["数据采集室", "内科", "外科", "妇科","妇科(化验)","妇科(病理)", "幽门螺旋杆菌检测室", "心电图室", "超声科", "影像科"]
],
/*

@ -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 @@
<view v-if="itemsInfo.items?.length">
<!-- 自选 -->
<view class="text-#2E2E2E text-30rpx center mb-20rpx">自选项目{{ itemsInfo.items?.length }}</view>
<view class="text-#2E2E2E text-30rpx center mb-20rpx">自选项目{{ itemsInfo.itemscount }}</view>
<view class="flex h-67rpx bg-#239ea3 text-#fff text-26rpx rounded-10rpx">
<view class="min-w-155rpx max-w-155rpx center b-0 b-r-4 b-solid b-#fff">检查项目</view>
<view class="grow center">检查指标意义</view>

@ -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,6 +240,7 @@ 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(() => {
</view>
<view
class="w-58% items-end flex justify-between"
@click="
() => {
if (selectIds.includes(item.id)) {
selectIds.splice(selectIds.indexOf(item.id), 1);
} else {
selectIds.push(item.id);
}
getBuyInfo();
}
"
@click="XuanZeItem(item)"
>
<text class="text-#EC3D15 text-26rpx">¥ {{ item.price }}</text>
<text class="text-#9e9d9d text-20rpx line-through"

@ -194,6 +194,23 @@ const getnmrList = async () => {
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 = (

Loading…
Cancel
Save