zhangdan 4 years ago
parent
commit
9f1e296516
5 changed files with 107 additions and 71 deletions
  1. 2 2
      App.vue
  2. 8 0
      api/order.js
  3. 6 6
      pages/index/index.vue
  4. 86 63
      pages/index/order.vue
  5. 5 0
      pages/index/yuyueResult.vue

+ 2 - 2
App.vue

@@ -1,6 +1,6 @@
 <script>
-	const uat_domain = 'https://cust.test.sxzxyj.net' // 预发布
-	// const uat_domain = 'http://192.168.16.103:8308' // 本地
+	// const uat_domain = 'https://cust.test.sxzxyj.net' // 预发布
+	const uat_domain = 'http://192.168.16.213:8308' // 本地
 	const pro_domain = 'https://cust.sxzxyj.net' // 生产
 	const uat_URL = uat_domain+'/gc-cust/' // 预发布
 	const pro_URL = pro_domain+'/gc-cust/'  // 生产

+ 8 - 0
api/order.js

@@ -18,3 +18,11 @@ export const cancelOrder = params => {
   })
 }
 
+// 扫码下单
+export const saomaOrder = params => {
+  return axios.request({
+    url: `/customer/reserve/findCustInfo`,
+    method: 'get',
+	data: {}
+  })
+}

+ 6 - 6
pages/index/index.vue

@@ -262,24 +262,24 @@
 			},
 			// 扫码下单
 			gotoSaoMa(){
-				if(this.hasLogin){
+				// if(this.hasLogin){
 					wx.scanCode({
 					  success: (res)=> {
 						  uni.navigateTo({
-						      url: '/pages/index/YY'
+						      url: '/pages/index/order'
 						  })
 					    console.log(res,'----------------res===================')
 					  }
 					})
-				}else{
-					this.loginModal()
-				}
+				// }else{
+				// 	this.loginModal()
+				// }
 			},
 			// 自主下单
 			gotoYueYu(){
 				if(this.hasLogin){
 					uni.navigateTo({
-					    url: '/pages/index/YY'
+					    url: '/pages/index/order'
 					})
 				}else{
 					this.loginModal()

+ 86 - 63
pages/index/order.vue

@@ -13,8 +13,8 @@
 		</view>
 			<view class="content-body">
 				<view class="store-image flex flex_column justify_center align_center">
-					<u-image src="/static/index/def_home_shop.png" width="172" height="172" ></u-image>
-					<text>骑手张三的店铺</text>
+					<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>
 				</view>
 				<!-- 表单 -->
 				<view class="list-container">
@@ -24,7 +24,7 @@
 							<u-image src="/static/billing_icon.png" width="24" height="24" style="margin:0 0 16rpx 10rpx;"></u-image>
 						</view>
 					    <view class="list-item-right flex_1">
-							<u-input class="flex_1" :custom-style="inputClass" v-model="form.contactMobile" placeholder="请输入车牌号码" placeholder-style="color:'#bbb';font-size:18px"/>
+							<u-input class="flex_1" :custom-style="inputClass" v-model="form.mobile" placeholder="请输入联系电话" placeholder-style="color:'#bbb';font-size:18px"/>
 					    </view>
 					</view>
 					<view class="list-item">
@@ -32,7 +32,7 @@
 							<text>通信地址</text>
 						</view>
 					    <view class="list-item-right flex_1">
-							<u-input class="flex_1" :custom-style="inputClass" v-model="form.contactAddress" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
+							<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-icon class="back-img" name="arrow-right" color="#9DA8B5"  @click="selectAddress"></u-icon>
 					    </view>
 					</view>
@@ -41,7 +41,7 @@
 							<text>详细地址</text>
 						</view>
 					    <view class="list-item-right flex_1">
-							<u-input class="flex_1" :custom-style="inputClass"  v-model="form.houseAddress" placeholder="街道,楼牌号等" placeholder-style="color:'#bbb';font-size:18px"/>
+							<u-input class="flex_1" :custom-style="inputClass"  v-model="form.receiveAddress.receiveAddress" placeholder="街道,楼牌号等" placeholder-style="color:'#bbb';font-size:18px"/>
 					    </view>
 					</view>
 				</view>
@@ -111,6 +111,7 @@
 	import {geRubbishType} from '@/api/index'
 	import {userInfoSave} from '@/api/data.js'
 	import { checkLogin } from '@/api/login.js' 
+	import {saomaOrder} from '@/api/order.js'
 	export default{
 		components: {uniNavBar},
 		data(){
@@ -129,18 +130,24 @@
 				rubbishYWList:[],
 				rubbishJSList:[],
 				rubbishPriceList:[],
-				form: {
-					contactMobile: '', //联系人手机
-					contactAddress:'' ,// 通讯地址
-					lat:'', // 通讯地址的经度
-					lng:'', // 通讯地址的纬度
-					houseAddress:'', // 详细地址
+				form:{
+					mobile:'', // 手机号码
+					receiveAddress: {
+					  provinceName: '',//  省
+					  cityName: '',// 市
+					  districtName: '', // 区
+					  receiveAddress: '',// 详细地址
+					  receiveAreasName:'',
+					  lat:'',
+					  lng:''
+					}
 				},
 				area:{},
 				statusBarHeight:0,
 				// toBar:44
 				// statusBarHeight:20,
-				toBarHeight:44
+				toBarHeight:44,
+				pageInfo:{}
 			}
 		},
 		onLoad() {
@@ -166,13 +173,16 @@
 				if(this.hasLogin){
 					this.pageInit()
 				}else{
-					this.noDataText="您尚未登录或登录已过期,完成登录后可进行下单操作!"
+					uni.navigateTo({
+						url:'/pages/login/login'
+					})
 				}
 			})
 		},
 		methods:{
 			pageInit() {
 				this.geRubbishTypeList()
+				this.getSaomaInfo()
 				// this.checkUpdate()
 			},
 			// 返回
@@ -181,7 +191,40 @@
 					
 				})
 			},
