Explorar o código

小程序司机端修改

chenwei hai 1 mes
pai
achega
6adf04d385

+ 3 - 3
VMMB.Blazor.Web-master/EasyTemplate.Blazor.Web/Properties/launchSettings.json

@@ -7,7 +7,7 @@
         "ASPNETCORE_ENVIRONMENT": "Development"
       },
       "dotnetRunMessages": true,
-      "applicationUrl": "http://10.153.140.16:5076"
+      "applicationUrl": "http://10.153.140.33:5076"
     },
     "IIS Express": {
       "commandName": "IISExpress",
@@ -19,10 +19,10 @@
     "WSL": {
       "commandName": "WSL2",
       "launchBrowser": true,
-      "launchUrl": "http://10.153.140.16:5076",
+      "launchUrl": "http://10.153.140.33:5076",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development",
-        "ASPNETCORE_URLS": "http://10.153.140.16:5076"
+        "ASPNETCORE_URLS": "http://10.153.140.33:5076"
       },
       "distributionName": ""
     }

+ 13 - 2
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/InvoiceRecord/InvoiceRecordEntity.cs

@@ -4,7 +4,7 @@ using System;
 using System.Collections.Generic;
 using System.Text;
 
-namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.InvoiceRecord
+namespace EasyTemplate.Tool.Entity.System.VehicleTerminal.InvoiceRecord
 {
     /// <summary>
     /// 开票记录表
@@ -20,35 +20,46 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.InvoiceRecord
         /// <summary>
         /// 开票主体
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string InvoiceSubject { get; set; }
 
         /// <summary>
         /// 开票时间
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public DateTime? InvoiceTime { get; set; }
 
         /// <summary>
         /// 开票金额
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public decimal? InvoiceAmount { get; set; }
 
         /// <summary>
         /// 开票抬头
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string InvoiceTitle { get; set; }
 
         /// <summary>
         /// 开票站点ID
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public long? SiteId { get; set; }
         /// <summary>
         /// 开票信息
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public string InvoiceData { get; set; }
         /// <summary>
         /// 订单id
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public long TransactionId { get; set; }
-
+        /// <summary>
+        /// 用户id
+        /// </summary>
+        [SugarColumn(IsNullable = true)]
+        public long UserId { get; set; }
     }
 }

+ 0 - 31
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/InvoiceRecord/InvoiceUserRelationEntity.cs

@@ -1,31 +0,0 @@
-using EasyTemplate.Tool.Entity;
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.InvoiceRecord
-{
-    /// <summary>
-    /// 开票记录与用户关系表
-    /// </summary>
-    [SugarTable(null, "开票记录与用户关系表")]
-    public class InvoiceUserRelationEntity : EntityBaseLite
-    {
-        /// <summary>
-        /// 主键ID
-        /// </summary>
-        public long Id { get; set; }
-
-        /// <summary>
-        /// 用户ID
-        /// </summary>
-        public long? UserId { get; set; }
-
-        /// <summary>
-        /// 开票记录ID
-        /// </summary>
-        public long? InvoiceId { get; set; }
-
-    }
-}

+ 1 - 0
VMMB.Blazor.Web-master/EasyTemplate.Tool/Entity/System/VehicleTerminal/TrackPoint/TrackPointEntity.cs

@@ -39,6 +39,7 @@ namespace ZhonTai.Admin.Contracts.Domain.VehicleTerminal.TrackPoint
         /// <summary>
         /// 最后更新时间
         /// </summary>
+        [SugarColumn(IsNullable = true)]
         public DateTime? LastUpdatedTime { get; set; }
 
     }

+ 2 - 1
wx/Fuelwx/app.json

@@ -30,7 +30,8 @@
     "pages/driver/trackRecord/trackRecord",
     "pages/driver/jieban/jieba",
     "pages/history/invoice",
