|
@@ -10,27 +10,27 @@
|
|
|
</view>
|
|
|
<view class="form-data">
|
|
|
<u-form :model="form" ref="uForm" :label-width="140" :error-type="['toast']">
|
|
|
- <u-form-item prop="time" label="预约时间:" >
|
|
|
+ <u-form-item prop="time" label="预约时间:" required>
|
|
|
<u-select v-model="show" mode="mutil-column-auto" :list="list" @confirm="confirm"></u-select>
|
|
|
- <u-input placeholder="请选择预约时间" v-model="form.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-form-item>
|
|
|
- <u-form-item prop="info" label="用户信息:" >
|
|
|
+ <u-form-item prop="info" label="用户信息:" required>
|
|
|
<u-input placeholder="请选择用户信息" v-model="form.info" @click="selectUserInfo" :disabled="true"/>
|
|
|
<u-icon name="arrow-right" slot="right" @click="selectUserInfo"></u-icon>
|
|
|
</u-form-item>
|
|
|
</u-form>
|
|
|
</view>
|
|
|
<view class="form-data rubbishType">
|
|
|
- <view class="rubbishType-title">回收分类</view>
|
|
|
+ <view class="rubbishType-title u-required:before">回收分类</view>
|
|
|
<view class="rubbishType-tags">
|
|
|
- <u-tag text="纸质类" shape="circle" type="info" @click="chooseRubbishType"/><u-tag text="金属类" shape="circle" type="info" @click="chooseRubbishType"/><u-tag text="衣物类" shape="circle" type="info" @click="chooseRubbishType"/><u-tag text="塑料类" shape="circle" type="info" @click="chooseRubbishType"/>
|
|
|
+ <view :class="['item-tags', item.check ? 'active' : '']" v-for="item in rubbishTypeListData" :key="item.code" @click="itemRubbishChange(item)">{{item.dispName}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="form-data rubbishType">
|
|
|
- <view class="rubbishType-title">预估重量</view>
|
|
|
+ <view class="rubbishType-title u-required:before">预估重量</view>
|
|
|
<view class="rubbishType-tags">
|
|
|
- <u-tag text="10-50克" shape="circle" :type="weightTagType" @click="chooseWeight(1)"/><u-tag text="50-100克" shape="circle" type="info" @click="chooseWeight(2)"/><u-tag text="100克以上" shape="circle" type="info" @click="chooseWeight(3)"/>
|
|
|
+ <view :class="['item-weightTags', checkWeightType == item.code ? 'active' : '']" v-for="item in rubbishweightList" :key="item.code" @click="itemRubbishWeightChange(item)">{{item.dispName}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="form-data qyImg">
|
|
@@ -48,8 +48,9 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view style="color:#FF2C5C;text-align: center;margin-bottom: 20upx;">当前地址/时段无可上门骑手,暂不能下单</view>
|
|
|
+ <view style="color:#FF2C5C;text-align: center;margin-bottom: 10upx;" v-if="!hasRider">当前地址/时段无可上门骑手,暂不能下单</view>
|
|
|
<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>
|
|
|
</view>
|
|
|
<!-- <uni-popup ref="openModal" type="center">
|
|
@@ -61,8 +62,9 @@
|
|
|
<script>
|
|
|
// import uniPopup from '@/components/uni-popup/uni-popup.vue'
|
|
|
// import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
|
|
|
- import {gatherSave,gatherDetail} from '@/api/index.js'
|
|
|
+ import {gatherSave,gatherDetail,searchRider} from '@/api/index.js'
|
|
|
import {saveImgToAliOss} from '@/libs/tools.js'
|
|
|
+ import { getLookUpDatas,userDetail,yuyueInfoSave } from '@/api/data'
|
|
|
export default {
|
|
|
// components: {
|
|
|
// uniPopup,uniPopupDialog
|
|
@@ -71,15 +73,28 @@
|
|
|
return {
|
|
|
title:'',
|
|
|
loading:false, // 提交按钮加载圈
|
|
|
+ check:'', // 是否选中
|
|
|
+ checkWeightType:'',
|
|
|
photograph: [], // 图片路径
|
|
|
RubbishType:[], // 回收分类
|
|
|
+ rubbishweightList:[], // 重量分类
|
|
|
weightType:'',
|
|
|
weightTagType:'info', // 重量按钮类型
|
|
|
+ latitude:'', // 当前位置经度
|
|
|
+ longitude:'' ,// 当前位置维度
|
|
|
+ day:'', // 今天、明天,后天
|
|
|
+ timeType:'', // 上午、下午
|
|
|
+ time: '', // 其它垃圾
|
|
|
+ rubbishTypeListData:[],
|
|
|
+ userDetailInfo:{}, // 用户信息
|
|
|
+ nowDate:null,
|
|
|
form: {
|
|
|
- time: '', // 其它垃圾
|
|
|
info: '', // 厨余垃圾
|
|
|
},
|
|
|
+ rubbishTypeList:[], // 垃圾类型
|
|
|
+ reserveWeight:'',
|
|
|
isView: false ,// 是否是查看详情
|
|
|
+ hasRider:true, // 是否有骑手
|
|
|
itemId:'',
|
|
|
submitBtn:{
|
|
|
backgroundColor: '#4F88F7',
|
|
@@ -131,51 +146,110 @@
|
|
|
]
|
|
|
},
|
|
|
],
|
|
|
- rules: {
|
|
|
- time: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择时间',
|
|
|
- trigger: ['blur', 'change']
|
|
|
- }
|
|
|
- ],
|
|
|
- info:[{required:true,message:'请选择用户信息',trigger:['change']}]
|
|
|
- }
|
|
|
+ // 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(),'-----------日期')
|
|
|
// 查看
|
|
|
if(option && option.id){
|
|
|
this.isView = true
|
|
|
this.itemId=option.id
|
|
|
- this.getDetailData()
|
|
|
}else {
|
|
|
console.log('--------新增')
|
|
|
this.photograph = []
|
|
|
this.form.remarks = ''
|
|
|
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)
|
|
|
},
|
|
|
onUnload() {
|
|
|
},
|
|
|
+ watch:{
|
|
|
+ },
|
|
|
methods: {
|
|
|
- // 保留几位小数
|
|
|
- // numberToFixed: function (key, num, max) {
|
|
|
- // let val = this.form[key]
|
|
|
- // let ret = numberToFixed(val, num, max)
|
|
|
- // this.$nextTick(() => {
|
|
|
- // this.form[key] = ret
|
|
|
- // })
|
|
|
- // },
|
|
|
+ // 获取垃圾分类
|
|
|
+ rubbishType () {
|
|
|
+ let _this = this
|
|
|
+ getLookUpDatas({
|
|
|
+ type: 'RESERVE_RUBBISH_TYPE'
|
|
|
+ }).then(result => {
|
|
|
+ if (result && result.status + '' === '200') {
|
|
|
+ result.data.forEach(item=>{
|
|
|
+ item.check=false
|
|
|
+ })
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ _this.rubbishTypeListData= result.data || []
|
|
|
+ console.log(_this.rubbishTypeListData,'_this.rubbishTypeListData','---------------------')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ rubbishWeightType () {
|
|
|
+ let _this = this
|
|
|
+ getLookUpDatas({
|
|
|
+ type: 'RUBBISH_WEIGHT_TEMPLATE'
|
|
|
+ }).then(result => {
|
|
|
+ if (result && result.status + '' === '200') {
|
|
|
+ _this.rubbishweightList= result.data || []
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 查询附近有无骑手可接单
|
|
|
+ getRiderStatus(){
|
|
|
+ searchRider({lng:this.longitude,lat:this.latitude}).then(res=>{
|
|
|
+ if(res.status==200){
|
|
|
+ this.hasRider=res.data
|
|
|
+ }
|
|
|
+ console.log(res,'-----------')
|
|
|
+ })
|
|
|
+ },
|
|
|
// 选择时间
|
|
|
selectTime(){
|
|
|
wx.hideKeyboard()
|
|
|
this.show=true
|
|
|
},
|
|
|
confirm(e) {
|
|
|
- console.log(e);
|
|
|
- this.form.time=e[0].label + e[1].label
|
|
|
+ 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)
|
|
|
+ }
|
|
|
},
|
|
|
// 选择用户信息
|
|
|
selectUserInfo(){
|
|
@@ -184,30 +258,27 @@
|
|
|
})
|
|
|
},
|
|
|
// 选择垃圾分类
|
|
|
- chooseRubbishType(){},
|
|
|
+ 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){
|
|
|
- if(value!=1 || value!=2 || value!=3){
|
|
|
- this.weightTagType='primary'
|
|
|
- }else{
|
|
|
- this.weightTagType='info'
|
|
|
- }
|
|
|
console.log('-------选中重量')
|
|
|
},
|
|
|
// 获取详情数据
|
|
|
getDetailData(){
|
|
|
- gatherDetail({id:this.itemId}).then(res=>{
|
|
|
+ userDetail().then(res=>{
|
|
|
if(res.status==200){
|
|
|
+ this.form.info=res.data.contactName
|
|
|
+ this.userDetailInfo=res.data
|
|
|
console.log(res)
|
|
|
- const a = res.data.gatherRubbishList.find(item=>item.rubbishType=='GATHER_BUILDING')
|
|
|
- const b = res.data.gatherRubbishList.find(item=>item.rubbishType=='GATHER_OTHER')
|
|
|
- const c = res.data.gatherRubbishList.find(item=>item.rubbishType=='GATHER_KITCHEN')
|
|
|
- this.form.gatherNum_jianzhu= a ? a.gatherNum.toString() : '0'
|
|
|
- this.form.gatherNum_chuyu= c ? c.gatherNum.toString() : '0'
|
|
|
- this.form.gatherNum_other= b ? b.gatherNum.toString() : '0'
|
|
|
- this.form.remarks=res.data.remarks
|
|
|
- this.photograph=res.data.imageUrlList || []
|
|
|
- console.log(this.form,'this.form')
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -233,9 +304,7 @@
|
|
|
mask: true
|
|
|
})
|
|
|
saveImgToAliOss(res.tempFilePaths[0],(ret)=>{
|
|
|
- // console.log(ret,'----------ret')
|
|
|
this.photograph.push(ret.data)
|
|
|
- // _this.photograph = ret.data
|
|
|
uni.hideLoading()
|
|
|
})
|
|
|
}
|
|
@@ -256,12 +325,41 @@
|
|
|
},
|
|
|
// 提交
|
|
|
submit(){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/index/yuyueResult'
|
|
|
- })
|
|
|
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('验证通过');
|
|
|
+ yuyueInfoSave(params).then(res=>{
|
|
|
+ if(res.status==200){
|
|
|
+ uni.showToast({
|
|
|
+ title: res.message,
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ setTimeout(()=>{
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/index/yuyueResult'
|
|
|
+ })
|
|
|
+ },500)
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
console.log('验证失败');
|
|
|
}
|
|
@@ -370,18 +468,31 @@
|
|
|
font-style: normal;
|
|
|
}
|
|
|
.form-data{
|
|
|
- padding: 0 30upx;
|
|
|
+ padding:0 30upx 0 50upx;
|
|
|
margin-bottom: 20upx;
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
.rubbishType{
|
|
|
- padding: 30upx ;
|
|
|
+ padding:30upx 30upx 30upx 50upx;
|
|
|
.rubbishType-title{
|
|
|
margin-bottom: 20upx;
|
|
|
}
|
|
|
.rubbishType-tags{
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
+ .item-tags.active{
|
|
|
+ padding: 10upx;
|
|
|
+ background-color:rgba(79, 136, 247, 0.2);
|
|
|
+ border-radius: 100px;
|
|
|
+ }
|
|
|
+ .item-weightTags.active{
|
|
|
+ padding: 10upx;
|
|
|
+ background-color:rgba(79, 136, 247, 0.2);
|
|
|
+ border-radius: 100px;
|
|
|
+ }
|
|
|
+ .check{
|
|
|
+ background: #F5F5F5;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.qyImg{
|