Commit fffc7052 by zhangzhen

内容优化

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