ccj 3 vuotta sitten
vanhempi
commit
519b4028e0
1 muutettua tiedostoa jossa 41 lisäystä ja 15 poistoa
  1. 41 15
      common/helper.js

+ 41 - 15
common/helper.js

@@ -94,24 +94,50 @@ const setAudit = (item) => {
 	}
 	console.log(item)
 }
-const contactCustomerService = (item) => {
-	console.log(item)
-	if (!item) {
-		item = '110'
+const contactCustomerService = (phone) => {
+	console.log(phone)
+	if (!phone) {
+		phone = '400123123'
 	}
-	console.log("联系客服")
-	uni.makePhoneCall({
-		phoneNumber: item,
-		success: (res) => {
-			console.log('调用成功!')
+	const res = uni.getSystemInfoSync();
+	// ios系统默认有个模态框
+	if(res.platform=='ios'){
+		uni.makePhoneCall({
+		phoneNumber:phone,
+		success(){
+			console.log('拨打成功了');
 		},
-
-		// 失败回调
-		fail: (res) => {
-			console.log('调用失败!')
-			contactCustomerService(item)
+		fail() {
+			console.log('拨打失败了');
 		}
-	});
+	})
+	}else{
+	//安卓手机手动设置一个showActionSheet
+		uni.showActionSheet({
+			itemList: [phone,'呼叫'],
+			success:function(res){
+				console.log(res);
+			   if(res.tapIndex==1){
+				uni.makePhoneCall({
+				  phoneNumber: phone,
+				})
+			  }
+			}
+		  })
+	}
+	// console.log("联系客服")
+	// uni.makePhoneCall({
+	// 	phoneNumber: item,
+	// 	success: (res) => {
+	// 		console.log('调用成功!')
+	// 	},
+
+	// 	// 失败回调
+	// 	fail: (res) => {
+	// 		console.log('调用失败!')
+	// 		contactCustomerService(item)
+	// 	}
+	// });
 }
 // 获取市、区简称
 const filterUrban = (s) => {