Commit 4992ba6d authored by Mac's avatar Mac

定制车辆的页面

parent 6c32181f
......@@ -358,6 +358,10 @@
"path":"pickcarcity"
},{
"path":"guidecarList"
},{
"path":"pickcarcity2"//出发和到达选择的地址
},{
"path":"bookaCarList"//定制车页面
},{
"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>
This diff is collapsed.
<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 @@
<u-icon name="arrow-left" size="44"></u-icon>
</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"
: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">
......@@ -1220,10 +1220,21 @@
},
yj(){
uni.navigateTo({
url: '/pages/blindDate/persondetails?UserId=123978'
// url: '/pages/blindDate/personal/IDidentification'
})
let obj ={ArriveCityId: 7,
ArriveCityName: "九寨沟",
ArriveCityType: 2,
Q_Date: "2021-5-25",
StartCityId: 262,
StartCityName: "成都",
StartCityType: 1}
obj = encodeURIComponent(JSON.stringify(obj))
uni.navigateTo({
url: '/pages/guidecar/bookaCarList?carMsg='+obj
})
// 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