|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="content-form">
|
|
|
- <view class="content-detail">
|
|
|
+ <!-- <view class="content-detail">
|
|
|
<view class="detail-text">
|
|
|
<u-image src="/static/pop_icon_warning.png" width="32" height="32"></u-image>
|
|
|
<text>请按照回收要求合理预约服务</text>
|
|
|
</view>
|
|
|
<view class="detail-xqtext">查看详情</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
<view class="form-data">
|
|
|
<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
|
|
|
<u-form-item prop="time" label="预约时间:" required>
|
|
@@ -62,7 +62,7 @@
|
|
|
<script>
|
|
|
// import uniPopup from '@/components/uni-popup/uni-popup.vue'
|
|
|
// import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
|
|
|
- import {gatherSave,gatherDetail,searchRider} from '@/api/index.js'
|
|
|
+ import {searchRider} from '@/api/index.js'
|
|
|
import {saveImgToAliOss} from '@/libs/tools.js'
|
|
|
import { getLookUpDatas,userDetail,yuyueInfoSave } from '@/api/data'
|
|
|
export default {
|
|
@@ -78,16 +78,16 @@
|
|
|
photograph: [], // 图片路径
|
|
|
RubbishType:[], // 回收分类
|
|
|
rubbishweightList:[], // 重量分类
|
|
|
- weightType:'',
|
|
|
- weightTagType:'info', // 重量按钮类型
|
|
|
latitude:'', // 当前位置经度
|
|
|
longitude:'' ,// 当前位置维度
|
|
|
day:'', // 今天、明天,后天
|
|
|
timeType:'', // 上午、下午
|
|
|
+ reserveDateBegin:'', // 预约开始时间
|
|
|
+ reserveDateEnd:'', // 预约结束时间
|
|
|
time: '', // 其它垃圾
|
|
|
rubbishTypeListData:[],
|
|
|
userDetailInfo:{}, // 用户信息
|
|
|
- nowDate:null,
|
|
|
+ nowDate:'',
|
|
|
form: {
|
|
|
info: '', // 厨余垃圾
|
|
|
},
|
|
@@ -146,39 +146,20 @@
|
|
|
]
|
|
|
},
|
|
|
],
|
|
|
- // rules: {
|
|
|
- // time: [
|
|
|
- // {
|
|
|
- // required: true,
|
|
|
- // message: '请选择时间',
|
|
|
- // trigger: ['blur', 'change']
|
|
|
- // }
|
|
|
- // ],
|
|
|
- // info:[{required:true,message:'请选择用户信息',trigger:['change']}]
|
|
|
- // }
|
|
|
};
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
console.log(option,option.id,'ppppppppp')
|
|
|
- this.rubbishType()
|
|
|
- this.getDetailData()
|
|
|
- this.rubbishWeightType()
|
|
|
- const date=new Date
|
|
|
- const year=date.getFullYear()
|
|
|
- const month = date.getMonth() + 1
|
|
|
- const day = date.getDate()
|
|
|
- this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day);
|
|
|
- console.log(date.getFullYear(),nowDate,date.getMonth(),'-----------日期')
|
|
|
+ this.pageInfo()
|
|
|
// 查看
|
|
|
- if(option && option.id){
|
|
|
- this.isView = true
|
|
|
- this.itemId=option.id
|
|
|
- }else {
|
|
|
- console.log('--------新增')
|
|
|
- this.photograph = []
|
|
|
- this.form.remarks = ''
|
|
|
- this.$refs.uForm.resetFields()
|
|
|
- }
|
|
|
+ // 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=> {
|
|
@@ -198,6 +179,18 @@
|
|
|
watch:{
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 初始化页面
|
|
|
+ pageInfo(){
|
|
|
+ this.time=''
|
|
|
+ this.userDetailInfo={}
|
|
|
+ this.photograph=[]
|
|
|
+ this.rubbishTypeList=[]
|
|
|
+ // this.latitude='' // 当前位置经度
|
|
|
+ // this.longitude='' // 当前位置维度
|
|
|
+ this.rubbishType()
|
|
|
+ this.getDetailData()
|
|
|
+ this.rubbishWeightType()
|
|
|
+ },
|
|
|
// 获取垃圾分类
|
|
|
rubbishType () {
|
|
|
let _this = this
|
|
@@ -210,7 +203,6 @@
|
|
|
})
|
|
|
this.$nextTick(()=>{
|
|
|
_this.rubbishTypeListData= result.data || []
|
|
|
- console.log(_this.rubbishTypeListData,'_this.rubbishTypeListData','---------------------')
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -232,7 +224,6 @@
|
|
|
if(res.status==200){
|
|
|
this.hasRider=res.data
|
|
|
}
|
|
|
- console.log(res,'-----------')
|
|
|
})
|
|
|
},
|
|
|
// 选择时间
|
|
@@ -241,14 +232,42 @@
|
|
|
this.show=true
|
|
|
},
|
|
|
confirm(e) {
|
|
|
+ const date=new Date
|
|
|
+ const year=date.getFullYear()
|
|
|
+ const month = date.getMonth() + 1
|
|
|
+ const day = date.getDate()
|
|
|
if(e){
|
|
|
this.time=e[0].label + e[1].label
|
|
|
this.day=e[0].label
|
|
|
- // if(e[0].label=='今天'){
|
|
|
- // this.day
|
|
|
- // }
|
|
|
this.timeType=e[1].label.substr(0, e[1].label.indexOf("(")) // 上午、下午
|
|
|
- console.log(e,'----------时间',this.day,this.timeType,e[1].label)
|
|
|
+ if(e[0].label=='今天'){
|
|
|
+ if(this.timeType=='上午'){
|
|
|
+ this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day)+' 08:00:00';
|
|
|
+ this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+day:day)+' 12:59:59';
|
|
|
+ }else{
|
|
|
+ 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';
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ if(e[0].label=='明天'){
|
|
|
+ if(this.timeType=='上午'){
|
|
|
+ this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+1):day+1)+' 08:00:00';
|
|
|
+ this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+1):day+1)+' 12:59:59';
|
|
|
+ }else{
|
|
|
+ this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+1):day+1)+' 13:00:00';
|
|
|
+ this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+1):day+1)+' 18:00:00';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(e[0].label=='后天'){
|
|
|
+ if(this.timeType=='上午'){
|
|
|
+ this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+2):day+2)+' 08:00:00';
|
|
|
+ this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+2):day+2)+' 12:59:59';
|
|
|
+ }else{
|
|
|
+ this.reserveDateBegin=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+2):day+2)+' 13:00:00';
|
|
|
+ this.reserveDateEnd=this.nowDate = year + "-" +( month<10? '0'+month:month ) + "-" + (day<10? '0'+(day+2):day+2)+' 18:00:00';
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 选择用户信息
|
|
@@ -260,18 +279,12 @@
|
|
|
// 选择垃圾分类
|
|
|
itemRubbishChange(item){
|
|
|
item.check=!item.check
|
|
|
- // this.rubbishTypeList.push(item.code)
|
|
|
console.log(item,item.code,'--------------',this.check)
|
|
|
},
|
|
|
itemRubbishWeightChange(item){
|
|
|
this.checkWeightType=item.code
|
|
|
- this.reserveWeight=item.code
|
|
|
console.log(item,item.code,'--------------',this.check)
|
|
|
},
|
|
|
- // 选择重量
|
|
|
- chooseWeight(value){
|
|
|
- console.log('-------选中重量')
|
|
|
- },
|
|
|
// 获取详情数据
|
|
|
getDetailData(){
|
|
|
userDetail().then(res=>{
|
|
@@ -326,27 +339,54 @@
|
|
|
// 提交
|
|
|
submit(){
|
|
|
this.$refs.uForm.validate(valid => {
|
|
|
- const params= Object.assign(this.userDetailInfo, this.form)
|
|
|
- if(this.time){
|
|
|
- params.dayStr=this.day
|
|
|
- params.reserveTimeType=this.timeType
|
|
|
- if(params.reserveTimeType=='上午'){
|
|
|
- params.beginStr='08:00:00', // 预约开始时间
|
|
|
- params.endStr="12:59:59"
|
|
|
- }else{
|
|
|
- params.beginStr='13:00:00', // 预约开始时间
|
|
|
- params.endStr="18:00:00"
|
|
|
- }
|
|
|
- }
|
|
|
- if(this.rubbishTypeList){
|
|
|
- params.rubbishTypeList=this.rubbishTypeList
|
|
|
- }
|
|
|
- if(this.reserveWeight){
|
|
|
- params.reserveWeight=this.reserveWeight
|
|
|
- }
|
|
|
- console.log(params,'--------------参数')
|
|
|
if (valid) {
|
|
|
- console.log('验证通过');
|
|
|
+ if(this.time ==''){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择预约时间',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.form.info ==''){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择用户信息',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.checkWeightType ==''){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择预估重量',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(this.rubbishTypeList ==[]){
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择回收分类',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const params= Object.assign(this.userDetailInfo, this.form)
|
|
|
+ if(this.time){
|
|
|
+ params.reserveDateBegin=this.reserveDateBegin
|
|
|
+ params.reserveDateEnd=this.reserveDateEnd
|
|
|
+ }
|
|
|
+ if(this.reserveWeight){
|
|
|
+ params.reserveWeight=this.checkWeightType
|
|
|
+ }
|
|
|
+ if(this.photograph){
|
|
|
+ params.imageList=this.photograph
|
|
|
+ }
|
|
|
+ if(this.rubbishTypeListData){
|
|
|
+ this.rubbishTypeListData.map(item=>{
|
|
|
+ if(item.check==true){
|
|
|
+ this.rubbishTypeList.push(item.code)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ params.rubbishTypeList=this.rubbishTypeList
|
|
|
+ }
|
|
|
yuyueInfoSave(params).then(res=>{
|
|
|
if(res.status==200){
|
|
|
uni.showToast({
|
|
@@ -365,60 +405,6 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 确认提交
|
|
|
- // onOk() {
|
|
|
- // this.$refs.openModal.close()
|
|
|
- // let params = {
|
|
|
- // rubbishEntityList: [],
|
|
|
- // imageUrlList: this.photograph,
|
|
|
- // remarks: this.form.remarks
|
|
|
- // }
|
|
|
- // if(this.itemId){
|
|
|
- // params.id=this.itemId
|
|
|
- // }
|
|
|
- // if(this.form.gatherNum_other) {
|
|
|
- // params.rubbishEntityList.push({
|
|
|
- // "rubbishType":"GATHER_OTHER",
|
|
|
- // "rubbishWeight": this.form.gatherNum_other*240,
|
|
|
- // "gatherNum": this.form.gatherNum_other,
|
|
|
- // "unit":"BUCKET"
|
|
|
- // })
|
|
|
- // }
|
|
|
- // if(this.form.gatherNum_chuyu) {
|
|
|
- // params.rubbishEntityList.push({
|
|
|
- // "rubbishType":"GATHER_KITCHEN",
|
|
|
- // "rubbishWeight": this.form.gatherNum_chuyu*240,
|
|
|
- // "gatherNum": this.form.gatherNum_chuyu,
|
|
|
- // "unit":"BUCKET"
|
|
|
- // })
|
|
|
- // }
|
|
|
- // if(this.form.gatherNum_jianzhu) {
|
|
|
- // params.rubbishEntityList.push({
|
|
|
- // "rubbishType":"GATHER_BUILDING",
|
|
|
- // "rubbishWeight": this.form.gatherNum_jianzhu*1000,
|
|
|
- // "gatherNum": this.form.gatherNum_jianzhu,
|
|
|
- // "unit":"TON"
|
|
|
- // })
|
|
|
- // }
|
|
|
- // this.loading=true
|
|
|
- // gatherSave(params).then(res=>{
|
|
|
- // if(res.status == 200) {
|
|
|
- // uni.showToast({
|
|
|
- // title: res.message,
|
|
|
- // icon: 'none'
|
|
|
- // })
|
|
|
- // setTimeout(()=>{
|
|
|
- // uni.navigateBack()
|
|
|
- // },300)
|
|
|
- // } else {
|
|
|
- // uni.showToast({
|
|
|
- // title: res.message,
|
|
|
- // icon: 'none'
|
|
|
- // })
|
|
|
- // }
|
|
|
- // this.loading= false
|
|
|
- // })
|
|
|
- // },
|
|
|
|
|
|
},
|
|
|
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|