فهرست منبع

Merge branch 'release/初版整合开发和maser分支'

Zhenghanjv 2 ماه پیش
والد
کامیت
cbb7d316d7
53فایلهای تغییر یافته به همراه2136 افزوده شده و 120 حذف شده
  1. 26 18
      app.json
  2. 34 0
      components/orderInfo/orderInfo.js
  3. 4 0
      components/orderInfo/orderInfo.json
  4. 30 0
      components/orderInfo/orderInfo.wxml
  5. 76 0
      components/orderInfo/orderInfo.wxss
  6. 78 0
      components/orderItem/orderItem.js
  7. 4 0
      components/orderItem/orderItem.json
  8. 54 0
      components/orderItem/orderItem.wxml
  9. 96 0
      components/orderItem/orderItem.wxss
  10. 79 0
      components/orderItemInfo/orderItemInfo.js
  11. 4 0
      components/orderItemInfo/orderItemInfo.json
  12. 63 0
      components/orderItemInfo/orderItemInfo.wxml
  13. 119 0
      components/orderItemInfo/orderItemInfo.wxss
  14. 29 0
      components/pay/pay.js
  15. 4 0
      components/pay/pay.json
  16. 4 0
      components/pay/pay.wxml
  17. 24 0
      components/pay/pay.wxss
  18. BIN
      images/date.png
  19. BIN
      images/down.png
  20. 6 0
      images/oil.svg
  21. 6 0
      images/order.svg
  22. BIN
      images/orientation.png
  23. 6 0
      images/question.svg
  24. BIN
      images/scan.png
  25. BIN
      images/stationBackground.png
  26. BIN
      images/user.png
  27. 18 16
      js/api.js
  28. 176 0
      pages/TransactionPage/TransactionPage.js
  29. 6 0
      pages/TransactionPage/TransactionPage.json
  30. 17 0
      pages/TransactionPage/TransactionPage.wxml
  31. 39 0
      pages/TransactionPage/TransactionPage.wxss
  32. 181 0
      pages/historyOrder/historyOrder.js
  33. 5 0
      pages/historyOrder/historyOrder.json
  34. 28 0
      pages/historyOrder/historyOrder.wxml
  35. 39 0
      pages/historyOrder/historyOrder.wxss
  36. 4 0
      pages/index/index.js
  37. 102 48
      pages/login/login.js
  38. 2 1
      pages/login/login.wxml
  39. 119 0
      pages/moreOrder/moreOrder.js
  40. 5 0
      pages/moreOrder/moreOrder.json
  41. 12 0
      pages/moreOrder/moreOrder.wxml
  42. 31 0
      pages/moreOrder/moreOrder.wxss
  43. 92 0
      pages/quantify/quantify.js
  44. 3 0
      pages/quantify/quantify.json
  45. 45 0
      pages/quantify/quantify.wxml
  46. 116 0
      pages/quantify/quantify.wxss
  47. 72 0
      pages/scan/scan.js
  48. 3 0
      pages/scan/scan.json
  49. 48 0
      pages/scan/scan.wxml
  50. 175 0
      pages/scan/scan.wxss
  51. 29 28
      project.config.json
  52. 8 8
      project.private.config.json
  53. 15 1
      utils/util.js

+ 26 - 18
app.json

@@ -1,18 +1,26 @@
-{
-  "pages": [
-    "pages/login/login",
-    "pages/login/load",
-    "pages/index/index",
-    "pages/logs/logs"
-   
-  ],
-  "window": {
-    "navigationBarTextStyle": "black",
-    "navigationBarTitleText": "Weixin",
-    "navigationBarBackgroundColor": "#ffffff"
-  },
-  "style": "v2",
-  "componentFramework": "glass-easel",
-  "sitemapLocation": "sitemap.json",
-  "lazyCodeLoading": "requiredComponents"
-}
+{
+  "pages": [
+    "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": {
+    "navigationBarTextStyle": "black",
+    "navigationBarTitleText": "Weixin",
+    "navigationBarBackgroundColor": "#ffffff"
+  },
+  "style": "v2",
+  "componentFramework": "glass-easel",
+  "sitemapLocation": "sitemap.json",
+  "lazyCodeLoading": "requiredComponents"
+}

+ 34 - 0
components/orderInfo/orderInfo.js

@@ -0,0 +1,34 @@
+// components/orderInfo/orderInfo.js
+Component({
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    order:{
+      type:Object,
+      value:{
+        oilName:'92号汽油',
+        nozzleNum:'5',
+        volume:'19.9',
+        amount:'46.8',
+        date:'2024-11-24',
+        time:'09:28'
+      }
+    },
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+
+  }
+})

