ソースを参照

整改基本完成

Huanyi 1 週間 前
コミット
e6f596c56d
3 ファイル変更32 行追加28 行削除
  1. 2 2
      manifest.json
  2. 28 24
      pages/orders/index.vue
  3. 2 2
      utils/config.js

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "履约守护",
     "appid" : "__UNI__76F5C47",
     "description" : "履约端",
-    "versionName" : "1.1.3",
-    "versionCode" : 14,
+    "versionName" : "1.2.0t",
+    "versionCode" : 16,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 28 - 24
pages/orders/index.vue

@@ -236,7 +236,7 @@
                         <text class="pm-log-date">{{ log.date }}</text>
                         <text class="pm-log-text">{{ log.content }}</text>
                         <text class="pm-log-recorder">{{ log.recorder === '系统记录' ? '' : '记录人: ' }}{{ log.recorder
-                            }}</text>
+                        }}</text>
                     </view>
                 </view>
                 <view style="height: 30rpx;"></view>
@@ -332,7 +332,7 @@
                             <view class="appeal-time-row">
                                 <text class="appeal-time">提交:{{ formatTime(record.createTime) }}</text>
                                 <text class="appeal-time" v-if="record.auditTime">审核:{{ formatTime(record.auditTime)
-                                    }}</text>
+                                }}</text>
                             </view>
                         </view>
                     </view>
@@ -564,7 +564,6 @@ export default {
         chooseMap(mapType) {
             let item = this.navTargetItem;
             let pointType = this.navTargetPointType;
-            // 起 -> fromAddress ; 终 -> toAddress
             let name = pointType === 'start' ? (item.fromAddress || '起点') : (item.toAddress || '终点');
             let address = pointType === 'start' ? (item.fromAddress || '起点地址') : (item.toAddress || '终点地址');
             let latitude = pointType === 'start' ? Number(item.fromLat) : Number(item.toLat);
@@ -572,37 +571,42 @@ export default {
 
             this.showNavModal = false;
 
-            // 统一定义打开地图的函数
-            const navigateTo = (lat, lng, addrName, addrDesc) => {
-                uni.openLocation({
-                    latitude: lat,
-                    longitude: lng,
-                    name: addrName,
-                    address: addrDesc || '无法获取详细地址',
-                    success: function () {
-                        console.log('打开导航成功: ' + mapType);
-                    },
-                    fail: function (err) {
-                        console.error('打开导航失败:', err);
-                        uni.showToast({ title: '打开地图失败', icon: 'none' });
-                    }
+            const openApp = (lat, lng, addrName, addrDesc) => {
+                let url = '';
+                // #ifdef APP-PLUS
+                if (mapType === '高德') {
+                    url = `androidamap://viewMap?sourceApplication=yingpaipay&poiname=${encodeURIComponent(addrName)}&lat=${lat}&lon=${lng}&dev=0`;
+                } else if (mapType === '腾讯') {
+                    url = `qqmap://map/marker?marker=coord:${lat},${lng};title:${encodeURIComponent(addrName)};addr:${encodeURIComponent(addrDesc)}&referer=yingpaipay`;
+                } else if (mapType === '百度') {
+                    url = `baidumap://map/marker?location=${lat},${lng}&title=${encodeURIComponent(addrName)}&content=${encodeURIComponent(addrDesc)}&src=yingpaipay`;
+                }
+                plus.runtime.openURL(url, (e) => {
+                    console.error('打开' + mapType + '地图失败:', e);
                 });
+                // #endif
+                // #ifdef H5
+                if (mapType === '高德') {
+                    url = `https://uri.amap.com/marker?position=${lng},${lat}&name=${encodeURIComponent(addrName)}`;
+                } else if (mapType === '腾讯') {
+                    url = `https://apis.map.qq.com/uri/v1/marker?marker=coord:${lat},${lng};title:${encodeURIComponent(addrName)}&referer=yingpaipay`;
+                } else if (mapType === '百度') {
+                    url = `https://api.map.baidu.com/marker?location=${lat},${lng}&title=${encodeURIComponent(addrName)}&content=${encodeURIComponent(addrDesc)}&output=html&src=yingpaipay`;
+                }
+                window.open(url, '_blank');
+                // #endif
             };
 
-            // 如果有目标经纬度,直接打开
             if (latitude && longitude && !isNaN(latitude) && !isNaN(longitude)) {
-                navigateTo(latitude, longitude, name, address);
+                openApp(latitude, longitude, name, address);
             } else {
-                // 如果没有经纬度,按照需求:使用自己当前的经纬度,然后搜索 fromAddress 或者 toAddress
                 uni.showLoading({ title: '获取当前位置...', mask: true });
                 reportGps(true).then(res => {
                     uni.hideLoading();
-                    // 使用用户当前经纬度作为锚点打开地图,展示目标地址信息
-                    navigateTo(res.latitude, res.longitude, name, address);
+                    openApp(res.latitude, res.longitude, name, address);
                 }).catch(err => {
                     uni.hideLoading();
                     console.error('获取地理位置失败:', err);
-                    // 具体的授权引导已在 reportGps 内部处理
                 });
             }
         },
@@ -892,7 +896,7 @@ export default {
                     orderId: this.currentOrder.id,
                     reason: this.cancelReason
                 });
-                uni.showToast({ title: '订单已取消', icon: 'success' });
+                uni.showToast({ title: '已取消接单', icon: 'success' });
                 this.showCancelModal = false;
                 this.currentOrder = null;
                 // 延时刷新列表,防止提示框闪现

+ 2 - 2
utils/config.js

@@ -6,8 +6,8 @@
 // API 基础地址(开发环境)
 // export const BASE_URL = 'http://192.168.1.118:8080'
 // export const BASE_URL = 'http://192.168.1.205:8080'
-export const BASE_URL = 'http://www.hoomeng.pet/api'
-// export const BASE_URL = 'http://111.228.46.254/api'
+// export const BASE_URL = 'http://www.hoomeng.pet/api'
+export const BASE_URL = 'http://111.228.46.254/api'
 
 // 履约者App客户端ID(需要在 sys_client 表中配置)
 export const CLIENT_ID = 'fe63fea7be31b0200b496d08bc6b517d'