Browse Source

优化物流

Menethil 7 years ago
parent
commit
f8312ca4e6

+ 3 - 0
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/dao/CaptchaItem.java

@@ -2,6 +2,9 @@ package org.linlinjava.litemall.wx.dao;
 
 import java.time.LocalDateTime;
 
+/**
+ * 验证码实体类,用于缓存验证码发送
+ */
 public class CaptchaItem {
     private String phoneNumber;
     private String code;

+ 0 - 2
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/UserInfoService.java

@@ -21,6 +21,4 @@ public class UserInfoService {
         userInfo.setAvatarUrl(user.getAvatar());
         return userInfo;
     }
-
-
 }

+ 6 - 3
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/service/UserTokenManager.java

@@ -7,6 +7,9 @@ import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.Map;
 
+/**
+ * 维护用户token
+ */
 public class UserTokenManager {
     private static Map<String, UserToken> tokenMap = new HashMap<>();
     private static Map<Integer, UserToken> idMap = new HashMap<>();
@@ -15,11 +18,11 @@ public class UserTokenManager {
 
 
         UserToken userToken = tokenMap.get(token);
-        if(userToken == null){
+        if (userToken == null) {
             return null;
         }
 
-        if(userToken.getExpireTime().isBefore(LocalDateTime.now())){
+        if (userToken.getExpireTime().isBefore(LocalDateTime.now())) {
             tokenMap.remove(token);
             idMap.remove(userToken.getUserId());
             return null;
@@ -29,7 +32,7 @@ public class UserTokenManager {
     }
 
 
-    public static UserToken generateToken(Integer id){
+    public static UserToken generateToken(Integer id) {
         UserToken userToken = null;
 
 //        userToken = idMap.get(id);

+ 4 - 1
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/util/IpUtil.java

@@ -4,6 +4,9 @@ import javax.servlet.http.HttpServletRequest;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 
+/**
+ * IP地址相关工具类
+ */
 public class IpUtil {
     public static String client(HttpServletRequest request) {
         String xff = request.getHeader("x-forwarded-for");
@@ -44,7 +47,7 @@ public class IpUtil {
                 }
             }
         } catch (Exception e) {
-            ipAddress="";
+            ipAddress = "";
         }
         // ipAddress = this.getRequest().getRemoteAddr();
 

+ 6 - 4
litemall-wx/config/api.js

@@ -4,9 +4,9 @@
 // 局域网测试使用
 // var WxApiRoot = 'http://192.168.0.101:8082/wx/';
 // 云平台部署时使用
-var WxApiRoot = 'http://122.152.206.172:8082/wx/';
+// var WxApiRoot = 'http://122.152.206.172:8082/wx/';
 // 云平台上线时使用
-// var WxApiRoot = 'https://www.menethil.com.cn/wx/';
+var WxApiRoot = 'https://www.menethil.com.cn/wx/';
 
 // 以下是图片存储服务器API地址
 // 本机开发时使用
@@ -14,9 +14,9 @@ var WxApiRoot = 'http://122.152.206.172:8082/wx/';
 // 局域网测试时使用
 // var StorageApi = 'http://192.168.0.101:8081/os/storage/create';
 // 云平台部署时使用
-var StorageApi = 'http://122.152.206.172:8081/os/storage/create';
+// var StorageApi = 'http://122.152.206.172:8081/os/storage/create';
 // 云平台上线时使用
-// var StorageApi = 'https://www.menethil.com.cn/os/storage/create';
+var StorageApi = 'https://www.menethil.com.cn/os/storage/create';
 
 module.exports = {
  IndexUrl: WxApiRoot + 'home/index', //首页数据接口
@@ -87,5 +87,7 @@ module.exports = {
  FootprintList: WxApiRoot + 'footprint/list', //足迹列表
  FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
 
+ UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId,用于发送模版消息
+
  StorageUpload: StorageApi, //图片上传
 };

+ 41 - 36
litemall-wx/pages/ucenter/orderDetail/orderDetail.js

@@ -17,6 +17,12 @@ Page({
     });
     this.getOrderDetail();
   },
+ onPullDownRefresh() {
+  wx.showNavigationBarLoading() //在标题栏中显示加载
+  this.getOrderDetail();
+  wx.hideNavigationBarLoading() //完成停止加载
+  wx.stopPullDownRefresh() //停止下拉刷新
+ },
   getOrderExpress: function() {
     let that = this;
     util.request(api.ExpressQuery, {
@@ -28,7 +34,6 @@ Page({
           expressInfo: res.data
         });
 
-        console.log(that.data.expressInfo);
       }
     });
   },
@@ -51,42 +56,42 @@ Page({
           handleOption: res.data.orderInfo.handleOption
         });
 
-        // 请求物流信息,仅当订单状态为发货时才请求
-        if (that.data.handleOption.confirm) {
-          that.getOrderExpress();
-        }
-      }
-    });
-  },
-  // “去付款”按钮点击效果
-  payOrder: function () {
-    let that = this;
-    util.request(api.OrderPrepay, {
-      orderId: that.data.orderId
-    }, 'POST').then(function (res) {
-      if (res.errno === 0) {
-        const payParam = res.data;
-        console.log("支付过程开始")
-        wx.requestPayment({
-          'timeStamp': payParam.timeStamp,
-          'nonceStr': payParam.nonceStr,
-          'package': payParam.packageValue,
-          'signType': payParam.signType,
-          'paySign': payParam.paySign,
-          'success': function (res) {
-            console.log("支付过程成功")
-            util.redirect('/pages/ucenter/order/order');
-          },
-          'fail': function (res) {
-            console.log("支付过程失败")
-            util.showErrorToast('支付失败');
-          },
-          'complete': function (res) {
-            console.log("支付过程结束")
-          }
-        });
-      }
+    // 请求物流信息,仅当订单状态为发货时才请求
+    if (res.data.orderInfo.handleOption.confirm) {
+     that.getOrderExpress();
+    }
+   }
+  });
+ },
+ // “去付款”按钮点击效果
+ payOrder: function() {
+  let that = this;
+  util.request(api.OrderPrepay, {
+   orderId: that.data.orderId
+  }, 'POST').then(function(res) {
+   if (res.errno === 0) {
+    const payParam = res.data;
+    console.log("支付过程开始");
+    wx.requestPayment({
+     'timeStamp': payParam.timeStamp,
+     'nonceStr': payParam.nonceStr,
+     'package': payParam.packageValue,
+     'signType': payParam.signType,
+     'paySign': payParam.paySign,
+     'success': function(res) {
+      console.log("支付过程成功");
+      util.redirect('/pages/ucenter/order/order');
+     },
+     'fail': function(res) {
+      console.log("支付过程失败");
+      util.showErrorToast('支付失败');
+     },
+     'complete': function(res) {
+      console.log("支付过程结束")
+     }
     });
+   }
+  });
 
   },
   // “取消订单”点击效果

+ 24 - 21
litemall-wx/pages/ucenter/orderDetail/orderDetail.wxml

@@ -40,28 +40,10 @@
                 </view>
             </view>
         </view>
-    <!-- 物流信息,仅收货状态下可见 -->
-    <view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
-      <view class="order-express">
-        <view class="title">
-          <view class="t">快递公司:{{expressInfo.expNo}}</view>
-          <view class="b">物流单号:{{expressInfo.expCode}}</view>
-        </view>
-      </view>
-    </view>
+  <!-- 展开 -->
+  <!-- <view class="data-expand p10 border-bottom" wx:if="{{ flag }}">
 
-    <!-- 展开 -->
-    <view class="data-expand p10 border-bottom" wx:if="{{ flag }}">
-      <view class="order-express">
-        <view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem">
-          <view class="trace">
-            <view class="acceptTime">{{iitem.AcceptTime}}</view>
-            <view class="acceptStation">{{iitem.AcceptStation}}</view>
-          </view>
-        </view>
-      </view>
-    </view>
-    </view>
+ </view> -->
 
     <view class="order-bottom">
         <view class="address">
@@ -86,4 +68,25 @@
             <text class="txt">¥{{orderInfo.actualPrice}}</text>
         </view>
     </view>
+</view>
+
+ <!-- 物流信息,仅收货状态下可见 -->
+ <view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
+  <view class="order-express">
+   <view class="title">
+    <view class="t">快递公司:{{expressInfo.expName}}</view>
+    <view class="b">物流单号:{{expressInfo.expCode}}</view>
+   </view>
+   <image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
+  </view>
+
+  <!-- <view class="order-express" > -->
+  <view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
+   <view class="trace">
+    <view class="acceptStation">{{iitem.AcceptStation}}</view>
+    <view class="acceptTime">{{iitem.AcceptTime}}</view>
+   </view>
+  </view>
+ </view>
+ <!-- </view> -->
 </view>

+ 36 - 41
litemall-wx/pages/ucenter/orderDetail/orderDetail.wxss

@@ -273,62 +273,57 @@ page{
 }
 
 .order-express {
-  margin-top: 20rpx;
-  padding-left: 31.25rpx;
-  height: auto;
+ margin-top: 20rpx;
+ width: 100%;
+ height: 100rpx;
+ background: #fff;
 }
 
 .order-express .title {
-  width: 750rpx;
-  height: 108rpx;
-  background: #fff;
-  margin-bottom: 20rpx;
+ float: left;
+ margin-bottom: 20rpx;
+ padding: 10rpx;
 }
 
-.order-express .title.t {
-  float: left;
-  width: 600rpx;
-  height: 108rpx;
-  line-height: 108rpx;
-  font-size: 29rpx;
-  margin-left: 31.25rpx;
+.order-express .ti {
+ float: right;
+ width: 52rpx;
+ height: 52rpx;
+ margin-right: 16rpx;
+ margin-top: 28rpx;
+}
 
+.order-express .t {
+ font-size: 29rpx;
+ margin-left: 10.25rpx;
+ color: #a78845;
 }
 
-.order-express .title.b {
-  float: left;
-  width: 600rpx;
-  height: 108rpx;
-  line-height: 108rpx;
-  font-size: 29rpx;
-  margin-left: 31.25rpx;
+.order-express .b {
+ font-size: 29rpx;
+ margin-left: 10.25rpx;
+ color: #a78845;
 }
 
 .order-express .traces {
-  height: auto;
-  padding-bottom: 17.5rpx;
-  padding-top: 17.5rpx;
-  border-bottom: 1px solid #f4f4f4;
+ padding: 17.5rpx;
+ background: #fff;
+ border-bottom: 1rpx solid #f1e6cdcc;
 }
 
-.order-express .traces.trace {
-  height: 180rpx;
-  padding-bottom: 17.5rpx;
-  padding-top: 17.5rpx;
-  border-bottom: 1px solid #f4f4f4;
+.order-express .trace {
+ padding-bottom: 17.5rpx;
+ padding-top: 17.5rpx;
+ background: #fff;
 }
 
-.order-express .traces.trace.acceptTime {
-  display: inline-block;
-  height: 35rpx;
-  width: 140rpx;
-  line-height: 35rpx;
-  font-size: 24rpx;
+.order-express .acceptTime {
+ margin-top: 20rpx;
+ margin-right: 40rpx;
+ text-align: right;
+ font-size: 26rpx;
 }
 
-.order-express .traces.trace.acceptStation {
-  display: inline-block;
-  height: 35rpx;
-  line-height: 35rpx;
-  font-size: 24rpx;
+.order-express .acceptStation {
+ font-size: 26rpx;
 }