Commit f8312ca4 authored by Menethil's avatar Menethil
Browse files

优化物流

parent 7d4aca77
...@@ -2,6 +2,9 @@ package org.linlinjava.litemall.wx.dao; ...@@ -2,6 +2,9 @@ package org.linlinjava.litemall.wx.dao;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/**
* 验证码实体类,用于缓存验证码发送
*/
public class CaptchaItem { public class CaptchaItem {
private String phoneNumber; private String phoneNumber;
private String code; private String code;
......
...@@ -21,6 +21,4 @@ public class UserInfoService { ...@@ -21,6 +21,4 @@ public class UserInfoService {
userInfo.setAvatarUrl(user.getAvatar()); userInfo.setAvatarUrl(user.getAvatar());
return userInfo; return userInfo;
} }
} }
...@@ -7,6 +7,9 @@ import java.time.LocalDateTime; ...@@ -7,6 +7,9 @@ import java.time.LocalDateTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 维护用户token
*/
public class UserTokenManager { public class UserTokenManager {
private static Map<String, UserToken> tokenMap = new HashMap<>(); private static Map<String, UserToken> tokenMap = new HashMap<>();
private static Map<Integer, UserToken> idMap = new HashMap<>(); private static Map<Integer, UserToken> idMap = new HashMap<>();
...@@ -15,11 +18,11 @@ public class UserTokenManager { ...@@ -15,11 +18,11 @@ public class UserTokenManager {
UserToken userToken = tokenMap.get(token); UserToken userToken = tokenMap.get(token);
if(userToken == null){ if (userToken == null) {
return null; return null;
} }
if(userToken.getExpireTime().isBefore(LocalDateTime.now())){ if (userToken.getExpireTime().isBefore(LocalDateTime.now())) {
tokenMap.remove(token); tokenMap.remove(token);
idMap.remove(userToken.getUserId()); idMap.remove(userToken.getUserId());
return null; return null;
...@@ -29,7 +32,7 @@ public class UserTokenManager { ...@@ -29,7 +32,7 @@ public class UserTokenManager {
} }
public static UserToken generateToken(Integer id){ public static UserToken generateToken(Integer id) {
UserToken userToken = null; UserToken userToken = null;
// userToken = idMap.get(id); // userToken = idMap.get(id);
......
...@@ -4,6 +4,9 @@ import javax.servlet.http.HttpServletRequest; ...@@ -4,6 +4,9 @@ import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
/**
* IP地址相关工具类
*/
public class IpUtil { public class IpUtil {
public static String client(HttpServletRequest request) { public static String client(HttpServletRequest request) {
String xff = request.getHeader("x-forwarded-for"); String xff = request.getHeader("x-forwarded-for");
...@@ -44,7 +47,7 @@ public class IpUtil { ...@@ -44,7 +47,7 @@ public class IpUtil {
} }
} }
} catch (Exception e) { } catch (Exception e) {
ipAddress=""; ipAddress = "";
} }
// ipAddress = this.getRequest().getRemoteAddr(); // ipAddress = this.getRequest().getRemoteAddr();
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
// 局域网测试使用 // 局域网测试使用
// var WxApiRoot = 'http://192.168.0.101:8082/wx/'; // 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地址 // 以下是图片存储服务器API地址
// 本机开发时使用 // 本机开发时使用
...@@ -14,9 +14,9 @@ var WxApiRoot = 'http://122.152.206.172:8082/wx/'; ...@@ -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://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 = { module.exports = {
IndexUrl: WxApiRoot + 'home/index', //首页数据接口 IndexUrl: WxApiRoot + 'home/index', //首页数据接口
...@@ -87,5 +87,7 @@ module.exports = { ...@@ -87,5 +87,7 @@ module.exports = {
FootprintList: WxApiRoot + 'footprint/list', //足迹列表 FootprintList: WxApiRoot + 'footprint/list', //足迹列表
FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹 FootprintDelete: WxApiRoot + 'footprint/delete', //删除足迹
UserFormIdCreate: WxApiRoot + 'formid/create', //用户FromId,用于发送模版消息
StorageUpload: StorageApi, //图片上传 StorageUpload: StorageApi, //图片上传
}; };
\ No newline at end of file
...@@ -17,6 +17,12 @@ Page({ ...@@ -17,6 +17,12 @@ Page({
}); });
this.getOrderDetail(); this.getOrderDetail();
}, },
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderDetail();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
getOrderExpress: function() { getOrderExpress: function() {
let that = this; let that = this;
util.request(api.ExpressQuery, { util.request(api.ExpressQuery, {
...@@ -28,7 +34,6 @@ Page({ ...@@ -28,7 +34,6 @@ Page({
expressInfo: res.data expressInfo: res.data
}); });
console.log(that.data.expressInfo);
} }
}); });
}, },
...@@ -51,42 +56,42 @@ Page({ ...@@ -51,42 +56,42 @@ Page({
handleOption: res.data.orderInfo.handleOption handleOption: res.data.orderInfo.handleOption
}); });
// 请求物流信息,仅当订单状态为发货时才请求 // 请求物流信息,仅当订单状态为发货时才请求
if (that.data.handleOption.confirm) { if (res.data.orderInfo.handleOption.confirm) {
that.getOrderExpress(); that.getOrderExpress();
} }
} }
}); });
}, },
// “去付款”按钮点击效果 // “去付款”按钮点击效果
payOrder: function () { payOrder: function() {
let that = this; let that = this;
util.request(api.OrderPrepay, { util.request(api.OrderPrepay, {
orderId: that.data.orderId orderId: that.data.orderId
}, 'POST').then(function (res) { }, 'POST').then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
const payParam = res.data; const payParam = res.data;
console.log("支付过程开始") console.log("支付过程开始");
wx.requestPayment({ wx.requestPayment({
'timeStamp': payParam.timeStamp, 'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr, 'nonceStr': payParam.nonceStr,
'package': payParam.packageValue, 'package': payParam.packageValue,
'signType': payParam.signType, 'signType': payParam.signType,
'paySign': payParam.paySign, 'paySign': payParam.paySign,
'success': function (res) { 'success': function(res) {
console.log("支付过程成功") console.log("支付过程成功");
util.redirect('/pages/ucenter/order/order'); util.redirect('/pages/ucenter/order/order');
}, },
'fail': function (res) { 'fail': function(res) {
console.log("支付过程失败") console.log("支付过程失败");
util.showErrorToast('支付失败'); util.showErrorToast('支付失败');
}, },
'complete': function (res) { 'complete': function(res) {
console.log("支付过程结束") console.log("支付过程结束")
} }
});
}
}); });
}
});
}, },
// “取消订单”点击效果 // “取消订单”点击效果
......
...@@ -40,28 +40,10 @@ ...@@ -40,28 +40,10 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 物流信息,仅收货状态下可见 --> <!-- 展开 -->
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}"> <!-- <view class="data-expand p10 border-bottom" wx:if="{{ flag }}">
<view class="order-express">
<view class="title">
<view class="t">快递公司:{{expressInfo.expNo}}</view>
<view class="b">物流单号:{{expressInfo.expCode}}</view>
</view>
</view>
</view>
<!-- 展开 --> </view> -->
<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 class="order-bottom"> <view class="order-bottom">
<view class="address"> <view class="address">
...@@ -86,4 +68,25 @@ ...@@ -86,4 +68,25 @@
<text class="txt">¥{{orderInfo.actualPrice}}</text> <text class="txt">¥{{orderInfo.actualPrice}}</text>
</view> </view>
</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> </view>
\ No newline at end of file
...@@ -273,62 +273,57 @@ page{ ...@@ -273,62 +273,57 @@ page{
} }
.order-express { .order-express {
margin-top: 20rpx; margin-top: 20rpx;
padding-left: 31.25rpx; width: 100%;
height: auto; height: 100rpx;
background: #fff;
} }
.order-express .title { .order-express .title {
width: 750rpx; float: left;
height: 108rpx; margin-bottom: 20rpx;
background: #fff; padding: 10rpx;
margin-bottom: 20rpx;
} }
.order-express .title.t { .order-express .ti {
float: left; float: right;
width: 600rpx; width: 52rpx;
height: 108rpx; height: 52rpx;
line-height: 108rpx; margin-right: 16rpx;
font-size: 29rpx; margin-top: 28rpx;
margin-left: 31.25rpx; }
.order-express .t {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
} }
.order-express .title.b { .order-express .b {
float: left; font-size: 29rpx;
width: 600rpx; margin-left: 10.25rpx;
height: 108rpx; color: #a78845;
line-height: 108rpx;
font-size: 29rpx;
margin-left: 31.25rpx;
} }
.order-express .traces { .order-express .traces {
height: auto; padding: 17.5rpx;
padding-bottom: 17.5rpx; background: #fff;
padding-top: 17.5rpx; border-bottom: 1rpx solid #f1e6cdcc;
border-bottom: 1px solid #f4f4f4;
} }
.order-express .traces.trace { .order-express .trace {
height: 180rpx; padding-bottom: 17.5rpx;
padding-bottom: 17.5rpx; padding-top: 17.5rpx;
padding-top: 17.5rpx; background: #fff;
border-bottom: 1px solid #f4f4f4;
} }
.order-express .traces.trace.acceptTime { .order-express .acceptTime {
display: inline-block; margin-top: 20rpx;
height: 35rpx; margin-right: 40rpx;
width: 140rpx; text-align: right;
line-height: 35rpx; font-size: 26rpx;
font-size: 24rpx;
} }
.order-express .traces.trace.acceptStation { .order-express .acceptStation {
display: inline-block; font-size: 26rpx;
height: 35rpx;
line-height: 35rpx;
font-size: 24rpx;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment