diff --git a/Laravel/app/Http/Controllers/ViewController.php b/Laravel/app/Http/Controllers/ViewController.php index 37f9019..3ea006d 100644 --- a/Laravel/app/Http/Controllers/ViewController.php +++ b/Laravel/app/Http/Controllers/ViewController.php @@ -21,6 +21,155 @@ class ViewController extends Controller return $site; } + public function public_config() + { + $request = request(); + $search = $request->get('search') ?? ''; + return [ + 'search_value' => $search, + 'search_tags' => ['女性', '男性', '入职', '父母', '高端'] + ]; + } + + public function combo_list(Request $request) + { + $site = self::site(); + if (!$site) return '站点暂时关闭'; + $hospital_ids = json_decode($site->hospital, true); + $type = $request->get('type') ?? ''; + $combo_type = $request->get('combo_type') ?? ''; + $price = $request->get('price') ?? ''; + $sex = $request->get('sex') ?? ''; + $order = $request->get('order') ?? 'zh'; + $search = $request->get('search') ?? ''; + + $combos = DB::table('combos') + ->whereIn('hospital_id', $hospital_ids) + ->where(function ($query) use ($type) { + if ($type != '') $query->where('tags', 'like', "%\"$type\"%"); + }) + ->where(function ($query) use ($combo_type) { + if ($combo_type != '') $query->where('tags', 'like', "%\"$combo_type\"%"); + }) + ->where(function ($query) use ($price) { + if ($price != '') { + $price_arr = explode('-', $price); + if (count($price_arr) == 2) { + $query->whereBetween('price', [$price_arr[0], $price_arr[1]]); + } else { + $price_arr = explode('u', $price); + $query->where('price', '>=', $price_arr[0]); + } + } + }) + ->where(function ($query) use ($sex) { + if ($sex != '') $query->whereIn('sex', [0, $sex]); + }) + ->where(function ($query) use ($search) { + if ($search != '') $query->where('tags', 'like', "%\"$search\"%") + ->orWhere('name', 'like', "%$search%"); + }) + ->orderBy($order == 'zh' ? 'id' : 'price', $order == 'zh' ? 'desc' : 'asc') + ->paginate(20) + ->withQueryString() + ->toArray(); + $combo_count = DB::table('combos') + ->whereIn('hospital_id', $hospital_ids) + ->where(function ($query) use ($type) { + if ($type != '') $query->where('tags', 'like', "%\"$type\"%"); + }) + ->where(function ($query) use ($combo_type) { + if ($combo_type != '') $query->where('tags', 'like', "%\"$combo_type\"%"); + }) + ->where(function ($query) use ($price) { + if ($price != '') { + $price_arr = explode('-', $price); + if (count($price_arr) == 2) { + $query->whereBetween('price', [$price_arr[0], $price_arr[1]]); + } else { + $price_arr = explode('u', $price); + $query->where('price', '>=', $price_arr[0]); + } + } + }) + ->where(function ($query) use ($sex) { + if ($sex != '') $query->whereIn('sex', [0, $sex]); + }) + ->where(function ($query) use ($search) { + if ($search != '') $query->where('tags', 'like', "%\"$search\"%") + ->orWhere('name', 'like', "%$search%"); + }) + ->count(); + + $search_arr = [[ + 'label' => '体检类型', + 'value' => 'type', + 'options' => [ + ['label' => '不限', 'value' => ''], + ['label' => '中老年', 'value' => '中老年'], + ['label' => '青年女性', 'value' => '青年女性'], + ['label' => '基础套餐', 'value' => '基础套餐'], + ['label' => '入职体检', 'value' => '入职体检'], + ] + ], [ + 'label' => '体检套餐', + 'value' => 'combo_type', + 'options' => [ + ['label' => '不限', 'value' => ''], + ['label' => '肝脏疾病', 'value' => '肝脏疾病'], + ['label' => '糖尿病', 'value' => '糖尿病'], + ['label' => '泌尿系统疾病', 'value' => '泌尿系统疾病'], + ['label' => '高血脂', 'value' => '高血脂'], + ['label' => '高血糖', 'value' => '高血糖'], + ['label' => '消化系统疾病', 'value' => '消化系统疾病'], + ['label' => '前列腺疾病', 'value' => '前列腺疾病'], + ['label' => '妇科疾病', 'value' => '妇科疾病'], + ['label' => '甲状腺疾病', 'value' => '甲状腺疾病'], + ['label' => '心血管疾病', 'value' => '心血管疾病'], + ['label' => '心脏病', 'value' => '心脏病'], + ['label' => '骨质疏松', 'value' => '骨质疏松'], + ['label' => '腰颈肩病', 'value' => '腰颈肩病'], + ['label' => '风湿病', 'value' => '风湿病'], + ['label' => '肺部疾病', 'value' => '肺部疾病'], + ] + ], [ + 'label' => '价格区间', + 'value' => 'price', + 'options' => [ + ['label' => '不限', 'value' => ''], + ['label' => '100-300', 'value' => '100-300'], + ['label' => '300-500', 'value' => '300-500'], + ['label' => '500-800', 'value' => '500-800'], + ['label' => '800以上', 'value' => '800u'], + ] + ], [ + 'label' => '性别', + 'value' => 'sex', + 'options' => [ + ['label' => '不限', 'value' => ''], + ['label' => '男', 'value' => '1'], + ['label' => '女', 'value' => '2'], + ] + ]]; + foreach ($combos['data'] as $combo) { + $combo->tags_arr = json_decode($combo->tags, true); + } +// Yz::debug(['a' => $combos]); + return view('combo_list.combo_list', [ + 'public_config' => self::public_config(), + 'combos' => $combos, + 'combo_count' => $combo_count, + 'search_arr' => $search_arr, + 'search_choose' => [ + 'type' => $type, + 'combo_type' => $combo_type, + 'price' => $price, + 'sex' => $sex, + 'order' => $order, + ] + ]); + } + public function home() { $site = self::site(); @@ -29,6 +178,7 @@ class ViewController extends Controller $combos = DB::table('combos') ->whereIn('hospital_id', $hospital_ids) ->limit(8) + ->orderBy('id', 'desc') ->get(); foreach ($combos as $combo) { $combo->tags_arr = json_decode($combo->tags, true); @@ -36,11 +186,13 @@ class ViewController extends Controller $hospital_list = DB::table('hospital') ->whereIn('id', $hospital_ids) ->limit(8) + ->orderBy('id', 'desc') ->get(); foreach ($hospital_list as $hospital) { $hospital->tags_arr = json_decode($hospital->tags, true); } return view('home.home', [ + 'public_config' => self::public_config(), 'combos' => $combos, 'hospitals' => $hospital_list, ]); @@ -61,7 +213,11 @@ class ViewController extends Controller ->where('id', $combo->hospital_id) ->first(); $url = $hospital->mp_jump . '?combo=' . $combo->combo_id . '&hospital=' . $hospital->code; +// Yz::debug([ +// 'a' => $hospital +// ]); return view('combo.combo', [ + 'public_config' => self::public_config(), 'qrcode' => $url, 'combo' => $combo, 'hospital' => $hospital, diff --git a/Laravel/public/assets/css/layout.css b/Laravel/public/assets/css/layout.css index 24a0af0..60f1b82 100644 --- a/Laravel/public/assets/css/layout.css +++ b/Laravel/public/assets/css/layout.css @@ -2,6 +2,57 @@ --style-color-1: #86b883; --style-color-2: #d35050; --style-color-3: #aee3ab; + --style-color-4: #e19898; +} + +.footer_beian_wrapper { + padding-top: 30px; + margin-top: 30px; + border-top: 1px solid #8c939d30; + text-align: center; + line-height: 40px; + font-size: 16px; + color: #8c939d; +} + +.footer_web_icon_wrapper { + width: 500px; +} + + +.footer_web_icon_wrapper img { + width: 500px; +} + +.footer_web_wrapper { + display: flex; + justify-content: space-between; + align-items: center; +} + +.footer_web_logo_wrapper { + +} + +.footer_web_logo_icon_wrapper { + width: 200px; + height: 80px; + line-height: 80px; + font-weight: bold; + font-size: 30px; +} + +.footer_web_logo_text_wrapper { + width: 400px; + line-height: 28px; + font-size: 16px; + color: #8c939d; +} + +.footer_wrapper { + background: #f1f2f4; + padding: 30px 50px; + margin-top: 20px; } .header_info_wrapper { @@ -60,6 +111,11 @@ cursor: pointer; } +.header_search_tag_active_wrapper { + color: #ffffff; + background: var(--style-color-1); +} + .header_search_wrapper { margin-left: 30px; } diff --git a/Laravel/public/assets/images/footer-icon.png b/Laravel/public/assets/images/footer-icon.png new file mode 100644 index 0000000..d1869bb Binary files /dev/null and b/Laravel/public/assets/images/footer-icon.png differ diff --git a/Laravel/public/assets/images/qy-logo.png b/Laravel/public/assets/images/qy-logo.png new file mode 100644 index 0000000..0ad80fb Binary files /dev/null and b/Laravel/public/assets/images/qy-logo.png differ diff --git a/Laravel/public/assets/images/yy-logo.png b/Laravel/public/assets/images/yy-logo.png new file mode 100644 index 0000000..93a1843 Binary files /dev/null and b/Laravel/public/assets/images/yy-logo.png differ diff --git a/Laravel/resources/views/combo/combo.blade.php b/Laravel/resources/views/combo/combo.blade.php index 1699aeb..143d2af 100644 --- a/Laravel/resources/views/combo/combo.blade.php +++ b/Laravel/resources/views/combo/combo.blade.php @@ -12,7 +12,12 @@
{{ $combo->name }}
优惠价
-
¥ {{ $combo->price }}
+
+ ¥ {{ $combo->price }} + @if($combo->price < $combo->original_price) + {{ $combo->original_price }} + @endif +
套餐简介:
@@ -99,6 +104,11 @@
医院简介
{!! $hospital->desc !!}
+
地图
+
+
+
@endsection diff --git a/Laravel/resources/views/combo/combo.css b/Laravel/resources/views/combo/combo.css index a2cc3cc..7405332 100644 --- a/Laravel/resources/views/combo/combo.css +++ b/Laravel/resources/views/combo/combo.css @@ -3,6 +3,11 @@ text-align: center; } +#hospital_map_container { + width: 100%; + height: 400px; +} + .qrcode_box_wrapper { width: 200px; height: 200px; @@ -225,10 +230,18 @@ margin-left: 20px; } +.combo_price_original_price_wrapper { + font-size: 18px; + margin-left: 10px; + color: var(--style-color-4); + font-weight: 400; + text-decoration: line-through; +} + .combo_wrapper { display: flex; width: 1200px; - margin: 0 auto; + margin: 20px auto 0; justify-content: space-between; } diff --git a/Laravel/resources/views/combo/combo.js b/Laravel/resources/views/combo/combo.js index 3ff8834..a1a619f 100644 --- a/Laravel/resources/views/combo/combo.js +++ b/Laravel/resources/views/combo/combo.js @@ -29,12 +29,21 @@ const qrcodeRef = (e) => { qrcode_ref.value = e qrcodeCreate() } +const hospital_map_ref = ref(null) +const hospitalMapRef = (e, longitude, latitude) => { + hospital_map_ref.value = e + const map = new BMapGL.Map(hospital_map_ref.value); + const point = new BMapGL.Point(longitude, latitude); + map.centerAndZoom(point, 16); + map.enableScrollWheelZoom(true); +} // SCRIPT END // MOUNTED // MOUNTED END // RETURN const ret_ = { + hospitalMapRef, qrcodeRef, qrcode_show, showQrcodeClick, diff --git a/Laravel/resources/views/combo_list/combo_list.blade.php b/Laravel/resources/views/combo_list/combo_list.blade.php new file mode 100644 index 0000000..6754bae --- /dev/null +++ b/Laravel/resources/views/combo_list/combo_list.blade.php @@ -0,0 +1,92 @@ +@extends('layout.layout') +@section('content') +
+
体检套餐
+ +
体检机构
+
+
+
+ @foreach($search_arr as $search_list) +
+
{{ $search_list['label'] }}
+
+ @foreach($search_list['options'] as $search_item) +
{{ $search_item['label'] }}
+ @endforeach +
+
+ @endforeach +
+
+
+
排序方式
+
+
综合排序 +
+
折扣最多 +
+
+
共有{{ $combo_count }}个符合条件的套餐 +
+
+
+
+
+ @foreach($combos['data'] as $combo) + +
+ @if($combo->cover != '') + + @else +
暂无封面图
+ @endif +
+
{{ $combo->name }}
+
+ @foreach($combo->tags_arr as $tag) +
{{ $tag }}
+ @endforeach +
+
+ ¥ {{ $combo->price }} + @if($combo->price < $combo->original_price) + {{ $combo->original_price }} + @endif +
+
+ @endforeach +
+
+ + @if(count($combos['data']) > 0) +
+ @foreach($combos['links'] as $key => $item) + +
+ @if($key == 0) + 上一页 + @elseif($key == count($combos['links']) - 1) + 下一页 + @else + {{ $item['label'] }} + @endif +
+
+ @endforeach +
+ @else +
未搜索到符合条件的套餐
+ @endif +@endsection diff --git a/Laravel/resources/views/combo_list/combo_list.css b/Laravel/resources/views/combo_list/combo_list.css new file mode 100644 index 0000000..5c9428d --- /dev/null +++ b/Laravel/resources/views/combo_list/combo_list.css @@ -0,0 +1,206 @@ +.combo_list_search_wrapper, +.combo_list_order_wrapper { + width: 1200px; + margin: 20px auto 0; + border: 1px solid #cccccc; + padding: 10px; +} + +.combo_list_order_line_wrapper, +.combo_list_search_line_wrapper { + display: flex; + line-height: 60px; + border-bottom: 1px dashed #cccccc; + padding: 10px 0; +} + +.combo_list_order_line_wrapper { + border-bottom: none; +} + +.combo_list_count_number_wrapper { + color: var(--style-color-1); + margin: 5px; +} + +.combo_list_order_line_title_wrapper, +.combo_list_search_line_title_wrapper { + width: 80px; + font-size: 16px; + font-weight: bold; + color: #aaaaaa; + margin-left: 20px; +} + +.combo_list_order_line_content_wrapper, +.combo_list_search_line_content_wrapper { + display: flex; + margin-left: 20px; + width: calc(100% - 120px - 40px); + flex-wrap: wrap; + align-items: center; +} + +.combo_list_count_wrapper { + text-align: right; + width: 420px; +} + +.combo_list_order_line_content_wrapper { + width: calc(100% - 120px - 40px - 400px); +} + +.combo_list_order_line_content_item_wrapper, +.combo_list_search_line_content_item_wrapper { + padding: 0 20px; + text-align: center; + height: 40px; + line-height: 40px; + cursor: pointer; +} + +.combo_list_order_line_content_active_wrapper, +.combo_list_search_line_content_active_wrapper { + background: var(--style-color-1); + color: #fff; +} + +.combo_list_nav_wrapper { + height: 60px; + line-height: 60px; + border-bottom: 5px solid var(--style-color-1); + width: 1200px; + margin: 20px auto 0; + display: flex; + align-items: center; +} + +.combo_list_nav_item_wrapper { + height: 60px; + line-height: 60px; + width: 140px; + text-align: center; + cursor: pointer; +} + +.combo_list_nav_item_active_wrapper { + background: var(--style-color-1); + color: #fff; +} + + +.combo_price_wrapper { + font-size: 24px; + color: var(--style-color-2); + font-weight: bold; + margin-top: 10px; +} + +.combo_original_price_wrapper { + font-size: 18px; + margin-left: 10px; + color: var(--style-color-4); + font-weight: 400; + text-decoration: line-through; +} + +.combo_tag_wrapper { + padding: 5px 10px; + background: #eaeaea; + border-radius: 6px; + color: #676767; + margin-right: 5px; +} + +.combo_tags_wrapper { + display: flex; + flex-wrap: wrap; +} + +.combo_name_wrapper { + font-size: 20px; + line-height: 40px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.combo_cover_wrapper { + width: 100%; + height: 200px; + background: #cccccc; + line-height: 200px; + text-align: center; + color: #333333; + border-radius: 6px; + overflow: hidden; +} + +.combo_cover_wrapper img { + width: 100%; + height: 200px; + object-fit: cover; +} + +.combo_item_wrapper { + width: 25%; + padding: 5px; + margin-bottom: 10px; +} + +.combo_list_wrapper { + display: flex; + flex-wrap: wrap; + margin-top: 20px; +} + +.combo_wrapper { + width: 1200px; + margin: 20px auto 0; +} + +.page_wrapper { + display: flex; + justify-content: center; + flex-wrap: wrap; + margin-top: 40px; + margin-bottom: 70px; +} + +.page_item_wrapper { + margin: 5px; + padding: 0 10px; + height: 30px; + background: #FFFFFF; + border: 1px solid #E5E7EC; + line-height: 30px; + text-align: center; + font-size: 16px; + color: #B5B5C4; + cursor: pointer; +} + +.page_item_wrapper:hover { + background: #FAFAFA; + border: 1px solid #E5E7EC; + font-size: 16px; + color: var(--style-color-1); +} + +.page_item_active_wrapper { + background: #FAFAFA; + border: 1px solid #E5E7EC; + font-weight: bold; + font-size: 16px; + color: var(--style-color-1); +} + +.no_data_wrapper { + width: 100%; + font-size: 14px; + color: #999999; + line-height: 300px; + margin-top: 20px; + text-align: center; + height: 300px; +} diff --git a/Laravel/resources/views/combo_list/combo_list.js b/Laravel/resources/views/combo_list/combo_list.js new file mode 100644 index 0000000..dcd67d4 --- /dev/null +++ b/Laravel/resources/views/combo_list/combo_list.js @@ -0,0 +1,39 @@ +// SCRIPT +const pageJump = (key, value) => { + let search_data = { + ...page_options.value, + } + search_data[key] = value + if (key !== 'page') { + search_data.page = 1 + } + let url = `/combo_list?` + for (let i in search_data) { + if (search_data[i]) { + url += `${i}=${search_data[i]}&` + } + } + window.location.href = url +} +// SCRIPT END +// MOUNTED + +// MOUNTED END +// RETURN +const ret_ = { + pageJump, +} +// RETURN END +// OPTIONS +const opt = (g) => { + return { + type: 'type' in g ? g.type : '', + combo_type: 'combo_type' in g ? g.combo_type : '', + price: 'price' in g ? g.price : '', + sex: 'sex' in g ? g.sex : '', + order: 'order' in g ? g.order : 'zh', + search: 'search' in g ? g.search : '', + page: 'page' in g ? Number(g.page) : 1, + } +} +// OPTIONS END diff --git a/Laravel/resources/views/components/footer.blade.php b/Laravel/resources/views/components/footer.blade.php index daa6cc6..d36f379 100644 --- a/Laravel/resources/views/components/footer.blade.php +++ b/Laravel/resources/views/components/footer.blade.php @@ -1,3 +1,16 @@ diff --git a/Laravel/resources/views/components/header.blade.php b/Laravel/resources/views/components/header.blade.php index 130f277..5db9d4b 100644 --- a/Laravel/resources/views/components/header.blade.php +++ b/Laravel/resources/views/components/header.blade.php @@ -24,17 +24,17 @@
- -
+ +
-
女性
-
男性
-
入职
-
父母
-
高端
+ @foreach($public_config['search_tags'] as $tag) +
{{ $tag }}
+ @endforeach
diff --git a/Laravel/resources/views/home/home.blade.php b/Laravel/resources/views/home/home.blade.php index f56dcdc..195d227 100644 --- a/Laravel/resources/views/home/home.blade.php +++ b/Laravel/resources/views/home/home.blade.php @@ -12,10 +12,12 @@
+
+
+
部分合作医院&机构
+
+
+ @for($i = 0; $i < 8; $i++) +
+ +
+ @endfor +
+
+
+
+
+
+
+
+
部分合作企业&单位
+
+
+ @for($i = 0; $i < 8; $i++) +
+ +
+ @endfor +
+
+
+
+
+
@endsection diff --git a/Laravel/resources/views/home/home.css b/Laravel/resources/views/home/home.css index b1a661f..cf074c1 100644 --- a/Laravel/resources/views/home/home.css +++ b/Laravel/resources/views/home/home.css @@ -4,6 +4,35 @@ font-weight: bold; } +.hospital_list_wrapper { + display: flex; + align-items: center; + flex-wrap: wrap; + width: 1200px; + margin: 20px auto 0; + justify-content: space-around; +} + +.hospital_item_wrapper { + width: 280px; + height: 100px; + border: 1px solid #8c939d; + margin: 10px 5px; + overflow: hidden; +} + +.hospital_item_wrapper img { + width: 280px; + height: 100px; + display: block; + object-fit: contain; +} + + +.hospital_item_blank_wrapper { + width: 290px; +} + .hospital_address_text_wrapper { margin-left: 5px; width: calc(100% - 50px); @@ -76,7 +105,6 @@ .banner_menu_item_wrapper { padding-left: 30px; margin-top: 20px; - display: none; } .banner_wrapper { @@ -89,6 +117,7 @@ text-align: center; height: 50px; line-height: 50px; + display: none; } .banner_nav_group_wrapper { @@ -116,6 +145,14 @@ margin-top: 10px; } +.combo_original_price_wrapper { + font-size: 18px; + margin-left: 10px; + color: var(--style-color-4); + font-weight: 400; + text-decoration: line-through; +} + .combo_tag_wrapper { padding: 5px 10px; background: #eaeaea; diff --git a/Laravel/resources/views/layout/layout.blade.php b/Laravel/resources/views/layout/layout.blade.php index 009549a..0c1b859 100644 --- a/Laravel/resources/views/layout/layout.blade.php +++ b/Laravel/resources/views/layout/layout.blade.php @@ -1,87 +1,112 @@ - - - - - - - - - - - 体检平台 - - - - + + + + + + + + + + + + 体检平台 + + + +
- - -
- @include('components.header') -
-
- @yield('content') -
-
- @include('components.footer') -
-
-
+ + +
+ @include('components.header') +
+
+ @yield('content') +
+
+ @include('components.footer') +
+
+
diff --git a/Laravel/routes/web.php b/Laravel/routes/web.php index cd468de..f39a079 100644 --- a/Laravel/routes/web.php +++ b/Laravel/routes/web.php @@ -14,6 +14,7 @@ use Illuminate\Support\Facades\Route; */ Route::get('/Qrcode/combo', [\App\Http\Controllers\QrcodeController::class, 'combo_jump']); +Route::get('/combo_list', [\App\Http\Controllers\ViewController::class, 'combo_list']); Route::get('/combo', [\App\Http\Controllers\ViewController::class, 'combo']); Route::get('/', [\App\Http\Controllers\ViewController::class, 'home']);