-    "pages/history/h5Invoice"
+    "pages/history/h5Invoice",
+    "pages/driver/monitoringScreen/monitoringScreen"
   ],
   "window": {
     "navigationBarTextStyle": "black",

+ 6 - 2
wx/Fuelwx/js/api.js

@@ -253,7 +253,10 @@ function request_GetInvoiceInfo(data) {
 function request_UpdateInvoiceInfo(data) {
   return request('api/Transactions/UpdateInvoiceInfo', "POST", data);
 }
-
+//小程序查询历史订单,司机端
+function request_WXFindDriverOrders(dateTime,pageNum,lineCount) {
+  return request('api/Transactions/WXFindDriverOrders?dateTime='+ dateTime + '&pageNum='+ pageNum+ '&lineCount='+ lineCount, "GET");
+}
 //司机端班结首页
 function request_DriverHome(data) {
   return request('api/Driver/DriverHome', "GET", data);
@@ -290,5 +293,6 @@ export default {
   request_UpdateInvoiceInfo,
   request_DriverHome,
   request_EndOfShift,
-  request_GetShitRecord
+  request_GetShitRecord,
+  request_WXFindDriverOrders
 }

+ 66 - 0
wx/Fuelwx/pages/driver/monitoringScreen/monitoringScreen.js

@@ -0,0 +1,66 @@
+// pages/driver/monitoringScreen/monitoringScreen.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
+})

+ 3 - 0
wx/Fuelwx/pages/driver/monitoringScreen/monitoringScreen.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 1 - 0
wx/Fuelwx/pages/driver/monitoringScreen/monitoringScreen.wxml

@@ -0,0 +1 @@
+<web-view src="http://localhost:8023/monitoringScreen.html"></web-view>

+ 1 - 0
wx/Fuelwx/pages/driver/monitoringScreen/monitoringScreen.wxss

@@ -0,0 +1 @@
+/* pages/driver/monitoringScreen/monitoringScreen.wxss */

+ 126 - 178
wx/Fuelwx/pages/driver/refuelRecords/refuelRecords.js

@@ -1,207 +1,155 @@
-// pages/driver/refuel-records/refuel-records.js
+const { default: api } = require("../../../js/api");
+
 Page({
 
-  /**
-   * 页面的初始数据
-   */
   data: {
-    selectedDate: '2026-02-15',
-    recordList: [] // 加油流水列表
-  },
 
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
-    this.loadRecords(this.data.selectedDate);
-  },
+    selectedDate: '',
+    pageNum: 1,
+    pageSize: 10,
 
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady() {
+    recordList: []
 
   },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow() {
+  onLoad() {
 
-  },
+    const today = this.formatDate(new Date())
 
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide() {
+    this.setData({
+      selectedDate: today
+    })
+
+    this.getOrder()
 
   },
 
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload() {
+  onDateChange(e) {
+
+    this.setData({
+      selectedDate: e.detail.value
+    })
 
   },
 
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh() {
+  queryRecords() {
 
-  },
+    this.setData({
+      pageNum: 1,
+      recordList: []
+    })
 
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom() {
+    this.getOrder()
 
   },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage() {
+  getOrder() {
 
-  },
+    wx.showLoading({
+      title: '加载中'
+    })
 
-  /**
-   * 日期选择变化
-   */
-  onDateChange(e) {
-    this.setData({
-      selectedDate: e.detail.value
-    });
-  },
+    api.request_WXFindDriverOrders(
+      this.data.selectedDate,
+      this.data.pageNum,
+      this.data.pageSize
+    ).then(res => {
 
-  /**
-   * 查询按钮点击事件
-   */
-  queryRecords() {
-    this.loadRecords(this.data.selectedDate);
-  },
+      wx.hideLoading()
 
-  /**
-   * 根据日期加载加油流水记录(模拟数据)
-   */
-  loadRecords(date) {
-    wx.showLoading({
-      title: '查询中...',
-    });
-
-    setTimeout(() => {
-      let recordList = [];
-
-      if (date === '2026-02-10') {
-        recordList = [
-          {
-            time: '2023-10-10 09:15:22',
-            orderId: 'O20231010091522',
-            productName: '92#汽油',
-            unitPrice: '¥8.02/L',
-            volume: '22.5 L',
-            paymentMethod: '微信支付',
-            receivable: '¥180.45',
-            status: '已完成',
-            userName: '张三',
-            userPhone: '138****1234'
-          },
-          {
-            time: '2023-10-10 11:30:45',
-            orderId: 'O20231010113045',
-            productName: '95#汽油',
-            unitPrice: '¥8.52/L',
-            volume: '30.2 L',
-            paymentMethod: '现金支付',
-            receivable: '¥257.30',
-            status: '已完成',
-            userName: '李四',
-            userPhone: '139****5678'
-          }
-        ];
-      } else if (date === '2023-10-18') {
-        recordList = [
-          {
-            time: '2023-10-18 08:45:33',
-            orderId: 'O20231018084533',
-            productName: '0#柴油',
-            unitPrice: '¥7.65/L',
-            volume: '50.8 L',
-            paymentMethod: '通联支付',
-            receivable: '¥388.62',
-            status: '已完成',
-            userName: '王五',
-            userPhone: '136****9012'
-          }
-        ];
-      } else {
-        // 默认显示原始数据
-        recordList = [
-          {
-            time: '2026-02-15 08:30:25',
-            orderId: 'O20231015083025',
-            productName: '92#汽油',
-            unitPrice: '¥8.02/L',
-            volume: '25.8 L',
-            paymentMethod: '微信支付',
-            receivable: '¥206.92',
-            status: '已完成',
-            userName: '张三',
-            userPhone: '138****1234'
-          },
-          {
-            time: '2026-02-15 09:15:42',
-            orderId: 'O20231015091542',
-            productName: '95#汽油',
-            unitPrice: '¥8.52/L',
-            volume: '32.5 L',
-            paymentMethod: '现金支付',
-            receivable: '¥276.90',
-            status: '已完成',
-            userName: '李四',
-            userPhone: '139****5678'
-          },
-          {
-            time: '2026-02-15 10:20:18',
-            orderId: 'O20231015102018',
-            productName: '0#柴油',
-            unitPrice: '¥7.65/L',
-            volume: '45.2 L',
-            paymentMethod: '通联支付',
-            receivable: '¥345.78',
-            status: '已完成',
-            userName: '王五',
-            userPhone: '136****9012'
-          },
-          {
-            time: '2026-02-15 11:45:33',
-            orderId: 'O20231015114533',
-            productName: '92#汽油',
-            unitPrice: '¥8.02/L',
-            volume: '18.6 L',
-            paymentMethod: '银联支付',
-            receivable: '¥149.17',
-            status: '已完成',
-            userName: '赵六',
-            userPhone: '137****3456'
-          },
-          {
-            time: '2023-10-15 14:30:55',
-            orderId: 'O20231015143055',
-            productName: '95#汽油',
-            unitPrice: '¥8.52/L',
-            volume: '28.3 L',
-            paymentMethod: '微信支付',
-            receivable: '¥241.12',
-            status: '已完成',
-            userName: '钱七',
-            userPhone: '135****7890'
-          }
-        ];
+      console.log("订单数据", res)
+
+      let datas = res.data.data || []
+
+      let list = datas.map(item => {
+
+        let payText = "其他支付"
+
+        if (item.paymentMethod === 1) payText = "微信支付"
+        if (item.paymentMethod === 2) payText = "现金支付"
+        if (item.paymentMethod === 5) payText = "通联支付"
+
+        let statusText = "未知"
+
+        if (item.orderStatus === 0) statusText = "未支付"
+        if (item.orderStatus === 1) statusText = "已支付"
+        if (item.orderStatus === 4) statusText = "已完成"
+        if (item.orderStatus === 5) statusText = "已取消"
+
+        return {
+
+          time: item.transactionTime ? item.transactionTime.replace("T", " ") : '',
+
+          orderId: item.billNumber || '',
+
+          productName: item.oilProduct || '',
+
+          unitPrice: "¥" + (item.oilPrice || 0) + "/L",
+
+          volume: (item.oilVolume || 0) + " L",
+
+          paymentMethod: payText,
+
+          receivable: "¥" + (item.payableAmount || 0),
+
+          status: statusText,
+
+          userName: item.licencePlate || "司机",
+
+          userPhone: item.mobile || ""
+
+        }
+
+      })
+
+      this.setData({
+        recordList: list
+      })
+
+    }).catch(err => {
+
+      wx.hideLoading()
+
+      wx.showToast({
+        title: '加载失败',
+        icon: 'none'
+      })
+
+      console.log(err)
+
+    })
+
+  },
+  cashCancel(e){
+
+    const orderId = e.currentTarget.dataset.id
+  
+    wx.showModal({
+      title:'提示',
+      content:'确认现金消单吗?',
+      success:(res)=>{
+  
+        if(res.confirm){
+  
+          console.log("消单订单",orderId)
+  
+          // 这里调用你的接口
+          // api.cashCancel(orderId)
+  
+        }
+  
       }
+    })
+  
+  },
+  formatDate(date) {
+
+    const y = date.getFullYear()
+    const m = (date.getMonth() + 1).toString().padStart(2, '0')
+    const d = date.getDate().toString().padStart(2, '0')
+
+    return `${y}-${m}-${d}`
 
-      this.setData({ recordList });
-      wx.hideLoading();
-    }, 500);
   }
+
 })

+ 21 - 4
wx/Fuelwx/pages/driver/refuelRecords/refuelRecords.wxml

@@ -26,19 +26,36 @@
       <!-- 第三行:升数和支付方式 -->
       <view class="amount-payment">
         <view class="amount">升数:{{item.volume}}</view>
-        <view class="payment-method">{{item.paymentMethod}}</view>
+        <view class="payment-method">支付方式:{{item.paymentMethod}}</view>
       </view>
       <!-- 第四行:应收款和状态 -->
       <view class="amount-status">
-        <view class="receivable">{{item.receivable}}</view>
-        <view class="status">{{item.status}}</view>
+        <view class="receivable">应付:{{item.receivable}}</view>
+        <view class="card-footer">
+
+<view class="status">
+  {{item.status}}
+</view>
+
+<button 
+  wx:if="{{item.status == '未支付'}}"
+  class="cancel-btn"
+  size="mini"
+  bindtap="cashCancel"
+  data-id="{{item.orderId}}">
+    现金消单
+</button>
+
+</view>
       </view>
       <!-- 第五行:用户信息 -->
       <view class="user-info">
-        <view class="user-name">{{item.userName}}</view>
         <view class="user-phone">{{item.userPhone}}</view>
       </view>
     </view>
+    <view wx:if="{{recordList.length == 0}}" class="empty-box">
+  <text class="empty-text">暂无订单数据</text>
+</view>
   </view>
   
   <!-- 自定义导航条 (请根据实际路径调整) -->

+ 27 - 0
wx/Fuelwx/pages/driver/refuelRecords/refuelRecords.wxss

@@ -137,7 +137,15 @@
   font-weight: bold;
   color: #0D7EE7;
 }
+.empty-box {
+  text-align: center;
+  margin-top: 200rpx;
+  color: #999;
+}
 
+.empty-text {
+  font-size: 30rpx;
+}
 .status {
   font-size: 24rpx;
   padding: 8rpx 16rpx;
@@ -153,4 +161,23 @@
   align-items: center;
   font-size: 28rpx;
   color: #666;
+}
+.card-footer{
+  display:flex;
+  justify-content:space-between;
+  align-items:center;
+  margin-top:20rpx;
+}
+
+.cancel-btn{
+  background: #fff1f0;
+  color:#ff4d4f;
+  border:none;
+  border-radius: 30rpx;
+  font-size:24rpx;
+  padding:8rpx 28rpx;
+}
+
+.cancel-btn::after{
+  border:none;
 }

+ 2 - 0
wx/Fuelwx/pages/driver/shiftRecord/shiftRecord.js

@@ -9,6 +9,8 @@ Page({
    * 页面的初始数据
    */
   data: {
+    pageNum: 1,//查询页码
+    pageSize: 5,//页数
     startDate: '2026-02-01',
     endDate: '2026-02-15',
     shiftList: [] // 班结记录列表

+ 23 - 3
wx/Fuelwx/pages/scan/scan.js

@@ -10,7 +10,7 @@ Page({
     userInfo: {},
     scanTitle: '扫码加油',
     scanTip: '请扫描加油机键盘上的二维码',
-    isDriver:false
+    isDriver:''
   },
 
   /**
@@ -23,6 +23,25 @@ Page({
   onShow(){
     this.getSiteInfo()
   },
+  switchTomonitoringScreen() {
+    wx.navigateTo({
+      url:'/pages/driver/monitoringScreen/monitoringScreen', 
+      fail: (err) => {
+        console.error('跳转失败', err);
+        // 如果是tab页,可以使用switchTab
+        if (err.errMsg.includes('tab page')) {
+          wx.switchTab({
+            url: page
+          });
+        } else {
+          // 尝试使用 redirectTo
+          wx.redirectTo({
+            url: page
+          });
+        }
+      }
+    });
+  },
   switchToDriver() {
     const app = getApp();
     // 假设全局用户角色存储在 app.globalData.userRole 中
@@ -72,10 +91,11 @@ Page({
       var formatePhone = utils.formatPhone(res.data.data.userInfo.userPhoneNumber);
       app.globalData.userInfo = res.data.data.userInfo;
       console.log("站点信息 app.globalData.userInfo",app.globalData.userInfo)
-      var isdeiver = res.data.data.userInfo.isDriver == 'admin' ? true : false;
+      debugger
+      //var isdeiver = res.data.data.userInfo.isDriver == 'admin' ? true : false;
       this.setData({
         isLoggedIn: true,
-        isDriver:isdeiver,
+        isDriver:res.data.data.userInfo.isDriver,
         site:res.data.data.site,
         userInfo: {
           userAddress:res.data.data.userInfo.userAddress,

+ 4 - 1
wx/Fuelwx/pages/scan/scan.wxml

@@ -3,8 +3,11 @@
     <image src="../../images/orientation.png" />
     <text>{{site.name}}</text>
   </view>
-  <view wx:if="{{isDriver}}" class="driver-switch" bind:tap="switchToDriver" style="position: fixed; top: 56rpx; right: 30rpx; z-index: 1000; background: #333; color: #fff; padding: 10rpx 24rpx; border-radius: 40rpx; font-size: 28rpx; box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.2);">
+  <view wx:if="{{isDriver == 'admin'}}" class="driver-switch" bind:tap="switchToDriver" style="position: fixed; top: 56rpx; right: 30rpx; z-index: 1000; background: #333; color: #fff; padding: 10rpx 24rpx; border-radius: 40rpx; font-size: 28rpx; box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.2);">
   切换司机端
+</view>
+<view wx:if="{{isDriver == 'boss'}}" class="driver-switch" bind:tap="switchTomonitoringScreen" style="position: fixed; top: 56rpx; right: 30rpx; z-index: 1000; background: #333; color: #fff; padding: 10rpx 24rpx; border-radius: 40rpx; font-size: 28rpx; box-shadow: 0 2rpx 10rpx rgba(0,0,0,0.2);">
+  监控大屏
 </view>
   <image class="background" src="../../images/stations.png" style="height: 518rpx; display: block; box-sizing: border-box"></image>