Sfoglia il codice sorgente

Merge branch 'develop' of ssh://gogs.zlhuiyun.com:8080/szr190/ShenhaiH5 into develop

fengyu 2 mesi fa
parent
commit
c401d54ef2

+ 82 - 0
src/api/home.ts

@@ -1 +1,83 @@
1 1
 import { http } from '@/utils/http'
2
+
3
+// 招商加盟
4
+export const getParkServiceInvestment = (parkId: string) => {
5
+  return http({
6
+    method: 'GET',
7
+    url: `/service/investment/park/${parkId}`
8
+  })
9
+}
10
+
11
+// 我要加油
12
+export const getParkServiceOil = (parkId: string) => {
13
+  return http({
14
+    method: 'GET',
15
+    url: `/service/oil/park/${parkId}`
16
+  })
17
+}
18
+
19
+// 我要充电
20
+export const getParkServicePower = (parkId: string) => {
21
+  return http({
22
+    method: 'GET',
23
+    url: `/service/power/park/${parkId}`
24
+  })
25
+}
26
+
27
+// 我要修车
28
+export const getParkServiceCar = (parkId: string) => {
29
+  return http({
30
+    method: 'GET',
31
+    url: `/service/car/park/${parkId}`
32
+  })
33
+}
34
+
35
+// 司机之家
36
+export const getParkServiceDriver = (parkId: string) => {
37
+  return http({
38
+    method: 'GET',
39
+    url: `/service/driver/park/${parkId}`
40
+  })
41
+}
42
+
43
+// 母婴室
44
+export const getParkServiceBoy = (parkId: string) => {
45
+  return http({
46
+    method: 'GET',
47
+    url: `/service/boy/park/${parkId}`
48
+  })
49
+}
50
+
51
+// 我要吃饭列表
52
+export const getParkServiceEatList = (data: any) => {
53
+  return http({
54
+    method: 'GET',
55
+    url: `/service/eat/park/list`,
56
+    data
57
+  })
58
+}
59
+
60
+// 我要吃饭详情
61
+export const getParkServiceEatDetail = (id: string, parkId: string) => {
62
+  return http({
63
+    method: 'GET',
64
+    url: `/service/eat/${id}/${parkId}`
65
+  })
66
+}
67
+
68
+// 精选商家列表
69
+export const getParkServiceShopList = (data: any) => {
70
+  return http({
71
+    method: 'GET',
72
+    url: `/service/shop/park/list`,
73
+    data
74
+  })
75
+}
76
+
77
+// 精选商家详情
78
+export const getParkServiceShopDetail = (id: string, parkId: string) => {
79
+  return http({
80
+    method: 'GET',
81
+    url: `/service/shop/${id}/${parkId}`
82
+  })
83
+}

+ 11 - 0
src/api/system.ts