-			//截取省市区
+			// 选择通信地址
+			selectAddress(){
+				wx.chooseLocation({
+					success:(res)=>{
+						if(res){
+							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
+							
+						}
+					}
+				})
+			},
+			// 扫码下单
+			getSaomaInfo(){
+				saomaOrder().then(res=>{
+					if(res.status==200){
+						this.pageInfo=res.data
+						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:''
+					}else{
+						uni.showToast({
+							title:res.message,
+							icon:'none'
+						})
+					}
+				})
+			},
 			getArea(str) {
 			    // let area = {}
 			    let index11 = 0
@@ -189,54 +232,37 @@
 			    if (index1 == -1) {
 			      index11 = str.indexOf("自治区")
 			      if (index11 != -1) {
-			        this.area.Province = str.substring(0, index11 + 3)
+			        this.form.receiveAddress.provinceName = str.substring(0, index11 + 3)
 			      } else {
-			        this.area.Province = str.substring(0, 0)
+			        this.form.receiveAddress.provinceName= str.substring(0, 0)
 			      }
 			    } else {
-			      this.area.Province = str.substring(0, index1 + 1)
+			      this.form.receiveAddress.provinceName = str.substring(0, index1 + 1)
 			    }
 			 
 			    let index2 = str.indexOf("市")
 			    if (index11 == -1) {
-			      this.area.City = str.substring(index11 + 1, index2 + 1)
+			      this.form.receiveAddress.cityName = str.substring(index11 + 1, index2 + 1)
 			    } else {
 			      if (index11 == 0) {
-			        this.area.City = str.substring(index1 + 1, index2 + 1)
+			       this.form.receiveAddress.cityName = str.substring(index1 + 1, index2 + 1)
 			      } else {
-			        this.area.City = str.substring(index11 + 3, index2 + 1)
+			        this.form.receiveAddress.cityName = str.substring(index11 + 3, index2 + 1)
 			      }
 			    }
 			 
 			    let index3 = str.lastIndexOf("区")
 			    if (index3 == -1) {
 			      index3 = str.indexOf("县")
-			      this.area.Country = str.substring(index2 + 1, index3 + 1)
+			      this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
 			    } else {
-			      this.area.Country = str.substring(index2 + 1, index3 + 1)
+			      this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
 			    }
 			    // return this.area;
-				if(this.area.Province==''){
-					this.area.Province=this.area.City
+				if(this.form.receiveAddress==''){
+					this.form.receiveAddress.provinceName=this.form.receiveAddress.cityName
 				}
-				console.log(this.area,'---------------省市区')
 			  },
-			// 选择通信地址
-			selectAddress(){
-				wx.chooseLocation({
-					success:(res)=>{
-						if(res){
-							this.getArea(res.address)
-							console.log(res,'------------------地址信息',this.getArea(res.address))
-							// this.form.contactAddress=res.address
-							this.form.lat=res.latitude
-							this.form.lng=res.longitude
-							this.form.contactAddress=this.area.Province+this.area.City+this.area.Country
-							
-						}
-					}
-				})
-			},
 			// 获取垃圾分类
 			geRubbishTypeList(){
 				geRubbishType().then(res=>{
@@ -314,28 +340,25 @@
 			},
 			// 预约
 			submit(){
-				uni.navigateTo({
-					url:'/pages/index/yuyueResult'
+				const testVal=/^1[34578]\d{9}$/
+				if (!testVal.test(this.form.mobile)) {
+					uni.showToast({
+						title: '请输入正确的联系电话',
+						icon: 'none'
+					})
+					return false
+				}
+				const params=Object.assign(this.form)
+				userInfoSave(params).then(res=>{
+					if(res.status==200){
+						// uni.$emit('pageType', {data: 'userInfo' })
+						setTimeout(()=>{
+							uni.navigateTo({
+								url:'/pages/index/yuyueResult'
+							})
+						},300)
+					}
 				})
-				// const testVal=/^1[34578]\d{9}$/
-				// if (!testVal.test(this.form.contactMobile)) {
-				// 	uni.showToast({
-				// 		title: '请输入正确的联系电话',
-				// 		icon: 'none'
-				// 	})
-				// 	return false
-				// }
-				// const params=Object.assign(this.form,{lat:this.form.lat,lng:this.form.lng})
-				// userInfoSave(params).then(res=>{
-				// 	if(res.status==200){
-				// 		uni.$emit('pageType', {data: 'userInfo' })
-				// 		setTimeout(()=>{
-				// 			uni.navigateBack({
-								
-				// 			})
-				// 		},300)
-				// 	}
-				// })
 			},
 			// 未登录弹窗
 			loginModal(){
@@ -368,7 +391,7 @@
 			height: 100vh;
 			display: flex;
 			flex-direction: column;
-			position: absolute;
+			// position: absolute;
 		.content-nav{
 			width: 750upx;
 			height: 396upx ;

+ 5 - 0
pages/index/yuyueResult.vue

@@ -73,6 +73,11 @@
 			// 	this.$refs.openModal.close()
 			// 	this.chooseReason()
 			// },
+			onClickBack(){
+				uni.navigateBack({
+					
+				})
+			},
 			// 查看订单详情
 			checkOrderDetail(){
 				uni.navigateTo({