+ 4 - 0
components/orderInfo/orderInfo.json

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

+ 30 - 0
components/orderInfo/orderInfo.wxml

@@ -0,0 +1,30 @@
+<!-- 订单信息 -->
+<view class="orderItemContainer">
+    <!-- 时间 -->
+    <view class="dateTime">
+      <text style="margin-left: 3%;color: #a7a7a7;font-size: smaller;">{{order.date}}</text>
+      <text style="font-weight: 600;margin-right: 3%;">{{order.time}}</text>
+    </view>
+
+    <!-- 中间订单信息 -->
+    <view class="middle">
+      <image src="../../images/oil.svg" mode="aspectFit"></image>
+      <view class="orderInfo">
+        <text style="font-weight: 800;">{{order.oilName}}</text>
+        <view class="nozzleAndVolume">
+          <text class="nozzle">{{order.nozzleNum}}号枪</text>
+          <text class="volume">{{order.volume}}</text>
+          <text style="color: #ff4e0e;font-size: small;">升</text>
+        </view>
+      </view>
+    </view>
+
+    <!-- 底部金额-->  
+    <view class="bottom">
+      <view class="amount">
+        <text>合计</text>
+        <text>¥</text>
+        <text>{{order.amount}}</text>
+      </view>
+    </view>
+  </view>

+ 76 - 0
components/orderInfo/orderInfo.wxss

@@ -0,0 +1,76 @@
+.orderItemContainer{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 90%;
+  margin-top: 5%;
+  margin-bottom: 3%;
+  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+  border-radius: 3%;
+  padding: 2% 2%;
+}
+
+.dateTime {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  width: 100%;
+}
+
+.middle {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  width: 90%;
+  border-bottom: 2rpx dashed #e1e1e2;
+}
+
+.middle image{
+  width: 150rpx;
+  height: 150rpx;
+}
+
+.orderInfo{
+  width: 50%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-around;
+}
+
+.nozzleAndVolume{
+  display: flex;
+  width: 60%;
+  justify-content: space-between;
+  align-items: center;
+  margin-top: 3%;
+}
+
+.nozzle {
+  color: #ffffff;
+  font-weight: 600;
+  font-size: small;
+  background-color: #ca5a50;
+  border-radius: 10%;
+}
+
+.volume {
+  color: #ff4e0e;
+  font-size: large;
+}
+
+.bottom {
+  display: flex;
+  flex-direction: row-reverse;
+  align-items: center;
+  justify-content: space-between;
+  margin-top: 5%;
+  width: 90%;
+}
+
+.amount {
+  display: flex;
+  flex-direction: row;
+  font-weight: 600;
+}

+ 78 - 0
components/orderItem/orderItem.js

