diff --git a/Laravel/app/Http/Controllers/API/H5/ComboController.php b/Laravel/app/Http/Controllers/API/H5/ComboController.php index 9f67f37..78a554a 100644 --- a/Laravel/app/Http/Controllers/API/H5/ComboController.php +++ b/Laravel/app/Http/Controllers/API/H5/ComboController.php @@ -48,6 +48,10 @@ class ComboController extends Controller $combo_item = $request->post('combo_item'); $checkup_type_id = $request->post('checkup_type_id'); $keshi_name=$request->post('keshi_name'); + $price_range=$request->post('price_range'); + $sort_price=$request->post('sort_price'); + $sort_sale_count=$request->post('sort_sale_count'); + $hospital = DB::table('hospitals')->select('id', 'name', 'address', 'latitude', 'longitude')->where(['id' => $hospital])->first(); $user = DB::table('web_users')->where(['openid' => $openid, 'status' => 1, 'is_del' => 0])->first(); @@ -59,7 +63,7 @@ class ComboController extends Controller $canshu = []; $canshu[]=$person->sex; $sql = ''; - if (isset($combo_price)) { + if (isset($combo_price) and !isset($price_range)) { $price_list = [ "1" => [0, 299], "2" => [300, 999], @@ -71,8 +75,13 @@ class ComboController extends Controller $sql = " and (a.price>=? and a.price<=?) "; $canshu[] = $price_list[$combo_price][0]; $canshu[] = $price_list[$combo_price][1]; - } + if (isset($price_range) and !isset($combo_price)) { + $sql = " and (a.price>=? and a.price<=?) "; + $canshu[] = $price_range[0]; + $canshu[] = $price_range[1]; + } + if(isset($checkup_type_id)){ $sql = $sql . " and a.checkup_type_id=? "; $canshu[] = $checkup_type_id; @@ -92,9 +101,12 @@ class ComboController extends Controller $sql = $sql . " and a.name like ? "; $canshu[] = '%'.$search.'%'; } - if (!isset($combo_sort)) { - $sql = $sql . " order by a.order "; - } + + if(isset($sort_price) and $sort_price==1) $combo_sort=3; + if(isset($sort_price) and $sort_price==2) $combo_sort=4; + if(isset($sort_sale_count) and $sort_sale_count==1) $combo_sort=7; + if(isset($sort_sale_count) and $sort_sale_count==2) $combo_sort=8; + if (isset($combo_sort)) { if ($combo_sort == 1) { $sql = $sql . " "; @@ -114,7 +126,15 @@ class ComboController extends Controller if ($combo_sort == 6) { $sql = $sql . " order by b.count "; } - + if ($combo_sort == 7) { + $sql = $sql . " order by a.sale_count "; + } + if ($combo_sort == 8) { + $sql = $sql . " order by a.sale_count desc"; + } + } + if (!isset($combo_sort)) { + $sql = $sql . " order by a.order "; } if(isset($keshi_name)){ $combo_ids=DB::table('combo_items')->where(['status'=>1,'keshi_name'=>$keshi_name]) ->pluck('combo_id')->toArray(); @@ -208,12 +228,46 @@ select combo_id as c_id,count(*) as count from combo_items where status in(1) gr 'id' => $doctor, 'name' => '张大夫' ]; + //获取套餐价格分布 + $step = 500; + $maxPrice = 20000 + $step; + $result=DB::select("SELECT FLOOR(price / ?) * ? AS price_range_start, COUNT(*) AS count + FROM combos + WHERE price >= 0 AND price < ? + GROUP BY price_range_start;",[$step,$step,$maxPrice]); + $price_ranges = []; + for ($i = 0; $i <= 20000; $i += $step) { + $price_ranges[$i] = 0; + } + foreach ($result as $row) { + if (isset($price_ranges[$row->price_range_start])) { + $price_ranges[$row->price_range_start] = $row->count; + } + } + $formatted_price_ranges = []; + $formatted_price_ranges[]=['start' => 0, + 'count' => 0]; + foreach ($price_ranges as $start => $count) { + // 如果你想包括结束值,可以添加 'end' 键,例如:'end' => $start + 99 + $formatted_price_ranges[] = [ + 'start' => $start, + 'count' => $count + ]; + } + $price_max_min=DB::select("SELECT + MAX(price) AS highest_price, + MIN(price) AS lowest_price +FROM combos;"); return \Yz::Return(true, '获取成功', [ 'list' => $combos, 'hospital' => $hospital_info, 'doctor' => $doctor_info, 'info' => $info, + 'price_range' => $formatted_price_ranges, + 'price_max_min' =>isset($price_range)?$price_range:[0,$maxPrice], + 'price_max' =>$maxPrice, + 'step' => $step, ]); } diff --git a/h5/common/PriceRange.vue b/h5/common/PriceRange.vue index 5f57210..fee6c53 100644 --- a/h5/common/PriceRange.vue +++ b/h5/common/PriceRange.vue @@ -2,18 +2,18 @@ - 折线图 + ¥{{rang0}} ¥{{rang1}} - + - + @@ -23,13 +23,66 @@ + .select_done_wrapper { + color: #ffffff; + background: #239ea3; + width: calc(100% - 60rpx); + margin: 50rpx auto 0; + height: 50rpx; + line-height: 50rpx; + text-align: center; + border-radius: 6rpx; + } + + .select_group_item_wrapper { + padding: 10rpx 20rpx; + border: 1rpx solid #239ea3; + font-size: 22rpx; + margin: 20rpx 20rpx 0 0; + border-radius: 6rpx; + color: #239ea3; + } + + .select_group_item_wrapper.active { + color: #ffffff; + background: #239ea3; + } + + .select_group_line_wrapper { + display: flex; + align-items: center; + flex-wrap: wrap; + } + + .select_group_wrapper { + margin: 20rpx; + } + + .list_wrapper { + padding-top: 30rpx; + height: calc(100vh - 100rpx - 10rpx - 70rpx - 80rpx - 30rpx - 30rpx); + width: 750rpx; + overflow-y: auto; + padding-bottom: 30rpx; + margin: 0 auto; + overflow-x: hidden; + -ms-overflow-style: none; + scrollbar-width: none; + overflow: -moz-scrollbars-none; + overflow-y: scroll; + background-color: #fff; + } + + .list_wrapper::-webkit-scrollbar { + display: none; + } + + .combo_line_wrapper { + width: 710rpx; + height: 1rpx; + background: #e1ecee; + margin: 26rpx 0rpx 0rpx 0; + } + + .combo_pick_button_wrapper { + width: 160rpx; + height: 60rpx; + background: #e1ecee; + border-radius: 30rpx; + font-weight: 400; + font-size: 28rpx; + color: #239ea3; + text-align: center; + line-height: 60rpx; + } + + .combo_buy_button_wrapper { + width: 160rpx; + height: 60rpx; + background: #239ea3; + border-radius: 30rpx; + font-weight: 400; + font-size: 28rpx; + color: #ffffff; + text-align: center; + line-height: 60rpx; + } + + .combo_button_wrapper { + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-around; + + } + + .combo_count_wrapper { + font-weight: 500; + font-size: 18rpx; + color: #8b8b8b; + line-height: 1; + } + + .combo_original_price_wrapper { + font-weight: 500; + font-size: 18rpx; + color: #8b8b8b; + line-height: 1; + text-decoration-line: line-through; + margin-left: 10rpx; + } + + .combo_true_price_wrapper { + font-weight: 500; + font-size: 18rpx; + color: #ec3d15; + line-height: 1; + } + + .combo_true_price_number_wrapper { + font-size: 38rpx; + } + + .combo_price_wrapper { + display: flex; + align-items: end; + justify-content: space-between; + margin-top: 21rpx; + } + + .combo_price_box_wrapper { + display: flex; + align-items: end; + } + + .combo_wrapper { + /* height: 196rpx; */ + width: calc(750rpx - 80rpx); + margin: 0 auto; + background-color: #fff; + padding: 0rpx 40rpx 30rpx 40rpx; + } + + .combo_tags_wrapper { + display: flex; + align-items: center; + margin-top: 13rpx; + } + + .combo_desc_wrapper { + font-weight: 500; + font-size: 20rpx; + color: #8b8b8b; + line-height: 1; + margin-top: 18rpx; + } + + .combo_tag_wrapper { + padding-left: 13rpx; + padding-right: 13rpx; + height: 30rpx; + line-height: 30rpx; + border-radius: 5rpx; + font-weight: 400; + font-size: 18rpx; + color: #47abd8; + margin: 10rpx 8rpx 10rpx 0rpx; + border: 1rpx solid #009da5; + } + + .combo_name_wrapper { + font-weight: 400; + font-size: 32rpx; + color: #0e0e0e; + line-height: 32rpx; + + } + + .combo_content_wrapper { + margin-left: 30rpx; + width: calc(750rpx - 190rpx - 30rpx - 20rpx - 55rpx); + } + + .combo_info_wrapper { + display: flex; + align-items: center; + width: 750rpx; + margin: 0 auto; + } + + .combo_cover_wrapper { + width: 190rpx; + height: 190rpx; + margin-left: 20rpx; + } + + .combo_cover_wrapper image { + width: 190rpx; + height: 190rpx; + display: block; + object-fit: contain; + } + + .select_item_line_wrapper { + position: absolute; + width: 95rpx; + height: 10rpx; + background: linear-gradient(to bottom, #ffffff00, #1b9a9f); + border-radius: 5rpx; + bottom: 0; + left: 50%; + transform: translateX(calc(-50% - 8px)); + opacity: 0; + } + + .select_wrapper { + display: flex; + align-items: center; + justify-content: space-between; + width: 750rpx; + height: 80rpx; + background: #eef7f7; + box-shadow: 0rpx -1rpx 1rpx 0rpx rgba(0, 0, 0, 0.1); + margin: 0 auto; + position: relative; + z-index: 999; + } + + .select_item_icon_wrapper { + width: 18rpx; + height: 9rpx; + margin-left: 9rpx; + filter: grayscale(100%); + } + + .select_item_icon_wrapper image { + width: 18rpx; + height: 9rpx; + display: block; + object-fit: contain; + } + + .select_item_icon2_wrapper { + width: 26rpx; + height: 23rpx; + margin-left: 7rpx; + } + + .select_item_icon2_wrapper image { + width: 26rpx; + height: 23rpx; + display: block; + object-fit: contain; + } + + .select_item_name_wrapper { + font-weight: 400; + font-size: 26rpx; + color: #2f2f2f; + line-height: 1; + } + + .select_item_wrapper { + width: 25%; + display: flex; + align-items: center; + justify-content: center; + position: relative; + height: 80rpx; + } + + .select_item_wrapper.active .select_item_name_wrapper { + color: #239ea3; + font-weight: bold; + } + + .select_item_wrapper.active .select_item_icon_wrapper { + filter: grayscale(0%); + } + + .select_item_wrapper.active .select_item_line_wrapper { + opacity: 1; + } + + .doctor_name_wrapper { + font-weight: 400; + font-size: 24rpx; + line-height: 1; + color: #ffffff; + border-bottom: 1rpx solid #ffffff; + } + + .doctor_tip_wrapper { + font-weight: 400; + font-size: 22rpx; + line-height: 1; + color: #ffffff; + } + + .doctor_wrapper { + display: flex; + align-items: center; + width: 710rpx; + height: 70rpx; + background: #239ea3; + border-radius: 15rpx 15rpx 0rpx 0rpx; + padding-left: 24rpx; + } + + .user_choose_wrapper { + width: 50rpx; + height: 50rpx; + margin-left: 30rpx; + } + + .user_choose_wrapper image { + width: 50rpx; + height: 50rpx; + display: block; + object-fit: contain; + } + + .user_title_wrapper { + font-weight: 400; + font-size: 26rpx; + color: #fff; + line-height: 1; + } + + .user_name_wrapper { + font-weight: 400; + font-size: 26rpx; + color: #fff; + line-height: 1; + } + + .user_wrapper { + height: 80rpx; + padding-left: 40rpx; + padding-right: 20rpx; + margin-right: 20rpx; + background: #009ea7; + border-radius: 40rpx; + display: flex; + align-items: center; + justify-content: center; + } + + .header_wrapper { + display: flex; + align-items: center; + justify-content: space-between; + width: 710rpx; + height: 100rpx; + background: #d8edf2; + margin: 0 auto; + position: relative; + z-index: 999; + background-color: #fff; + margin-left: 20rpx; + margin-right: 20rpx; + border-radius: 20rpx; + } + + .hospital_wrapper { + display: flex; + align-items: center; + width: 40%; + } + + .hospital_icon_wrapper { + width: 48rpx; + height: 48rpx; + margin-left: 20rpx; + } + + .hospital_icon_wrapper image { + width: 48rpx; + height: 48rpx; + display: block; + object-fit: contain; + } + + .hospital_name_wrapper { + font-weight: 400; + font-size: 28rpx; + color: #484747; + margin-left: 9rpx; + line-height: 1; + } + + .hospital_select_wrapper { + width: 24rpx; + height: 14rpx; + margin-left: 19rpx; + } + + .hospital_select_wrapper image { + width: 24rpx; + height: 14rpx; + display: block; + object-fit: contain; + } + + .popup_new_main { + background-color: #fff; + border-radius: 0rpx 0rpx 20rpx 20rpx; + padding: 40rpx 20rpx 20rpx 20rpx; + } + + .top_button_row { + display: flex; + justify-content: space-between; + padding-left: 20rpx; + padding-right: 20rpx; + } + + .top_button { + color: #666; + background-color: #fff; + padding: 6rpx 40rpx; + border-radius: 15rpx; + margin-top: -6rpx; + margin-bottom: 8rpx; + font-size: 28rpx; + width: 140rpx; + text-align: center; + } + + .top_button_active { + background-color: #009ea7; + color: #fff; + } + + .search {} + + .shaixuan_title { + font-size: 26rpx; + margin-top: 20rpx; + margin-bottom: 10rpx; + } + + .shaixuan_button { + font-size: 24rpx; + padding-left: 10rpx; + background-color: #ccc; + margin: 10rpx; + padding: 5rpx 10rpx; + border-radius: 5rpx; + background-color: #f3f3f3; + color: #1e1a19; + } + .shaixuan_button_active{ + background-color: #009da5; + color: #fff; + } + \ No newline at end of file diff --git a/h5/pages/main/tj/tjzx_new.vue b/h5/pages/main/tj/tjzx_new.vue new file mode 100644 index 0000000..d88f219 --- /dev/null +++ b/h5/pages/main/tj/tjzx_new.vue @@ -0,0 +1,590 @@ + + + diff --git a/h5/static/assets/buy/huomiao.jpg b/h5/static/assets/buy/huomiao.jpg new file mode 100644 index 0000000..24fe964 Binary files /dev/null and b/h5/static/assets/buy/huomiao.jpg differ