فهرست منبع

Merge branch 'feature/整合页面与接口' into develop

Zhenghanjv 4 ماه پیش
والد
کامیت
d1209400ac
39فایلهای تغییر یافته به همراه1297 افزوده شده و 465 حذف شده
  1. 5 4
      app.json
  2. 79 0
      components/orderItemInfo/orderItemInfo.js
  3. 4 0
      components/orderItemInfo/orderItemInfo.json
  4. 63 0
      components/orderItemInfo/orderItemInfo.wxml
  5. 119 0
      components/orderItemInfo/orderItemInfo.wxss
  6. 1 1
      components/pay/pay.wxss
  7. BIN
      images/date.png
  8. BIN
      images/down.png
  9. BIN
      images/orientation.png
  10. BIN
      images/scan.png
  11. BIN
      images/user.png
  12. 53 18
      js/api.js
  13. 176 0
      pages/TransactionPage/TransactionPage.js
  14. 6 0
      pages/TransactionPage/TransactionPage.json
  15. 17 0
      pages/TransactionPage/TransactionPage.wxml
  16. 39 0
      pages/TransactionPage/TransactionPage.wxss
  17. 23 102
      pages/historyOrder/historyOrder.js
  18. 1 1
      pages/historyOrder/historyOrder.json
  19. 6 7
      pages/historyOrder/historyOrder.wxml
  20. 11 0
      pages/historyOrder/historyOrder.wxss
  21. 7 1
      pages/index/index.js
  22. 185 48
      pages/login/login.js
  23. 5 1
      pages/login/login.wxml
  24. 47 73
      pages/moreOrder/moreOrder.js
  25. 1 1
      pages/moreOrder/moreOrder.json
  26. 7 6
      pages/moreOrder/moreOrder.wxml
  27. 13 0
      pages/moreOrder/moreOrder.wxss
  28. 0 6
      pages/orderConfirm/orderConfirm.json
  29. 0 17
      pages/orderConfirm/orderConfirm.wxml
  30. 0 48
      pages/orderConfirm/orderConfirm.wxss
  31. 27 20
      pages/quantify/quantify.js
  32. 3 0
      pages/quantify/quantify.json
  33. 45 0
      pages/quantify/quantify.wxml
  34. 116 0
      pages/quantify/quantify.wxss
  35. 61 15
      pages/scan/scan.js
  36. 42 26
      pages/scan/scan.wxml
  37. 119 68
      pages/scan/scan.wxss
  38. 1 1
      project.private.config.json
  39. 15 1
      utils/util.js

+ 5 - 4
app.json