@@ -0,0 +1,78 @@
+// components/orderItem/orderItem.js
+Component({
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    order:{
+      type:Object,
+      // value:{
+      //   oilName:'92号汽油',
+      //   nozzleNum:'5',
+      //   volume:'19.9',
+      //   amount:'46.8',
+      //   date:'2024-11-24',
+      //   time:'09:28',
+      //   status:'已授权'
+      // }
+    },
+    statusColor:{
+      type:String,
+      // value:"#88b743"
+    },
+    countdown:{
+      type:String,
+      // value:""
+    },
+    buttonMessage1:{
+      type:String,
+      // value:"按钮一"
+    },
+    buttonMessage2:{
+      type:String,
+      // value:"按钮二"
+    },
+    buttonColor1:{
+      type:String,
+      // value:"#ee333a"
+    },
+    buttonColor2:{
+      type:String,
+      // value:"#97c276"
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    //第一个按钮的点击事件
+    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/orderItem/orderItem.json

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

+ 54 - 0
components/orderItem/orderItem.wxml

@@ -0,0 +1,54 @@
+<!--components/orderItem/orderItem.wxml-->
+<view class="orderItemContainer">
+  <!-- 时间 -->
+  <view class="dateTime">
+    <text style="margin-left: 3%;color: #a7a7a7;font-size: smaller;">{{order.date}}</text>
+    <view style="margin-right: 3%;" class="timeAndStatus">
+      <text style="font-weight: 600;">{{order.time}}</text>
+      <text wx:if="{{order.status != ''}}" style="color: {{statusColor}};font-size: small;">{{order.status}}</text>
+    </view>
+  </view>
+
+  <!-- 中间订单信息 -->
+  <view class="middle">
+    <image src="../../images/oil.svg" mode="aspectFit"></image>
+    <view class="orderInfo">
+      <text style="font-weight: 800;">{{order.oilName}}</text>
+      <view class="nozzleAndVolume">
+        <text class="nozzle">{{order.nozzleNum}}号枪</text>
+        <text class="volume">{{order.volume}}</text>
+        <text style="color: #ff4e0e;font-size: small;">升</text>
+      </view>
+    </view>
+    <text wx:if="{{countdown != ''}}">倒计时 {{countdown}} 秒</text>
+  </view>
+
+  <!-- 底部金额及按钮-->  
+  <view class="bottom">
+    <view class="amount">
+      <text>金额</text>
+      <text>¥</text>
+      <text>{{order.amount}}</text>
+    </view>
+    <view class="botton">
+      <block wx:if="{{buttonMessage1 != ''}}">
+        <button 
+        style="color: {{buttonColor1}};"
+        bind:tap="buttonClick1">{{buttonMessage1}}</button>
+      </block>
+      <block wx:else>
+        <view style="width: 45%;"></view> <!-- 占位元素 -->
+      </block>
+      
+      <block wx:if="{{buttonMessage2 != ''}}">
+        <button 
+        style="color: {{buttonColor2}};"
+        bind:tap="buttonClick2">{{buttonMessage2}}</button>
+      </block>
+      <block wx:else>
+        <view style="width: 45%;"></view> <!-- 占位元素 -->
+      </block>
+    </view>
+    
+  </view>
+</view>

+ 96 - 0
components/orderItem/orderItem.wxss

@@ -0,0 +1,96 @@
+.orderItemContainer{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  width: 100%;
+  margin-top: 3%;
+  margin-bottom: 3%;
+}
+
+.dateTime {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+  align-items: center;
+  width: 100%;
+}
+
+.timeAndStatus{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.middle {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  width: 90%;
+  border-bottom: 2rpx dashed #e1e1e2;
+}
+
+.middle image{
+  width: 150rpx;
+  height: 150rpx;
+}
+
+.orderInfo{
+  width: 50%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  justify-content: space-around;
+}
+
+.nozzleAndVolume{
+  display: flex;
+  width: 60%;
+  justify-content: space-between;
+  align-items: center;
+  margin-top: 3%;
+}
+
+.nozzle {
+  color: #ffffff;
+  font-weight: 600;
+  font-size: small;
+  background-color: #ca5a50;
+  border-radius: 10%;
+}
+
+.volume {
+  color: #ff4e0e;
+  font-size: large;
+}
+
+.bottom {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  justify-content: space-between;
+  margin-top: 5%;
+  width: 90%;
+}
+
+.amount {
+  display: flex;
+  flex-direction: row;
+  font-weight: 600;
+}
+
+.botton{
+  display: flex;
+  width: 60%;
+  justify-content: space-between;
+}
+
+.botton button{
+  width: 45%;
+  background-color: transparent;
+  border: 1rpx solid #b6df96;
+  font-weight: 500;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  padding: 5px;
+}

+ 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%;
+}

+ 29 - 0
components/pay/pay.js

@@ -0,0 +1,29 @@
+// components/pay/pay.js
+Component({
+
+  /**
+   * 组件的属性列表
+   */
+  properties: {
+    amount:{
+      type:String,
+      value:'46.8'
+    }
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    toPay(){
+      this.triggerEvent("onPay");
+    }
+  }
+})

+ 4 - 0
components/pay/pay.json

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

+ 4 - 0
components/pay/pay.wxml

@@ -0,0 +1,4 @@
+<view class="payContainer">
+  <view class="amount">合计 ¥ {{amount}}</view>
+  <view class="toPay" bind:tap="toPay">去支付</view>
+</view>

+ 24 - 0
components/pay/pay.wxss

@@ -0,0 +1,24 @@
+
+.payContainer{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  height: 80rpx;
+  border-radius: 40rpx;
+  padding-left: 5%;
+  padding-right: 8%;
+  background-image: linear-gradient(to right, #333333 75%, #d81e07 75%); /* 线性渐变 */
+}
+
+.amount{
+  color: #eaf3fa;
+  display: flex;
+  justify-content: start;
+}
+
+.toPay{
+  color: #eaf3fa;
+  display: flex;
+  flex-direction: row-reverse;
+  justify-content: end;
+}

BIN
images/date.png


BIN
images/down.png


+ 6 - 0
images/oil.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" width="94" height="94" style="" filter="none">
+    
+    <g>
+    <defs fill="rgba(16,16,16,1)"><style fill="rgba(16,16,16,1)">.cls-1 {fill: #4895ef;}.cls-2 {fill: #135891;}.cls-3 {fill: none;}.cls-4 {fill: #82bbf0;}</style></defs><rect class="cls-2" x="9.28" y="4" width="4.8" height="3.36" rx="1.04" ry="1.04" fill="rgba(16,16,16,1)"></rect><path class="cls-3" d="m18.7,9.2c-.38-.45-1.05-.52-1.51-.14-.45.38-.52,1.05-.14,1.51l3.34,4.05c.38.45,1.05.52,1.51.14.45-.38.52-1.05.14-1.51l-3.34-4.05Z" fill="rgba(16,16,16,1)"></path><path class="cls-4" d="m24.64,13.96c0-.43-.15-.86-.44-1.19l-5.25-6.2c-.35-.41-.86-.65-1.4-.65h-8.35c-1.01,0-1.84.82-1.84,1.84v16.88h17.28v-10.68Zm-2.75.8c-.45.38-1.13.31-1.51-.14l-3.34-4.05c-.38-.45-.31-1.13.14-1.51.45-.38,1.13-.31,1.51.14l3.34,4.05c.38.45.31,1.13-.14,1.51Z" fill="rgba(16,16,16,1)"></path><path class="cls-2" d="m9.2,28h13.61c1.01,0,1.84-.82,1.84-1.84v-1.52H7.36v1.52c0,1.01.82,1.84,1.84,1.84Z" fill="rgba(16,16,16,1)"></path><path class="cls-1" d="m14.56,18.27c0,1.07-.87,1.94-1.94,1.94s-1.94-.87-1.94-1.94,1.94-4.19,1.94-4.19c0,0,1.94,3.12,1.94,4.19Z" fill="rgba(16,16,16,1)"></path>
+    </g>
+  </svg>

+ 6 - 0
images/order.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48" width="32" height="32" style="" filter="none">
+    
+    <g>
+    <path d="M10 6C10 4.89543 10.8954 4 12 4H36C37.1046 4 38 4.89543 38 6V44L31 39L24 44L17 39L10 44V6Z" fill="none" stroke="rgba(129,179,55,1)" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></path><path d="M18 22L30 22" stroke="rgba(129,179,55,1)" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" fill="none"></path><path d="M18 30L30 30" stroke="rgba(129,179,55,1)" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" fill="none"></path><path d="M18 14L30 14" stroke="rgba(129,179,55,1)" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" fill="none"></path>
+    </g>
+  </svg>

BIN
images/orientation.png


+ 6 - 0
images/question.svg

@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" width="36" height="36" style="" filter="none">
+    
+    <g>
+    <path d="M16 1.984c-7.744 0-13.984 6.272-13.984 14.016s6.24 14.016 13.984 14.016 14.016-6.272 14.016-14.016-6.272-14.016-14.016-14.016zM17.6 25.728c-0.672 0.096-1.344 0.16-1.984 0.16-0.672 0-1.344-0.064-2.016-0.16-0.096-0.672-0.16-1.344-0.16-2.016s0.064-1.312 0.16-2.016c0.672-0.096 1.344-0.16 1.984-0.16 0.672 0 1.344 0.064 2.016 0.16 0.128 0.704 0.16 1.376 0.16 2.016 0 0.672-0.032 1.344-0.16 2.016zM21.248 13.888c-0.31 0.615-0.718 1.136-1.21 1.563l-0.006 0.005c-0.405 0.399-0.868 0.74-1.376 1.009l-0.032 0.015c-0.48 0.288-0.896 0.48-1.184 0.608v2.464c-0.64 0.096-1.248 0.16-1.856 0.16s-1.152-0.064-1.696-0.16v-4.672c0.416-0.064 0.832-0.192 1.312-0.32 0.475-0.137 0.89-0.334 1.264-0.586l-0.016 0.010c0.378-0.215 0.69-0.506 0.922-0.854l0.006-0.010c0.256-0.352 0.384-0.8 0.384-1.344 0-0.768-0.288-1.344-0.864-1.76-0.544-0.416-1.312-0.608-2.24-0.608-0.384 0-0.704 0-1.024 0.032-0.314 0.028-0.598 0.073-0.875 0.136l0.043-0.008c-0.224 0.064-0.512 0.128-0.768 0.224s-0.544 0.16-0.832 0.288c-0.256-0.48-0.448-0.96-0.64-1.472-0.151-0.471-0.254-1.017-0.287-1.582l-0.001-0.018c0.48-0.16 0.928-0.288 1.312-0.416s0.8-0.192 1.184-0.288c0.352-0.064 0.736-0.128 1.12-0.128 0.384-0.032 0.8-0.064 1.216-0.064 2.208 0 3.84 0.512 4.96 1.504 1.088 0.992 1.664 2.336 1.664 4.064 0 0.864-0.16 1.6-0.48 2.208z" fill="rgba(129,179,55,1)"></path>
+    </g>
+  </svg>

BIN
images/scan.png


BIN
images/stationBackground.png


BIN
images/user.png


+ 18 - 16
js/api.js

@@ -16,15 +16,14 @@ function request(path, method = 'GET', data = null) {
     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;
-    if(jsonString != '')
-    {
-      stringToSign +=  "&"+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位
@@ -151,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");
 }
 
 //小程序用户查询未支付订单
@@ -172,7 +171,7 @@ 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) {
@@ -205,5 +204,8 @@ export default {
   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;
+}

+ 181 - 0
pages/historyOrder/historyOrder.js

@@ -0,0 +1,181 @@
+const { default: api } = require("../../js/api");
+
+// pages/historyOrderAfter/historyOrderAfter.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    date:'',
+    startDate:'',
+    endDate:'',
+    orders:[
+      {
+        order:{
+          nozzle:5,
+          status:'已授权',
+          statusColor:'#bbe06e',
+          oilName:"92#",
+          volume:20.0,
+          amount:46.8,
+          payAmount:46.8,
+          discount:0.00,
+          time:'2024-11-24 09:08',
+        },
+        bottonText2:'请尽快提枪'
+      },
+    ]
+  },
+
+  /** 获取当前日期 */
+  getNowDate(){
+    const date = new Date(); // 获取当前日期
+    const year = date.getFullYear(); // 获取年份
+    const month = String(date.getMonth() + 1).padStart(2, '0'); // 获取月份,补零
+    const day = String(date.getDate()).padStart(2, '0'); // 获取日期,补零
+  
+    return `${year}-${month}-${day}`; // 拼接成 yyyy-MM-dd 格式
+  },
+  /** 获取上个月日期 */
+  getLastMouthDate(){
+    const currentDate = new Date(); // 获取当前日期
+    const year = currentDate.getFullYear(); // 当前年份
+    const month = currentDate.getMonth(); // 当前月份(0-11)
+    const day = currentDate.getDate(); // 当前日期
+
+    // 计算一个月前的日期
+    const oneMonthAgoDate = new Date(year, month - 1, day);
+
+    // 处理跨年问题(如果当前月份是 1 月,month - 1 会是 0,即上一年的 12 月)
+    // 无需额外处理,Date 对象会自动处理
+
+    // 格式化日期为 YYYY-MM-DD
+    const formattedDate = `${oneMonthAgoDate.getFullYear()}-${String(oneMonthAgoDate.getMonth() + 1).padStart(2, '0')}-${String(oneMonthAgoDate.getDate()).padStart(2, '0')}`;
+
+    return formattedDate;
+  },
+
+  /** 计算倒计时,倒计时结束后发起取消授权 */
+  startCountdow(){
+    this.timer = setInterval(() => {
+      const countDownZeroOrders = []
+      const orders = this.data.orders.map(order => {
+        if(order.countdown && order.countdown != '0') {
+          const currentCountDown = (Number(order.countdown) - 1);
+          order.countdown = currentCountDown.toString();
+          if(currentCountDown <= 0) countDownZeroOrders.push(order)
+        }
+        return order
+      })
+
+      this.setData({
+        orders:orders
+      })
+      this.toUnAnthorization(countDownZeroOrders)
+    },1000);
+  },
+
+  /** 结束倒计时 */
+  endCountDown(){
+    if(this.timer) {
+      clearInterval(this.timer)
+      this.timer = null
+    }
+  },
+  /** 发送取消授权 */
+  toUnAnthorization(orders) {
+    console.log(orders)
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    const today = this.getNowDate();
+    const lastMouthDay = this.getLastMouthDate();
+    this.setData({
+      date:today,
+      startDate:today,
+      endDate:lastMouthDay
+    });
+
+
+    // this.startCountdow();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+    this.endCountDown()
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+
+  /** 日期选择器选择时间 */
+  bindDateChange(date) {
+    this.setData({
+      date: date.detail.value
+    });
+    console.log(date)
+  },
+
+  /** 组件按钮一点击事件 */
+  onOrderButtonClick1(event){
+    console.log(event)
+  },
+
+  /** 组件按钮二点击事件 */
+  onOrderButtonClick2(event){
+    console.log(event)
+  },
+
+  /** 获取订单 */
+  getOrder(){
+    api.request_GetMiniProgramTransactionsUnpaidQuery(null).then(res => {
+      console.log("未支付订单",res)
+    }).catch(err => {
+      console.log("获取未支付订单失败",err)
+    })
+  }
+})

+ 5 - 0
pages/historyOrder/historyOrder.json

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

+ 28 - 0
pages/historyOrder/historyOrder.wxml

@@ -0,0 +1,28 @@
+<!--pages/historyOrderAfter/historyOrderAfter.wxml-->
+<view class="orderContainer">
+
+  <!-- 日期选择器 -->
+  <view class="dataSelect">
+    <view class="dateTip">
+      <image src="../../images/date.png" mode="aspectFill" />
+      <text>日期跳转</text>
+    </view>
+    
+    <picker mode="date" value="{{date}}" bindchange="bindDateChange">
+      <text>{{date}} ></text>
+    </picker>
+  </view>
+
+  <!-- 订单列表 -->
+  <view class="order">
+    <view class="orderItem" wx:for="{{orders}}">
+      <orderItem 
+      order="{{item.order}}"
+      bottonText2="{{item.bottonText2}}"
+      bind:bottonEvent1="onOrderButtonClick1"
+      bind:bottonEvent2="onOrderButtonClick2" />
+    </view>
+  </view>
+
+  <text style="color: #a1a1a1; margin: 5%">仅保留一个月的交易记录</text>
+</view>

+ 39 - 0
pages/historyOrder/historyOrder.wxss

@@ -0,0 +1,39 @@
+.orderContainer{
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+}
+
+.dataSelect {
+  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;
+  flex-direction: column;
+  align-items: center;
+  width: 93%;
+}
+
+.orderItem {
+  width: 100%;
+  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+  border-radius: 1%;
+}

+ 4 - 0
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,12 +29,15 @@ 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({

+ 102 - 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,6 +65,7 @@ Page({
   onShareAppMessage() {
 
   },
+
   pay(){
     api.request_wechatPay(23)
     .then(res => {
@@ -142,52 +142,7 @@ debugger
         console.log('用户拒绝授权');
     }
 },
-  handleAuthLogin() {
-    console.log('一键授权登录按钮被点击');
-    // 调用微信登录接口
-    wx.login({
-      success(res) {
-        if (res.code) {
-          console.log('登录成功,code:', res.code);
-          api.request_Wechatlogin(res.code)
-          .then(res => {
-            debugger
-            wx.setStorageSync('WachatID', res.data.data)
-          });
-        } else {
-          console.log('登录失败:', res.errMsg);
-        }
-      },
-      fail(err) {
-        console.error('登录接口调用失败:', err);
-      },
-    });
-
-    // 获取用户信息授权
-    wx.getUserProfile({
-      desc: '用于完善用户资料', // 声明获取用户信息的目的
-      success(res) {
-        console.log('用户信息:', res.userInfo);
-        var user = {
-          UserName : res.userInfo.nickName,
-          UserAvatarUrl :res.userInfo.avatarUrl,
-          UserPhoneNumber:'',
-          Address:''
-        };
-        api.request_AddMiniprogramUser(user)
-        .then(res => {
-          debugger
-        });
-        // 将用户信息发送到服务器
-        // 例如:wx.request({ url: 'https://example.com/userInfo', data: res.userInfo })
-      },
-      fail(err) {
-        console.error('获取用户信息失败:', err);
-      },
-    });
-
-
-
+  subMessage() {
     wx.requestSubscribeMessage({
       tmplIds: ['ldkKXfnHj-uKo6SBep08f_kaSjtxMOccJywHOEgxyPg'], // 最多支持3条
       success(res) {
@@ -216,5 +171,104 @@ debugger
         }
       }
     })
+  },
+
+  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);
+          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);
+      },
+    });
+  },
+
+  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 
   }
 })