@@ -24,6 +24,17 @@ export const getConfigAPI = () => {
24 24
  * @description: 获取全部园区楼宇
25 25
  * @return {*}
26 26
  */
27
+export const getParkWebAPI = () => {
28
+  return http<ParkItem[]>({
29
+    method: 'GET',
30
+    url: '/space/park/web'
31
+  })
32
+}
33
+
34
+/**
35
+ * @description: 获取全部园区楼宇
36
+ * @return {*}
37
+ */
27 38
 export const getParkAPI = () => {
28 39
   return http<ParkItem[]>({
29 40
     method: 'GET',

+ 13 - 2
src/base/base.scss

@@ -56,6 +56,13 @@
56 56
         vertical-align: middle;
57 57
       }
58 58
     }
59
+    .common-card-rate {
60
+      display: flex;
61
+      align-items: center;
62
+      text {
63
+        margin-left: 6rpx;
64
+      }
65
+    }
59 66
     .common-sub-title {
60 67
       font-size: 25rpx;
61 68
       color: #333;
@@ -77,7 +84,7 @@
77 84
       }
78 85
     }
79 86
     .common-card-content {
80
-      font-size: 22rpx;
87
+      // font-size: 22rpx;
81 88
       color: #333;
82 89
       line-height: 42rpx;
83 90
       text {
@@ -87,7 +94,7 @@
87 94
     .common-card-list {
88 95
       display: flex;
89 96
       flex-wrap: wrap;
90
-      justify-content: space-between;
97
+      // justify-content: space-between;
91 98
       margin-top: 24rpx;
92 99
       .card-list-item {
93 100
         display: flex;
@@ -95,6 +102,10 @@
95 102
         align-items: center;
96 103
         justify-content: center;
97 104
         margin-bottom: 22rpx;
105
+        margin-right: 48rpx;
106
+        &:nth-child(3n) {
107
+          margin-right: 0;
108
+        }
98 109
         .item-img-wrap {
99 110
           width: 180rpx;
100 111
           height: 180rpx;

+ 21 - 13
src/base/common/charge.vue

@@ -1,34 +1,31 @@
1 1
 <template>
2 2
   <view class="common-details-container">
3 3
     <view class="common-header-wrapper">
4
-      <image :src="minioUrl + '/img_chongdian_bg.png'" mode="scaleToFill" />
4
+      <image :src="content.image" mode="scaleToFill" />
5 5
     </view>
6 6
     <view class="common-content-wrapper">
7 7
       <view class="common-card">
8 8
         <!-- common title -->
9
-        <view class="common-card-title">山高新能源海清高速服务区充电站</view>
9
+        <view class="common-card-title">{{ chargeInfo?.title }}</view>
10 10
         <!-- sub title -->
11
-        <view class="common-sub-title">营业时间:24小时</view>
12
-        <view class="common-sub-title">客服电话:0532-8886666</view>
11
+        <view class="common-sub-title">营业时间:{{ chargeInfo?.businessAt }}</view>
12
+        <view class="common-sub-title">客服电话:{{ chargeInfo?.mobile }}</view>
13 13
       </view>
14 14
       <view class="common-card">
15 15
         <view class="common-card-title u-margin-bottom-20">当前电价</view>
16 16
         <!-- 当前电价及时间展示 -->
17 17
         <view class="charge-current-wrapper">
18 18
           <view class="current-left-wrap">
19
-            <view class="text">1.36</view>
19
+            <view class="text">{{ content?.price }}</view>
20 20
             <view class="unit">元/度</view>
21 21
           </view>
22 22
           <view class="current-right-wrap">09:00-12:00</view>
23 23
         </view>
24
-        <HyCharge />
24
+        <HyCharge title="快充" :freeNum="content?.fastChargeFree" :totalNum="content?.fastChargeTotal" :status="content?.fastChargeStatus" />
25
+        <HyCharge title="慢充" :freeNum="content?.slowChargeFree" :totalNum="content?.slowChargeTotal" :status="content?.slowChargeStatus" />
25 26
         <view class="common-card-title u-margin-top-45">温馨提示</view>
26 27
         <view class="common-card-content">
27
-          <text>1、进出充电站时,请严格遵守交通规则和指示标识,注意观察礼让其他车辆。</text>
28
-          <text>2、充电前请确认车辆与充电桩兼容(如接口类型、功率匹配),优先选择支持直流快充的桩。</text>
29
-          <text>3、充电前确保车辆熄火(混动车型需熄火),连接充电枪后启动充电程序。</text>
30
-          <text>4、充电过程中若发现设备故障、异味或漏电,立即停止并联系工作人员。</text>
31
-          <text>5、充电结束时先关闭电源,再拔枪并妥善存放。</text>
28
+          <u-parse :html="content?.intro" />
32 29
         </view>
33 30
       </view>
34 31
     </view>
@@ -37,8 +34,19 @@
37 34
 
38 35
 <script setup lang="ts">
39 36
 import { ref } from 'vue'
40
-import { useGlobal } from '../../composables/index'
41
-const { minioUrl } = useGlobal()
37
+import { onLoad } from '@dcloudio/uni-app'
38
+import { getParkServicePower } from '@/api/home'
39
+
40
+const chargeInfo = ref<any>({})
41
+const content = ref<any>({})
42
+onLoad(async () => {
43
+  const parkId = uni.getStorageSync('parkId')
44
+  const res = await getParkServicePower(parkId)
45
+  if (res.code === 200) {
46
+    chargeInfo.value = res.data
47
+    content.value = JSON.parse(chargeInfo.value.content)
48
+  }
49
+})
42 50
 </script>
43 51
 
44 52
 <style lang="scss" scoepd>

+ 20 - 9
src/base/common/driversHome.vue

@@ -1,25 +1,24 @@
1 1
 <template>
2 2
   <view class="common-details-container">
3 3
     <view class="common-header-wrapper">
4
-      <image :src="minioUrl + '/img_sijizhijia_bg.png'" mode="scaleToFill" />
4
+      <image :src="content.image" mode="scaleToFill" />
5 5
     </view>
6 6
     <view class="common-content-wrapper">
7 7
       <view class="common-card">
8 8
         <!-- common title -->
9
-        <view class="common-card-title">海清服务区司机之家</view>
9
+        <view class="common-card-title">{{ driverInfo?.title }}</view>
10 10
         <!-- sub title -->
11
-        <view class="common-sub-title">营业时间:24小时</view>
12
-        <view class="common-sub-title">客服电话:0532-8886666</view>
11
+        <view class="common-sub-title">营业时间:{{ driverInfo?.businessAt }}</view>
12
+        <view class="common-sub-title">客服电话:{{ driverInfo?.mobile }}</view>
13 13
       </view>
14 14
       <view class="common-card">
15 15
         <view class="common-card-title u-margin-bottom-20">基本介绍</view>
16 16
         <view class="common-card-content">
17
-          “司机之家”是指主要为道路运输车辆及驾驶人员提供公共服务的场所和建筑设施,一般具有餐饮、休息、停车安保、宣传教育等服务功能。按照建设要求,“司机之家”应在高速公路服务区、普通国省干线公路服务区(站)、物流通道货物集散地或者物流园区等地建设,截至2025年4月全国30个省(自治区、直辖市)已建成1900余个“司机之家”线下服务点。
17
+          <u-parse :html="content.intro" />
18 18
         </view>
19 19
         <view class="common-card-title u-margin-top-45">设施配置</view>
20 20
         <view class="u-flex u-col-center u-margin-top-24">
21
-          <HyTag text="淋浴(有热水)" imgUrl="/icon_ly.png" />
22
-          <HyTag text="洗衣机" imgUrl="/icon_xyj.png" />
21
+          <HyTag v-for="(item, index) in content.facilities" :key="index" :text="item.name" :imgUrl="item.img" />
23 22
         </view>
24 23
       </view>
25 24
     </view>
@@ -28,8 +27,20 @@
28 27
 
29 28
 <script setup lang="ts">
30 29
 import { ref } from 'vue'
31
-import { useGlobal } from '../../composables/index'
32
-const { minioUrl } = useGlobal()
30
+import { onLoad } from '@dcloudio/uni-app'
31
+import { getParkServiceDriver } from '@/api/home'
32
+
33
+const driverInfo = ref<any>({})
34
+const content = ref<any>({})
35
+onLoad(async () => {
36
+  const parkId = uni.getStorageSync('parkId')
37
+  const res = await getParkServiceDriver(parkId)
38
+  if (res.code === 200) {
39
+    driverInfo.value = res.data
40
+    content.value = JSON.parse(driverInfo.value.content)
41
+    console.log('🚀 ~ content.value:', content.value)
42
+  }
43
+})
33 44
 </script>
34 45
 
35 46
 <style lang="scss" scoepd>

File diff suppressed because it is too large
+ 20 - 4
src/base/common/join.vue


+ 19 - 11
src/base/common/nursingRoom.vue

@@ -1,27 +1,24 @@
1 1
 <template>
2 2
   <view class="common-details-container">
3 3
     <view class="common-header-wrapper">
4
-      <image :src="minioUrl + '/img_muying_bg.png'" mode="scaleToFill" />
4
+      <image :src="content.image" mode="scaleToFill" />
5 5
     </view>
6 6
     <view class="common-content-wrapper">
7 7
       <view class="common-card">
8 8
         <!-- common title -->
9
-        <view class="common-card-title">海清服务区母婴室</view>
9
+        <view class="common-card-title">{{ boyInfo?.title }}</view>
10 10
         <!-- sub title -->
11
-        <view class="common-sub-title">营业时间:24小时</view>
12
-        <view class="common-sub-title">客服电话:0532-8886666</view>
11
+        <view class="common-sub-title">营业时间:{{ boyInfo?.businessAt }}</view>
12
+        <view class="common-sub-title">客服电话:{{ boyInfo?.mobile }}</view>
13 13
       </view>
14 14
       <view class="common-card">
15 15
         <view class="common-card-title u-margin-bottom-20">基本介绍</view>
16 16
         <view class="common-card-content">
17
-          母婴室,也称作母乳喂养室,通常建设于大型公共场所,如:商业综合体、交通枢纽、医疗机构、游乐场馆、文体教育场所等。以便于携婴父母出门在外照料哺乳期婴儿进行护理、哺乳、集乳、喂食、备餐的功能。建设主体包括商业场所及政府非营利性公共服务设施。
17
+          <u-parse :html="content?.intro" />
18 18
         </view>
19 19
         <view class="common-card-title u-margin-top-45">设施配置</view>
20 20
         <view class="bottom-box-wrap">
21
-          <HyTag text="哺乳椅" imgUrl="/icon_muying_01.png" />
22
-          <HyTag text="饮水机(有热水)" imgUrl="/icon_muying_02.png" />
23
-          <HyTag text="尿布台" imgUrl="/icon_muying_03.png" />
24
-          <HyTag text="婴儿床" imgUrl="/icon_muying_04.png" />
21
+          <HyTag v-for="item in content?.facilities" :key="item" :text="item.name" :imgUrl="item.img" />
25 22
         </view>
26 23
       </view>
27 24
     </view>
@@ -30,8 +27,19 @@
30 27
 
31 28
 <script setup lang="ts">
32 29
 import { ref } from 'vue'
33
-import { useGlobal } from '../../composables/index'
34
-const { minioUrl } = useGlobal()
30
+import { onLoad } from '@dcloudio/uni-app'
31
+import { getParkServiceBoy } from '@/api/home'
32
+
33
+const boyInfo = ref<any>({})
34
+const content = ref<any>({})
35
+onLoad(async () => {
36
+  const parkId = uni.getStorageSync('parkId')
37
+  const res = await getParkServiceBoy(parkId)
38
+  if (res.code === 200) {
39
+    boyInfo.value = res.data
40
+    content.value = JSON.parse(boyInfo.value.content)
41
+  }
42
+})
35 43
 </script>
36 44
 
37 45
 <style lang="scss" scoepd>

+ 40 - 9
src/base/common/refuel.vue

@@ -1,25 +1,22 @@
1 1
 <template>
2 2
   <view class="common-details-container">
3 3
     <view class="common-header-wrapper">
4
-      <image :src="minioUrl + '/img_jiayou_bg.png'" mode="scaleToFill" />
4
+      <image :src="content.image" mode="scaleToFill" />
5 5
     </view>
6 6
     <view class="common-content-wrapper">
7 7
       <view class="common-card">
8 8
         <!-- common title -->
9
-        <view class="common-card-title">中石化海清高速服务区加油站</view>
9
+        <view class="common-card-title">{{ refuelInfo.title }}</view>
10 10
         <!-- sub title -->
11
-        <view class="common-sub-title">营业时间:24小时</view>
12
-        <view class="common-sub-title">客服电话:0532-8886666</view>
11
+        <view class="common-sub-title">营业时间:{{ refuelInfo?.businessAt }}</view>
12
+        <view class="common-sub-title">客服电话:{{ refuelInfo?.mobile }}</view>
13 13
       </view>
14 14
       <view class="common-card">
15 15
         <view class="common-card-title u-margin-bottom-20">当前油价</view>
16
-        <HyStation type="2" v-for="index in 4" :key="index"></HyStation>
16
+        <HyStation type="2" v-for="(item, index) in list" :key="index" :item="item"></HyStation>
17 17
         <view class="common-card-title u-margin-top-45">温馨提示</view>
18 18
         <view class="common-card-content">
19
-          <text>1、进出加油站时,请严格遵守交通规则和指示标识,注意观察礼让其他车辆。</text>
20
-          <text>2、加油前请熄火,不要拨打电话。</text>
21
-          <text>3、加油站区域内请勿吸烟、使用明火(如打火机)。</text>
22
-          <text>4、如需开具发票,请联系站内工作人员。</text>
19
+          <u-parse :html="content?.intro" />
23 20
         </view>
24 21
       </view>
25 22
     </view>
@@ -28,8 +25,42 @@
28 25
 
29 26
 <script setup lang="ts">
30 27
 import { ref } from 'vue'
28
+import { onLoad } from '@dcloudio/uni-app'
29
+import { getParkServiceOil } from '@/api/home'
31 30
 import { useGlobal } from '../../composables/index'
32 31
 const { minioUrl } = useGlobal()
32
+
33
+// 我要加油
34
+const refuelInfo = ref<any>({})
35
+const content = ref<any>({})
36
+const list = ref<any>([])
37
+onLoad(async () => {
38
+  const parkId = uni.getStorageSync('parkId')
39
+  if (parkId) {
40
+    const res = await getParkServiceOil(parkId)
41
+    if (res.code === 200) {
42
+      refuelInfo.value = res.data
43
+      content.value = JSON.parse(refuelInfo.value.content)
44
+      const {
45
+        oil92ActivityPrice,
46
+        oil92OriginalPrice,
47
+        oil95ActivityPrice,
48
+        oil95OriginalPrice,
49
+        oil89ActivityPrice,
50
+        oil89OriginalPrice,
51
+        dieselActivityPrice,
52
+        dieselOriginalPrice
53
+      } = content.value
54
+      const _list = [
55
+        { name: '92#', activityPrice: oil92ActivityPrice, originalPrice: oil92OriginalPrice },
56
+        { name: '95#', activityPrice: oil95ActivityPrice, originalPrice: oil95OriginalPrice },
57
+        { name: '89#', activityPrice: oil89ActivityPrice, originalPrice: oil89OriginalPrice },
58
+        { name: '柴油#', activityPrice: dieselActivityPrice, originalPrice: dieselOriginalPrice }
59
+      ]
60
+      list.value = _list
61
+    }
62
+  }
63
+})
33 64
 </script>
34 65
 
35 66
 <style lang="scss" scoepd>

+ 18 - 10
src/base/common/repair.vue

@@ -1,23 +1,20 @@
1 1
 <template>
2 2
   <view class="common-details-container">
3 3
     <view class="common-header-wrapper">
4
-      <image :src="minioUrl + '/img_xiuche_bg.png'" mode="scaleToFill" />
4
+      <image :src="content.image" mode="scaleToFill" />
5 5
     </view>
6 6
     <view class="common-content-wrapper">
7 7
       <view class="common-card">
8 8
         <!-- common title -->
9
-        <view class="common-card-title">驿驰汽修</view>
9
+        <view class="common-card-title">{{ carInfo?.title }}</view>
10 10
         <!-- sub title -->
11
-        <view class="common-sub-title">营业时间:24小时</view>
12
-        <view class="common-sub-title">客服电话:0532-8886666</view>
11
+        <view class="common-sub-title">营业时间:{{ carInfo?.businessAt }}</view>
12
+        <view class="common-sub-title">客服电话:{{ carInfo?.mobile }}</view>
13 13
       </view>
14 14
       <view class="common-card">
15
-        <view class="common-card-title u-margin-bottom-20">免费项目</view>
16 15
         <view class="common-card-content">
17
-          <text>大货车免费汽修项目:启动搭电、胎压检测</text>
18
-          <text>小客车免费汽修项目:启动搭电、胎压检测、轮胎充气</text>
16
+          <u-parse :html="content?.intro" />
19 17
         </view>
20
-        <view class="common-card-title u-margin-top-45">收费项目</view>
21 18
       </view>
22 19
     </view>
23 20
   </view>
@@ -25,8 +22,19 @@
25 22
 
26 23
 <script setup lang="ts">
27 24
 import { ref } from 'vue'
28
-import { useGlobal } from '../../composables/index'
29
-const { minioUrl } = useGlobal()
25
+import { onLoad } from '@dcloudio/uni-app'
26
+import { getParkServiceCar } from '@/api/home'
27
+
28
+const carInfo = ref<any>({})
29
+const content = ref<any>({})
30
+onLoad(async () => {
31
+  const parkId = uni.getStorageSync('parkId')
32
+  const res = await getParkServiceCar(parkId)
33
+  if (res.code === 200) {
34
+    carInfo.value = res.data
35
+    content.value = JSON.parse(carInfo.value.content)
36
+  }
37
+})
30 38
 </script>
31 39
 
32 40
 <style lang="scss" scoepd>

+ 34 - 15
src/base/shop/details.vue

@@ -1,41 +1,60 @@
1 1
 <template>
2 2
   <view class="common-details-container">
3 3
     <view class="common-header-wrapper">
4
-      <image src="" mode="scaleToFill" />
4
+      <image :src="content.image" mode="scaleToFill" />
5 5
     </view>
6 6
     <view class="common-content-wrapper">
7 7
       <view class="common-card">
8 8
         <!-- common title -->
9
-        <view class="common-card-title">肯德基海清高速服务区店</view>
9
+        <view class="common-card-title">{{ details.title }}</view>
10 10
         <!-- rate -->
11 11
         <view class="common-card-rate">
12
-          <uni-rate allow-half :value="5" color="#ddd" activeColor="#ff5702" />
12
+          <uni-rate allow-half :value="content.rate" color="#ddd" activeColor="#ff5702" />
13
+          <text>{{ content.rate }}</text>
13 14
         </view>
14 15
         <!-- sub title -->
15
-        <view class="common-sub-title">营业时间: 08:00-24:00</view>
16
+        <view class="common-sub-title">营业时间: {{ details.businessAt }}</view>
16 17
       </view>
17 18
       <view class="common-card">
18 19
         <view class="common-card-title">店铺简介</view>
19
-        <view class="common-card-content"
20
-          >肯德基(Kentucky Fried Chicken),简称KFC,
21
-          全球炸鸡连锁餐厅,总部位于美国肯塔基州路易斯维尔市,在世界上105个国家和地区开设有15000多家肯德基餐厅,
22
-          隶属于全球最大的餐饮连锁企业百胜餐饮集团。 产品以鸡肉为主,并不断推出新产品。</view
23
-        >
24
-        <view class="common-card-title u-margin-top-12">精品推荐</view>
25
-        <view class="common-card-list">
26
-          <view class="card-list-item" v-for="index in 6" :key="index">
20
+        <view class="common-card-content">
21
+          <u-parse :html="content?.intro" />
22
+        </view>
23
+        <view class="common-card-title u-margin-top-30">精品推荐</view>
24
+        <view class="common-card-list" v-if="content.facilities.length > 0">
25
+          <view class="card-list-item" v-for="(item, index) in content.facilities" :key="index">
27 26
             <view class="item-img-wrap">
28
-              <image src="" mode="scaleToFill" />
27
+              <image :src="item.img" mode="scaleToFill" />
29 28
             </view>
30
-            <view class="list-text">蜜汁全鸡</view>
29
+            <view class="list-text">{{ item.name }}</view>
31 30
           </view>
32 31
         </view>
32
+        <view class="common-empty" v-else>
33
+          <u-empty text="暂无推荐" />
34
+        </view>
33 35
       </view>
34 36
     </view>
35 37
   </view>
36 38
 </template>
37 39
 
38
-<script lang="ts" setup></script>
40
+<script lang="ts" setup>
41
+import { ref } from 'vue'
42
+import { onLoad } from '@dcloudio/uni-app'
43
+import { getParkServiceEatDetail } from '@/api/home'
44
+
45
+const id = ref<string>('')
46
+const details = ref<any>({})
47
+const content = ref<any>({})
48
+onLoad(async (options) => {
49
+  id.value = options?.id || ''
50
+  const parkId = uni.getStorageSync('parkId')
51
+  const res = await getParkServiceEatDetail(id.value, parkId)
52
+  if (res.code === 200) {
53
+    details.value = res.data
54
+    content.value = JSON.parse(details.value.content)
55
+  }
56
+})
57
+</script>
39 58
 
40 59
 <style lang="scss" scoepd>
41 60
 @import '../base.scss';

+ 42 - 2
src/base/shop/index.vue

@@ -1,10 +1,50 @@
1 1
 <template>
2 2
   <view class="shop-index-container">
3
-    <HyShopItem v-for="index in 5" :key="index" />
3
+    <mescroll-body @init="mescrollInit" :down="{ use: true, minAngle: angle }" @down="downCallback" @up="upCallback">
4
+      <HyShopItem v-for="(item, index) in list" :key="index" :item="item" />
5
+    </mescroll-body>
4 6
   </view>
5 7
 </template>
6 8
 
7
-<script lang="ts" setup></script>
9
+<script lang="ts" setup>
10
+import { ref, computed } from 'vue'
11
+import { onLoad, onShow, onPageScroll } from '@dcloudio/uni-app'
12
+import { getParkServiceShopList } from '@/api/home'
13
+import { useListLoader } from '@/composables/useListLoader'
14
+
15
+const angle = ref(45)
16
+// 监听页面滚动
17
+onPageScroll((e) => {
18
+  if (e.scrollTop > 80) {
19
+    angle.value = 90
20
+  } else {
21
+    angle.value = 45
22
+  }
23
+})
24
+
25
+let canReset = false
26
+onShow(() => {
27
+  if (canReset) {
28
+    handleSearch()
29
+  }
30
+  canReset = true
31
+})
32
+
33
+const list = computed(() => {
34
+  return listData.value.map((item: any) => ({
35
+    ...item,
36
+    content: JSON.parse(item.content)
37
+  }))
38
+})
39
+
40
+// 列表加载
41
+const { listData, upCallback, downCallback, handleSearch, mescrollInit } = useListLoader({
42
+  apiFn: getParkServiceShopList,
43
+  initialParams: {
44
+    parkId: uni.getStorageSync('parkId')
45
+  }
46
+})
47
+</script>
8 48
 
9 49
 <style lang="scss" scoepd>
10 50
 .shop-index-container {

+ 42 - 2
src/base/shop/meal.vue

@@ -1,10 +1,50 @@
1 1
 <template>
2 2
   <view class="shop-index-container">
3
-    <HyShopItem v-for="index in 5" :key="index" price />
3
+    <mescroll-body @init="mescrollInit" :down="{ use: true, minAngle: angle }" @down="downCallback" @up="upCallback">
4
+      <HyShopItem v-for="(item, index) in list" :key="index" :item="item" price />
5
+    </mescroll-body>
4 6
   </view>
5 7
 </template>
6 8
 
7
-<script lang="ts" setup></script>
9
+<script lang="ts" setup>
10
+import { ref, computed } from 'vue'
11
+import { onLoad, onShow, onPageScroll } from '@dcloudio/uni-app'
12
+import { getParkServiceEatList } from '@/api/home'
13
+import { useListLoader } from '@/composables/useListLoader'
14
+
15
+const angle = ref(45)
16
+// 监听页面滚动
17
+onPageScroll((e) => {
18
+  if (e.scrollTop > 80) {
19
+    angle.value = 90
20
+  } else {
21
+    angle.value = 45
22
+  }
23
+})
24
+
25
+let canReset = false
26
+onShow(() => {
27
+  if (canReset) {
28
+    handleSearch()
29
+  }
30
+  canReset = true
31
+})
32
+
33
+const list = computed(() => {
34
+  return listData.value.map((item: any) => ({
35
+    ...item,
36
+    content: JSON.parse(item.content)
37
+  }))
38
+})
39
+
40
+// 列表加载
41
+const { listData, upCallback, downCallback, handleSearch, mescrollInit } = useListLoader({
42
+  apiFn: getParkServiceEatList,
43
+  initialParams: {
44
+    parkId: uni.getStorageSync('parkId')
45
+  }
46
+})
47
+</script>
8 48
 
9 49
 <style lang="scss" scoepd>
10 50
 .shop-index-container {

+ 27 - 5
src/components/HyCharge.vue

@@ -1,18 +1,39 @@
1 1
 <template>
2 2
   <view class="charge-item-wrapper">
3
-    <view class="item-btn-wrap">快充</view>
3
+    <view class="item-btn-wrap">{{ title }}</view>
4 4
     <view class="item-content-wrap">
5 5
       <view class="text">空闲</view>
6 6
       <view class="content-number">
7
-        <view class="left-num">10</view>
8
-        <view class="right-num">/24</view>
7
+        <view class="left-num">{{ freeNum }}</view>
8
+        <view class="right-num">/{{ totalNum }}</view>
9 9
       </view>
10 10
     </view>
11
-    <view class="item-status-wrap">排队中</view>
11
+    <view class="item-status-wrap">{{ status }}</view>
12 12
   </view>
13 13
 </template>
14 14
 
15
-<script lang="ts" setup></script>
15
+<script lang="ts" setup>
16
+import { ref } from 'vue'
17
+
18
+const props = defineProps({
19
+  title: {
20
+    type: String,
21
+    default: '快充'
22
+  },
23
+  freeNum: {
24
+    type: Number,
25
+    default: 0
26
+  },
27
+  totalNum: {
28
+    type: Number,
29
+    default: 24
30
+  },
31
+  status: {
32
+    type: String,
33
+    default: '排队中'
34
+  }
35
+})
36
+</script>
16 37
 
17 38
 <style lang="scss" scoped>
18 39
 .charge-item-wrapper {
@@ -24,6 +45,7 @@
24 45
   display: flex;
25 46
   align-items: center;
26 47
   justify-content: center;
48
+  margin-bottom: 20rpx;
27 49
   .item-btn-wrap {
28 50
     width: 94rpx;
29 51
     height: 42rpx;

+ 13 - 7
src/components/HySelect.vue

@@ -21,6 +21,7 @@
21 21
 
22 22
 <script setup lang="ts">
23 23
 import { ref, computed, watch } from 'vue'
24
+import { getParkWebAPI } from '@/api/system'
24 25
 import { useGlobal } from '@/composables/index'
25 26
 const { minioUrl } = useGlobal()
26 27
 
@@ -45,19 +46,24 @@ const emit = defineEmits(['update:modelValue', 'change'])
45 46
 const dropdownVisible = ref(false)
46 47
 const selectedValue = ref(props.modelValue)
47 48
 
48
-const parkList = ref([
49
-  { id: '1', name: '海青服务区' },
50
-  { id: '2', name: '黄岛服务区' },
51
-  { id: '3', name: '南村服务区' },
52
-  { id: '4', name: '胶州服务区' }
53
-])
49
+const parkList = ref([]) as any
54 50
 
55 51
 // 计算当前选中的选项文本
56 52
 const selectedOptionText = computed(() => {
57
-  const selected = parkList.value.find((item) => item.id === selectedValue.value)
53
+  const selected = parkList.value.find((item: any) => item.id === selectedValue.value)
58 54
   return selected ? selected.name : ''
59 55
 })
60 56
 
57
+// 获取全部园区楼宇
58
+const getParkWeb = async () => {
59
+  const res = await getParkWebAPI()
60
+  if (res.code === 200) {
61
+    parkList.value = res.rows
62
+  }
63
+}
64
+
65
+getParkWeb()
66
+
61 67
 // 监听modelValue变化,同步内部状态
62 68
 watch(
63 69
   () => props.modelValue,

+ 16 - 14
src/components/HyShopItem.vue

@@ -1,38 +1,40 @@
1
+<!-- eslint-disable vue/no-mutating-props -->
1 2
 <template>
2
-  <view class="shop-item-wrapper" @click="navigateToDetails">
3
-    <view class="item-left-wrap"></view>
3
+  <view class="shop-item-wrapper" @click="navigateToDetails(item)">
4
+    <view class="item-left-wrap">
5
+      <image :src="item.content?.image" mode="scaleToFill" />
6
+    </view>
4 7
     <view class="item-right-wrap">
5 8
       <view class="top">
6
-        <view class="title u-line-1">肯德基</view>
9
+        <view class="title u-line-1">{{ item.title }}</view>
7 10
         <view class="rate-box">
8
-          <uni-rate allow-half v-model="rate" color="#ddd" activeColor="#ff5702" size="20" />
9
-          <text class="rate-text">{{ rate }}</text>
11
+          <uni-rate allow-half :value="item.content?.rate" disabled color="#ddd" disabledColor="#ff5702" activeColor="#ff5702" size="20" />
12
+          <text class="rate-text">{{ item.content?.rate }}</text>
10 13
         </view>
11
-        <view class="price" v-if="price">¥50/人</view>
14
+        <view class="price" v-if="price">¥{{ item.content?.price }}/人</view>
12 15
       </view>
13 16
       <view class="bottom">
14
-        <view class="tag-item">西式快餐</view>
15
-        <view class="tag-item">汉堡</view>
17
+        <view class="tag-item" v-for="(tag, index) in item.content?.tags" :key="index">{{ tag }}</view>
16 18
       </view>
17 19
     </view>
18 20
   </view>
19 21
 </template>
20 22
 
21 23
 <script lang="ts" setup>
22
-import { ref } from 'vue'
23
-
24
-const rate = ref(3.5)
25
-
26 24
 defineProps({
27 25
   price: {
28 26
     type: Boolean,
29 27
     default: false
28
+  },
29
+  item: {
30
+    type: Object,
31
+    default: () => ({})
30 32
   }
31 33
 })
32 34
 
33
-const navigateToDetails = () => {
35
+const navigateToDetails = (item: any) => {
34 36
   uni.navigateTo({
35
-    url: '/base/shop/details'
37
+    url: '/base/shop/details?id=' + item.id
36 38
   })
37 39
 }
38 40
 </script>

+ 16 - 6
src/components/HyStation.vue

@@ -3,23 +3,29 @@
3 3
     <template v-if="type === 1">
4 4
       <view class="station-card-wrap">
5 5
         <view class="card-header">
6
-          <view class="text">92#</view>
6
+          <view class="text">{{ item.name }}</view>
7 7
           <image :src="minioUrl + '/icon_sm_jiayou.png'" mode="scaleToFill" />
8 8
         </view>
9 9
         <view class="card-bottom">
10 10
           <view class="price-box">
11
-            <view class="price"><text>7.25</text>元</view>
11
+            <view class="price"
12
+              ><text>{{ item.activityPrice }}</text
13
+              >元</view
14
+            >
12 15
           </view>
13
-          <view class="origin-box">原价:7.90元</view>
16
+          <view class="origin-box">原价:{{ item.originalPrice }}元</view>
14 17
         </view>
15 18
       </view>
16 19
     </template>
17 20
     <template v-else>
18 21
       <view class="station-list-wrap">
19
-        <view class="station-name">92#</view>
22
+        <view class="station-name">{{ item.name }}</view>
20 23
         <view class="price-wrap">
21
-          <view class="price-text"><text>7.25</text>元</view>
22
-          <view class="origin-text">原价:7.90元</view>
24
+          <view class="price-text"
25
+            ><text>{{ item.activityPrice }}</text
26
+            >元</view
27
+          >
28
+          <view class="origin-text">原价:{{ item.originalPrice }}元</view>
23 29
         </view>
24 30
       </view>
25 31
     </template>
@@ -35,6 +41,10 @@ defineProps({
35 41
   type: {
36 42
     type: Number,
37 43
     default: 1
44
+  },
45
+  item: {
46
+    type: Object,
47
+    default: () => ({})
38 48
   }
39 49
 })
40 50
 </script>

+ 3 - 3
src/components/HyTag.vue

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <view class="tag-item-wrapper">
3 3
     <view class="tag-item-content" :class="{ 'need-border': needBorder }">
4
-      <image :src="minioUrl + imgUrl" :style="{ width: imgWidth, height: imgHeight }" />
4
+      <image :src="imgUrl" :style="{ width: imgWidth, height: imgHeight }" />
5 5
       <view class="tag-item-text" :style="{ fontSize: fontSize }">{{ text }}</view>
6 6
     </view>
7 7
   </view>
@@ -23,7 +23,7 @@ defineProps({
23 23
   },
24 24
   imgUrl: {
25 25
     type: String,
26
-    default: '/icon_iot_canyin.png'
26
+    default: ''
27 27
   },
28 28
   text: {
29 29
     type: String,
@@ -43,7 +43,7 @@ defineProps({
43 43
 <style lang="scss" scoped>
44 44
 .tag-item-wrapper {
45 45
   box-sizing: border-box;
46
-  margin: 0 10rpx 20rpx 0;
46
+  margin: 0 20rpx 20rpx 0;
47 47
   .tag-item-content {
48 48
     border-radius: 4rpx;
49 49
     display: flex;

+ 68 - 7
src/pages/index.vue

@@ -1,6 +1,7 @@
1 1
 <script setup lang="ts">
2 2
 import { ref } from 'vue'
3 3
 import { onLoad } from '@dcloudio/uni-app'
4
+import { getParkServiceOil, getParkServicePower, getParkServiceShopList } from '@/api/home'
4 5
 import { useGlobal } from '@/composables/index'
5 6
 const { minioUrl } = useGlobal()
6 7
 
@@ -24,13 +25,68 @@ const navList = ref([
24 25
   { image: `${minioUrl}/icon_nav_10.png`, text: '招商加盟', path: '/base/common/join', w: '76rpx', h: '76rpx' }
25 26
 ])
26 27
 
27
-const selectedValue = ref('1')
28
+const selectedValue = ref('')
28 29
 
29 30
 // 一键救援弹窗展示
30 31
 const isRescueShow = ref(false)
31 32
 // 失物招领弹窗展示
32 33
 const isLostFoundShow = ref(false)
33 34
 
35
+onLoad(() => {
36
+  const parkId = '1998662443205042178'
37
+  selectedValue.value = parkId
38
+  // 存储到本地缓存中
39
+  uni.setStorageSync('parkId', parkId)
40
+  // 获取我要加油数据
41
+  getOilList()
42
+  // 获取我要充电数据
43
+  getPowerList()
44
+  // 获取精选商家数据
45
+  getShopList()
46
+})
47
+
48
+// 获取我要加油数据
49
+const oilInfo = ref<any>({})
50
+const listOli = ref<any>([])
51
+const getOilList = async () => {
52
+  const res = (await getParkServiceOil(selectedValue.value)) as any
53
+  oilInfo.value = JSON.parse(res.data.content)
54
+  const {
55
+    oil92ActivityPrice,
56
+    oil92OriginalPrice,
57
+    oil95ActivityPrice,
58
+    oil95OriginalPrice,
59
+    oil89ActivityPrice,
60
+    oil89OriginalPrice,
61
+    dieselActivityPrice,
62
+    dieselOriginalPrice
63
+  } = oilInfo.value
64
+  const _list = [
65
+    { name: '92#', activityPrice: oil92ActivityPrice, originalPrice: oil92OriginalPrice },
66
+    { name: '95#', activityPrice: oil95ActivityPrice, originalPrice: oil95OriginalPrice },
67
+    { name: '89#', activityPrice: oil89ActivityPrice, originalPrice: oil89OriginalPrice },
68
+    { name: '柴油#', activityPrice: dieselActivityPrice, originalPrice: dieselOriginalPrice }
69
+  ]
70
+  listOli.value = _list
71
+}
72
+
73
+// 获取我要充电数据
74
+const powerInfo = ref<any>({})
75
+const getPowerList = async () => {
76
+  const res = (await getParkServicePower(selectedValue.value)) as any
77
+  powerInfo.value = JSON.parse(res.data.content)
78
+}
79
+
80
+// 获取精选商家数据
81
+const shopList = ref<any>([])
82
+const getShopList = async () => {
83
+  const res = (await getParkServiceShopList({ parkId: selectedValue.value })) as any
84
+  shopList.value = res.rows.slice(0, 5).map((item: any) => ({
85
+    ...item,
86
+    content: JSON.parse(item.content)
87
+  }))
88
+}
89
+
34 90
 // 金刚区点击事件
35 91
 const navClick = (item: { path: string; type?: string; text?: string }) => {
36 92
   if (item.type === 'popup') {
@@ -156,12 +212,13 @@ const callPhone = (phone: string) => {
156 212
       ></u-tabs>
157 213
       <template v-if="tabActive === 0">
158 214
         <view class="tab-station-wrap">
159
-          <HyStation v-for="index in 4" :key="index" />
215
+          <HyStation v-for="(item, index) in listOli" :key="index" :item="item"></HyStation>
160 216
         </view>
161 217
       </template>
162 218
       <template v-if="tabActive === 1">
163
-        <view class="tab-station-wrap">
164
-          <HyCharge />
219
+        <view class="tab-station-wrap column">
220
+          <HyCharge title="快充" :freeNum="powerInfo?.fastChargeFree" :totalNum="powerInfo?.fastChargeTotal" :status="powerInfo?.fastChargeStatus" />
221
+          <HyCharge title="慢充" :freeNum="powerInfo?.slowChargeFree" :totalNum="powerInfo?.slowChargeTotal" :status="powerInfo?.slowChargeStatus" />
165 222
         </view>
166 223
       </template>
167 224
     </view>
@@ -174,11 +231,11 @@ const callPhone = (phone: string) => {
174 231
     <!-- 人气优选商家 -->
175 232
     <HyCard title="人气优选商家" rightText="更多商家" isShowRight :marginBottom="24" @clickRight="navigateToShop">
176 233
       <view class="index-shop-wrapper">
177
-        <view class="shop-item" v-for="index in 5" :key="index">
234
+        <view class="shop-item" v-for="(item, index) in shopList" :key="index">
178 235
           <view class="img-wrap">
179
-            <image src="" mode="scaleToFill" />
236
+            <image :src="item.content.image" mode="scaleToFill" />
180 237
           </view>
181
-          <view class="item-text u-line-1">肯德基</view>
238
+          <view class="item-text u-line-1">{{ item.title }}</view>
182 239
         </view>
183 240
       </view>
184 241
     </HyCard>
@@ -462,6 +519,9 @@ const callPhone = (phone: string) => {
462 519
       align-items: center;
463 520
       justify-content: space-around;
464 521
       margin-top: 24rpx;
522
+      &.column {
523
+        flex-direction: column;
524
+      }
465 525
     }
466 526
   }
467 527
   .index-service-wrapper {
@@ -502,6 +562,7 @@ const callPhone = (phone: string) => {
502 562
         width: 100rpx;
503 563
         text-align: center;
504 564
         margin-top: 12rpx;
565
+        font-size: 24rpx;
505 566
       }
506 567
     }
507 568
   }

+ 1 - 1
src/stores/modules/user.ts

@@ -44,7 +44,7 @@ export const user = defineStore(
44 44
       setPermissions,
45 45
       setToken,
46 46
       setUserInfo,
47
-      clearInfo,
47
+      clearInfo
48 48
     }
49 49
   },
50 50
   // 持久化配置