瀏覽代碼

更改 流量卡

2687224328@qq.com 11 月之前
父節點
當前提交
5abef2c70b
共有 2 個文件被更改,包括 105 次插入58 次删除
  1. 72 25
      pages/flowDetails/flowDetails.vue
  2. 33 33
      util/mixin.js

+ 72 - 25
pages/flowDetails/flowDetails.vue

@@ -230,6 +230,8 @@
 
 <script>
 	import wPicker from "@/components/w-picker/w-picker.vue"
+	import http from "@/https/request.js"
+	import { isString } from "util"
 	export default {
 		data() {
 			return {
@@ -279,7 +281,7 @@
 					sms_code:'', //	验证码
 					address: '', //详细地址
 					chanId: '',
-					county: 1480, //城市ID,区县id
+					county: 0, //城市ID,区县id
 					id_no: '', //身份号码,
 					mobile_id: '',
 					name: '', //姓名
@@ -291,7 +293,8 @@
 					open_idcard_back_img:'',
 					open_face_img:'',
 					orderId:'',
-					no:''
+					no:'',
+					platform_type: 'h5',
 				},
 				chanId:''
 
@@ -634,31 +637,67 @@
 			},
 			// 根据经纬度查询城市
 			loAcquire(longitude, latitude) {
-				let this_ = this;
-				this.myAmapFun.reverseGeocoder({
-					location: {
-						latitude: latitude,
-						longitude: longitude
-					},
-					success: function(res) {
-						console.log("解析地址成功");
-						console.log(res);
-						// 根据名称筛选id
-						this_.cityId(res.result.address_component.province, res.result.address_component.city,
-							res.result.address_component.district)
-					},
-					fail: function(res) {
-						uni.showToast({
-							title: '定位失败',
-							duration: 2000,
-							icon: "none"
-						})
-						console.log(res);
-					},
-					complete: function(res) {
-						console.log(res);
+				let this_=this;
+				
+				http('https://restapi.amap.com/v3/geocode/regeo',"GET",{
+					key: "08dceab59cbce678d07e89924e376f53",
+					location: longitude + ',' + latitude,
+					output: "JSON"  
+				})
+				.then(res=>{
+					console.log(res)
+					if(res.statusCode == 200){
+						if(res.data.status == 1){
+							console.log({
+											province:res.data.regeocode.addressComponent.province,
+											city:res.data.regeocode.addressComponent.city,
+											district:res.data.regeocode.addressComponent.district,
+										});
+							let province = res.data.regeocode.addressComponent.province;
+							let city = res.data.regeocode.addressComponent.city;
+							let district = res.data.regeocode.addressComponent.district;
+							if(!isString(city)){
+								city = province;
+							}
+							// uni.setStorage({
+							// 			key: 'address',
+							// 			data: JSON.stringify({
+							// 				district:district,
+							// 				city:city,
+							// 				province:province,
+							// 			})
+							// 		});
+							this_.cityId(province, city, district);
+						}
 					}
+					
 				})
+				
+				// let this_ = this;
+				// this.myAmapFun.reverseGeocoder({
+				// 	location: {
+				// 		latitude: latitude,
+				// 		longitude: longitude
+				// 	},
+				// 	success: function(res) {
+				// 		console.log("解析地址成功");
+				// 		console.log(res);
+				// 		// 根据名称筛选id
+				// 		this_.cityId(res.result.address_component.province, res.result.address_component.city,
+				// 			res.result.address_component.district)
+				// 	},
+				// 	fail: function(res) {
+				// 		uni.showToast({
+				// 			title: '定位失败',
+				// 			duration: 2000,
+				// 			icon: "none"
+				// 		})
+				// 		console.log(res);
+				// 	},
+				// 	complete: function(res) {
+				// 		console.log(res);
+				// 	}
+				// })
 			},
 			// 根据名称筛选id
 			cityId(province, city, district) {
@@ -850,6 +889,13 @@
 					})
 					return;
 				}
+				if (this.form.county == 0) {
+					this.$refs.uToast.show({
+						title: '请选择城市',
+						type: 'error ',
+					})
+					return;
+				}
 				if (this.form.address == '') {
 					this.$refs.uToast.show({
 						title: '请输入地址',
@@ -860,6 +906,7 @@
 				this.applyType = false
 				//#ifdef MP-TOUTIAO
 				this.form.pay_type = 4
+				this.form.platform_type = 'dy_mini'
 				//#endif
 				// 是否是H5支付
 				if (this.mixin_type == 'H5') {

+ 33 - 33
util/mixin.js

@@ -41,40 +41,40 @@ export default {
     // console.log(this.mixin_type)
 
     // 除了H5 小程序需要登录
-    // if(this.mixin_type!='H5'){
-    // 	if(!uni.getStorageSync('token')){
-    // 		this.login_show=true;
-    // 		this.getcode()
-    // 	}else{
-    // 		// 有token 判断是否过期
-    // 		Vue.prototype.$http.userIndex()
-    // 		.then(res=>{
-    // 			if(res.statusCode==401){
-    // 				uni.removeStorageSync('token');
-    // 				uni.showToast({
-    // 					title: '登录失效,请重新进入小程序.',
-    // 					duration: 2000,
-    // 					icon: 'none'
-    // 				});
-    // 				const pages = getCurrentPages()
-    // 				// 声明一个pages使用getCurrentPages方法
-    // 				const curPage = pages[pages.length - 1]
-    // 				// 声明一个当前页面
-    // 				curPage.onLoad(curPage.options) // 传入参数
-    // 				curPage.onShow()
-    // 				curPage.onReady()
-    // 			}
-    // 		})
-    // 	}
-    // 	//快手分享
-    if (this.mixin_type != "TOUTIAO") {
-      ks.showShareMenu({
-        success(res) {
-          // console.log("已成功显示转发按钮", res);
-        },
-      });
+    if(this.mixin_type!='H5'){
+    	if(!uni.getStorageSync('token')){
+    		this.login_show=true;
+    		this.getcode()
+    	}else{
+    		// 有token 判断是否过期
+    		Vue.prototype.$http.userIndex()
+    		.then(res=>{
+    			if(res.statusCode==401){
+    				uni.removeStorageSync('token');
+    				uni.showToast({
+    					title: '登录失效,请重新进入小程序.',
+    					duration: 2000,
+    					icon: 'none'
+    				});
+    				const pages = getCurrentPages()
+    				// 声明一个pages使用getCurrentPages方法
+    				const curPage = pages[pages.length - 1]
+    				// 声明一个当前页面
+    				curPage.onLoad(curPage.options) // 传入参数
+    				curPage.onShow()
+    				curPage.onReady()
+    			}
+    		})
+    	}
+    	//快手分享
+		if (this.mixin_type != "TOUTIAO") {
+		  ks.showShareMenu({
+			success(res) {
+			  // console.log("已成功显示转发按钮", res);
+			},
+		  });
+		}
     }
-    // }
   },
   onLoad(option) {
     // if(option.chanId){