|
@@ -11,7 +11,7 @@
|
|
<view class="form-data">
|
|
<view class="form-data">
|
|
<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
|
|
<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
|
|
<u-form-item prop="time" label="预约时间:" required>
|
|
<u-form-item prop="time" label="预约时间:" required>
|
|
- <u-select v-model="show" mode="mutil-column-auto" :list="list" @confirm="confirm"></u-select>
|
|
|
|
|
|
+ <u-select v-model="show" mode="mutil-column-auto" :list="list" @confirm="confirm" confirm-color="#07C160"></u-select>
|
|
<u-input placeholder="请选择预约时间" v-model="time" @click="selectTime" :disabled="true"/>
|
|
<u-input placeholder="请选择预约时间" v-model="time" @click="selectTime" :disabled="true"/>
|
|
<u-icon name="arrow-right" slot="right" @click="selectTime"></u-icon>
|
|
<u-icon name="arrow-right" slot="right" @click="selectTime"></u-icon>
|
|
</u-form-item>
|
|
</u-form-item>
|
|
@@ -48,10 +48,10 @@
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
- <view style="color:#FF2C5C;text-align: center;margin-bottom: 10upx;" v-if="!hasRider">当前地址/时段无可上门骑手,暂不能下单</view>
|
|
|
|
|
|
+ <view style="color:#FF2C5C;text-align: center;margin-bottom: 10upx;" v-if="!hasRider">当前无可上门骑手,暂不能下单</view>
|
|
<view class="btns">
|
|
<view class="btns">
|
|
- <u-button @click="submit" :loading="loading" :custom-style="submitBtn" :disabled="!hasRider">提交</u-button>
|
|
|
|
- <!-- <u-button @click="submit" :loading="loading" :custom-style="submitBtn">提交</u-button> -->
|
|
|
|
|
|
+ <u-button @click="submit" :loading="loading" :custom-style="submitBtn" v-if="hasRider">立即下单</u-button>
|
|
|
|
+ <u-button :loading="loading" :custom-style="disabledBtn" v-if="!hasRider" :disabled="true">立即下单</u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -72,6 +72,8 @@
|
|
rubbishweightList:[], // 重量分类
|
|
rubbishweightList:[], // 重量分类
|
|
latitude:'', // 当前位置经度
|
|
latitude:'', // 当前位置经度
|
|
longitude:'' ,// 当前位置维度
|
|
longitude:'' ,// 当前位置维度
|
|
|
|
+ userLatitude:'' , // 用户位置经度
|
|
|
|
+ userLongitude:'', // 用户位置维度
|
|
day:'', // 今天、明天,后天
|
|
day:'', // 今天、明天,后天
|
|
timeType:'', // 上午、下午
|
|
timeType:'', // 上午、下午
|
|
reserveDateBegin:'', // 预约开始时间
|
|
reserveDateBegin:'', // 预约开始时间
|
|
@@ -87,12 +89,18 @@
|
|
reserveWeight:'',
|
|
reserveWeight:'',
|
|
isView: false ,// 是否是查看详情
|
|
isView: false ,// 是否是查看详情
|
|
hasRider:true, // 是否有骑手
|
|
hasRider:true, // 是否有骑手
|
|
|
|
+ currentTime:'', // 当前时间戳
|
|
itemId:'',
|
|
itemId:'',
|
|
submitBtn:{
|
|
submitBtn:{
|
|
backgroundColor: '#4F88F7',
|
|
backgroundColor: '#4F88F7',
|
|
color: '#fff',
|
|
color: '#fff',
|
|
borderRadius: '12px'
|
|
borderRadius: '12px'
|
|
},
|
|
},
|
|
|
|
+ disabledBtn:{
|
|
|
|
+ backgroundColor: '#999',
|
|
|
|
+ color: '#fff',
|
|
|
|
+ borderRadius: '12px'
|
|
|
|
+ },
|
|
show: false,
|
|
show: false,
|
|
val:'',
|
|
val:'',
|
|
list: [
|
|
list: [
|
|
@@ -142,38 +150,13 @@
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
- console.log(option,option.pageType,'ppppppppp')
|
|
|
|
- // this.pageInfo()
|
|
|
|
- // if(!option.pageType){
|
|
|
|
- // this.pageInfo()
|
|
|
|
- // }
|
|
|
|
|
|
+ this.rubbishType()
|
|
|
|
+ this.rubbishWeightType()
|
|
uni.$on('pageType', this.pageType)
|
|
uni.$on('pageType', this.pageType)
|
|
-
|
|
|
|
- // 查看
|
|
|
|
- // if(option && option.id){
|
|
|
|
- // this.isView = true
|
|
|
|
- // this.itemId=option.id
|
|
|
|
- // }else {
|
|
|
|
- // console.log('--------新增')
|
|
|
|
- // this.photograph = []
|
|
|
|
- // this.$refs.uForm.resetFields()
|
|
|
|
- // }
|
|
|
|
- wx.getLocation({
|
|
|
|
- type: 'wgs84',
|
|
|
|
- success:(res=> {
|
|
|
|
- if(res.latitude && res.longitude){
|
|
|
|
- this.latitude = res.latitude
|
|
|
|
- this.longitude = res.longitude
|
|
|
|
- }
|
|
|
|
- console.log(res,'位置信息',this.latitude,this.longitude)
|
|
|
|
- })
|
|
|
|
- })
|
|
|
|
- setTimeout(()=>{
|
|
|
|
- this.getRiderStatus()
|
|
|
|
- },300)
|
|
|
|
|
|
+ console.log(uni.$on('pageType', this.pageType))
|
|
},
|
|
},
|
|
onShow() {
|
|
onShow() {
|
|
- this.pageInfo()
|
|
|
|
|
|
+ this.getDetailData()
|
|
},
|
|
},
|
|
onUnload() {
|
|
onUnload() {
|
|
},
|
|
},
|
|
@@ -189,16 +172,14 @@
|
|
this.rubbishTypeListData=[]
|
|
this.rubbishTypeListData=[]
|
|
this.latitude='' // 当前位置经度
|
|
this.latitude='' // 当前位置经度
|
|
this.longitude='' // 当前位置维度
|
|
this.longitude='' // 当前位置维度
|
|
- this.rubbishType()
|
|
|
|
- this.getDetailData()
|
|
|
|
- this.rubbishWeightType()
|
|
|
|
|
|
+ this.userLatitude='' // 用户位置经度
|
|
|
|
+ this.userLongitude='' // 用户位置维度
|
|
},
|
|
},
|
|
pageType(e){
|
|
pageType(e){
|
|
this.val += e.data
|
|
this.val += e.data
|
|
- if(this.val!='userInfo'){
|
|
|
|
|
|
+ if(e && e.data!='userInfo'){
|
|
this.pageInfo()
|
|
this.pageInfo()
|
|
}
|
|
}
|
|
- console.log(this.val,'----------',e)
|
|
|
|
},
|
|
},
|
|
// 获取垃圾分类
|
|
// 获取垃圾分类
|
|
rubbishType () {
|
|
rubbishType () {
|
|
@@ -229,7 +210,7 @@
|
|
},
|
|
},
|
|
// 查询附近有无骑手可接单
|
|
// 查询附近有无骑手可接单
|
|
getRiderStatus(){
|
|
getRiderStatus(){
|
|
- searchRider({lng:this.longitude,lat:this.latitude}).then(res=>{
|
|
|
|
|
|
+ searchRider({lat:this.userLatitude,lng:this.userLongitude}).then(res=>{
|
|
if(res.status==200){
|
|
if(res.status==200){
|
|
this.hasRider=res.data
|
|
this.hasRider=res.data
|
|
}
|
|
}
|
|
@@ -238,6 +219,66 @@
|
|
// 选择时间
|
|
// 选择时间
|
|
selectTime(){
|
|
selectTime(){
|
|
wx.hideKeyboard()
|
|
wx.hideKeyboard()
|
|
|
|
+ const date = new Date()
|
|
|
|
+ const year = date.getFullYear()
|
|
|
|
+ const month = date.getMonth()+1
|
|
|
|
+ const day = date.getDate()
|
|
|
|
+ const amMax = [year,month,day].join('-') + ' ' + '12:59:59'
|
|
|
|
+ const pmMax = [year,month,day].join('-') + ' ' + '18:00:00'
|
|
|
|
+ const nowTime = date.getTime()
|
|
|
|
+ console.log([year,month,day].join('-'))
|
|
|
|
+ console.log(date.getTime(),'now time')
|
|
|
|
+ console.log(new Date(amMax).getTime(),'am time')
|
|
|
|
+ console.log(new Date(pmMax).getTime(),'pm time')
|
|
|
|
+ const list = [
|
|
|
|
+ {
|
|
|
|
+ value: 4,
|
|
|
|
+ label: '明天',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ value: 5,
|
|
|
|
+ label: '上午(08-13点)',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 6,
|
|
|
|
+ label: '下午(13-18点)',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 7,
|
|
|
|
+ label: '后天',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ value: 8,
|
|
|
|
+ label: '上午(08-13点)',
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ value: 9,
|
|
|
|
+ label: '下午(13-18点)',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ if(nowTime > new Date(pmMax).getTime()){
|
|
|
|
+ this.list = list
|
|
|
|
+ }else{
|
|
|
|
+ if(nowTime > new Date(amMax).getTime()){
|
|
|
|
+ this.list = list
|
|
|
|
+ this.list.unshift({
|
|
|
|
+ value: 1,
|
|
|
|
+ label: '今天',
|
|
|
|
+ children: [
|
|
|
|
+ {
|
|
|
|
+ value: 3,
|
|
|
|
+ label: '下午(13-18点)',
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // return
|
|
this.show=true
|
|
this.show=true
|
|
},
|
|
},
|
|
confirm(e) {
|
|
confirm(e) {
|
|
@@ -257,7 +298,6 @@
|
|
this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day)+' 13:00:00';
|
|
this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day)+' 13:00:00';
|
|
this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day)+' 18:00:00';
|
|
this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day)+' 18:00:00';
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
if(e[0].label=='明天'){
|
|
if(e[0].label=='明天'){
|
|
if(this.timeType=='上午'){
|
|
if(this.timeType=='上午'){
|
|
@@ -277,7 +317,22 @@
|
|
this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+2):day+2)+' 18:00:00';
|
|
this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+2):day+2)+' 18:00:00';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ console.log(new Date(this.reserveDateEnd).getTime(),'--------------结束时间戳')
|
|
|
|
+ // if((new Date(this.reserveDateEnd).getTime())-(new Date().getTime())<=0){
|
|
|
|
+ // this.time=''
|
|
|
|
+ // this.show=true
|
|
|
|
+ // console.log(this.show,'------------展开')
|
|
|
|
+ // uni.showToast({
|
|
|
|
+ // title: '请选择合适的预约时间',
|
|
|
|
+ // icon: 'none'
|
|
|
|
+ // })
|
|
|
|
+ // return false
|
|
|
|
+ // }else{
|
|
|
|
+ // this.time=e[0].label + e[1].label
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
},
|
|
},
|
|
// 选择用户信息
|
|
// 选择用户信息
|
|
selectUserInfo(){
|
|
selectUserInfo(){
|
|
@@ -288,11 +343,9 @@
|
|
// 选择垃圾分类
|
|
// 选择垃圾分类
|
|
itemRubbishChange(item){
|
|
itemRubbishChange(item){
|
|
item.check=!item.check
|
|
item.check=!item.check
|
|
- console.log(item,item.code,'--------------',this.check)
|
|
|
|
},
|
|
},
|
|
itemRubbishWeightChange(item){
|
|
itemRubbishWeightChange(item){
|
|
this.checkWeightType=item.code
|
|
this.checkWeightType=item.code
|
|
- console.log(item,item.code,'--------------',this.check,this.checkWeightType)
|
|
|
|
},
|
|
},
|
|
// 获取详情数据
|
|
// 获取详情数据
|
|
getDetailData(){
|
|
getDetailData(){
|
|
@@ -300,8 +353,11 @@
|
|
if(res.status==200){
|
|
if(res.status==200){
|
|
this.form.info=res.data.contactName
|
|
this.form.info=res.data.contactName
|
|
this.userId=res.data.id
|
|
this.userId=res.data.id
|
|
|
|
+ this.userLatitude=res.data.lat // 用户位置经度
|
|
|
|
+ this.userLongitude=res.data.lng // 用户位置维度
|
|
delete res.data.id
|
|
delete res.data.id
|
|
this.userDetailInfo=res.data
|
|
this.userDetailInfo=res.data
|
|
|
|
+ this.getRiderStatus()
|
|
console.log(res)
|
|
console.log(res)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -350,10 +406,8 @@
|
|
// 提交
|
|
// 提交
|
|
submit(){
|
|
submit(){
|
|
this.rubbishTypeList=[]
|
|
this.rubbishTypeList=[]
|
|
- console.log('-------------提交')
|
|
|
|
this.$refs.uForm.validate(valid => {
|
|
this.$refs.uForm.validate(valid => {
|
|
const params= Object.assign(this.userDetailInfo, this.form,{userId:this.userId})
|
|
const params= Object.assign(this.userDetailInfo, this.form,{userId:this.userId})
|
|
- console.log('-------------校验')
|
|
|
|
if (valid) {
|
|
if (valid) {
|
|
if(this.time ==''){
|
|
if(this.time ==''){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -362,7 +416,6 @@
|
|
})
|
|
})
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- console.log('-------------时间校验')
|
|
|
|
if(this.form.info ==''){
|
|
if(this.form.info ==''){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '请选择用户信息',
|
|
title: '请选择用户信息',
|
|
@@ -370,7 +423,6 @@
|
|
})
|
|
})
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- console.log('-------------用户校验')
|
|
|
|
if(this.checkWeightType ==''){
|
|
if(this.checkWeightType ==''){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '请选择预估重量',
|
|
title: '请选择预估重量',
|
|
@@ -378,25 +430,21 @@
|
|
})
|
|
})
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- console.log('-------------重量校验')
|
|
|
|
if(this.rubbishTypeListData){
|
|
if(this.rubbishTypeListData){
|
|
this.rubbishTypeListData.map(item=>{
|
|
this.rubbishTypeListData.map(item=>{
|
|
if(item.check==true){
|
|
if(item.check==true){
|
|
this.rubbishTypeList.push(item.code)
|
|
this.rubbishTypeList.push(item.code)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- console.log(this.rubbishTypeListData,this.rubbishTypeList,'--------选中垃圾分类')
|
|
|
|
params.rubbishTypeList=this.rubbishTypeList
|
|
params.rubbishTypeList=this.rubbishTypeList
|
|
}
|
|
}
|
|
- console.log(params,'----------params垃圾类型')
|
|
|
|
- if(this.rubbishTypeList ==[]){
|
|
|
|
|
|
+ if(this.rubbishTypeList.length ==0){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '请选择回收分类',
|
|
title: '请选择回收分类',
|
|
icon: 'none'
|
|
icon: 'none'
|
|
})
|
|
})
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- console.log(params,'----------params垃圾类型')
|
|
|
|
if(this.time){
|
|
if(this.time){
|
|
params.reserveDateBegin=this.reserveDateBegin
|
|
params.reserveDateBegin=this.reserveDateBegin
|
|
params.reserveDateEnd=this.reserveDateEnd
|
|
params.reserveDateEnd=this.reserveDateEnd
|