zhangdan há 4 anos atrás
pai
commit
90010a1e47
6 ficheiros alterados com 183 adições e 69 exclusões
  1. 12 3
      api/data.js
  2. 22 3
      api/order.js
  3. 11 10
      pages/index/index.vue
  4. 92 42
      pages/index/order.vue
  5. 8 4
      pages/index/yuyueResult.vue
  6. 38 7
      pages/order/orderDetails.vue

+ 12 - 3
api/data.js

@@ -16,7 +16,7 @@ export const listLookUp = (params) => {
   }).then(res => res)
   }).then(res => res)
 }
 }
 
 
-// 预约保存
+// 用户信息保存
 export const userInfoSave = (params) => {
 export const userInfoSave = (params) => {
   return axios.request({
   return axios.request({
     url: `reserve/user/info/saveMould`,
     url: `reserve/user/info/saveMould`,
@@ -24,8 +24,8 @@ export const userInfoSave = (params) => {
 	data:params
 	data:params
   })
   })
 }
 }
-// 用户信息保存
-export const yuyueInfoSave = (params) => {
+// 预约保存
+export const orderInfoSave = (params) => {
   return axios.request({
   return axios.request({
     url: `reserve/save`,
     url: `reserve/save`,
     method: 'post',
     method: 'post',
@@ -39,4 +39,13 @@ export const userDetail = (params) => {
     url: `reserve/user/info/findNewMould`,
     url: `reserve/user/info/findNewMould`,
     method: 'get',
     method: 'get',
   })
   })
+}
+
+// 查询附近有无骑手可接单
+export const searchRider = (params) => {
+  return axios.request({
+    url: `userExt/queryNearRiderInfo`,
+    method: 'post',
+	data: {}
+  })
 }
 }

+ 22 - 3
api/order.js

@@ -9,7 +9,7 @@ export const getOrderList = params => {
   })
   })
 }
 }
 
 