+ 2 - 1
pages/login/login.wxml

@@ -3,7 +3,8 @@
     <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>

+ 119 - 0
pages/moreOrder/moreOrder.js

@@ -0,0 +1,119 @@
+// pages/moreOrder/moreOrder.js
+const { default: api } = require("../../js/api");
+const util = require('../../utils/util.js')
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    buttonMessage2:'去支付',
+    orders:[
+      {
+        nozzle:5,
+        oilName:"92#",
+        volume:20.0,
+        amount:46.8,
+        payAmount:46.8,
+        discount:0.00,
+        orderId:'1',
+        time:'2024-11-24 09:08'
+      }
+    ]
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    console.log("更多订单页",options)
+    this.getOrder(options.nozzle)
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+  
+  /** 点击去支付 */
+  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("未获取到未支付订单")
+    })
+  },
+})

+ 5 - 0
pages/moreOrder/moreOrder.json

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

+ 12 - 0
pages/moreOrder/moreOrder.wxml

@@ -0,0 +1,12 @@
+<view class="moreOrderContainer">
+  <!-- 提示 -->
+  <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>
+</view>

+ 31 - 0
pages/moreOrder/moreOrder.wxss

@@ -0,0 +1,31 @@
+.moreOrderContainer{
+  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;
+  align-items: center;
+  width: 93%;
+}
+
+.orderItem{
+  width: 100%;
+  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
+  margin: 3%;
+  border-radius: 1%;
+}

