Commit db5dd663 authored by Mac's avatar Mac

司导的日历

parent d35318c5
......@@ -239,7 +239,7 @@
data() {
return {
pageTitle: "详情",
GoodsId:367471,
GoodsId:367468,
g:{},
imgs:[],
isExsitGoods: true,
......@@ -256,6 +256,8 @@
intervalDay:'',
address:'',
Pickcar:'',
StartTime:"",
EndTime:'',
}
},
onLoad(option){
......@@ -270,9 +272,11 @@
}
if(option && option.StartTime){
this.STime = this.getTime(option.StartTime)
this.StartTime= option.StartTime
}
if(option && option.EndTime){
this.ETime = this.getTime(option.EndTime)
this.EndTime= option.EndTime
}
if(option&& option.StartTime && option.EndTime){
let startTime = new Date(option.StartTime); // 开始时间
......@@ -445,8 +449,12 @@
//跳转
goUrl(){
uni.navigateTo({
url:'/pages/guidecar/place_order?GoodsId='+this.GoodsId+'&Number='+this.g.ride_num+'&ShoppingAddress='+this.address
url:'/pages/guidecar/place_order?GoodsId='+this.GoodsId+'&Number='+this.g.ride_num+'&ShoppingAddress='+this.address+
'&StartTime='+this.StartTime+
'&EndTime='+this.EndTime
})
}
}
......
......@@ -184,7 +184,7 @@ getGuideCarGuideModel(){//根据导游id获取导游信息
setTimeout(()=>{
this.detailContent = richtext;
},10)
console.log(this.guideModel)
}
);
},
......
......@@ -230,7 +230,7 @@
this.STime = obj;
this.ETime = obj;
this.msg.StartTime = obj.year+'-'+obj.month+'-'+obj.day+' '+obj.hour+':'+obj.minute+':00';
this.msg.EndTime = obj.year+'-'+obj.month+'-'+obj.day+' '+obj.hour+':'+obj.minute+':00';
this.msg.EndTime = obj.year+'-'+obj.month+'-'+obj.day+' '+obj.hour+':'+obj.minute+':10';
},
onLoad(options){
......@@ -355,7 +355,7 @@
let days = myDate.getDay();
this.STime.week = this.getweek(days)
}else{//结束时间的选择
this.msg.EndTime = val.year+'-'+val.month+'-'+val.day+' '+val.hour+':'+val.minute+':00';
this.msg.EndTime = val.year+'-'+val.month+'-'+val.day+' '+val.hour+':'+val.minute+':10';
this.ETime = val
let myDate = new Date(this.msg.EndTime);
let days = myDate.getDay();
......@@ -364,7 +364,7 @@
let startTime = new Date(this.msg.StartTime); // 开始时间
let endTime = new Date(this.msg.EndTime); // 结束时间
if(startTime.getTime()>endTime.getTime()){//如果开始时间大于结束时间吧结束时间赋值和开始时间一样
this.msg.EndTime= val.year+'-'+val.month+'-'+val.day+' '+val.hour+':'+val.minute+':00';
this.msg.EndTime= val.year+'-'+val.month+'-'+val.day+' '+val.hour+':'+val.minute+':10';
this.ETime = val
let myDate = new Date(this.msg.EndTime);
let days = myDate.getDay();
......
......@@ -208,7 +208,7 @@
<view class="order_big order_comLeft">出发地址</view>
<view style="display: flex;align-items: center;">
<image class="or_Image" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/o_address.png"></image>
<text>锦江区阳光新野中心</text>
<text>{{msg.ShoppingAddress}}</text>
</view>
</view>
<view class="order_GName" v-if="mchs[0].goods_list[0].goods_attr.car_type!=5">
......@@ -220,11 +220,11 @@
</view>
<view class="order_GName" style="height:90px;align-items: normal;">
<view class="order_big order_comLeft" style="margin-top:10px;">用车时间</view>
<view style="display: flex;align-items: center;">
<view style="display: flex;align-items: center;" @click="gotime">
<view style="text-align: right;">
<view>09月01日 周二 20:30</view>
<view style="margin:5px 0;"><text style="color:#4578FF;font-size:12px;">(2天)</text></view>
<view>09月03日 周四 20:30</view>
<view>{{STime.month}}{{STime.day}}{{STime.week+' '+STime.hour+':'+STime.minute}}</view>
<view style="margin:5px 0;"><text style="color:#4578FF;font-size:12px;">{{intervalDay}}</text></view>
<view>{{ETime.month}}{{ETime.day}}{{ETime.week+' '+ETime.hour+':'+ETime.minute}}</view>
</view>
<view>
<u-icon name="arrow" :size="32" color="#111"></u-icon>
......@@ -399,7 +399,12 @@
TripETime:'', //预定结束时间
CarType:'', //服务类型
DestinationAddress:'' //目的地
}
},
intervalDay:'',
StartTime:'',
EndTime:'',
STime:{},
ETime:{},
};
},
......@@ -408,8 +413,15 @@
if(options){
this.msg.DetailList[0].GoodsId = options.GoodsId;
this.msg.DetailList[0].Number = options.Number;
this.msg.ShoppingAddress = '四川省成都市龙泉驿区';
this.msg.ShoppingAddress = options.ShoppingAddress;
//时间的处理
this.msg.TripSTime = options.StartTime;
this.STime = this.getTime(options.StartTime)
this.StartTime= options.StartTime
this.ETime = this.getTime(options.EndTime)
this.EndTime= options.EndTime;
//地址处理
let parseResult = AddressParse(this.msg.ShoppingAddress, 0)
let nameList = [parseResult.province, parseResult.city, parseResult.area];
this.getDestination(nameList);
......@@ -435,6 +447,7 @@
if(res.resultCode==1){
this.dataList = res.data;
this.mchs = res.data.mch_list;
this.intervalDay = this.dataList.mch_list[0].goods_list[0].goods_attr.use_day;//获取多少天
this.mchs.forEach(x=>{
x.goods_list.forEach(j=>{
j.marketingLogo = JSON.parse(j.marketingLogo)
......@@ -445,6 +458,50 @@
}
);
},
gotime(){
let GoodsId = this.msg.DetailList[0].GoodsId
uni.navigateTo({
url:'/pages/guidecar/rili?StartTime='+this.StartTime+'&EndTime='+this.EndTime+'&use_day='+this.intervalDay+'&GoodsId='+GoodsId
})
},
gotimeconfirm(StartTime,EndTime){//选择时间返回的参数
console.log(StartTime,EndTime)
this.STime = this.getTime(StartTime)
this.StartTime= StartTime
this.ETime = this.getTime(EndTime)
this.EndTime= EndTime;
this.msg.TripSTime = StartTime;
this.getData()
},
getTime(time){
let myDate = new Date(time);
let obj = {}
obj.year = myDate.getFullYear(); //年
obj.month = myDate.getMonth() + 1; //月
obj.day = myDate.getDate(); //日
obj.hour = myDate.getHours(); //时
obj.minute = myDate.getMinutes(); //分
let days = myDate.getDay();
obj.week = this.getweek(days)//星期几
return obj
},
getweek(day){//根据值返回当前时间的星期几
if(day==1){
return '星期一'
}else if(day==2){
return '星期二'
}else if(day==3){
return '星期三'
}else if(day==4){
return '星期四'
}else if(day==5){
return '星期五'
}else if(day==6){
return '星期六'
}else if(day==0){
return '星期日'
}
},
//通过地址获取省市区ID
getDestination(nameList) {
this.request2({
......
......@@ -33,7 +33,7 @@
<span>{{stilltime}}</span>
</view>
</view>
<view class="btn" >确定</view>
<view class="btn" @click="goconfirm">确定</view>
<u-picker v-model="showStart" mode="time" :params="params" @confirm='btnStart' :default-time='defaultTime'></u-picker>
</view>
......@@ -61,52 +61,104 @@
hour: true,
minute: true,
},
use_day:0,
GoodsId:0,
};
},
mounted() {
let myDate = new Date();
let year = myDate.getFullYear(); //年
let month = myDate.getMonth() + 1; //月
let hour = myDate.getHours(); //时
let minute = myDate.getMinutes(); //分
if(month<10){
month = ('0' + month)
}
let Month = year+'-'+month
this.STime = this.getTime('2020-09-18 12:20',1)
this.ETime = this.getTime('2020-09-19 12:20',2)
let startTime = new Date('2020-09-18 12:20'); // 开始时间
let endTime = new Date('2020-09-19 12:20'); // 结束时间
let usedTime = endTime - startTime; // 相差的毫秒数
let days = Math.floor(usedTime / (24 * 3600 * 1000)); // 计算出天数
let leavel = usedTime % (24 * 3600 * 1000); // 计算天数后剩余的时间
let hours = Math.floor(leavel / (3600 * 1000)); // 计算剩余的小时数
if(days>0){
if(leavel>0){
this.intervalDay=days+1+'天'
}else{
this.intervalDay=days+'天'
}
}else{
if(hours>=6){
this.intervalDay='1天'
}else{
onLoad(options){
if(options){
this.use_day = options.use_day;
this.GoodsId = options.GoodsId;
// this.use_day =3;
if(this.use_day==0.5){
this.intervalDay='半天'
}else if(this.use_day>0.5){
this.intervalDay=this.use_day+'天'
}
this.STime = this.getTime(options.StartTime,1)
this.ETime = this.getTime(options.EndTime,2)
let startTime = new Date(options.StartTime); // 开始时间
let year = startTime.getFullYear(); //年
let month = startTime.getMonth() + 1; //月
if(month<10){
month = ('0' + month)
}
let Month = year+'-'+month
this.getGoodsDateList(Month)
}
this.getGoodsDateList(Month)
},
mounted() {
},
methods:{
changeDate(data){ //选择日期事件 可以将data绑定到此页面以用来提交等操作
console.log("日期:"+data);
this.selectedData = data;
this.STime = this.getTime(data+' '+this.qutime)
let myDate = new Date(data);
myDate=myDate.setDate(myDate.getDate()+(Number(this.use_day)-1));
myDate=new Date(myDate);
let year = myDate.getFullYear(); //年
let month = myDate.getMonth() + 1; //月
let day = myDate.getDate(); //日
let data2 = year+'-'+month+'-'+day
this.ETime = this.getTime(data2+' '+this.stilltime)
},
// 时间转为毫秒
timeToSec(time) {
var hour = time.split(':')[0]
var min = time.split(':')[1]
var sec = time.split(':')[2]
var s = Number(hour * 3600) + Number(min * 60)
return s * 1000
},
// 将秒转化成时分秒
goconfirm(){
let StartTime = this.STime.year+'-'+this.STime.month+'-'+this.STime.day+' '+this.STime.hour+':'+this.STime.minute+':00';
let EndTime = this.ETime.year+'-'+this.ETime.month+'-'+this.ETime.day+' '+this.ETime.hour+':'+this.ETime.minute+':10';
console.log(this.qutime)
console.log(this.stilltime)
let quT = this.timeToSec(this.qutime)
let stillT = this.timeToSec(this.qutime)
console.log(quT,stillT)
if(this.use_day==0.5){
if(quT>=stillT){
uni.showToast({
title:'还车时间必须大于取车时间',
icon:'none'
})
}else{
if((stillT-quT)>(12*3600)){
uni.showToast({
title:'使用使用不能大于半天',
icon:'none'
})
}
}
}else if(this.use_day==1 && (stillT-quT)<(12*3600)){
uni.showToast({
title:'使用时间大于半天',
icon:'none'
})
}
let pages = getCurrentPages(); // 当前页面
let beforePage
beforePage = pages[pages.length - 2]; // 前一个页面
setTimeout(()=>{
uni.navigateBack({
delta:1,
success: function() {
beforePage.$vm.gotimeconfirm(StartTime,EndTime); // 执行前一个页面的方法
}
});
},100)
},
getTest(){
//上面那个是选择日期时自动绑定的方式,但默认赋值之后没有进行选择操作 如何拿到选中的值
......@@ -122,7 +174,7 @@
{
url: '/api/AppletGCOrder/GetAppletSDGoodsTargetDateList',
data: {
GoodsId:367468,
GoodsId:this.GoodsId,
Month:Month
}
},
......@@ -149,9 +201,13 @@
console.log(val)
if(this.timeType==1){
this.qutime=val.hour+":"+val.minute
this.STime.hour = val.hour;
this.STime.minute = val.minute;
}
if(this.timeType==2){
this.stilltime=val.hour+":"+val.minute
this.ETime.hour = val.hour;
this.ETime.minute = val.minute;
}
},
getTime(time,type=0){
......
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