ccj преди 3 години
родител
ревизия
1072adfd5d
променени са 3 файла, в които са добавени 39 реда и са изтрити 15 реда
  1. 37 14
      common/helper.js
  2. 1 0
      manifest.json
  3. 1 1
      pages/order/orderDetails.vue

+ 37 - 14
common/helper.js

@@ -92,23 +92,46 @@ 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,
+				success: (res) => {
+					console.log('调用成功!')
+				},
+			  
+				// 失败回调
+				fail: (res) => {
+					console.log('调用失败!')
+					// contactCustomerService(item)
+				}
+				})
+			  }
+			}
+		  })
+	}
 }
 // 获取市、区简称
 const filterUrban = (s) => {

+ 1 - 0
manifest.json

@@ -36,6 +36,7 @@
                     "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
                     "<uses-permission android:name=\"android.permission.BLUETOOTH\"/>",
                     "<uses-permission android:name=\"android.permission.BLUETOOTH_ADMIN\"/>",
+                    "<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
                     "<uses-permission android:name=\"android.permission.CAMERA\"/>",
                     "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
                     "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",

+ 1 - 1
pages/order/orderDetails.vue

@@ -6,7 +6,7 @@
 			<view class='title flex flex-center'>
 				<u-icon class="back" name="arrow-left" color="" size="20" @click="back"></u-icon>
 				<view class="nav-title">订单详情</view>
-				<u-icon class="search" name="server-fill" color="" size="28" @click="$helper.contactCustomerService">
+				<u-icon class="search" name="server-fill" color="" size="28" @click="$helper.contactCustomerService()">
 				</u-icon>
 			</view>
 		</view>