Commit fffc7052 by zhangzhen

内容优化

parent 19ea526a
...@@ -49,7 +49,7 @@ http.interceptor.request = (config => { ...@@ -49,7 +49,7 @@ http.interceptor.request = (config => {
return config; return config;
}) })
http.interceptor.response = (config) => { http.interceptor.response = (config) => {
uni.hideLoading(); // uni.hideLoading();
// console.log(config.data, "请求结果") // console.log(config.data, "请求结果")
if (config.header && config.header["Access-Control-Expose-Headers"]) { if (config.header && config.header["Access-Control-Expose-Headers"]) {
......
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
</uni-popup> </uni-popup>
<LoginPop ref="loginPop" /> <!-- <LoginPop ref="loginPop" /> -->
<f-tabbar></f-tabbar> <f-tabbar></f-tabbar>
</view> </view>
</template> </template>
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
<script> <script>
import fTabbar from '@/components/module/f-tabbar/f-tabbar'; import fTabbar from '@/components/module/f-tabbar/f-tabbar';
import fNavbar from '@/components/module/f-navbar/f-navbar'; import fNavbar from '@/components/module/f-navbar/f-navbar';
import LoginPop from "@/components/login/login" // import LoginPop from "@/components/login/login"
import { import {
login, login,
dictList, dictList,
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
fTabbar, fTabbar,
fNavbar, fNavbar,
ToolBox, ToolBox,
LoginPop // LoginPop
}, },
data() { data() {
return { return {
...@@ -295,7 +295,8 @@ ...@@ -295,7 +295,8 @@
list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], list: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
objListDate: [], objListDate: [],
timer2: null, timer2: null,
timerLocation: null timerLocation: null,
tempStoreInfo:{},
} }
}, },
onShow() { onShow() {
...@@ -328,7 +329,7 @@ ...@@ -328,7 +329,7 @@
this.onSetShowPoint(); this.onSetShowPoint();
// 隐藏原生的tabbar // 隐藏原生的tabbar
uni.hideTabBar(); uni.hideTabBar();
this.$refs.loginPop.open(); // this.$refs.loginPop.open();
}, },
methods: { methods: {
onStoreChage(id) { onStoreChage(id) {
...@@ -428,7 +429,7 @@ ...@@ -428,7 +429,7 @@
obj = res.data.data[0]; obj = res.data.data[0];
uni.setStorageSync("storeId", obj.id); uni.setStorageSync("storeId", obj.id);
} }
that.storeInfo = { that.tempStoreInfo = {
...obj, ...obj,
distance: obj.distance ? Number(obj.distance.substr(0, 8)).toFixed(2) : 0 distance: obj.distance ? Number(obj.distance.substr(0, 8)).toFixed(2) : 0
} }
...@@ -449,6 +450,7 @@ ...@@ -449,6 +450,7 @@
getRoomList({ getRoomList({
storeId storeId
}).then(res => { }).then(res => {
uni.hideLoading();
if (res.data.code == 200 && res.data.data.length) { if (res.data.code == 200 && res.data.data.length) {
let list = res.data.data.map(item => { let list = res.data.data.map(item => {
let sortNum = 1; let sortNum = 1;
...@@ -483,6 +485,7 @@ ...@@ -483,6 +485,7 @@
}) })
list.sort((a, b) => a.sortNum - b.sortNum); list.sort((a, b) => a.sortNum - b.sortNum);
that.storeInfo = that.tempStoreInfo;
that.roomVoList = list; that.roomVoList = list;
let l = that.roomVoList.filter(item => item.sortNum === 1) let l = that.roomVoList.filter(item => item.sortNum === 1)
...@@ -493,6 +496,7 @@ ...@@ -493,6 +496,7 @@
} }
} else { } else {
that.storeInfo = that.tempStoreInfo;
that.roomVoList = [] that.roomVoList = []
} }
uni.hideLoading() uni.hideLoading()
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<button class="cu-btn block round line-pink lg" open-type="share">分享好友</button> <button class="cu-btn block round line-pink lg" open-type="share">分享好友</button>
</view> </view>
<view v-if="(continStatus || orderInfo.status ==1) && userInfo.id == orderInfo.consumerId" class="part"> <view v-if="(continStatus || orderInfo.status ==1) && userInfo.id == orderInfo.consumerId" class="part">
<button class="cu-btn block round bg-mauve lg" @tap="onNavToOrder">房间续单</button> <button class="cu-btn block round bg-mauve lg" @tap="onCheckLogin">房间续单</button>
</view> </view>
</view> </view>
</view> </view>
...@@ -130,6 +130,9 @@ ...@@ -130,6 +130,9 @@
<uni-popup ref="popup" type="dialog"> <uni-popup ref="popup" type="dialog">
<uni-popup-dialog mode="base" content="请确认是否退单" :duration="2000" :before-close="true" @close="close" @confirm="confirm"></uni-popup-dialog> <uni-popup-dialog mode="base" content="请确认是否退单" :duration="2000" :before-close="true" @close="close" @confirm="confirm"></uni-popup-dialog>
</uni-popup> </uni-popup>
<LoginPop ref="loginPop" @success='onNavToOrder' />
</view> </view>
</template> </template>
...@@ -141,10 +144,12 @@ ...@@ -141,10 +144,12 @@
import moment from "@/common/moment_zh_cn.js"; import moment from "@/common/moment_zh_cn.js";
import config from "@/config/index.config" import config from "@/config/index.config"
import {listSortDistance} from "@/api/store.js"; import {listSortDistance} from "@/api/store.js";
import LoginPop from "@/components/login/login"
export default { export default {
components:{ components:{
fNavbar fNavbar,
LoginPop
}, },
data() { data() {
return { return {
...@@ -163,9 +168,7 @@ ...@@ -163,9 +168,7 @@
}; };
}, },
onLoad(option) { onLoad(option) {
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = uni.getStorageSync('userInfo')
console.log(this.userInfo,"用户信息")
this.orderNo = option.orderNo; this.orderNo = option.orderNo;
if(option.share && option.share =="share"){ if(option.share && option.share =="share"){
...@@ -211,7 +214,7 @@ ...@@ -211,7 +214,7 @@
if(res.data.data.status ===2){ if(res.data.data.status ===2){
let nowTime = moment().valueOf(); let nowTime = moment().valueOf();
let endTime = moment(res.data.data.endDate).valueOf(); let endTime = moment(res.data.data.endDate).valueOf();
if(nowTime-endTime< 15*60*1000){ if(nowTime - endTime< 15*60*1000){
this.continStatus = true; this.continStatus = true;
} }
} }
...@@ -257,6 +260,12 @@ ...@@ -257,6 +260,12 @@
}, },
onGetOrderInfo(){ onGetOrderInfo(){
noLoginGetOrderInfo(this.orderNo).then(res=>{ noLoginGetOrderInfo(this.orderNo).then(res=>{
let nowTime = moment().valueOf();
let endTime = moment(res.data.data.endDate).valueOf();
if(nowTime - endTime< 15*60*1000){
this.continStatus = true;
}
console.log(this.continStatus,888)
this.orderInfo = { this.orderInfo = {
...res.data.data, ...res.data.data,
roomImages: res.data.data.roomImages.split(','), roomImages: res.data.data.roomImages.split(','),
...@@ -332,13 +341,25 @@ ...@@ -332,13 +341,25 @@
} }
}) })
}, },
onCheckLogin(){
if(this.shareOrder){
this.$refs.loginPop.open();
}else{
this.onNavToOrder()
}
},
onNavToOrder(){ onNavToOrder(){
uni.showLoading({
title:'加载中'
})
listSortDistance({ listSortDistance({
storeId: this.orderInfo.storeId, storeId: this.orderInfo.storeId,
roomId: this.orderInfo.roomId, roomId: this.orderInfo.roomId,
day: this.orderInfo.endDate, day: this.orderInfo.endDate,
orderType:2 orderType:2,
orderId: this.orderInfo.id
}).then(res=>{ }).then(res=>{
uni.hideLoading()
if(res.data.code != 200){ if(res.data.code != 200){
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
...@@ -349,75 +370,60 @@ ...@@ -349,75 +370,60 @@
//订单结束时间 //订单结束时间
let orderEndDate = `${this.orderInfo.endDate} ${this.orderInfo.endTime}:00`; let orderEndDate = `${this.orderInfo.endDate} ${this.orderInfo.endTime}:00`;
// 续单开始时间戳,订单未结束使用订单实际结束时间,订单结束使用当前时间 // 续单开始时间戳,订单未结束使用订单实际结束时间,订单结束使用当前时间
let startDateStemp = this.orderInfo.status == 2? moment(moment().format("YYYY-MM-DD HH:mm:00")).valueOf(): moment(orderEndDate).valueOf(); let startDateStemp = this.orderInfo.status == 2? moment(moment().format("YYYY-MM-DD HH:mm:00")).valueOf(): moment(orderEndDate).valueOf()
//可续单的结束时间戳
//订单开始时间 let endDateStemp = startDateStemp + 60*60*1000;
let orderStartTime = 0; let continueStatus = true;
let continueStatus = false;
if(res.data.code ==200 && res.data.data && res.data.data.length){ if(res.data.code ==200 && res.data.data && res.data.data.length){
res.data.data.forEach(item=>{ new Promise((resolve,reject) => {
if(continueStatus) return; res.data.data.forEach((item,i)=>{
if(orderStartTime){ let start = moment(item.timeHour +':00:00').valueOf();
if(item.status == 0){ let end = moment(item.timeHour +':59:59').valueOf();
uni.navigateTo({ if(start < endDateStemp && start >= startDateStemp && item.status ==1 ){
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}` if(this.onCheckHourUse(item.startHoldTime,item.endHoldTime)){
}) continueStatus = false;
continueStatus = true; }else{
}else{
let d = moment(item.startHoldTime).valueOf() if( startDateStemp >= moment(item.startHoldTime).valueOf() && startDateStemp < moment(item.endHoldTime).valueOf()){
if(d - orderStartTime >= 3600*1000){ continueStatus = false;
uni.navigateTo({ }else if( endDateStemp >= moment(item.startHoldTime).valueOf()){
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}` continueStatus = false;
}) }
continueStatus = true;
return }
}else{
uni.showToast({
icon:"none",
title:"此订单已无可续单时段"
})
continueStatus = true;
return
}
} }
}else{ if(i>= res.data.data.length-1){
if(item.status == 1) { resolve(continueStatus)
let d = moment(item.endHoldTime).valueOf();
if( d >= startDateStemp ){
orderStartTime = d;
console.log(moment(orderStartTime).format("YYYY-MM-DD HH:mm:ss"),"续单可开始的时间2")
}
} }
}
})
}
return;
let h = this.orderInfo.endTime.split(":").map(item=>Number(item))
if(res.data.code == 200){
let val = res.data.data[h[0]+1];
if(val.status ===0){
uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
}) })
}else if(val.status ===1){ }).then(continueStatus =>{
let nextStartH = moment(val.startHoldTime).format("HH:mm").split(":").map(item=>Number(item)) if(continueStatus){
if(nextStartH[1]>h[1]){
uni.navigateTo({ uni.navigateTo({
url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}` url:`/pages/order/order?roomId=${this.orderInfo.roomId}&orderNo=${this.orderInfo.orderNo}`
}) })
}else{ }else{
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:"此订单已无可续单时段" title:"此订单已无可续单时段"
}) })
} }
} })
} }
}).catch(err=>{
uni.hideLoading()
uni.showToast({
icon:"none",
title:err.msg || err.message||'请求数据出错'
})
}) })
}, },
// 检查当前小时段是否被全部占用 true 完全占用 false 部分占用
onCheckHourUse(startDate,endDate) {
let timeStamp = moment(endDate).valueOf()-moment(startDate).valueOf();
return timeStamp >= 3599000
},
onOrderRefund(){ onOrderRefund(){
this.$refs.popup.open(); this.$refs.popup.open();
}, },
......
Markdown is supported
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