Commit 4992ba6d authored by Mac's avatar Mac

定制车辆的页面

parent 6c32181f
...@@ -358,6 +358,10 @@ ...@@ -358,6 +358,10 @@
"path":"pickcarcity" "path":"pickcarcity"
},{ },{
"path":"guidecarList" "path":"guidecarList"
},{
"path":"pickcarcity2"//出发和到达选择的地址
},{
"path":"bookaCarList"//定制车页面
},{ },{
"path": "orderList" "path": "orderList"
},{ },{
......
<style scoped lang="scss">
.bookaCarList{
width: 100%;
height: 100vh;
background: #FFF;
.box-top{
width: 100%;
height: 50px;
display: flex;
align-items: center;
padding: 0 15px;
.box-top-b{
width: 100%;
height: 45px;
background: #ECF1F4;
border-radius: 23px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
.box-top-b-l{
width: calc((100vw - 30px - 30px - 30px)/2);
overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
text-align: center;
}
}
}
.box-rili{
width: 100%;
height: 80px;
display: flex;
align-items: center;
padding: 0 10px;
position: relative;
}
}
</style>
<template>
<view class="bookaCarList">
<view class="box-top">
<view class="box-top-b">
<view class="box-top-b-l">
{{carMsg.StartCityName}}
</view>
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zhuanghuan.png" mode="aspectFill" style="width: 20px;height: 20px;"></image>
<view class="box-top-b-l">
{{carMsg.ArriveCityName}}
</view>
</view>
</view>
<view class="box-rili">
<view class="box-rili-scroll">
</view>
</view>
</view>
</template>
<script>
export default{
data(){
return{
pageTitle: "去订车",
msg:{
pageIndex:1,
pageSize:20,
StartCityId:0,
StartCityType:0,
ArriveCityId:0,
ArriveCityType:0,
Q_Date:'',
StartCityName:'',
ArriveCityName:'',
StartDate:'',
EndDate:'',
},
carMsg:{},
page_count:1,
status: "loadmore",
g: [],
}
},
onLoad(options) {
if(options && options.carMsg){
//对象解码
this.carMsg = JSON.parse(decodeURIComponent(options.carMsg))
this.msg.StartCityId = this.carMsg.StartCityId;
this.msg.StartCityType = this.carMsg.StartCityType;
this.msg.ArriveCityId = this.carMsg.ArriveCityId;
this.msg.ArriveCityType = this.carMsg.ArriveCityType;
this.msg.Q_Date = this.carMsg.Q_Date;
}
this.gettimeList()
this.init()
uni.setNavigationBarTitle({
title: this.pageTitle,
});
},
methods:{
gettimeList(){
var date1 = new Date();
var date2 = new Date(date1);
date2.setDate(date1.getDate() + 30);
let nowtime = date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate() ;
let htime = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate() ;
this.getdiffdate(nowtime,htime)
},
getdiffdate(stime,etime){
console.log(stime,etime)
var diffdate = new Array();
var i=0;
//开始日期小于等于结束日期,并循环
while(stime<=etime){
diffdate[i] = stime;
//获取开始日期时间戳
var stime_ts = new Date(stime).getTime();
//增加一天时间戳后的日期
var next_date = stime_ts + (24*60*60*1000);
//拼接年月日,这里的月份会返回(0-11),所以要+1
var next_dates_y = new Date(next_date).getFullYear()+'-';
var next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
var next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
stime = next_dates_y+next_dates_m+next_dates_d;
//增加数组key
i++;
}
console.log(diffdate);
//处理为数组
},
init(){
this.request2(
{
url: '/api/AppletCar/GetAppletCarCustomPageList',
data: this.msg
},
res => {
if(res.resultCode==1){
this.g = this.g.concat(res.data.pageData);
this.page_count = res.data.pageCount;
if (this.page_count == 1) {
this.status = "nomore";
}
}
}
);
}
}
}
</script>
...@@ -13,6 +13,39 @@ ...@@ -13,6 +13,39 @@
</view> </view>
<view class="content"> <view class="content">
<view class="content_box"> <view class="content_box">
<view class="c_row" style="padding: 0;border: none;">
<u-tabs style='width: 100%;' :is-scroll="false" name="Name" :list="navs" :active-color="mainColor" :current="active" @change="changeHandler2"
:show-bar="true" :activeFontSize="34" :inactive-color="secondary" :bold="true" height="100" duration="0" font-size="28"></u-tabs>
</view>
<view v-if="active==1" style="width: 100%;padding: 10px 0;">
<view class="c_row" v-if="info.IsShowDate==1" style="justify-content: space-between;border-bottom: 1px solid #E2E2E2;">
<view class="ac_o" @click="goaddressx(1)">
<span class='ac_o_h' v-if="carMsg.StartCityName =='' ">出发地</span>
<span class='ztext2' v-else >{{carMsg.StartCityName}}</span>
</view>
<view class="topB" style="height: 20px;align-items: center;" @click="exchange()">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/CustomizedCar/zhuanghuan.png" mode="aspectFill" style="width: 21px;height: 21px;"></image>
</view>
<view class="ac_o" style="text-align: right;" @click="goaddressx(2)">
<span class='ac_o_h' v-if="carMsg.ArriveCityName =='' ">到达地</span>
<span class='ztext2' v-else >{{carMsg.ArriveCityName}}</span>
</view>
</view>
<view style="width: 100%;color: #919191;font-size: 11px;height: 30px;line-height: 30px;border: none;">
时间
</view>
<view style="width: 100%;height: 50px;display: flex;align-items: center;border-bottom: 1px solid #E2E2E2;font-size: 14px;color: #1B1D1E;font-weight: 800;">
<picker mode="date" :value="cardate" :start="startDate" @change="bindDateChange">
<span>{{showcardate}}</span>
<span style='margin-left: 5px;'>{{showweek}}</span>
</picker>
</view>
<view class="carbtn" @click="godingche">
去订车
</view>
</view>
<view v-if="active==0">
<view class="c_row"> <view class="c_row">
<view class="topB" v-if="info.IsShowCity==1" @click="gocity"> <view class="topB" v-if="info.IsShowCity==1" @click="gocity">
<span class='titext'>城市</span> <span class='titext'>城市</span>
...@@ -85,6 +118,9 @@ ...@@ -85,6 +118,9 @@
@click="goList"> @click="goList">
{{info.ButtonText?info.ButtonText:''}} {{info.ButtonText?info.ButtonText:''}}
</view> </view>
</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -141,6 +177,8 @@ ...@@ -141,6 +177,8 @@
return { return {
info: {}, info: {},
contentHeight: 0, contentHeight: 0,
navs:[{Name:'城际专车'},{Name:'定制专车'}],
active:0,
mainColor: '', mainColor: '',
scrollTop: 0, scrollTop: 0,
headStyle: {}, headStyle: {},
...@@ -183,6 +221,22 @@ ...@@ -183,6 +221,22 @@
key: 'c785085c46d1eb41b1ebe8d1ec7fd945', key: 'c785085c46d1eb41b1ebe8d1ec7fd945',
latitude: '', latitude: '',
longitude: '', longitude: '',
carMsg:{
StartCityId:0,
StartCityType:'',
ArriveCityId:0,
ArriveCityType:'',
StartCityName:'',
ArriveCityName:'',
Q_Date:'',
},
cardate:'',
startDate:'',
showcardate:'',
showweek:''
} }
}, },
created() { created() {
...@@ -191,7 +245,7 @@ ...@@ -191,7 +245,7 @@
this.nav = uni.getMenuButtonBoundingClientRect().top; this.nav = uni.getMenuButtonBoundingClientRect().top;
this.headStyle.paddingTop = this.nav + 'px'; this.headStyle.paddingTop = this.nav + 'px';
let myDate = new Date(); let myDate = new Date();
myDate = myDate.setDate(myDate.getDate() + 1); myDate = myDate.setDate(myDate.getDate() + 1);//多一天的日期
myDate = new Date(myDate); myDate = new Date(myDate);
let obj = {} let obj = {}
obj.year = myDate.getFullYear(); //年 obj.year = myDate.getFullYear(); //年
...@@ -225,6 +279,13 @@ ...@@ -225,6 +279,13 @@
this.intervalDay = '半天' this.intervalDay = '半天'
} }
} }
let carDate = new Date();
this.carMsg.Q_Date = carDate.getFullYear() +'-'+(carDate.getMonth() + 1)+'-'+carDate.getDate();
let carday = carDate.getDay();
this.startDate = carDate.getFullYear() +'-'+(carDate.getMonth() + 1)+'-'+carDate.getDate();//从啥时候开始
this.showcardate = (carDate.getMonth() + 1)+'-'+carDate.getDate();
this.showweek = this.getweek(carday) //得到定制专车的周几
}, },
onLoad(options) { onLoad(options) {
this.init() //获取司导首页配置 this.init() //获取司导首页配置
...@@ -235,6 +296,89 @@ ...@@ -235,6 +296,89 @@
}); });
}, },
methods: { methods: {
godingche(){//跳入订车页面
if(this.carMsg.StartCityName==''){
uni.showToast({
title:'请选择出发地址',
icon:'none'
})
return
}
if(this.carMsg.ArriveCityName==''){
uni.showToast({
title:'请选择到达地址',
icon:'none'
})
return
}
//对象编码
let obj = encodeURIComponent(JSON.stringify(this.carMsg))
uni.navigateTo({
url: '/pages/guidecar/bookaCarList?carMsg='+obj
})
},
exchange(){//出发地和到达地互换
let obj = {
StartCityId:this.carMsg.ArriveCityId,
StartCityType:this.carMsg.ArriveCityType,
StartCityName:this.carMsg.ArriveCityName,
ArriveCityId:this.carMsg.StartCityId,
ArriveCityType:this.carMsg.StartCityType,
ArriveCityName:this.carMsg.StartCityName,
}
this.carMsg.StartCityId = obj.StartCityId;
this.carMsg.StartCityType = obj.StartCityType;
this.carMsg.StartCityName = obj.StartCityName;
this.carMsg.ArriveCityId = obj.ArriveCityId;
this.carMsg.ArriveCityType = obj.ArriveCityType;
this.carMsg.ArriveCityName = obj.ArriveCityName;
},
goaddressx(type){
if(type==1){
uni.navigateTo({
url: '/pages/guidecar/pickcarcity2?type='+type
})
}else{
if(this.carMsg.StartCityName==''){
uni.showToast({
title:'请先选择出发地',
icon:'none'
})
}else{
uni.navigateTo({
url: '/pages/guidecar/pickcarcity2?type='+type+'&StartCityId='+this.carMsg.StartCityId+'&StartCityType='+this.carMsg.StartCityType
})
}
}
},
bindDateChange(e){
let value = e.detail.value;
let carDate = new Date(value);
if(carDate>=(new Date())){
this.carMsg.Q_Date = value;
this.cardate = value;
let carday = carDate.getDay();
this.showcardate = (carDate.getMonth() + 1)+'-'+carDate.getDate();
this.showweek = this.getweek(carday) //得到定制专车的周几
}else{
uni.showToast({
title:'时间不能小于今天',
icon:'none'
})
}
},
changeHandler2(e){
this.active = e
},
getRegeo() { //进入页面获取当前地址位置 getRegeo() { //进入页面获取当前地址位置
this.amapPlugin.getRegeo({ this.amapPlugin.getRegeo({
success: (data) => { success: (data) => {
...@@ -296,6 +440,20 @@ ...@@ -296,6 +440,20 @@
getPickcar(Name) { //选择取消地址 getPickcar(Name) { //选择取消地址
this.Pickcar = Name this.Pickcar = Name
}, },
getcar(ID,type,Name,cartype){//定制专车的返回地址
if(cartype==1){
this.carMsg.StartCityId = ID;
this.carMsg.StartCityType = type;
this.carMsg.StartCityName = Name;
this.carMsg.ArriveCityId = 0;
this.carMsg.ArriveCityType = '';
this.carMsg.ArriveCityName = '';
}else{
this.carMsg.ArriveCityId = ID;
this.carMsg.ArriveCityType = type;
this.carMsg.ArriveCityName = Name;
}
},
radioChange(item) { //车辆类型 radioChange(item) { //车辆类型
this.carName = item.Name; this.carName = item.Name;
this.msg.CarClass = item.Id; this.msg.CarClass = item.Id;
...@@ -634,6 +792,14 @@ ...@@ -634,6 +792,14 @@
color: #1C1E1F; color: #1C1E1F;
font-weight: bold; font-weight: bold;
} }
.guidecar .ztext2 {
font-size: 28rpx;
color: #1C1E1F;
font-weight: bold;
display: inline-block;
width: 100%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;
}
.guidecar .btnstyle { .guidecar .btnstyle {
width: 100%; width: 100%;
...@@ -671,4 +837,27 @@ ...@@ -671,4 +837,27 @@
justify-content: space-between; justify-content: space-between;
border-top: 1px solid #f5f5f5 border-top: 1px solid #f5f5f5
} }
.guidecar .ac_o{
width: calc((100vw - 72px - 30px)/2);
height: 40px;
line-height: 40px;
}
.guidecar .ac_o_h{
color: #919191;
}
.guidecar .carbtn{
width: 100%;
margin-top: 34px;
height: 44px;
border-radius: 10px;
background: #111111;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #FFF;
margin-bottom: 20px;
}
</style> </style>
<template>
<view class="pickcarcity" :style="{'height':contentHeight}">
<view class="qcity">
<view class="ctrl-box">
<u-search
action-text="搜索"
:focus="true"
:show-action="true"
radius="40"
v-model="searchKey"
@search="searchHandler"
@custom="searchHandler"
@change="changeHandler"
></u-search>
</view>
<view v-if="show==true">
<scroll-view
:scroll-y="true"
style="height: calc(100vh - 50px)">
<view class="txtype">
<view class="list-cell" v-for="(x, index) in searchList" :key="index" @click="goback(x,2)">
{{x.Name}}
</view>
</view>
</scroll-view>
</view>
<div style='height: calc(100vh - 50px);' v-if="show==false">
<u-index-list :scrollTop="scrollTop">
<view v-for="(item, index) in indexList" :key="index">
<u-index-anchor :index="item.ti" />
<view class="list-cell" v-for="(x,y) in item.children" :key='y' @click="goback(x,2)">
{{x.Name}}
</view>
</view>
</u-index-list>
</div>
</view>
</view>
</template>
<script>
export default {
data() {
return {
pageTitle: "取车城市",
scrollTop:0,
contentHeight:0,
mainColor:'',
secondary:'',
cityList:[],
searchList:[],//搜索出来的
searchKey: "",
show:false,
indexList: [{ti:"A"}, {ti:"B"}, {ti:"C"}, {ti:"D"}, {ti:"E"}, {ti:"F"}, {ti:"G"},{ ti:"H"}, {ti:"I"}, {ti:"J"}, {ti:"K"}, {ti:"L"},
{ti:"M"}, {ti:"N"}, {ti:"O"}, {ti:"P"},{ ti:"Q"}, {ti:"R"}, {ti:"S"}, {ti:"T"}, {ti:"U"},
{ti:"V"}, {ti:"W"}, {ti:"X"}, {ti:"Y"}, {ti:"Z"}
],
dztype:1,
ArriveMsg:{
StartCityId:0,
StartCityType:0
}
}
},
onLoad(option){
if(option && option.type){
this.dztype = option.type
}
if(option && option.StartCityId){
this.ArriveMsg.StartCityId = option.StartCityId;
this.ArriveMsg.StartCityType = option.StartCityType;
}
if(this.dztype ==1){
this.pageTitle = '出发地点'
}else{
this.pageTitle = '到达地点'
}
uni.setNavigationBarTitle({
title: this.pageTitle,
});
this.init()//城市列表
},
created(){
this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
this.mainColor = this.$uiConfig.mainColor;
this.secondary = this.$uiConfig.secondary;
},
mounted() {
},
methods: {
init(){
uni.showLoading({
title: "加载中",
});
let url = '/api/AppletCar/GetAppletCarDepartCityList';
let msg = {}
if(this.dztype==2){
url = '/api/AppletCar/GetAppletCarArriveCityList';
msg = this.ArriveMsg
}
this.request2(
{
url: url,
data: msg
},
(res) => {
this.cityList = res.data;
this.indexList=[]
this.cityList.forEach(x=>{
let obj = {
ti:(x.PinYin.substr(0,1)).toUpperCase()
}
this.indexList.push(obj)
})
this.indexList.forEach(x=>{
x.children=[];
this.cityList.forEach(j=>{
let obj={}
if(x.ti==(j.PinYin.substr(0,1)).toUpperCase()){
x.children.push(j)
}
})
})
uni.hideLoading();
}
);
},
onPageScroll(e) {
this.scrollTop = e.scrollTop;
},
goback(item,type){
// let Name
// if(type==1){
// Name=item.RegionName
// }else{
// Name=item.Name
// }
console.log(item)
let that = this
let pages = getCurrentPages(); // 当前页面
let beforePage
beforePage = pages[pages.length - 2]; // 前一个页面
// console.log( beforePage.$vm)
setTimeout(()=>{
uni.navigateBack({
delta:1,
success: function() {
beforePage.$vm.getcar(item.Id,item.Type,item.Name,that.dztype); // 执行前一个页面的方法
}
});
},100)
},
searchHandler(val){
if(val!=''){
this.searchList = []
this.cityList.forEach(x=>{
if(x.Name.indexOf(val)!=-1){
this.searchList.push(x)
}
})
this.show=true
}else{
this.show=false
}
},
changeHandler(val) {
if(val==''){
this.show=false
}
},
}
}
</script>
<style>
.pickcarcity{
background: #FFFFFF;
}
.pickcarcity .qcity{
}
.pickcarcity .list-cell {
display: flex;
box-sizing: border-box;
width: 100%;
padding: 10px 24rpx;
overflow: hidden;
color: #323233;
font-size: 14px;
line-height: 24px;
background-color: #fff;
position: relative;
}
.pickcarcity .anchor-text {
color: red;
}
.pickcarcity .kaitong{
width: 100%;
padding: 15px;
background: #FAF8F9;
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
}
.pickcarcity .region{
width: 200rpx;
height: 68rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
margin-right: 30rpx;
margin-top: 30rpx;
}
.pickcarcity .ctrl-box {
padding: 5px 10px;
}
.pickcarcity .txtype{
width: 100%;
background: #FFF;
height: calc(100vh - 50px);
}
</style>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<u-icon name="arrow-left" size="44"></u-icon> <u-icon name="arrow-left" size="44"></u-icon>
</view> </view>
</view> </view>
<!-- <view @click='yj' style="width: 200px;height: 50px;">活动</view> --> <view @click='yj' style="width: 200px;height: 50px;">活动</view>
<u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name" :list="myPageData.home_pages.navs" <u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name" :list="myPageData.home_pages.navs"
:is-scroll="true" :active-color="mainColor" :current="active" :bar-width="80" :font-size="32" :bold="false" @change="changeHandler"></u-tabs> :is-scroll="true" :active-color="mainColor" :current="active" :bar-width="80" :font-size="32" :bold="false" @change="changeHandler"></u-tabs>
<template v-for="(item, i) in myPageData.home_pages.navs"> <template v-for="(item, i) in myPageData.home_pages.navs">
...@@ -1220,10 +1220,21 @@ ...@@ -1220,10 +1220,21 @@
}, },
yj(){ yj(){
let obj ={ArriveCityId: 7,
ArriveCityName: "九寨沟",
ArriveCityType: 2,
Q_Date: "2021-5-25",
StartCityId: 262,
StartCityName: "成都",
StartCityType: 1}
obj = encodeURIComponent(JSON.stringify(obj))
uni.navigateTo({ uni.navigateTo({
url: '/pages/blindDate/persondetails?UserId=123978' url: '/pages/guidecar/bookaCarList?carMsg='+obj
// url: '/pages/blindDate/personal/IDidentification'
}) })
// uni.navigateTo({
// url: '/pages/guidecar/index'
// // url: '/pages/blindDate/personal/IDidentification'
// })
} }
}, },
......
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