+ 92 - 0
pages/quantify/quantify.js

@@ -0,0 +1,92 @@
+// pages/quantify/quantify.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    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,
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  },
+
+  /** 当选择定量类型 */
+  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;
+}

+ 72 - 0
pages/scan/scan.js

@@ -0,0 +1,72 @@
+const {
+  default: api
+} = require("../../js/api");
+
+Page({
+  data: {
+    isLoggedIn: false,
+    site:{},
+    userInfo: {},
+    scanTitle: '扫码加油',
+    scanTip: '请扫描加油机键盘上的二维码'
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    api.request_GetSiteInfo().then(res => {
+      if(res.data.statusCode == 203) {
+        console.log("获取站点信息失败",res)
+        return
+      }
+      console.log("站点信息",res)
+      this.setData({
+        isLoggedIn: true,
+        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.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'
+        });
+      }
+    });
+  }
+});

+ 3 - 0
pages/scan/scan.json

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

+ 48 - 0
pages/scan/scan.wxml

@@ -0,0 +1,48 @@
+<view class="scanContainer">
+  <view class="header">
+    <image src="../../images/orientation.png" />
+    <text>{{site.name}}</text>
+  </view>
+  <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>

+ 175 - 0
pages/scan/scan.wxss

@@ -0,0 +1,175 @@
+.scanContainer {
+  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: 5%;
+  left: 0;
+  height: 35px;
+  z-index: 999;
+  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 {
+  width: 100%;
+  height: 50vh;
+}
+
+.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;
+  align-items: center;
+  width: 100%;
+  max-width: 400px; /* 最大宽度 */
+  padding: 3%;
+  margin: 5% 0% 3%;
+  box-sizing: border-box; /* 确保宽度包含 padding */
+}
+.user-icon {
+  flex-grow: 1;
+  /* display: flex;
+  flex-direction: row;
+  align-items: center;
+  flex-grow: 10; */
+}
+.user-border-unlogin{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 50%;
+  width: 100rpx;
+  height: 100rpx;
+  border: #d81e07 solid 1rpx;
+  background-color: #ebebeb;
+  margin-right: 5%;
+}
+.user-border-unlogin image {
+  width: 80rpx;
+  height: 80rpx;
+  border-radius: 50%;
+  margin-right: 3%;
+}
+.user-icon-login {
+  width: 100rpx;
+  height: 100rpx;
+  border-radius: 50%;
+}
+.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;
+}
+
+.line{
+  width: 100%;
+  height: 6rpx;
+  background-color: #d81e07;
+  padding: 0;
+  margin: 0;
+}
+
+.scan-container {
+  display: flex;
+  width: 100%;
+  flex-direction: column;
+  align-items: center;
+  margin: 5% 0% 5%;
+  text-align: center;
+}
+
+.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-tip-title{
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 90%;
+  margin: 8% 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;
+}

