skyline 2 дней назад
Родитель
Сommit
5d9168e1e2

+ 12 - 2
car-wash-miniapp/src/main/java/com/kym/miniapp/controller/WashOrderController.java

@@ -3,9 +3,13 @@ package com.kym.miniapp.controller;
 import cn.dev33.satoken.annotation.SaIgnore;
 import com.kym.common.R;
 import com.kym.common.controller.IController;
+import com.kym.entity.WashOrder;
 import com.kym.entity.common.PageParams;
 import com.kym.entity.queryParams.WashOrderQueryParams;
+import com.kym.entity.vo.WashOrderVo;
 import com.kym.service.WashOrderService;
+import com.kym.service.cache.KymCache;
+import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 
 /**
@@ -45,8 +49,14 @@ public class WashOrderController extends IController {
      * @return
      */
     @GetMapping(value = "/detailWashOrder")
-    R<?> listMyWashOrder(@ModelAttribute WashOrderQueryParams params) {
-        return resp(() -> washOrderService.queryOrder(params));
+    R<?> detailWashOrder(@ModelAttribute WashOrderQueryParams params) {
+        return resp(() -> {
+            WashOrder order = washOrderService.queryOrder(params);
+            WashOrderVo vo = new WashOrderVo();
+            BeanUtils.copyProperties(order, vo);
+            vo.setStationName(KymCache.INSTANCE.getStationNameById(order.getStationId()));
+            return vo;
+        });
     }
 
     /**

+ 40 - 11
car-wash-mp/src/components/station/index.vue

@@ -26,9 +26,15 @@
       </view>
     </view>
 
-    <view class="station_item-distance">
-      <text class="business_hours">营业时间: {{ item.businessHours }}</text>
-      <uv-text class="parking-fee" color="#C6171E" :text="item.parkingFee" size="13"></uv-text>
+    <view class="station_item-footer">
+      <view class="footer-row">
+        <uv-icon name="clock" size="14" color="#909399"></uv-icon>
+        <text class="business_hours">营业时间: {{ item.businessHours }}</text>
+      </view>
+      <view class="footer-row" v-if="item.parkingFee">
+        <text class="parking-icon">P</text>
+        <text class="parking-fee">{{ item.parkingFee }}</text>
+      </view>
     </view>
   </view>
 </template>
@@ -216,18 +222,41 @@ defineExpose({
     }
   }
 
-  &-distance {
-    font-size: $uni-font-size-sm;
-    color: $uni-text-color-tertiary;
-    padding-top: 12rpx;
-    border-top: 1px solid $uni-border-color-light;
+  &-footer {
     display: flex;
-    justify-content: space-between;
-    align-items: center;
+    flex-direction: column;
+    gap: 10rpx;
+    padding-top: 16rpx;
+    border-top: 1px solid $uni-border-color-light;
+
+    .footer-row {
+      display: flex;
+      align-items: center;
+      gap: 8rpx;
+    }
+
+    .business_hours {
+      font-size: $uni-font-size-sm;
+      color: $uni-text-color-tertiary;
+    }
 
     .parking-fee {
-      font-weight: $uni-font-weight-medium;
+      font-size: $uni-font-size-sm;
       color: $uni-color-primary;
+      font-weight: $uni-font-weight-medium;
+    }
+
+    .parking-icon {
+      width: 28rpx;
+      height: 28rpx;
+      line-height: 28rpx;
+      text-align: center;
+      font-size: 18rpx;
+      font-weight: $uni-font-weight-bold;
+      color: #fff;
+      background: $uni-color-primary;
+      border-radius: 4rpx;
+      flex-shrink: 0;
     }
   }
 }

+ 5 - 0
car-wash-mp/src/pages-order/detail/index.vue

@@ -39,6 +39,11 @@
             </view>
           </view>
 
+          <view class="info-item" v-if="state.detail.stationName">
+            <text class="info-label">消费站点</text>
+            <text class="info-value">{{ state.detail.stationName }}</text>
+          </view>
+
           <view class="info-item">
             <text class="info-label">开始时间</text>
             <text class="info-value">{{ fmtDateTime(state.detail.startTime) }}</text>

+ 5 - 0
car-wash-mp/src/pages-order/list/index.vue

@@ -36,6 +36,11 @@
 
           <view class="order-content">
             <view class="order-info">
+              <view class="info-item" v-if="item.stationName">
+                <uv-icon name="map" size="16" color="#909399"></uv-icon>
+                <text class="info-label">消费站点</text>
+                <text class="info-value">{{ item.stationName }}</text>
+              </view>
               <view class="info-item">
                 <uv-icon name="clock" size="16" color="#909399"></uv-icon>
                 <text class="info-label">消费时间</text>

+ 19 - 5
car-wash-mp/src/pages-wash/device/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="page-container">
-    <uv-navbar title="洗车机" bgColor="#C6171E" leftIconColor="#FFFFFF" :titleStyle="{ color: '#FFFFFF' }" :autoBack="true" :placeholder="true"></uv-navbar>
+    <uv-navbar title="洗车机" bgColor="#C6171E" leftIconColor="#FFFFFF" :titleStyle="{ color: '#FFFFFF' }" :placeholder="true" @leftClick="handleNavigateBack"></uv-navbar>
     <scroll-view class="content-scroll" scroll-y="true">
       <!-- 设备信息卡片 -->
       <view class="device-info-card">
@@ -127,6 +127,14 @@ const initState = () => ({
 const state = reactive(initState())
 const timerId = ref<ReturnType<typeof setInterval> | null>(null)
 
+const loadBalance = () => {
+  get('/account/balance').then((res: any) => {
+    state.balance = res.balance
+    const gd = getApp<any>().globalData
+    gd.user = Object.assign({}, gd.user, { balance: res.balance })
+  })
+}
+
 onHide(() => {
   if (timerId.value) {
     clearInterval(timerId.value);
@@ -155,7 +163,7 @@ onLoad((options: any) => {
     state.isLogin =true;
     setTimeout(() => {
       loadDeviceDetail(id);
-      state.balance = getApp<any>().globalData.user.balance
+      loadBalance()
     }, 200)
   }).catch(e => {
     console.error("onLoad 校验登录失败,自动跳转登录页")
@@ -175,7 +183,7 @@ onShow((options:any) => {
       loadDeviceDetail(state.deviceId);
     }
     state.isLogin =true;
-    state.balance = getApp<any>().globalData.user.balance
+    loadBalance()
   }).catch(e => {
     console.error("校验登录失败,自动跳转登录页")
     setTimeout(()=>{
@@ -195,7 +203,7 @@ const addListener = () => {
     state.isLogin =true;
     if (state.deviceId && data.isLogin) {
       loadDeviceDetail(state.deviceId);
-      state.balance = getApp<any>().globalData.user.balance
+      loadBalance()
     }
   })
 
@@ -233,7 +241,12 @@ const  loadDeviceDetail = (id: any) => {
 }
 
 const handleNavigateBack = () => {
-  uni.navigateBack();
+  const pages = getCurrentPages()
+  if (pages.length > 1) {
+    uni.navigateBack()
+  } else {
+    uni.switchTab({ url: '/pages/index/index' })
+  }
 }
 
 const debounceStartStopDevice = debounce(() => {
@@ -273,6 +286,7 @@ const handleClickDevice = () => {
               title: '设备停机成功'
             })
             state.device.state = 'idle'
+            loadBalance()
 
           })
         }

+ 0 - 1
car-wash-mp/src/pages-wash/station/index.vue

@@ -53,7 +53,6 @@
           >
             <view class="device-header">
               <view class="device-name">
-                <uv-icon name="car" size="18" color="#C6171E"></uv-icon>
                 <text>{{ device.seqName }}</text>
               </view>
               <view class="device-status" :class="'status-' + getDeviceStatusClass(device.state)">

+ 1 - 0
car-wash-service/src/main/java/com/kym/service/impl/WashOrderServiceImpl.java

@@ -209,6 +209,7 @@ public class WashOrderServiceImpl extends MyBaseServiceImpl<WashOrderMapper, Was
         var voList = pages.getList().stream().map(order -> {
             var vo = new WashOrderVo();
             BeanUtils.copyProperties(order, vo);
+            vo.setStationName(KymCache.INSTANCE.getStationNameById(order.getStationId()));
             return vo;
         }).toList();
         PageBean<WashOrderVo> bean = new PageBean<>(voList);