|
@@ -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
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|