-// 取消订单 reserve/cancel
+// 取消订单 
 export const cancelOrder = params => {
 export const cancelOrder = params => {
   return axios.request({
   return axios.request({
     url: `reserve/cancel`,
     url: `reserve/cancel`,
@@ -21,8 +21,27 @@ export const cancelOrder = params => {
 // 扫码下单
 // 扫码下单
 export const saomaOrder = params => {
 export const saomaOrder = params => {
   return axios.request({
   return axios.request({
-    url: `/customer/reserve/findCustInfo`,
+    url: `customer/reserve/findCustInfo`,
     method: 'get',
     method: 'get',
 	data: {}
 	data: {}
   })
   })
-}
+}
+
+// 查看订单详情
+export const orderDetail = (params) => {
+  return axios.request({
+    url: `/reserve/findById/${params.id}`,
+    method: 'get',
+	data: {}
+  })
+}
+
+// 查询商铺详情
+// export const shopDetails = (params) => {
+//   const url = `/customer/reserve/findById/${params.id}`
+//   return axios.request({
+//     url: url,
+//     data: {},
+//     method: 'get'
+//   })
+// }

+ 11 - 10
pages/index/index.vue

@@ -6,8 +6,6 @@
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="content-bottom">
 		<view class="content-bottom">
-			<!-- 预约 -->
-			<!-- <u-button :custom-style="yuYueBtn" :hair-line="false" @click="gotoYueYu">一键预约</u-button> -->
 			<!-- 接单信息 -->
 			<!-- 接单信息 -->
 			<view class="bottom-new-notice" v-if="orderStatusText" @click="checkOrderDetail()">
 			<view class="bottom-new-notice" v-if="orderStatusText" @click="checkOrderDetail()">
 				<view class="notice-content">
 				<view class="notice-content">
@@ -124,7 +122,8 @@
 				rubbishSLList:[],
 				rubbishSLList:[],
 				rubbishYWList:[],
 				rubbishYWList:[],
 				rubbishJSList:[],
 				rubbishJSList:[],
-				rubbishPriceList:[]
+				rubbishPriceList:[],
+				orderId:'' // 订单id
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
@@ -172,18 +171,20 @@
 			getOrderStatus(){
 			getOrderStatus(){
 				orderStatus().then(res=>{
 				orderStatus().then(res=>{
 					if(res.status==200){
 					if(res.status==200){
+						console.log(res,'----------订单状态')
+						this.orderId=res.data.id
 						this.itemOrderStatus=res.data.orderStatus
 						this.itemOrderStatus=res.data.orderStatus
 						this.orderStatusText=res.data.orderStatusDictValue
 						this.orderStatusText=res.data.orderStatusDictValue
 						this.orderTime=res.data.reserveDateBegin.substring(0,10)+' '+res.data.reserveTimeTypeDictValue
 						this.orderTime=res.data.reserveDateBegin.substring(0,10)+' '+res.data.reserveTimeTypeDictValue
 						this.finishTime=res.data.finishDate
 						this.finishTime=res.data.finishDate
-						console.log(res,'----------订单状态')
+						console.log(res,this.orderId,'----------订单状态')
 					}
 					}
 				})
 				})
 			},
 			},
 			// 查看订单详情
 			// 查看订单详情
 			checkOrderDetail(){
 			checkOrderDetail(){
 				uni.navigateTo({
 				uni.navigateTo({
-					url:'/pages/order/orderDetails'
+					url:`/pages/order/orderDetails?id=${this.orderId}`
 				})
 				})
 			},
 			},
 			// 获取垃圾分类
 			// 获取垃圾分类
@@ -287,11 +288,11 @@
 				}
 				}
 			},
 			},
 			// 回收指引
 			// 回收指引
-			toZY(){
-				uni.navigateTo({
-				    url: '/pages/index/zhiyin'
-				})
-			},
+			// toZY(){
+			// 	uni.navigateTo({
+			// 	    url: '/pages/index/zhiyin'
+			// 	})
+			// },
 			// 未登录弹窗
 			// 未登录弹窗
 			loginModal(){
 			loginModal(){
 				uni.showModal({
 				uni.showModal({

+ 92 - 42
pages/index/order.vue

@@ -14,7 +14,7 @@
 			<view class="content-body">
 			<view class="content-body">
 				<view class="store-image flex flex_column justify_center align_center">
 				<view class="store-image flex flex_column justify_center align_center">
 					<u-image :src="pageInfo.receiveAddressVO.headerImageList? pageInfo.receiveAddressVO.headerImageList[0]:'/static/index/def_home_shop.png'" width="172" height="172" ></u-image>
 					<u-image :src="pageInfo.receiveAddressVO.headerImageList? pageInfo.receiveAddressVO.headerImageList[0]:'/static/index/def_home_shop.png'" width="172" height="172" ></u-image>
-					<text v-if="pageInfo.userId">骑手张三的店铺</text>
+					<text v-if="isHasRider.haveBindRider && pageInfo.name">{{pageInfo.name}}</text>
 					<text v-else>{{mobile}}</text>
 					<text v-else>{{mobile}}</text>
 				</view>
 				</view>
 				<!-- 表单 -->
 				<!-- 表单 -->
@@ -32,9 +32,8 @@
 						<view class="list-item-left">
 						<view class="list-item-left">
 							<text>通信地址</text>
 							<text>通信地址</text>
 						</view>
 						</view>
-						<!-- {{form.receiveAddress.receiveAreasName}} -->
 					    <view class="list-item-right flex_1">
 					    <view class="list-item-right flex_1">
-							<u-input class="flex_1" :custom-style="inputClass" v-model="form.receiveAddress.receiveAreasName" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
+							<u-input class="flex_1" :custom-style="inputClass" v-model="reverseReceiveAddress.receiveAreasName" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
 							<u-icon class="back-img" name="arrow-right" color="#9DA8B5"  @click="selectAddress"></u-icon>
 							<u-icon class="back-img" name="arrow-right" color="#9DA8B5"  @click="selectAddress"></u-icon>
 					    </view>
 					    </view>
 					</view>
 					</view>
@@ -43,12 +42,18 @@
 							<text>详细地址</text>
 							<text>详细地址</text>
 						</view>
 						</view>
 					    <view class="list-item-right flex_1">
 					    <view class="list-item-right flex_1">
-							<u-input class="flex_1" :custom-style="inputClass"  v-model="form.receiveAddress.receiveAddress" placeholder="街道,楼牌号等" placeholder-style="color:'#bbb';font-size:18px"/>
+							<u-input class="flex_1" :custom-style="inputClass"  v-model="reverseReceiveAddress.receiveAddress" placeholder="街道,楼牌号等" placeholder-style="color:'#bbb';font-size:18px"/>
 					    </view>
 					    </view>
 					</view>
 					</view>
 				</view>
 				</view>
 				<!-- 一键预约 -->
 				<!-- 一键预约 -->
-				<u-button :custom-style="yuYueBtn" :hair-line="false" @click="submit">一键预约</u-button>
+				<view class="flex flex_column justify_center align_center yuyueBtn">
+					<view v-if="!isHasRider.haveBindRider && !isHasRider.haveTempRider" class="title">暂无可上门骑手,不能下单</view>
+					<view class="haveRiderStyle" @click="submit" v-if="isHasRider.haveBindRider || isHasRider.haveTempRider">一键预约</view>
+					<view class="noRiderStyle" v-if="!isHasRider.haveBindRider && !isHasRider.haveTempRider">一键预约</view>
+					<!-- <u-button :custom-style="yuYueBtn" :hair-line="false" >一键预约</u-button> -->
+				</view>
+				
 				<!-- 今日上门回收价格 -->
 				<!-- 今日上门回收价格 -->
 				<view class="statistics-title">今日上门回收价格</view>
 				<view class="statistics-title">今日上门回收价格</view>
 				<view>
 				<view>
@@ -111,7 +116,7 @@
 <script>
 <script>
 	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
 	import uniNavBar from '@/components/uni-nav-bar/uni-nav-bar.vue'
 	import {geRubbishType} from '@/api/index'
 	import {geRubbishType} from '@/api/index'
-	import {userInfoSave} from '@/api/data.js'
+	import {orderInfoSave,searchRider} from '@/api/data.js'
 	import { checkLogin } from '@/api/login.js' 
 	import { checkLogin } from '@/api/login.js' 
 	import {saomaOrder} from '@/api/order.js'
 	import {saomaOrder} from '@/api/order.js'
 	export default{
 	export default{
@@ -119,6 +124,7 @@
 		data(){
 		data(){
 			return{
 			return{
 				yuYueBtn:{
 				yuYueBtn:{
+					width:'100%',
 					background: "#1995FF",
 					background: "#1995FF",
 					borderRadius: "8px",
 					borderRadius: "8px",
 					color:'#fff',
 					color:'#fff',
@@ -134,22 +140,23 @@
 				rubbishPriceList:[],
 				rubbishPriceList:[],
 				form:{
 				form:{
 					mobile:'', // 手机号码
 					mobile:'', // 手机号码
-					receiveAddress: {
-					  provinceName: '',//  省
-					  cityName: '',// 市
-					  districtName: '', // 区
-					  receiveAddress: '',// 详细地址
-					  receiveAreasName:'',
-					  lat:'',
-					  lng:''
-					}
+				},
+				reverseReceiveAddress: {
+				  // provinceName: '',//  省
+				  // cityName: '',// 市
+				  // districtName: '', // 区
+				  receiveAddress: '',// 详细地址
+				  receiveAreasName:'',
+				  lat:'',
+				  lng:''
 				},
 				},
 				area:{},
 				area:{},
 				statusBarHeight:0,
 				statusBarHeight:0,
 				// toBar:44
 				// toBar:44
 				// statusBarHeight:20,
 				// statusBarHeight:20,
 				toBarHeight:44,
 				toBarHeight:44,
-				pageInfo:{}
+				pageInfo:{},
+				isHasRider:{} // 是否有绑定的骑手或3公里有可分配的骑手
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
@@ -194,6 +201,7 @@
 			pageInit() {
 			pageInit() {
 				this.geRubbishTypeList()
 				this.geRubbishTypeList()
 				this.getSaomaInfo()
 				this.getSaomaInfo()
+				this.getHasRider()
 				// this.checkUpdate()
 				// this.checkUpdate()
 			},
 			},
 			// 返回
 			// 返回
@@ -202,18 +210,31 @@
 					url:'/pages/index/index'
 					url:'/pages/index/index'
 				})
 				})
 			},
 			},
+			// 未绑定骑手 校验3公里是否有启用的骑手
+			getHasRider(){
+				searchRider().then(res=>{
+					console.log(res,'==================')
+					if(res.status==200){
+						this.isHasRider=res.data
+					}else{
+						uni.showToast({
+							title:res.message,
+							icon:'none'
+						})
+					}
+					
+				})
+			},
 			// 选择通信地址
 			// 选择通信地址
 			selectAddress(){
 			selectAddress(){
-				console.log(this.form.receiveAddress.receiveAreasName,'==========')
+				// console.log(this.form.receiveAddress.receiveAreasName,'==========')
 				wx.chooseLocation({
 				wx.chooseLocation({
 					success:(res)=>{
 					success:(res)=>{
 						if(res){
 						if(res){
-							console.log(res,res.address,'----------------------')
-							// this.getArea(res.address)
-							// this.form.contactAddress=res.address
-							this.form.receiveAddress.lat=res.latitude
-							this.form.receiveAddress.lng=res.longitude
-							this.form.receiveAddress.receiveAreasName= res.address
+							this.getArea(res.address)
+							this.reverseReceiveAddress.lat=res.latitude
+							this.reverseReceiveAddress.lng=res.longitude
+							this.reverseReceiveAddress.receiveAreasName= res.address
 							
 							
 						}
 						}
 					}
 					}
@@ -223,14 +244,9 @@
 			getSaomaInfo(){
 			getSaomaInfo(){
 				saomaOrder().then(res=>{
 				saomaOrder().then(res=>{
 					if(res.status==200){
 					if(res.status==200){
-						// this.form=Object.assign(this.form,res.data)
 						this.pageInfo=res.data
 						this.pageInfo=res.data
 						this.form.mobile=res.data.mobile
 						this.form.mobile=res.data.mobile
-						this.form.receiveAddress.provinceName=res.data.receiveAddressVO?res.data.receiveAddressVO.provinceName:''
-						this.form.receiveAddress.cityName=res.data.receiveAddressVO?res.data.receiveAddressVO.cityName:''
-						this.form.receiveAddress.districtName=res.data.receiveAddressVO?res.data.receiveAddressVO.districtName:''
-						this.form.receiveAddress.receiveAddress=res.data.receiveAddressVO?res.data.receiveAddressVO.receiveAddress:''
-						this.form.receiveAddress.receiveAreasName=res.data.receiveAddressVO?res.data.receiveAddressVO.receiveAreasName:''
+						this.reverseReceiveAddress=Object.assign(this.reverseReceiveAddress,res.data.reverseReceiveAddress||{})
 					}else{
 					}else{
 						uni.showToast({
 						uni.showToast({
 							title:res.message,
 							title:res.message,
@@ -246,35 +262,35 @@
 			    if (index1 == -1) {
 			    if (index1 == -1) {
 			      index11 = str.indexOf("自治区")
 			      index11 = str.indexOf("自治区")
 			      if (index11 != -1) {
 			      if (index11 != -1) {
-			        this.form.receiveAddress.provinceName = str.substring(0, index11 + 3)
+			        this.reverseReceiveAddress.provinceName = str.substring(0, index11 + 3)
 			      } else {
 			      } else {
-			        this.form.receiveAddress.provinceName= str.substring(0, 0)
+			        this.reverseReceiveAddress.provinceName= str.substring(0, 0)
 			      }
 			      }
 			    } else {
 			    } else {
-			      this.form.receiveAddress.provinceName = str.substring(0, index1 + 1)
+			      this.reverseReceiveAddress.provinceName = str.substring(0, index1 + 1)
 			    }
 			    }
 			 
 			 
 			    let index2 = str.indexOf("市")
 			    let index2 = str.indexOf("市")
 			    if (index11 == -1) {
 			    if (index11 == -1) {
-			      this.form.receiveAddress.cityName = str.substring(index11 + 1, index2 + 1)
+			      this.reverseReceiveAddress.cityName = str.substring(index11 + 1, index2 + 1)
 			    } else {
 			    } else {
 			      if (index11 == 0) {
 			      if (index11 == 0) {
-			       this.form.receiveAddress.cityName = str.substring(index1 + 1, index2 + 1)
+			       this.reverseReceiveAddress.cityName = str.substring(index1 + 1, index2 + 1)
 			      } else {
 			      } else {
-			        this.form.receiveAddress.cityName = str.substring(index11 + 3, index2 + 1)
+			        this.reverseReceiveAddress.cityName = str.substring(index11 + 3, index2 + 1)
 			      }
 			      }
 			    }
 			    }
 			 
 			 
 			    let index3 = str.lastIndexOf("区")
 			    let index3 = str.lastIndexOf("区")
 			    if (index3 == -1) {
 			    if (index3 == -1) {
 			      index3 = str.indexOf("县")
 			      index3 = str.indexOf("县")
-			      this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
+			      this.reverseReceiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
 			    } else {
 			    } else {
-			      this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
+			      this.reverseReceiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
 			    }
 			    }
 			    // return this.area;
 			    // return this.area;
-				if(this.form.receiveAddress==''){
-					this.form.receiveAddress.provinceName=this.form.receiveAddress.cityName
+				if(this.reverseReceiveAddress.provinceName==''){
+					this.reverseReceiveAddress.provinceName=this.reverseReceiveAddress.cityName
 				}
 				}
 			  },
 			  },
 			// 获取垃圾分类
 			// 获取垃圾分类
@@ -362,12 +378,18 @@
 					})
 					})
 					return false
 					return false
 				}
 				}
-				userInfoSave(this.form).then(res=>{
+				const params=this.form
+				params.contactMobile=this.form.mobile?this.form.mobile:''
+				params.contactAddress=this.reverseReceiveAddress.receiveAreasName?this.reverseReceiveAddress.receiveAreasName:''
+				params.houseAddress=this.reverseReceiveAddress.receiveAddress?this.reverseReceiveAddress.receiveAddress:''
+				params.lat=this.reverseReceiveAddress.lat?this.reverseReceiveAddress.lat:''
+				params.lng=this.reverseReceiveAddress.lng?this.reverseReceiveAddress.lng:''
+				orderInfoSave(params).then(res=>{
 					if(res.status==200){
 					if(res.status==200){
-						// uni.$emit('pageType', {data: 'userInfo' })
+						const id=res.data?res.data.id:''
 						setTimeout(()=>{
 						setTimeout(()=>{
 							uni.navigateTo({
 							uni.navigateTo({
-								url:'/pages/index/yuyueResult'
+								url:`/pages/index/yuyueResult?id=${id}`
 							})
 							})
 						},300)
 						},300)
 					}
 					}
@@ -506,6 +528,34 @@
 					border-bottom: none;
 					border-bottom: none;
 				}
 				}
 			}
 			}
+			.yuyueBtn{
+				width: 100%;
+				.title{
+					color: red;
+					margin-bottom: 15rpx;
+				}
+				.haveRiderStyle{
+					width: 100%;
+					background: #1995FF;
+					height: 84rpx;
+					border-radius: 16rpx;
+					color:#fff;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+				}
+				.noRiderStyle{
+					width: 100%;
+					height: 84rpx;
+					background: rgba(25, 149, 255, 0.6);
+					color:#fff;
+					font-weight: 500;
+					border-radius: 16rpx;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+				}
+			}
 			.statistics-title{
 			.statistics-title{
 				font-size: 36upx;
 				font-size: 36upx;
 				font-family: PingFang SC;
 				font-family: PingFang SC;

+ 8 - 4
pages/index/yuyueResult.vue

@@ -45,11 +45,15 @@
 		data(){
 		data(){
 			return{
 			return{
 				statusBarHeight:0,
 				statusBarHeight:0,
-				toBarHeight:44
-				
+				toBarHeight:44,
+				orderId:''
 			}
 			}
 		},
 		},
-		onLoad() {
+		onLoad(query) {
+			console.log(query,query.id,'================订单id')
+			if(query){
+				this.orderId=query.id
+			}
 			wx.getSystemInfo({success: (res)=>{
 			wx.getSystemInfo({success: (res)=>{
 				if(res.statusBarHeight){
 				if(res.statusBarHeight){
 					console.log(res.statusBarHeight,'--------res.statusBarHeight')
 					console.log(res.statusBarHeight,'--------res.statusBarHeight')
@@ -81,7 +85,7 @@
 			// 查看订单详情
 			// 查看订单详情
 			checkOrderDetail(){
 			checkOrderDetail(){
 				uni.navigateTo({
 				uni.navigateTo({
-					url:'/pages/order/orderDetails'
+					url:`/pages/order/orderDetails?id=${this.orderId}`
 				})
 				})
 			},
 			},
 			// 取消订单
 			// 取消订单

+ 38 - 7
pages/order/orderDetails.vue

@@ -2,30 +2,30 @@
 	<view class="content-orderDetails">
 	<view class="content-orderDetails">
 		<view class="flex justify_center align_center order-states">
 		<view class="flex justify_center align_center order-states">
 			<u-image src="/static/order/prescription_order_icon_pay.png" width="48" height="48"></u-image>
 			<u-image src="/static/order/prescription_order_icon_pay.png" width="48" height="48"></u-image>
-			<text>已完成</text>
+			<text>{{pageInfo.orderStatusDictValue||''}}</text>
 		</view>
 		</view>
-		<view class="flex justify_center order-time">下单时间:2020-12-12 02:02:23</view>
+		<view class="flex justify_center order-time">下单时间:{{pageInfo.createDate||'--'}}</view>
 		<view class="order-info">
 		<view class="order-info">
 			<view class="flex justify_between item">
 			<view class="flex justify_between item">
 				<text>店铺名称</text>
 				<text>店铺名称</text>
-				<text>华帝金座(菜鸟驿站)</text>
+				<text>{{pageInfo.customerName||'--'}}</text>
 			</view>
 			</view>
 			<view class="flex justify_between item">
 			<view class="flex justify_between item">
 				<text>订单编号</text>
 				<text>订单编号</text>
-				<text>20202020202020</text>
+				<text>{{pageInfo.orderReserveNo|| '--'}}</text>
 			</view>
 			</view>
 			<view class="flex justify_between item">
 			<view class="flex justify_between item">
 				<text>服务骑手</text>
 				<text>服务骑手</text>
-				<text>张三</text>
+				<text>{{pageInfo.name||'--'}}</text>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="order-info">
 		<view class="order-info">
 			<view class="flex justify_between item">
 			<view class="flex justify_between item">
 				<text>下单用户</text>
 				<text>下单用户</text>
-				<text>18292887584</text>
+				<text>{{pageInfo.contactMobile||'--'}}</text>
 			</view>
 			</view>
 		</view>
 		</view>
-		<view class="order-info">
+		<view class="order-info" v-if="pageInfo.orderStatus=='FINISH'">
 			<view class="flex flex_column item type">
 			<view class="flex flex_column item type">
 				<view>回收品类明细</view>
 				<view>回收品类明细</view>
 				<view></view>
 				<view></view>
@@ -47,6 +47,37 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import {orderDetail}from '@/api/order.js'
+	export default{
+		data(){
+			return{
+				pageInfo:null,
+				orderId:''  // 订单id
+			}
+		},
+		onLoad(query) {
+			console.log(query,query.id,'============订单')
+			if(query){
+				this.orderId=query.id
+				this.getPageInfo()
+			}
+		},
+		methods:{
+			getPageInfo(){
+				orderDetail({id:this.orderId}).then(res=>{
+					console.log(res,'============订单详情')
+					if(res.status==200){
+						this.pageInfo=res.data
+					}else{
+						uni.showToast({
+							title:res.message,
+							icon:'none'
+						})
+					}
+				})
+			}
+		}
+	}
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">