+ 29 - 28
project.config.json

@@ -1,29 +1,30 @@
-{
-  "compileType": "miniprogram",
-  "libVersion": "trial",
-  "setting": {
-    "coverView": true,
-    "es6": true,
-    "postcss": true,
-    "minified": true,
-    "enhance": true,
-    "showShadowRootInWxmlPanel": true,
-    "packNpmRelationList": [],
-    "babelSetting": {
-      "ignore": [],
-      "disablePlugins": [],
-      "outputPath": ""
-    },
-    "ignoreUploadUnusedFiles": true
-  },
-  "condition": {},
-  "editorSetting": {
-    "tabIndent": "auto",
-    "tabSize": 2
-  },
-  "packOptions": {
-    "ignore": [],
-    "include": []
-  },
-  "appid": "wxb198dafff060e651"
+{
+  "compileType": "miniprogram",
+  "libVersion": "trial",
+  "packOptions": {
+    "ignore": [],
+    "include": []
+  },
+  "setting": {
+    "coverView": true,
+    "es6": true,
+    "postcss": true,
+    "minified": true,
+    "enhance": true,
+    "showShadowRootInWxmlPanel": true,
+    "packNpmRelationList": [],
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
+    },
+    "ignoreUploadUnusedFiles": true
+  },
+  "condition": {},
+  "editorSetting": {
+    "tabIndent": "auto",
+    "tabSize": 2
+  },
+  "appid": "wxb198dafff060e651",
+  "projectname": "fuelwx"
 }

+ 8 - 8
project.private.config.json

@@ -1,9 +1,9 @@
-{
-  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
-  "projectname": "fuelwx",
-  "setting": {
-    "compileHotReLoad": true,
-    "urlCheck": false
-  },
-  "libVersion": "3.7.7"
+{
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "projectname": "fuelwx",
+  "setting": {
+    "compileHotReLoad": true,
+    "urlCheck": false
+  },
+  "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
 }