@@ -1,16 +1,17 @@
 {
   "pages": [
-    
-    "pages/moreOrder/moreOrder",
-    "pages/orderConfirm/orderConfirm",
-    "pages/historyOrder/historyOrder",
     "pages/scan/scan",
+    "pages/quantify/quantify",
+    "pages/moreOrder/moreOrder",
+    "pages/TransactionPage/TransactionPage",
     "pages/index/index",
     "pages/login/login",
+    "pages/historyOrder/historyOrder",
     "pages/login/load",
     "pages/logs/logs",
     "components/orderItem/orderItem",
     "components/orderInfo/orderInfo",
+    "components/orderItemInfo/orderItemInfo",
     "components/pay/pay"
   ],
   "window": {

+ 79 - 0
components/orderItemInfo/orderItemInfo.js

@@ -0,0 +1,79 @@
+// components/orderItemInfo/orderItemInfo.js
+Component({
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    order:{
+      type:Object,
+      value:{
+        nozzle:5,
+        status:'已授权',
+        statusColor:'#a6d53f',
+        oilName:'92#汽油',
+        volume:30,
+        amount:224.7,
+        payAmount:209.4,
+        discount:15.3,
+        orderId:'20251111111111',
+        time:'2025-01-20 18:33'
+      }
+    },
+    bottonText1:{
+      type:String,
+      value:"按钮一"
+    },
+    bottonText2:{
+      type:String,
+      value:"按钮二"
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    contentHeight: 10,
+    isHide:false,
+    rotateDeg:0
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    showOrHide(){
+      
+      const height = this.data.isHide?10:23;
+      console.log("点击了",this.data.isHide,height)
+      
+      this.setData({
+        contentHeight:height,
+        isHide:!this.data.isHide,
+        rotateDeg:this.data.rotateDeg+180
+      })
+    },
+
+    //第一个按钮的点击事件
+    buttonClick1(){
+      this.triggerEvent('bottonEvent1',{
+        order:this.properties.order,
+        event:3 //第一个按钮只会传递取消订单
+      })
+    },
+    //第二个按钮的点击事件
+    buttonClick2(){
+      /**第二个按钮会是去支付:1和去授权:2两种
+       * 当当前订单状态为未支付或者支付失败时,第二个按钮点击就是去支付,event 传递1
+       * 当当前订单状态为已失效时,第二个按钮点击就是去重新授权,event 传递2
+       */
+      var sendEvent = 1;
+      if(this.properties.order.status == "已失效") sendEvent = 2
+      this.triggerEvent('bottonEvent2',{
+        order:this.properties.order,
+        event:sendEvent
+      })
+    },
+  }
+})

+ 4 - 0
components/orderItemInfo/orderItemInfo.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 63 - 0
components/orderItemInfo/orderItemInfo.wxml

@@ -0,0 +1,63 @@
+<view class="orderItemInfoContainer">
+  <!-- 订单信息 -->
+  <view class="orderInfoBox">
+    <!-- 油枪 -->
+    <view class="nozzleAndStatus">
+      <text class="nozzle">{{order.nozzle}} 号油枪</text>
+      <text class="status" style="color: {{order.statusColor}};">{{order.status}}</text>
+    </view>
+    
+
+    <view class="orderInfo" style="height: {{contentHeight}}vh;" bind:tap="showOrHide">
+      <!-- 订单主要信息 -->
+      <view class="mainInfo">
+        <image src="../../images/oil.svg" mode="aspectFill" />
+        <view class="oilInfo">
+          <text class="oil">{{order.oilName}}</text>
+          <text class="volume">{{order.volume}}升数</text>
+        </view>
+        <view class="amountBox">
+          <text class="mainAmount">¥ {{order.payAmount}}</text>
+          <image src="../../images/down.png" mode="aspectFill" style="transform: rotate({{rotateDeg}}deg);" />
+        </view>
+      </view>
+
+      <!-- 分割线 -->
+      <view class="line"></view>
+
+      <!-- 详情信息 -->
+      <view class="orderDetailInfo">
+        <view>
+          <text>金额</text>
+          <text>¥ {{order.amount}}</text>
+        </view>
+        <view>
+          <text>优惠</text>
+          <text>-{{order.discount}}</text>
+        </view>
+        <view>
+          <text>合计</text>
+          <text>¥ {{order.payAmount}}</text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 分割线 -->
+    <view class="line"></view>
+
+    <!-- 其余信息 -->
+    <view class="orderDetailInfo">
+      <view>
+        <text>交易订单号</text>
+        <text>{{order.orderId}}</text>
+      </view>
+      <view>
+        <text>时间</text>
+        <text>{{order.time}}</text>
+      </view>
+    </view>
+  </view>
+
+  <text class="botton" bind:tap="buttonClick2">{{bottonText2}}</text>
+
+</view>

+ 119 - 0
components/orderItemInfo/orderItemInfo.wxss

@@ -0,0 +1,119 @@
+.orderItemInfoContainer{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  border-radius: 15rpx;
+  background-color: #FFFFFF;
+  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+}
+
+.orderInfoBox{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 90%;
+}
+.nozzleAndStatus{
+  display: flex;
+  justify-content: center;
+  width: 100%;
+}
+.nozzle{
+  font-weight: 600;
+}
+.status{
+  position: absolute;
+  font-weight: 600;
+  margin-left: 70%;
+}
+
+.orderInfo{
+  width: 100%;
+  overflow: hidden;
+  transition: height 0.3s ease-in-out; /* 添加过渡效果 */
+}
+
+.mainInfo{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  width: 100%;
+}
+
+.mainInfo image{
+  width: 150rpx;
+  height: 150rpx;
+  flex-grow: 1;
+}
+
+.oilInfo{
+  display: flex;
+  flex-direction: column;
+  flex-grow: 3;
+}
+.oil{
+  color: #d92610;
+  font-size: large;
+  font-weight: 550;
+  margin-bottom: 3%;
+}
+.volume{
+  color: #878787;
+  font-size: small;
+}
+
+.amountBox{
+  display: flex;
+  flex-direction: column;
+  align-items: flex-end;
+  flex-grow: 3;
+}
+.mainAmount{
+  font-size: larger;
+  font-weight: 600;
+  margin-bottom: 3%;
+}
+
+.amountBox image {
+  width: 40rpx;
+  height: 40rpx;
+  margin-top: 3%;
+  transition: transform 0.3s ease-in-out;
+}
+
+.line{
+  background-color: #e5e5e5;
+  height: 1rpx;
+  width: 105%;
+  margin: 3% 0%;
+}
+
+.orderDetailInfo{
+  display: flex;
+  flex-direction: column;
+  width: 100%;
+}
+.orderDetailInfo view{
+  display: flex;
+  justify-content: space-between;
+}
+.orderDetailInfo text{
+  color: #838383;
+  font-size: small;
+  margin: 1% 0%;
+}
+
+.botton{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  background-color: #d81e07;
+  color: #FFFFFF;
+  width: 100%;
+  height: 5vh;
+  font-size: small;
+  border-radius: 0 0 15rpx 15rpx ;
+  margin-top: 3%;
+}

+ 1 - 1
components/pay/pay.wxss

@@ -7,7 +7,7 @@
   border-radius: 40rpx;
   padding-left: 5%;
   padding-right: 8%;
-  background-image: linear-gradient(to right, #333333 75%, #81b337 75%); /* 线性渐变 */
+  background-image: linear-gradient(to right, #333333 75%, #d81e07 75%); /* 线性渐变 */
 }
 
 .amount{

BIN
images/date.png


BIN
images/down.png


BIN
images/orientation.png


BIN
images/scan.png


BIN
images/user.png


+ 53 - 18
js/api.js

@@ -3,24 +3,27 @@ const SM4Exten = require('../js/SM4Exten');
 const miniprogramsm4 = require("../miniprogram_npm/miniprogram-sm-crypto/index").sm4;
 const secretId = "D2BCF8DE-AA24-4BF6-9C34-C8DD325E412B";//小程序应用ID
 const Secret = "6C680A47B87740138DFB299FC69A64E1";//小程序应用密钥
-const api_root = 'http://192.168.0.202:5006/'
+const api_root = 'http://192.168.5.5:5006/'
 const CurrentBuId = '12345678-9abc-def0-1234-56789abcdef0';
 
 function request(path, method = 'GET', data = null) {
-
+  var WachatID = wx.getStorageSync('WachatID')
   return new Promise((resolve, reject) => { 
     var sign_method = "HMAC_SM4";
     var url = api_root +  path;
     var nonce = generateRandomString();
     const timestamp = Date.now();
+    console.log('data :' + data);
     let jsonString = (data != null && method != 'GET') ? JSON.stringify(data) : '';
     console.log('request :' + jsonString);
-    var stringToSign = "sign_method=" +sign_method + 
-                       "&secret_id=" +secretId+
-                       "&nonce=" +  nonce +
-                       "&timestamp=" + timestamp + 
-                       jsonString;
-                       debugger
+     var stringToSign = "sign_method=" +sign_method + 
+                       "&secret_id=" +secretId+
+                       "&nonce=" +  nonce +
+                       "&timestamp=" + timestamp;
+    if(jsonString != '')
+    {
+      stringToSign +=  "&"+jsonString
+    }
     console.log('加密串 :' + stringToSign);
     let key =  stringToHex(Secret);//key转16进制
     key = getFirst32Chars(key);//截取前16位
@@ -35,7 +38,8 @@ function request(path, method = 'GET', data = null) {
         "nonce": nonce,
         "timestamp": timestamp,
         "signature": signature,
-        "CurrentBuId" : CurrentBuId
+        "CurrentBuId" : CurrentBuId,
+        "WachatID":WachatID
       },
       url: url, 
       method: method,
@@ -146,18 +150,18 @@ function generateRandomString(minLength = 6, maxLength = 10) {
   return result;
 }
 
-//获取站点信息
-function request_getSite(data) {
-  return request('api/Nozzle/GetNozzleInfo?Nozzleid='+ data, "GET",data);
-}
+// //获取站点信息
+// function request_getSite(data) {
+//   return request('api/Nozzle/GetNozzleInfo?Nozzleid='+ data, "GET",data);
+// }
 //支付
 function request_wechatPay(data) {
   return request('api/Transactions/UnifiedOrder?trxid='+ data, "GET",data);
 }
 
 //获取站点信息与用户信息
-function request_GetSiteInfo(data) {
-  return request('api/Site/GetSiteInfo', "GET",data);
+function request_GetSiteInfo() {
+  return request('api/Site/GetSiteInfo', "GET");
 }
 
 //小程序用户查询未支付订单
@@ -167,10 +171,41 @@ function request_GetMiniProgramTransactionsUnpaidQuery(data) {
 
 //小程序用户根据抢号查询未支付订单
 function request_GetMiniProgramTransactionsUnpaidNozzle(data) {
-  return request('api/Transactions/GetMiniProgramTransactionsUnpaidNozzle', "GET",data);
+  return request('api/Transactions/GetMiniProgramTransactionsUnpaidNozzle?NozzleId='+data, "GET",data);
+}
+//小程序登录
+function request_Wechatlogin(data) {
+  return request('api/Auth/Wechatlogin?code='+ data, "GET",data);
+}
+
+//添加用户信息
+function request_AddMiniprogramUser(data) {
+  return request('api/Site/AddMiniprogramUser', "POST",data);
+}
+
+//向fcc发起油枪授权
+function request_NozzleAuthorization(data) {
+  return request('api/Nozzle/NozzleAuthorization?trxid=' +data, "GET",data);
+}
+
+//向fcc发起取消油枪授权
+function request_CancelNozzleAuthorization(data) {
+  return request('api/Nozzle/CancelNozzleAuthorization?trxid=' +data, "GET",data);
+}
+//退款
+function request_RefundTrx(data) {
+  return request('api/Transactions/RefundTrx', "POST",data);
 }
 
 export default {
-  request_getSite,
-  request_wechatPay
+  request_GetSiteInfo,
+  request_wechatPay,
+  request_Wechatlogin,
+  request_AddMiniprogramUser,
+  request_NozzleAuthorization,
+  request_CancelNozzleAuthorization,
+  request_GetMiniProgramTransactionsUnpaidQuery,
+  request_GetMiniProgramTransactionsUnpaidNozzle,
+  request_AddMiniprogramUser,
+  request_RefundTrx
 }

+ 176 - 0
pages/TransactionPage/TransactionPage.js

@@ -0,0 +1,176 @@
+const { default: api } = require("../../js/api");
+const util = require('../../utils/util.js')
+
+// pages/orderConfirm/orderConfirm.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    nozzleId:0,
+    type:'后支付',
+    order:{},
+    oprationBtn1:'',
+    oprationBtn2:'对此订单有疑问?',
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    const link = decodeURIComponent(options.q) // 获取到二维码原始链接
+    console.log("link",link);
+    var id = link.split('wxapp?id=')[1];
+    console.log("id1",id);
+    if(id == undefined) {
+      id = options.id;
+    }
+    console.log("id2",id)
+    this.setData({
+      nozzleId:id
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+    this.getOrder()
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+
+  /** 获取订单信息 */
+  getOrder() {
+    api.request_GetMiniProgramTransactionsUnpaidNozzle(Number(this.data.nozzleId))
+    .then(res => {
+      if(res.data.statusCode == 203) {
+        wx.navigateTo({
+          url: '../login/login',
+        })
+        return
+      }
+      console.log("获取到未支付订单",res)
+      var order = res.data.data[0];
+      var time = util.formatDateNotSecond(order.fuelItemTransactionEndTime);
+      this.setData({
+        order:{
+          oilName:order.productName,
+          nozzle:order.nozzleId,
+          volume:order.originalQty,
+          amount:order.originalAmount,
+          payAmount:order.actualPaymentAmount,
+          discount:order.originalAmount - order.actualPaymentAmount,
+          orderId:order.id,
+          time:time
+        }
+      })
+    }).catch(err => {
+      console.log("未获取到未支付订单")
+    })
+  },
+
+  /** 后支付查看更多交易 */
+  toMordOrderPage(){
+    var that = this;
+    wx.navigateTo({
+      url: '../moreOrder/moreOrder?nozzle='+this.data.nozzleId,
+      events:{
+        acceptOrderFromMoreOrder:function(data) {
+          console.log("获取到传送过来的订单",data)
+          this.setData({
+            order:data
+          })
+          that.setData({
+            order:data
+          })
+        }
+      }
+    })
+  },
+
+  /** 支付按钮点击事件 */
+  toPay(){
+    api.request_wechatPay(19).then(res => {
+      console.log("支付结果",res)
+      this.pay()
+    }).catch(err => {
+      console.log("支付失败",err)
+    })
+  },
+  pay() {
+    api.request_wechatPay(this.data.order.orderId)
+      .then(res => {
+        wx.requestPayment({
+          timeStamp: res.data.data.unifiedOrderResult.timeStamp,
+          nonceStr: res.data.data.unifiedOrderResult.nonceStr,
+          package: res.data.data.unifiedOrderResult.package,
+          signType: res.data.data.unifiedOrderResult.signType,
+          paySign: res.data.data.unifiedOrderResult.paySign,
+          success: res => {
+            wx.hideLoading()
+            wx.showToast({
+              title: '支付成功!',
+            })
+            setTimeout(function () {
+              wx.redirectTo({
+                url: '../scan/scan',
+              })
+            }, 2000)
+          },
+          fail: res => {
+            wx.hideLoading()
+            wx.showModal({
+              title: '支付失败',
+              content: res.errMsg + '请稍后再试',
+              showCancel: false,
+              success(res) {
+                
+              }
+            })
+          }
+        })
+      });
+  },
+})

+ 6 - 0
pages/TransactionPage/TransactionPage.json

@@ -0,0 +1,6 @@
+{
+  "usingComponents": {
+    "orderInfo":"../../components/orderItemInfo/orderItemInfo",
+    "pay":"../../components/pay/pay"
+  }
+}

+ 17 - 0
pages/TransactionPage/TransactionPage.wxml

@@ -0,0 +1,17 @@
+<view class="orderConfirmContainer">
+  <!-- 提示 -->
+  <view class="tip">
+    <icon color="#fbac15" type="warn"/>
+    <text>请勿在油机旁使用手机</text>
+  </view>
+
+  <!-- 订单 -->
+  <orderInfo class="orderInfo" order="{{order}}" bottonText2="{{oprationBtn2}}" bind:bottonEvent2="toMordOrderPage" />
+
+  <text class="moreOrderTip" bind:tap="toMordOrderPage">更多交易</text>
+  
+  <!-- 支付按钮 -->
+  <pay class="payButton" amount="{{order.amount}}" bind:onPay="toPay" />
+
+  <text>{{nozzleId}}</text>
+</view>

+ 39 - 0
pages/TransactionPage/TransactionPage.wxss

@@ -0,0 +1,39 @@
+.orderConfirmContainer{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 100%;
+  height: 95vh;
+  background-color: #f2f2f2;
+}
+.tip{
+  display: flex;
+  align-self: flex-start;
+  margin: 3%;
+  width: 100%;
+}
+.tip text{
+  color: #fbac15;
+  margin-left: 3%;
+}
+
+.orderInfo{
+  width: 90%;
+  display: flex;
+  justify-content: center;
+}
+
+.moreOrderTip{
+  color: #d81e07;
+  margin-top: 5%;
+  font-weight: 600;
+}
+
+.anthorizationTip{
+  color: #9f9cb7;
+  margin: 3%;
+}
+.payButton{
+  width: 95%;
+  margin-top: auto;
+}

+ 23 - 102
pages/historyOrder/historyOrder.js

@@ -1,3 +1,5 @@
+const { default: api } = require("../../js/api");
+
 // pages/historyOrderAfter/historyOrderAfter.js
 Page({
 
@@ -10,106 +12,18 @@ Page({
     endDate:'',
     orders:[
       {
-        buttonMessage1:'',
-        buttonColor1:'',
-        buttonMessage2:'',
-        buttonColor2:'',
         order:{
+          nozzle:5,
+          status:'已授权',
+          statusColor:'#bbe06e',
           oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08',
-          status:'已授权'
-        },
-        statusColor:'#838282',
-        countdown:'60'
-      },
-      {
-        buttonMessage1:'取消订单',
-        buttonColor1:'#838282',
-        buttonMessage2:'重新授权',
-        buttonColor2:'#d17067',
-        order:{
-          oilName:"0#",
-          nozzleNum:'6',
-          volume:'21.0',
-          amount:'42.8',
-          date:'2024-11-24',
-          time:'09:08',
-          status:'已失效'
-        },
-        statusColor:'#838282',
-        countdown:''
-      },
-      {
-        buttonMessage1:'',
-        buttonColor1:'',
-        buttonMessage2:'重新支付',
-        buttonColor2:'#d17067',
-        order:{
-          oilName:"0#",
-          nozzleNum:'6',
-          volume:'21.0',
-          amount:'42.8',
-          date:'2024-11-24',
-          time:'09:08',
-          status:'支付失败'
+          volume:20.0,
+          amount:46.8,
+          payAmount:46.8,
+          discount:0.00,
+          time:'2024-11-24 09:08',
         },
-        statusColor:'#d17067',
-        countdown:''
-      },
-      {
-        buttonMessage1:'',
-        buttonColor1:'',
-        buttonMessage2:'重新支付',
-        buttonColor2:'#d17067',
-        order:{
-          oilName:"0#",
-          nozzleNum:'6',
-          volume:'21.0',
-          amount:'42.8',
-          date:'2024-11-24',
-          time:'09:08',
-          status:'支付失败'
-        },
-        statusColor:'#d17067',
-        countdown:''
-      },
-      {
-        buttonMessage1:'',
-        buttonColor1:'',
-        buttonMessage2:'重新支付',
-        buttonColor2:'#d17067',
-        order:{
-          oilName:"0#",
-          nozzleNum:'6',
-          volume:'21.0',
-          amount:'42.8',
-          date:'2024-11-24',
-          time:'09:08',
-          status:'支付失败'
-        },
-        statusColor:'#d17067',
-        countdown:''
-      },
-      {
-        buttonMessage1:'',
-        buttonColor1:'',
-        buttonMessage2:'重新支付',
-        buttonColor2:'#d17067',
-        order:{
-          oilName:"0#",
-          nozzleNum:'6',
-          volume:'21.0',
-          amount:'42.8',
-          date:'2024-11-24',
-          time:'09:08',
-          status:'支付失败'
-        },
-        statusColor:'#d17067',
-        countdown:''
+        bottonText2:'请尽快提枪'
       },
     ]
   },
@@ -185,12 +99,10 @@ Page({
       endDate:lastMouthDay
     });
 
-    this.startCountdow();
-  },
 
-  onUnload(){
-    this.endCountDown()
+    // this.startCountdow();
   },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */
@@ -216,7 +128,7 @@ Page({
    * 生命周期函数--监听页面卸载
    */
   onUnload() {
-
+    this.endCountDown()
   },
 
   /**
@@ -257,4 +169,13 @@ Page({
   onOrderButtonClick2(event){
     console.log(event)
   },
+
+  /** 获取订单 */
+  getOrder(){
+    api.request_GetMiniProgramTransactionsUnpaidQuery(null).then(res => {
+      console.log("未支付订单",res)
+    }).catch(err => {
+      console.log("获取未支付订单失败",err)
+    })
+  }
 })

+ 1 - 1
pages/historyOrder/historyOrder.json

@@ -1,5 +1,5 @@
 {
   "usingComponents": {
-    "orderItem":"../../components/orderItem/orderItem"
+    "orderItem":"../../components/orderItemInfo/orderItemInfo"
   }
 }

+ 6 - 7
pages/historyOrder/historyOrder.wxml

@@ -3,7 +3,11 @@
 
   <!-- 日期选择器 -->
   <view class="dataSelect">
-    <text>日期选择</text>
+    <view class="dateTip">
+      <image src="../../images/date.png" mode="aspectFill" />
+      <text>日期跳转</text>
+    </view>
+    
     <picker mode="date" value="{{date}}" bindchange="bindDateChange">
       <text>{{date}} ></text>
     </picker>
@@ -14,12 +18,7 @@
     <view class="orderItem" wx:for="{{orders}}">
       <orderItem 
       order="{{item.order}}"
-      statusColor="{{item.statusColor}}"
-      buttonMessage1="{{item.buttonMessage1}}"
-      buttonColor1="{{item.buttonColor1}}"
-      buttonMessage2="{{item.buttonMessage2}}"
-      buttonColor2="{{item.buttonColor2}}"
-      countdown="{{item.countdown}}"
+      bottonText2="{{item.bottonText2}}"
       bind:bottonEvent1="onOrderButtonClick1"
       bind:bottonEvent2="onOrderButtonClick2" />
     </view>

+ 11 - 0
pages/historyOrder/historyOrder.wxss

@@ -8,11 +8,22 @@
   display: flex;
   flex-direction: row;
   justify-content: space-between;
+  align-items: center;
   width: 90%;
   box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
   padding: 2% 3%;
   border-radius: 3%;
 }
+.dateTip{
+  display: flex;
+  align-items: center;
+  width: 50%;
+}
+.dataSelect image{
+  width: 50rpx;
+  height: 50rpx;
+  margin-right: 5%;
+}
 
 .order{
   display: flex;

+ 7 - 1
pages/index/index.js

@@ -20,6 +20,7 @@ Page({
   onChooseAvatar(e) {
     const { avatarUrl } = e.detail
     const { nickName } = this.data.userInfo
+    console.log("获取头像",e,this.data.userInfo)
     this.setData({
       "userInfo.avatarUrl": avatarUrl,
       hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
@@ -28,17 +29,22 @@ Page({
   onInputChange(e) {
     const nickName = e.detail.value
     const { avatarUrl } = this.data.userInfo
+    
+    console.log("获取名称",e,this.data.userInfo)
     this.setData({
       "userInfo.nickName": nickName,
       hasUserInfo: nickName && avatarUrl && avatarUrl !== defaultAvatarUrl,
     })
   },
   getUserProfile(e) {
+    console.log("获取信息",e)
     // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
+    debugger
     wx.getUserProfile({
       desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
       success: (res) => {
-        console.log(res)
+        debugger
+        console.log("getUserProfile : "+res)
         this.setData({
           userInfo: res.userInfo,
           hasUserInfo: true

+ 185 - 48
pages/login/login.js

@@ -1,4 +1,3 @@
-
 //const app = require('../../js/api');
 import api from '../../js/api'
 // pages/login/login.js
@@ -8,7 +7,7 @@ Page({
    * 页面的初始数据
    */
   data: {
-
+    userInfo: {}
   },
 
   /**
@@ -66,72 +65,210 @@ Page({
   onShareAppMessage() {
 
   },
-  handleAuthLogin() {
-    console.log('一键授权登录按钮被点击');
-     api.request_wechatPay(1)
-     .then(res => {
-      wx.requestPayment({
-        timeStamp: res.data.data.unifiedOrderResult.timeStamp,
-        nonceStr: res.data.data.unifiedOrderResult.nonceStr,
-        package: res.data.data.unifiedOrderResult.package,
-        signType: res.data.data.unifiedOrderResult.signType,
-        paySign: res.data.data.unifiedOrderResult.paySign,
-        success: res => {
-          wx.hideLoading()
-          wx.showToast({
-            title: '支付成功!',
-          })
-          setTimeout(function () {
-            wx.switchTab({
-              url: '../index/index',
-            })
-          }, 2000)
 
-        },
-        fail: res => {
-          wx.hideLoading()
-          wx.showModal({
-            title: '支付失败',
-            content: res.errMsg + '请稍后再试',
-            showCancel: false,
+  pay(){
+    api.request_wechatPay(23)
+    .then(res => {
+     wx.requestPayment({
+       timeStamp: res.data.data.unifiedOrderResult.timeStamp,
+       nonceStr: res.data.data.unifiedOrderResult.nonceStr,
+       package: res.data.data.unifiedOrderResult.package,
+       signType: res.data.data.unifiedOrderResult.signType,
+       paySign: res.data.data.unifiedOrderResult.paySign,
+       success: res => {
+         wx.hideLoading()
+         wx.showToast({
+           title: '支付成功!',
+         })
+         setTimeout(function () {
+           wx.switchTab({
+             url: '../index/index',
+           })
+         }, 2000)
+
+       },
+       fail: res => {
+         wx.hideLoading()
+         wx.showModal({
+           title: '支付失败',
+           content: res.errMsg + '请稍后再试',
+           showCancel: false,
+           success(res) {
+             if (res.confirm) {
+               wx.switchTab({
+                 url: '../home/home',
+               })
+             }
+           }
+         })
+       }
+     })
+    });
+  },
+  RefundTrx:function(e){
+    var RefundTrx = {
+      trxId : 31,
+      longitude :116.4074,
+      latitude:39.9042
+    };
+    api.request_RefundTrx(RefundTrx)
+    .then(res => {
+      debugger
+    });
+  },
+  handleGetPhoneNumber: function(e) {
+    if (e.detail.errMsg === 'getPhoneNumber:ok') {
+        // 用户同意授权,获取加密数据
+        const encryptedData = e.detail.encryptedData;
+        const iv = e.detail.iv;
+debugger
+        // 调用后端接口进行解密
+        wx.request({
+            url: 'https://your-backend-api-endpoint.com/decryptPhoneNumber', // 替换为你的后端API地址
+            method: 'POST',
+            data: {
+                encryptedData: encryptedData,
+                iv: iv,
+                sessionKey: 'your-session-key' // 替换为实际的session_key
+            },
             success(res) {
-              if (res.confirm) {
-                wx.switchTab({
-                  url: '../home/home',
-                })
+                console.log('解密后的手机号:', res.data);
+            },
+            fail(err) {
+                console.error('解密失败:', err);
+            }
+        });
+    } else {
+        console.log('用户拒绝授权');
+    }
+},
+  subMessage() {
+    wx.requestSubscribeMessage({
+      tmplIds: ['ldkKXfnHj-uKo6SBep08f_kaSjtxMOccJywHOEgxyPg'], // 最多支持3条
+      success(res) {
+        // 'accept'表示用户同意订阅该条id对应的模板消息
+        if (res['ldkKXfnHj-uKo6SBep08f_kaSjtxMOccJywHOEgxyPg'] === 'accept') {
+          // 用户同意订阅,调用云函数或服务器接口发送订阅消息
+          wx.cloud.callFunction({
+            name: 'sendSubscribeMessage',
+            data: {
+              templateId: '配置好的模板ID',
+              openid: 'o8pFb5fB9YROMFirFYrVNE3lr4ak',
+              data: {
+                thing1: {
+                  value: '活动名称'
+                },
+                // 其他参数...
               }
+            },
+            success(res) {
+              console.log('订阅消息发送成功', res)
+            },   
+            fail(err) {
+              console.error('订阅消息发送失败', err)
             }
           })
         }
+      }
+    })
+  },
+
+  handleAuthLogin(e) {
+    console.log('一键授权登录按钮被点击', e);
+    wx.showLoading({
+      title: '正在登录中...',
+    })
+
+    if (e.type == "getphonenumber") {
+      console.log("添加手机信息",this.data.userInfo)
+      var user = {
+        UserName: this.data.userInfo.UserName,
+        UserAvatarUrl: this.data.userInfo.UserAvatarUrl,
+        UserPhoneNumber: '',
+        Address: '',
+        encryptedData: e.detail.encryptedData,
+        iv: e.detail.iv
+      };
+      this.setData({
+        userInfo: user
       })
-     });
+      this.toLogin()
+    }
+
+    if (e.type == "tap") {
+      console.log("添加用户信息",this.data.userInfo)
+      // 获取用户信息授权
+      const that = this;
+      wx.getUserProfile({
+        desc: '用于完善用户资料', // 声明获取用户信息的目的
+        success(res) {
+          console.log('用户信息:', res.userInfo);
+          var user = {
+            UserName: res.userInfo.nickName,
+            UserAvatarUrl: res.userInfo.avatarUrl,
+            UserPhoneNumber: '',
+            Address: '',
+            encryptedData: that.data.userInfo.encryptedData,
+            iv: that.data.userInfo.iv
+          };
+          that.setData({
+            userInfo: user
+          })
+          that.toLogin()
+          // 将用户信息发送到服务器
+          // 例如:wx.request({ url: 'https://example.com/userInfo', data: res.userInfo })
+        },
+        fail(err) {
+          console.error('获取用户信息失败:', err);
+          wx.hideLoading()
+        },
+      });
+    }
+
+  },
+
+  toLogin() {
+    if(!this.cheackUserInfo()) {
+      console.log("userInfo 信息不全",this.data.userInfo)
+      wx.hideLoading()
+      return
+    }
     // 调用微信登录接口
+    var that = this;
     wx.login({
       success(res) {
         if (res.code) {
           console.log('登录成功,code:', res.code);
-          // 将 code 发送到服务器,获取用户信息
-          // 例如:wx.request({ url: 'https://example.com/login', data: { code: res.code } })
+          api.request_Wechatlogin(res.code)
+            .then(res => {
+              console.log("获取wid", res.data.data)
+              wx.setStorageSync('WachatID', res.data.data)
+              console.log("传递的userInfo", that.data.userInfo)
+              return api.request_AddMiniprogramUser(that.data.userInfo)
+            }).then(res => {
+              console.log("添加user", res)
+              wx.hideLoading()
+              wx.redirectTo({
+                url: '../scan/scan',
+              })
+            }).catch(err => {
+              console.log("报错", res)
+              wx.hideLoading()
+            });
         } else {
+          wx.hideLoading()
           console.log('登录失败:', res.errMsg);
         }
       },
       fail(err) {
+        wx.hideLoading()
         console.error('登录接口调用失败:', err);
       },
     });
+  },
 
-    // 获取用户信息授权
-    wx.getUserProfile({
-      desc: '用于完善用户资料', // 声明获取用户信息的目的
-      success(res) {
-        console.log('用户信息:', res.userInfo);
-        // 将用户信息发送到服务器
-        // 例如:wx.request({ url: 'https://example.com/userInfo', data: res.userInfo })
-      },
-      fail(err) {
-        console.error('获取用户信息失败:', err);
-      },
-    });
+  cheackUserInfo(){
+    var userInfo = this.data.userInfo;
+    return userInfo.UserAvatarUrl != '' && userInfo.UserAvatarUrl != undefined && userInfo.UserName != '' && userInfo.UserName != undefined && userInfo.encryptedData != '' && userInfo.encryptedData != undefined && userInfo.iv != '' && userInfo.iv != undefined 
   }
 })

+ 5 - 1
pages/login/login.wxml

@@ -3,8 +3,12 @@
     <image src="/images/v2_sony48.svg" mode="widthFix" class="auto-image"></image>
   </view>
   <view class="action-text">立码加油</view>
-  <button class="auth-button" style="width: 547rpx; height: 94rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx"  bindtap="handleAuthLogin">一键授权登录</button>
+  <open-data></open-data>
+  <button class="auth-button" open-type="getPhoneNumber" style="width: 547rpx; height: 94rpx; display: block; box-sizing: border-box; left: 0rpx; top: 0rpx"  bindtap="handleAuthLogin" bindgetphonenumber="handleAuthLogin">一键授权登录</button>
   <view class="agreement">
+    <button class="auth-button"   bindtap="pay">支付</button>
+    <button class="auth-button"   bindtap="RefundTrx">退款</button>
+    <button open-type="getPhoneNumber" bindgetphonenumber="handleGetPhoneNumber">获取手机号</button>
     <checkbox checked="{{true}}" disabled="{{true}}" />
     <text>我已阅读并同意</text>
     <text class="link">《用户协议》</text>

+ 47 - 73
pages/moreOrder/moreOrder.js

@@ -1,83 +1,24 @@
 // pages/moreOrder/moreOrder.js
+const { default: api } = require("../../js/api");
+const util = require('../../utils/util.js')
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
+    buttonMessage2:'去支付',
     orders:[
       {
-        buttonMessage2:'去支付',
-        buttonColor2:'#91cdcc',
-        order:{
-          oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08'
-        }
-      },
-      {
-        buttonMessage2:'去支付',
-        buttonColor2:'#91cdcc',
-        order:{
-          oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08'
-        }
-      },
-      {
-        buttonMessage2:'去支付',
-        buttonColor2:'#91cdcc',
-        order:{
-          oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08'
-        }
-      },
-      {
-        buttonMessage2:'去支付',
-        buttonColor2:'#91cdcc',
-        order:{
-          oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08'
-        }
-      },
-      {
-        buttonMessage2:'去支付',
-        buttonColor2:'#91cdcc',
-        order:{
-          oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08'
-        }
-      },
-      {
-        buttonMessage2:'去支付',
-        buttonColor2:'#91cdcc',
-        order:{
-          oilName:"92#",
-          nozzleNum:'5',
-          volume:'20.0',
-          amount:'46.8',
-          date:'2024-11-24',
-          time:'09:08'
-        }
-      },
+        nozzle:5,
+        oilName:"92#",
+        volume:20.0,
+        amount:46.8,
+        payAmount:46.8,
+        discount:0.00,
+        orderId:'1',
+        time:'2024-11-24 09:08'
+      }
     ]
   },
 
@@ -85,7 +26,8 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    console.log("更多订单页",options)
+    this.getOrder(options.nozzle)
   },
 
   /**
@@ -140,6 +82,38 @@ Page({
   /** 点击去支付 */
   toPay(event) {
     console.log(event)
+    const eventChannel = this.getOpenerEventChannel()
+    eventChannel.emit('acceptOrderFromMoreOrder', event.detail.order);
+    wx.navigateBack()
     //跳转回支付页
-  }
+  },
+
+  /** 获取订单信息 */
+  getOrder(nozzle) {
+    api.request_GetMiniProgramTransactionsUnpaidNozzle(Number(nozzle))
+    .then(res => {
+      console.log("获取到未支付订单",res)
+      var datas = res.data.data;
+      var getOrders = datas.map(order => {
+        var time = util.formatDateNotSecond(order.fuelItemTransactionEndTime);
+        return {
+          oilName:order.productName,
+          nozzle:order.nozzleId,
+          volume:order.originalQty,
+          amount:order.originalAmount,
+          payAmount:order.actualPaymentAmount,
+          discount:order.originalAmount - order.actualPaymentAmount,
+          orderId:order.id,
+          time:time
+        }
+      })
+      
+      this.setData({
+        orders:getOrders
+      })
+      
+    }).catch(err => {
+      console.log("未获取到未支付订单")
+    })
+  },
 })

+ 1 - 1
pages/moreOrder/moreOrder.json

@@ -1,5 +1,5 @@
 {
   "usingComponents": {
-    "orderItem":"../../components/orderItem/orderItem"
+    "orderItem":"../../components/orderItemInfo/orderItemInfo"
   }
 }

+ 7 - 6
pages/moreOrder/moreOrder.wxml

@@ -1,10 +1,11 @@
 <view class="moreOrderContainer">
-  <view class="order" wx:for="{{orders}}">
-    <orderItem class="orderItem"
-    order="{{item.order}}" 
-    buttonMessage2="{{item.buttonMessage2}}"
-    buttonColor="{{item.buttonColor2}}"
-    bind:bottonEvent2="toPay" />
+  <!-- 提示 -->
+  <view class="tip">
+    <icon color="#fbac15" type="warn" />
+    <text>请勿在油机旁使用手机</text>
+  </view>
+  <view class="order" wx:for="{{orders}}" wx:key="{{index}}">
+    <orderItem class="orderItem" order="{{item}}" bottonText2="{{buttonMessage2}}" bind:bottonEvent2="toPay" />
   </view>
 
   <text style="margin-top: 3%;margin-bottom: 10%;color: #b29a9a;">没有找到?请联系油站工作人员</text>

+ 13 - 0
pages/moreOrder/moreOrder.wxss

@@ -2,7 +2,20 @@
   display: flex;
   flex-direction: column;
   align-items: center;
+  background-color: #f2f2f2;
+  height: 100vh;
 }
+.tip{
+  display: flex;
+  align-self: flex-start;
+  margin: 3%;
+  width: 100%;
+}
+.tip text{
+  color: #fbac15;
+  margin-left: 3%;
+}
+
 .order{
   display: flex;
   flex-direction: column;

+ 0 - 6
pages/orderConfirm/orderConfirm.json

@@ -1,6 +0,0 @@
-{
-  "usingComponents": {
-    "orderInfo":"../../components/orderInfo/orderInfo",
-    "pay":"../../components/pay/pay"
-  }
-}

+ 0 - 17
pages/orderConfirm/orderConfirm.wxml

@@ -1,17 +0,0 @@
-<view class="orderConfirmContainer">
-  <orderInfo class="orderInfo" order="{{order}}"></orderInfo>
-  <!-- 后支付提示 -->
-  <view wx:if="{{type == '后支付'}}" class="afterPayTipBox">
-    <view class="afterPayTip">
-      <image src="../../images/question.svg"/>
-      <text>不是我的交易?</text>
-    </view>
-    <button bind:tap="toMordOrderPage">更多交易</button>
-  </view>
-
-  <!-- 预支付提示 -->
-  <text wx:if="{{type == '预支付'}}" class="anthorizationTip">请您先提枪后再做授权</text>
-
-  <!-- 支付按钮 -->
-  <pay class="payButton" amount="{{order.amount}}" bind:onPay="toPay" />
-</view>

+ 0 - 48
pages/orderConfirm/orderConfirm.wxss

@@ -1,48 +0,0 @@
-.orderConfirmContainer{
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  width: 100%;
-  height: 95vh;
-}
-
-.orderInfo{
-  width: 100%;
-  display: flex;
-  justify-content: center;
-}
-
-.afterPayTipBox{
-  display: flex;
-  flex-direction: column;
-  width: 100%;
-  align-items: center;
-  margin-top: 3%;
-}
-
-.afterPayTip{
-  display: flex;
-  flex-direction: row;
-  align-items: center;
-  width: 40%;
-  justify-content: space-around;
-}
-
-.afterPayTip image{
-  width: 50rpx;
-  height: 50rpx;
-}
-
-.afterPayTipBox button {
-  color: #2bc675;
-  margin-top: 3%;
-}
-
-.anthorizationTip{
-  color: #9f9cb7;
-  margin: 3%;
-}
-.payButton{
-  width: 95%;
-  margin-top: auto;
-}

+ 27 - 20
pages/orderConfirm/orderConfirm.js → pages/quantify/quantify.js

@@ -1,27 +1,30 @@
-// pages/orderConfirm/orderConfirm.js
+// pages/quantify/quantify.js
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    type:'后支付',
-    order:{
-      oilName:"92#",
-      nozzleNum:'5',
-      volume:'20.0',
-      amount:'46.8',
-      date:'2024-11-24',
-      time:'09:08',
-      status:'已授权'
-    },
+    nozzleId:'',
+    quantify:'元',
+    fastInputs:[10,20,50,100,200,500],
+    type:[
+      { name:'金额',checked:true},
+      { name:'升数',checked:false}
+    ]
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    const id = decodeURIComponent(options.q) // 获取到二维码原始链接内容
+    this.setData({
+      nozzleId:id
+    })
+    wx.showToast({
+      title: id,
+    })
   },
 
   /**
@@ -73,13 +76,17 @@ Page({
 
   },
 
-  /** 后支付查看更多交易 */
-  toMordOrderPage(){
-    console.log("跳转到更多交易页面");
-  },
-
-  /** 支付按钮点击事件 */
-  toPay(){
-    console.log("点击了支付")
+  /** 当选择定量类型 */
+  onTypeChange(event) {
+    var type = event.detail.value;
+    if(type == '升数') {
+      this.setData({
+        quantify:'升'
+      })
+    } else {
+      this.setData({
+        quantify:'元'
+      })
+    }
   }
 })

+ 3 - 0
pages/quantify/quantify.json

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

+ 45 - 0
pages/quantify/quantify.wxml

@@ -0,0 +1,45 @@
+
+<view class="quantifyContainer">
+  <!-- 提示 -->
+  <view class="tip">
+    <icon color="#fbac15" type="warn" />
+    <text>请勿在油机旁使用手机</text>
+  </view>
+
+  <view class="quantifyBox">
+    <!-- 油品信息 -->
+    <view class="oilInfoBox">
+      <image src="../../images/oil.svg" mode="aspectFill" />
+      <view class="oilInfo">
+        <text class="oil">92#汽油</text>
+        <text class="price">¥7.49/升</text>
+      </view>
+    </view>
+
+    <!-- 定值区 -->
+    <view class="inputBox">
+      <!-- 输入 -->
+      <view class="input">
+        <text>请输入金额</text>
+        <input type="digit" placeholder="0.00{{quantify}}"/>
+      </view>
+
+      <!-- 分割线 -->
+      <view class="line" />
+
+      <!-- 快速输入 -->
+      <view class="fastInput">
+        <text class="fastItem" wx:for="{{fastInputs}}" wx:key="{{index}}">{{item}}{{quantify}}</text>
+      </view>
+
+      <!-- 定量类型选择 -->
+      <radio-group class="typeSelect" bindchange="onTypeChange">
+        <radio wx:for="{{type}}" checked="{{item.checked}}"
+        color="#d81e07" value="{{item.name}}">{{item.name}}</radio>
+      </radio-group>
+    </view>
+  </view>
+
+  <text class="anthorization">授权</text>
+
+</view>

+ 116 - 0
pages/quantify/quantify.wxss

@@ -0,0 +1,116 @@
+.quantifyContainer{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  background-color: #f2f2f2;
+  height: 100vh;
+}
+
+.tip{
+  display: flex;
+  align-self: flex-start;
+  margin: 3%;
+  width: 100%;
+}
+.tip text{
+  color: #fbac15;
+  margin-left: 3%;
+}
+.quantifyBox{
+  display: flex;
+  flex-direction: column;
+  width: 90%;
+}
+
+.oilInfoBox{
+  display: flex;
+  align-items: center;
+  background-color: #FFFFFF;
+  border-radius: 10rpx;
+  height: 18vh;
+  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+}
+.oilInfoBox image {
+  width: 200rpx;
+  height: 200rpx;
+}
+.oilInfo{
+  display: flex;
+  flex-direction: column;
+  margin-left: 10%;
+}
+
+.oil{
+  font-weight: 600;
+  font-size: x-large;
+}
+
+.price{
+  border: #d81e07 solid 1rpx;
+  background-color: #ffebec;
+  border-radius: 18rpx;
+  margin-top: 5%;
+}
+
+.inputBox{
+  display: flex;
+  flex-direction: column;
+  background-color: #FFFFFF;
+  border-radius: 10rpx;
+  height: 30vh;
+  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+  margin-top: 5%;
+  padding: 5%;
+}
+.input{
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 3%;
+}
+.input input{
+  text-align: end;
+}
+
+.line{
+  width: 100%;
+  background-color: #8a8989;
+  height: 1rpx;
+  margin-bottom: 5%;
+}
+.fastInput{
+  display: flex;
+  flex-wrap: wrap;
+  height: 50%;
+}
+.fastItem{
+  flex:1 1 25%;
+  box-sizing: border-box;
+  text-align: center;
+  border: #f2f2f2 solid 2rpx;
+  background-color: #f2f2f2;
+  border-radius: 30rpx;
+  margin: 1%;
+  height: 100rpx;
+  line-height: 100rpx;
+  color: #acacac;
+}
+
+.typeSelect{
+  display: flex;
+  margin-top: 5%;
+}
+.typeSelect radio{
+  margin: 3% 3% 0% 3%;
+}
+
+.anthorization{
+  background-color: #d81e07;
+  color: #FFFFFF;
+  margin-top: 5%;
+  width: 90%;
+  height: 7vh;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border-radius: 20rpx;
+}

+ 61 - 15
pages/scan/scan.js

@@ -1,26 +1,72 @@
+const {
+  default: api
+} = require("../../js/api");
+
 Page({
   data: {
     isLoggedIn: false,
-    userInfo: null,
-    scanTitle:'扫码加油',
-    scanTip:'请扫码加油机键盘上的二维码'
+    site:{},
+    userInfo: {},
+    scanTitle: '扫码加油',
+    scanTip: '请扫描加油机键盘上的二维码'
   },
 
-  handleGetUserInfo: function(e) {
-    if (e.detail.userInfo) {
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    api.request_GetSiteInfo().then(res => {
+      if(res.data.statusCode == 203) {
+        console.log("获取站点信息失败",res)
+        return
+      }
+      console.log("站点信息",res)
       this.setData({
         isLoggedIn: true,
-        userInfo: e.detail.userInfo
-      });
-      wx.showToast({
-        title: '登录成功',
-        icon: 'success'
-      });
+        site:res.data.data.site,
+        userInfo: res.data.data.userInfo,
+        scanTitle: '扫码加油',
+        scanTip: '请扫码加油机键盘上的二维码'
+      })
+    }).catch(err => {
+      console.log("获取站点信息失败",err)
+    })
+  },
+
+  toLoginOrOrderPage: function () {
+    if (!this.data.isLoggedIn) {
+      wx.redirectTo({
+        url: '../login/login'
+      })
     } else {
-      wx.showToast({
-        title: '用户拒绝授权',
-        icon: 'none'
-      });
+      wx.navigateTo({
+        url: '../historyOrder/historyOrder',
+      })
     }
+  },
+
+  // 打开扫码功能
+  scanCode: function () {
+    const that = this;
+    wx.scanCode({
+      success(res) {
+        wx.redirectTo({
+          url: res.result,
+          fail(err){
+            wx.showToast({
+              title: '跳转页面失败',
+              icon: 'none'
+            });
+          }
+        })
+      },
+      fail(err) {
+        console.error('扫码失败:', err);
+        wx.showToast({
+          title: '扫码失败',
+          icon: 'none'
+        });
+      }
+    });
   }
 });

+ 42 - 26
pages/scan/scan.wxml

@@ -1,32 +1,48 @@
 <view class="scanContainer">
   <view class="header">
-    <text>淮河路加油站</text>
+    <image src="../../images/orientation.png" />
+    <text>{{site.name}}</text>
   </view>
-  <image class="background"  src="../../images/stationBackground.png"></image>
-  <view class="login-container" wx:if="{{!isLoggedIn}}">
-    <view class="user-icon">
-      <image src="../../images/user.png" mode="aspectFit"></image>
-      <view class="user-tip">
-          <text style="font-weight: 600;">未登录</text>
-          <text style="font-size: 24rpx;color: #81838f;">请授权登录</text>
-      </view> 
-    </view>
-    <button open-type="getUserInfo" bindgetuserinfo="handleGetUserInfo">授权登录</button>
-  </view>
-  <view class="login-container" wx:else="{{!isLoggedIn}}">
-    <view class="user-icon">
-      <image src="../../images/user.png" mode="aspectFit"></image>
-      <text>135******05</text>
-    </view>
-    <view class="order-tip">
-      <image src="../../images/order.svg" mode="aspectFit"/>
-      <text>历史订单</text>
+  <image class="background" src="../../images/stationBackground.png"></image>
+
+  <view class="scan-box">
+    <!-- 登录条 -->
+    <view class="login-container" bind:tap="toLoginOrOrderPage">
+      <view class="user-icon">
+        <view class="user-border-unlogin" wx:if="{{!isLoggedIn}}">
+          <image src="../../images/user.png" mode="aspectFit"></image>
+        </view>
+        <image class="user-icon-login" wx:if="{{isLoggedIn}}" src="{{userInfo.userAvatarUrl}}" mode="aspectFit"></image>
+      </view>
+      
+      <view class="user-tip" wx:if="{{!isLoggedIn}}">
+        <text style="font-weight: 530;">未登录</text>
+        <text style="font-size: 24rpx;color: #81838f;">请授权登录</text>
+      </view>
+      <text class="user-tip" wx:if="{{isLoggedIn}}">{{userInfo.userPhoneNumber}}</text>
+
+      <text class="toOtherPage">></text>
     </view>
     
+    <!-- 分割线 -->
+    <view class="line"></view>
+
+    <!-- 扫码区 -->
+    <view class="scan-container" bind:tap="scanCode">
+      <view class="scan-image-box">
+        <view class="scan-bg-1" />
+        <view class="scan-bg-2" />
+        <view class="scan-bg-3" />
+        <image src="../../images/scan.png" mode="aspectFit"></image>
+      </view>
+      
+      <view class="scan-tip-title">
+        <view class="title-line" />
+        <text class="scan-tip-title-text">{{scanTitle}}</text>
+      </view>
+      
+      <text class="scan-tip-text">{{scanTip}}</text>
+    </view>
   </view>
-  <view class="scan-container">
-    <image src="../../images/scan.png" mode="aspectFit"></image>
-    <text style="font-weight: 600;">{{scanTitle}}</text>
-    <text>{{scanTip}}</text>
-  </view>
-</view> 
+
+</view>

+ 119 - 68
pages/scan/scan.wxss

@@ -2,21 +2,28 @@
   display: flex;
   flex-direction: column;
   align-items: center;
+  background-color: #ededed;
 }
 
 .header {
+  display: flex;
+  align-items: center;
+  width: max-content;
+  justify-content: space-between;
   position: fixed;
-  top: 0;
+  top: 5%;
   left: 0;
-  right: 0;
-  height: 44px;
-  line-height: 44px;
-  text-align: left;
-  background-color: #fff;
-  border-bottom: 1px solid #e5e5e5;
-  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+  height: 35px;
   z-index: 999;
-  padding-left: 20px;
+  padding-left: 10px;
+  padding-right: 20px ;
+  background-color: rgba(255, 255, 255, 0.5);
+  border-radius: 0 40rpx 40rpx 0;
+}
+
+.header image{
+  width: 25px;
+  height: 25px;
 }
 
 .background {
@@ -24,70 +31,78 @@
   height: 50vh;
 }
 
-.login-container {
+.scan-box{
+  background-color: #FFFFFF;
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  width: 90%;
+  border-radius: 5%;
+  position: absolute;
+  top: 45%;
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
+}
+
+.login-container{
   display: flex;
   flex-direction: row;
   justify-content: space-between;
-  position: absolute;
-  top: 50%; /* 定位在父容器中间 */
-  left: 50%; /* 水平居中 */
-  transform: translate(-50%, -50%); /* 平移以实现居中 */
-  width: 90%; /* 适当宽度,避免溢出 */
+  align-items: center;
+  width: 100%;
   max-width: 400px; /* 最大宽度 */
   padding: 3%;
-  background-color: #fff;
-  border-radius: 8px;
-  z-index: 1;
+  margin: 5% 0% 3%;
   box-sizing: border-box; /* 确保宽度包含 padding */
 }
-
 .user-icon {
-  display: flex;
+  flex-grow: 1;
+  /* display: flex;
   flex-direction: row;
   align-items: center;
-  flex-grow: 10;
+  flex-grow: 10; */
 }
-
-.user-tip {
+.user-border-unlogin{
   display: flex;
-  height: 100%;
-  flex-direction: column;
-  justify-content: space-between;
+  justify-content: center;
+  align-items: center;
+  border-radius: 50%;
+  width: 100rpx;
+  height: 100rpx;
+  border: #d81e07 solid 1rpx;
+  background-color: #ebebeb;
+  margin-right: 5%;
 }
-
-.user-icon image {
-  width: 40px;
-  height: 40px;
+.user-border-unlogin image {
+  width: 80rpx;
+  height: 80rpx;
   border-radius: 50%;
   margin-right: 3%;
 }
-
-.login-container button {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  width: 33%;
-  height: 33%;
-  color: #fff;
-  font-size: 28rpx;
-  background-color: #15803d;
-  font-weight: 549;
+.user-icon-login {
+  width: 100rpx;
+  height: 100rpx;
+  border-radius: 50%;
 }
-
-.order-tip {
+.user-tip {
   display: flex;
+  height: 100%;
   flex-direction: column;
+  justify-content: space-between;
+  flex-grow: 5;
+}
+.toOtherPage{
+  flex-grow: 2;
+  display: flex;
   align-items: center;
+  justify-content: center;
 }
 
-.order-tip image {
+.line{
   width: 100%;
-  height: 100%;
-}
-
-.order-tip text {
-  font-size: small;
-  font-weight: 600;
+  height: 6rpx;
+  background-color: #d81e07;
+  padding: 0;
+  margin: 0;
 }
 
 .scan-container {
@@ -95,30 +110,66 @@
   width: 100%;
   flex-direction: column;
   align-items: center;
-  margin-top: 100rpx;
+  margin: 5% 0% 5%;
   text-align: center;
-  background-color: #fff;
-  padding: 20px;
-  border-radius: 8px;
 }
 
-.scan-container image {
-  width: 120px;
-  height: 120px;
+.scan-image-box{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 230rpx;
+  height: 230rpx;
+}
+.scan-bg-1{
+  position: absolute;
+  width: 230rpx;
+  height: 230rpx;
+  border-radius: 50%;
+  background: #fed3d4;
+}
+.scan-bg-2{
+  position: absolute;
+  width: 210rpx;
+  height: 210rpx;
   border-radius: 50%;
+  background: #f2635d;
+}
+.scan-bg-3{
+  position: absolute;
+  width: 200rpx;
+  height: 200rpx;
+  border-radius: 50%;
+  background: #d81e07;
+}
+.scan-container image {
+  position: absolute;
+  width: 120rpx;
+  height: 120rpx;
 }
 
-.scan-container text {
-  margin-top: 10px;
-  font-size: 16px;
-  color: #333;
+.scan-tip-title{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 90%;
+  margin: 8% 0%;
 }
 
-/* 背景图 */
-gas-station-background {
-  width: 100%;
-  height: 50vh; /* 占据屏幕高度的一半 */
-  object-fit: cover;
-  position: relative;
-  z-index: 0;
+.title-line{
+  position: absolute;
+  width: 80%;
+  height: 3rpx;
+  background-color: #e5e5e5;
+}
+.scan-tip-title-text{
+  position: absolute;
+  width: 30%;
+  font-weight: 600;
+  background-color: #FFFFFF;
+  font-size: larger;
+}
+.scan-tip-text{
+  font-size: small;
+  color: #808080;
 }

+ 1 - 1
project.private.config.json

@@ -5,5 +5,5 @@
     "compileHotReLoad": true,
     "urlCheck": false
   },
-  "libVersion": "2.31.1"
+  "libVersion": "2.16.1"
 }

+ 15 - 1
utils/util.js

@@ -9,11 +9,25 @@ const formatTime = date => {
   return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
 }
 
+const formatDateNotSecond = isoString => {
+  const date = new Date(isoString);
+
+  const year = date.getFullYear();
+  const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based
+  const day = String(date.getDate()).padStart(2, '0');
+  
+  const hours = String(date.getHours()).padStart(2, '0');
+  const minutes = String(date.getMinutes()).padStart(2, '0');
+
+  return `${year}-${month}-${day} ${hours}:${minutes}`;
+}
+
 const formatNumber = n => {
   n = n.toString()
   return n[1] ? n : `0${n}`
 }
 
 module.exports = {
-  formatTime
+  formatTime,
+  formatDateNotSecond
 }