Преглед изворни кода

下单获取地理位置失败弹出提示

gcz пре 1 година
родитељ
комит
44ff897763
2 измењених фајлова са 40 додато и 31 уклоњено
  1. 7 7
      common/config.js
  2. 33 24
      shopping/submitorder.vue

+ 7 - 7
common/config.js

@@ -12,15 +12,15 @@
 // }
 
 //64
-// let baseUrl='https://xusfoodapi.hw.hongweisoft.com/appapi/app';
-// let upFileUrl='http://fileupload.hw.hongweisoft.com/upload/single/minio';
-// // let staticUrl='http://res.hw.hongweisoft.com/xushuo/';
-// let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
+let baseUrl='https://xusfoodapi.hw.hongweisoft.com/appapi/app';
+let upFileUrl='http://fileupload.hw.hongweisoft.com/upload/single/minio';
+// let staticUrl='http://res.hw.hongweisoft.com/xushuo/';
+let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
 
 //正式
-let baseUrl='https://xusapi.gzxsjt.cn/appapi/app';
-let upFileUrl='https://xusapi.gzxsjt.cn/thirdapi/upload/single/minio';
-let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
+// let baseUrl='https://xusapi.gzxsjt.cn/appapi/app';
+// let upFileUrl='https://xusapi.gzxsjt.cn/thirdapi/upload/single/minio';
+// let staticUrl='https://xusapi.gzxsjt.cn/miniores/imgs/app';
 
 const commonConfig = {
 	wxAppid: '', // 测试wxAppid

+ 33 - 24
shopping/submitorder.vue

@@ -419,31 +419,40 @@
 				})
 				console.log('submitOrder param',param);
 				//获取经纬度
-				uni.getLocation({
-					type: 'gcj02',
-					success: (res) => {
-						param.latitude = res.latitude;
-						param.longitude = res.longitude;
-						that.$u.api.submitOrder(param).then(res=>{
-							console.log('res',res.data);
+					uni.getLocation({
+						type: 'gcj02',
+						success: (res) => {
+							param.latitude = res.latitude;
+							param.longitude = res.longitude;
+							that.$u.api.submitOrder(param).then(res=>{
+								console.log('res',res.data);
+								that.cansubmit = true;
+								if(res.data.payAmount>0){
+									uni.$u.route('/shopping/pay', {
+										orderId: res.data.orderId,
+										fromPage:that.fromPage,
+										payAmount:res.data.payAmount
+									});
+								}else{
+									uni.$u.route('/shopping/paysuccess', {
+										fromPage:'nocash'
+									});
+								}
+							}).catch(err=>{
+								that.cansubmit = true;
+								console.log('submitOrder',err);
+							})
+						},
+						fail: (err) => {
+							console.log('getLocationfail',err);
 							that.cansubmit = true;
-							if(res.data.payAmount>0){
-								uni.$u.route('/shopping/pay', {
-									orderId: res.data.orderId,
-									fromPage:that.fromPage,
-									payAmount:res.data.payAmount
-								});
-							}else{
-								uni.$u.route('/shopping/paysuccess', {
-									fromPage:'nocash'
-								});
-							}
-						}).catch(err=>{
-							that.cansubmit = true;
-							console.log('submitOrder',err);
-						})
-					},
-				});
+							uni.$u.toast('请允许获取地理位置,以便更好的服务')
+						},
+						complete(e) {
+							console.log('getLocation complete',e);
+						}
+					});
+				
 			},
 			selectReceiveWay(index){
 				this.selectReceiveIndex = index;