فهرست منبع

feat:UI修改,更改后支付切换到预支付后历史订单显示问题

Zhenghanjv 8 ماه پیش
والد
کامیت
f53160cccd

BIN
images/stationBackground.png


BIN
images/stations.png


+ 9 - 8
pages/AuthorizationTransactionPage/AuthorizationTransactionPage.js

@@ -83,14 +83,15 @@ Page({
 
 
   /** 支付按钮点击事件 */
   /** 支付按钮点击事件 */
   toPay() {
   toPay() {
-    var that = this;
-    api.request_wechatPay(this.data.order.orderId).then(res => {
-      console.log("支付结果", res)
-      that.subMessage()
-      // this.pay()
-    }).catch(err => {
-      console.log("支付失败", err)
-    })
+    this.subMessage()
+    // var that = this;
+    // api.request_wechatPay(this.data.order.orderId).then(res => {
+    //   console.log("支付结果", res)
+    //   that.subMessage()
+    //   // this.pay()
+    // }).catch(err => {
+    //   console.log("支付失败", err)
+    // })
   },
   },
   /** 订阅消息模板 */
   /** 订阅消息模板 */
   subMessage() {
   subMessage() {

+ 22 - 21
pages/TransactionPage/TransactionPage.js

@@ -159,27 +159,28 @@ Page({
     wx.showLoading({
     wx.showLoading({
       title: '正在跳转',
       title: '正在跳转',
     })
     })
-    var that = this;
-    api.request_wechatPay(this.data.order.orderId).then(res => {
-      console.log("支付结果", res)
-      if(res.data.statusCode != 200) {
-        wx.hideLoading()
-        wx.showModal({
-          title: '提示',
-          content: '支付失败',
-        })
-        return
-      }
-      this.subMessage()
-      // this.pay()
-    }).catch(err => {
-      wx.hideLoading()
-      console.log("支付失败", err)
-      wx.showModal({
-        title: '提示',
-        content: '支付失败',
-      })
-    })
+    this.subMessage()
+    // var that = this;
+    // api.request_wechatPay(this.data.order.orderId).then(res => {
+    //   console.log("支付结果", res)
+    //   if(res.data.statusCode != 200) {
+    //     wx.hideLoading()
+    //     wx.showModal({
+    //       title: '提示',
+    //       content: '支付失败',
+    //     })
+    //     return
+    //   }
+    //   this.subMessage()
+    //   // this.pay()
+    // }).catch(err => {
+    //   wx.hideLoading()
+    //   console.log("支付失败", err)
+    //   wx.showModal({
+    //     title: '提示',
+    //     content: '支付失败',
+    //   })
+    // })
     
     
   },
   },
   /** 订阅消息模板 */
   /** 订阅消息模板 */

+ 61 - 7
pages/historyOrder/historyOrder.js

@@ -12,6 +12,10 @@ Page({
   data: {
   data: {
     orders: [],
     orders: [],
     date: '',
     date: '',
+    latitude: 0, //用户当前经度
+    longitude: 0, //用户当前纬度
+    stationLatitude: 0, //站点经度
+    stationLongitude: 0, //站点纬度
     startDate: '',
     startDate: '',
     endDate: '',
     endDate: '',
     pageNum: 1,//查询页码
     pageNum: 1,//查询页码
@@ -152,10 +156,47 @@ Page({
       endDate: lastMouthDay
       endDate: lastMouthDay
     });
     });
     console.log("历史页当前data", this.data)
     console.log("历史页当前data", this.data)
+    // this.startCountdow();
+  },
 
 
-    
+  /** 获取站点信息 */
+  getStationInfo() {
+    const that = this;
+    api.request_GetSiteInfo().then(res => {
+      if (res.data.statusCode == 203) {
+        //若为203,证明还未登录,跳转到登录页,这里可能刚从主页跳转过来,频繁的跳转可能会跳转页面超时,故而加上延时
+        setTimeout(() => {
+          wx.navigateTo({
+            url: '../login/login'
+          })
+        }, 500)
+        return
+      }
+      console.log("站点信息", res)
+      const stationLocation = res.data.data.site.gpsCoordinates.split(",");
+      if (stationLocation.length == 2) {
+        that.setData({
+          stationLatitude: stationLocation[0],
+          stationLongitude: stationLocation[1]
+        })
+      }
+      this.getLocation();
+    })
+  },
 
 
-    // this.startCountdow();
+  /** 获取用户经纬度 */
+  getLocation() {
+    const that = this;
+    wx.getLocation({
+      type: 'wgs84',
+      success(res) {
+        console.log("获取经纬度结果", res)
+        that.setData({
+          latitude: res.latitude,
+          longitude: res.longitude
+        })
+      }
+    })
   },
   },
 
 
   /**
   /**
@@ -214,8 +255,11 @@ Page({
 
 
   /** 日期选择器选择时间 */
   /** 日期选择器选择时间 */
   bindDateChange(date) {
   bindDateChange(date) {
+    console.log("日期选择",date)
     this.setData({
     this.setData({
       date: date.detail.value,
       date: date.detail.value,
+      pageNum:1,
+      pageSize:5,
       orders: []
       orders: []
     });
     });
     console.log(date)
     console.log(date)
@@ -265,6 +309,13 @@ Page({
     wx.showLoading({
     wx.showLoading({
       title: '授权中',
       title: '授权中',
     })
     })
+    const distance = util.haversine(this.data.stationLatitude,this.data.stationLongitude,this.data.latitude,this.data.longitude);
+    if(distance > 500) {
+      wx.showToast({
+        title: '您不在油站范围内,请到油站时进行下单',
+      })
+      return
+    }
     api.request_NozzleAuthorization(orderId).then(res => {
     api.request_NozzleAuthorization(orderId).then(res => {
       console.log("授权", res)
       console.log("授权", res)
       wx.hideLoading()
       wx.hideLoading()
@@ -289,7 +340,8 @@ Page({
       title: '获取订单中',
       title: '获取订单中',
     })
     })
     const that = this;
     const that = this;
-    api.request_WXFindOrders(this.data.date, this.data.pageNum, this.data.pageSize).then(res => {
+    const findTime = this.data.date != '' ? this.data.date + "T23:59:59" : this.data.date;
+    api.request_WXFindOrders(findTime, this.data.pageNum, this.data.pageSize).then(res => {
       wx.hideLoading()
       wx.hideLoading()
       // api.request_WXFindOrders(this.data.date, 3, 5).then(res => {
       // api.request_WXFindOrders(this.data.date, 3, 5).then(res => {
       console.log("获取历史订单", res)
       console.log("获取历史订单", res)
@@ -331,7 +383,7 @@ Page({
       //获取订单状态
       //获取订单状态
       var status = undefined;
       var status = undefined;
       //根据不同的模式获取订单状态值
       //根据不同的模式获取订单状态值
-      if (that.data.paymentMode == 0) {
+      if (order.orderType == 0) {
         status = that.data.payStatusValue.find(state => state.orderStatus == order.orderStatus)
         status = that.data.payStatusValue.find(state => state.orderStatus == order.orderStatus)
       } else {
       } else {
         status = that.data.prepayStatuValue.find(state =>
         status = that.data.prepayStatuValue.find(state =>
@@ -348,7 +400,7 @@ Page({
         stute = status.status
         stute = status.status
         stateColor = status.statusColor
         stateColor = status.statusColor
       }
       }
-      if (that.data.paymentMode == 0) {
+      if (order.orderType == 0) {
         if (stute == '未支付') bt2 = '重新支付';
         if (stute == '未支付') bt2 = '重新支付';
         return {
         return {
           order: {
           order: {
@@ -364,7 +416,8 @@ Page({
             time: time,
             time: time,
             price: order.price
             price: order.price
           },
           },
-          bottonText2: bt2
+          bottonText2: bt2,
+          orderType:order.orderType
         }
         }
       } else {
       } else {
         if (stute == "授权成功") bt2 = "请尽快提枪"
         if (stute == "授权成功") bt2 = "请尽快提枪"
@@ -391,7 +444,8 @@ Page({
             time: time
             time: time
           },
           },
           bottonText1: bt1,
           bottonText1: bt1,
-          bottonText2: bt2
+          bottonText2: bt2,
+          orderType:order.orderType
         }
         }
       }
       }
     })
     })

+ 29 - 4
pages/historyOrder/historyOrder.wxml

@@ -12,19 +12,44 @@
   </view>
   </view>
 </picker>
 </picker>
 
 
+<view class="orderItem" wx:for="{{orders}}" wx:key="index">
+      <orderItem wx:if="{{item.orderType == 0}}"
+      order="{{item.order}}"
+      bottonText2="{{item.bottonText2}}"
+      bind:bottonEvent1="onOrderButtonClick1"
+      bind:bottonEvent2="onOrderButtonClick2" />
+
+      <prepayOrderItem wx:if="{{item.orderType == 1}}"
+      order="{{item.order}}"
+      buttonText1="{{item.bottonText1}}"
+      buttonText2="{{item.bottonText2}}"
+      bind:bottonEvent1="onOrderButtonClick1"
+      bind:bottonEvent2="onOrderButtonClick2" />
+      
+    </view>
+
+    
   <!-- 订单列表-后支付-->
   <!-- 订单列表-后支付-->
-  <view class="order" wx:if="{{paymentMode == 0}}">
+  <!-- <view class="order" wx:if="{{paymentMode == 0}}">
     <view class="orderItem" wx:for="{{orders}}" wx:key="index">
     <view class="orderItem" wx:for="{{orders}}" wx:key="index">
       <orderItem 
       <orderItem 
       order="{{item.order}}"
       order="{{item.order}}"
       bottonText2="{{item.bottonText2}}"
       bottonText2="{{item.bottonText2}}"
       bind:bottonEvent1="onOrderButtonClick1"
       bind:bottonEvent1="onOrderButtonClick1"
       bind:bottonEvent2="onOrderButtonClick2" />
       bind:bottonEvent2="onOrderButtonClick2" />
+
+      <prepayOrderItem 
+      order="{{item.order}}"
+      buttonText1="{{item.bottonText1}}"
+      buttonText2="{{item.bottonText2}}"
+      bind:bottonEvent1="onOrderButtonClick1"
+      bind:bottonEvent2="onOrderButtonClick2" />
+      
     </view>
     </view>
-  </view>
+  </view> -->
 
 
   <!-- 订单列表-预支付-->
   <!-- 订单列表-预支付-->
-  <view class="order" wx:if="{{paymentMode == 1}}">
+  <!-- <view class="order" wx:if="{{paymentMode == 1}}">
     <view class="orderItem" wx:for="{{orders}}" wx:key="index">
     <view class="orderItem" wx:for="{{orders}}" wx:key="index">
       <prepayOrderItem 
       <prepayOrderItem 
       order="{{item.order}}"
       order="{{item.order}}"
@@ -33,7 +58,7 @@
       bind:bottonEvent1="onOrderButtonClick1"
       bind:bottonEvent1="onOrderButtonClick1"
       bind:bottonEvent2="onOrderButtonClick2" />
       bind:bottonEvent2="onOrderButtonClick2" />
     </view>
     </view>
-  </view>
+  </view> -->
 
 
   <text style="color: #a1a1a1; margin: 6%">仅保留一个月的交易记录</text>
   <text style="color: #a1a1a1; margin: 6%">仅保留一个月的交易记录</text>
 </view>
 </view>

+ 4 - 3
pages/payStatus/payStatus.wxml

@@ -78,8 +78,8 @@
     <text class="f" style="position: relative; left: 0rpx; top: -312rpx">加油中</text>
     <text class="f" style="position: relative; left: 0rpx; top: -312rpx">加油中</text>
   </view>
   </view>
   <view class="button-container">
   <view class="button-container">
-    <button class="check-order-btn" style="position: relative; left: 0rpx; top: -314rpx; width: 593rpx; display: block; box-sizing: border-box; height: 99rpx">查看订单</button>
-    <button class="complete-btn" style="position: relative; left: 0rpx; top: -295rpx; width: 593rpx; display: block; box-sizing: border-box; height: 99rpx">完成</button>
+    <button class="check-order-btn" style="position: relative; left: 0rpx; top: -314rpx; width: 593rpx; display: block; box-sizing: border-box; height: 99rpx" bind:tap="toHistory">查看订单</button>
+    <button class="complete-btn" style="position: relative; left: 0rpx; top: -295rpx; width: 593rpx; display: block; box-sizing: border-box; height: 99rpx"bind:tap="toHistory">完成</button>
   </view>
   </view>
   <!-- 底部链接区域 -->
   <!-- 底部链接区域 -->
   <view class="bottom-links" style="position: relative; left: 180rpx; top: -12rpx">
   <view class="bottom-links" style="position: relative; left: 180rpx; top: -12rpx">
@@ -103,7 +103,8 @@
 
 
   <!-- 操作按钮部分 -->
   <!-- 操作按钮部分 -->
   <view class="action-button-section">
   <view class="action-button-section">
-    <button class="retry-pay-btn" style="position: relative; left: 0rpx; top: 245rpx; width: 602rpx; display: block; box-sizing: border-box">重新发起授权</button>
+    <button class="retry-pay-btn" style="position: relative; left: 0rpx; top: 245rpx; width: 602rpx; display: block; box-sizing: border-box" bind:tap="toAuthorization">重新发起授权</button>
+    <button class="checkHistory" style="position: relative; left: 0rpx; top: 245rpx; width: 602rpx; display: block; box-sizing: border-box" bind:tap="toHistory">查看订单</button>
   </view>
   </view>
   <!-- 底部链接区域 -->
   <!-- 底部链接区域 -->
   <view class="bottom-links" style="position: relative; left: 24rpx; top: 0rpx">
   <view class="bottom-links" style="position: relative; left: 24rpx; top: 0rpx">

+ 7 - 7
pages/quantify/quantify.js

@@ -137,13 +137,13 @@ Page({
   
   
     console.log('进入 toAuthorization 方法');
     console.log('进入 toAuthorization 方法');
     console.log(this.data)
     console.log(this.data)
-    // const distance = utils.haversine(this.data.stationLatitude,this.data.stationLongitude,this.data.latitude,this.data.longitude);
-    // if(distance > 500) {
-    //   wx.showToast({
-    //     title: '您不在油站范围内,请到油站时进行下单',
-    //   })
-    //   return
-    // }
+    const distance = utils.haversine(this.data.stationLatitude,this.data.stationLongitude,this.data.latitude,this.data.longitude);
+    if(distance > 500) {
+      wx.showToast({
+        title: '您不在油站范围内,请到油站时进行下单',
+      })
+      return
+    }
     this.createOrder();
     this.createOrder();
   },
   },
 
 

+ 1 - 1
pages/scan/scan.wxml

@@ -3,7 +3,7 @@
     <image src="../../images/orientation.png" />
     <image src="../../images/orientation.png" />
     <text>{{site.name}}</text>
     <text>{{site.name}}</text>
   </view>
   </view>
-  <image class="background" src="../../images/stationBackground.png" style="height: 518rpx; display: block; box-sizing: border-box"></image>
+  <image class="background" src="../../images/stations.png" style="height: 518rpx; display: block; box-sizing: border-box"></image>
 
 
   <view class="scan-box" style="position: absolute; left: 38rpx; top: 379rpx; height: 1050rpx; display: flex; box-sizing: border-box">
   <view class="scan-box" style="position: absolute; left: 38rpx; top: 379rpx; height: 1050rpx; display: flex; box-sizing: border-box">
     <!-- 登录条 -->
     <!-- 登录条 -->