jufubao-base 1.0.385 → 1.0.387

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,11 +8,11 @@
8
8
  */
9
9
  const getPackagePath = (threePackagePath, packname = 'gxd-commands-bussiness')=>{
10
10
  if(packname === 'gxd-commands-bussiness') {
11
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-commands-bussiness/${threePackagePath}`;
11
+ return `/Users/shiyonggao/home/root/Base-Jufubao/xd-commands-bussiness/${threePackagePath}`;
12
12
  }
13
13
 
14
14
  if (packname === 'gxd-uni-library-editx') {
15
- return `/Users/shiyonggao/Desktop/code/BASE/UNIAPP/xd-uni-library-editx/${threePackagePath}`;
15
+ return `/Users/shiyonggao/home/root/Base-Jufubao/xd-uni-library-editx/${threePackagePath}`;
16
16
  }
17
17
 
18
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jufubao-base",
3
- "version": "1.0.385",
3
+ "version": "1.0.387",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+ /**
3
+ * @description 接口配置,
4
+ * 在设置方法名字当时候,别忘记加上【模块名字】:Delivery
5
+ * @type {*[]}
6
+ */
7
+ module.exports = [
8
+ {
9
+ mapFnName: 'getSameCityTrack',
10
+ title: '订单 - 同城物流轨迹查询',
11
+ path: '/order/v1/logistics/same-city-track',
12
+ isRule: false,
13
+ params: {
14
+ sub_order_id: ['拆单号', 'Number', '必选'],
15
+ channel_code: ['渠道编码', 'String', '可选'],
16
+ channel_order_no: ['渠道订单号', 'Number', '可选'],
17
+ },
18
+ isConsole: true,
19
+ disabled: true,
20
+ },
21
+ {
22
+ mapFnName: "getBaiduNavigationPath",
23
+ path: "/order/v1/logistics/baidu-navigation-path",
24
+ title: "订单 - 百度导航路径查询",
25
+ params: {
26
+ origin_latitude: ["起点纬度", "Number", "必选"],
27
+ origin_longitude: ["起点经度", "Number", "必选"],
28
+ destination_latitude: ["终点纬度", "Number", "必选"],
29
+ destination_longitude: ["终点经度", "Number", "必选"]
30
+ },
31
+ isConsole: true,
32
+ disabled: true
33
+ }
34
+ ];
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description 当表单组件中有联动操作时候,使用方法进行返回
5
+ */
6
+ export default {
7
+ style: [],
8
+ content: (data) => {
9
+ return [
10
+
11
+ ].filter(i=>i)
12
+ },
13
+ advanced: [],
14
+ };
@@ -0,0 +1,472 @@
1
+ <template>
2
+ <view class="cus-delivery-map">
3
+ <!-- #ifdef H5 -->
4
+ <view id="delivery-map-container" class="map-container"></view>
5
+ <!-- #endif -->
6
+
7
+ <!-- #ifndef H5 -->
8
+ <map
9
+ id="deliveryMap"
10
+ class="map-container"
11
+ :latitude="mapCenter.lat"
12
+ :longitude="mapCenter.lng"
13
+ :scale="10"
14
+ :markers="mapMarkers"
15
+ :polyline="mapPolyline"
16
+ :show-location="false"
17
+ :enable-3D="false"
18
+ :show-compass="false"
19
+ :enable-zoom="true"
20
+ :enable-scroll="true"
21
+ :enable-rotate="false"
22
+ ></map>
23
+ <!-- #endif -->
24
+ </view>
25
+ </template>
26
+
27
+ <script>
28
+ // 透明1x1像素图片,用于小程序标记点(实际显示使用 callout)
29
+ const TRANSPARENT_ICON = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=='
30
+
31
+ export default {
32
+ name: 'CusDeliveryMap',
33
+ props: {
34
+ // 收货地址坐标 { lng, lat }
35
+ receivePoint: {
36
+ type: Object,
37
+ default: () => ({ lng: 120.581, lat: 31.299 })
38
+ },
39
+ // 发货地址坐标 { lng, lat }
40
+ sendPoint: {
41
+ type: Object,
42
+ default: () => ({ lng: 121.125, lat: 31.465 })
43
+ },
44
+ // 骑手当前位置 { lng, lat }
45
+ riderPoint: {
46
+ type: Object,
47
+ default: () => ({ lng: 120.928, lat: 31.360 })
48
+ },
49
+ // 已完成的轨迹点数组
50
+ trackItems: {
51
+ type: Array,
52
+ default: () => []
53
+ },
54
+ // 骑手到收货地址的导航路径 [{ latitude, longitude }, ...]
55
+ navigationPath: {
56
+ type: Array,
57
+ default: () => []
58
+ },
59
+ // 百度地图 AK (仅H5使用)
60
+ ak: {
61
+ type: String,
62
+ default: 'btKt57MWjMx2P1ds2OjZIttLOOjR2Ndf'
63
+ }
64
+ },
65
+ data() {
66
+ return {
67
+ map: null,
68
+ isMapLoaded: false,
69
+ overlays: [],
70
+ mapContext: null // 小程序地图上下文
71
+ }
72
+ },
73
+ computed: {
74
+ // 小程序:地图中心点
75
+ mapCenter() {
76
+ // 计算所有点的中心
77
+ const lats = [this.sendPoint.lat, this.riderPoint.lat, this.receivePoint.lat]
78
+ const lngs = [this.sendPoint.lng, this.riderPoint.lng, this.receivePoint.lng]
79
+ return {
80
+ lat: (Math.max(...lats) + Math.min(...lats)) / 2,
81
+ lng: (Math.max(...lngs) + Math.min(...lngs)) / 2
82
+ }
83
+ },
84
+ // 小程序:地图标记点
85
+ mapMarkers() {
86
+ return [
87
+ // 发货地址标记
88
+ {
89
+ id: 1,
90
+ latitude: this.sendPoint.lat,
91
+ longitude: this.sendPoint.lng,
92
+ width: 30,
93
+ height: 30,
94
+ iconPath: TRANSPARENT_ICON,
95
+ callout: {
96
+ content: '发',
97
+ color: '#fff',
98
+ fontSize: 12,
99
+ borderRadius: 15,
100
+ borderWidth: 0,
101
+ bgColor: '#ff8d1a',
102
+ padding: 5,
103
+ display: 'ALWAYS'
104
+ }
105
+ },
106
+ // 骑手位置标记
107
+ {
108
+ id: 2,
109
+ latitude: this.riderPoint.lat,
110
+ longitude: this.riderPoint.lng,
111
+ width: 30,
112
+ height: 30,
113
+ iconPath: TRANSPARENT_ICON,
114
+ callout: {
115
+ content: '🚚',
116
+ fontSize: 16,
117
+ borderRadius: 15,
118
+ borderWidth: 1,
119
+ borderColor: '#ddd',
120
+ bgColor: '#fff',
121
+ padding: 5,
122
+ display: 'ALWAYS'
123
+ }
124
+ },
125
+ // 收货地址标记
126
+ {
127
+ id: 3,
128
+ latitude: this.receivePoint.lat,
129
+ longitude: this.receivePoint.lng,
130
+ width: 30,
131
+ height: 30,
132
+ iconPath: TRANSPARENT_ICON,
133
+ callout: {
134
+ content: '收',
135
+ color: '#fff',
136
+ fontSize: 12,
137
+ borderRadius: 15,
138
+ borderWidth: 0,
139
+ bgColor: '#ff4d4f',
140
+ padding: 5,
141
+ display: 'ALWAYS'
142
+ }
143
+ }
144
+ ]
145
+ },
146
+ // 小程序:路线
147
+ mapPolyline() {
148
+ const lines = []
149
+
150
+ // 已完成的轨迹线(从发货地址到骑手位置)
151
+ if (this.trackItems && this.trackItems.length > 0) {
152
+ const trackPoints = this.trackItems.map(p => ({
153
+ latitude: parseFloat(p.transporter_latitude),
154
+ longitude: parseFloat(p.transporter_longitude)
155
+ }))
156
+ lines.push({
157
+ points: trackPoints,
158
+ color: '#E2412D',
159
+ width: 6,
160
+ arrowLine: true
161
+ })
162
+ }
163
+
164
+ // 从骑手位置到收货地址的导航路径
165
+ if (this.navigationPath && this.navigationPath.length > 0) {
166
+ const navPoints = this.navigationPath.map(p => ({
167
+ latitude: parseFloat(p.latitude),
168
+ longitude: parseFloat(p.longitude)
169
+ }))
170
+ lines.push({
171
+ points: navPoints,
172
+ color: '#F1AEA5',
173
+ width: 6,
174
+ arrowLine: true
175
+ })
176
+ }
177
+
178
+ return lines
179
+ }
180
+ },
181
+ watch: {
182
+ // H5:监听关键数据变化,重新绘制地图
183
+ trackItems: {
184
+ handler() {
185
+ // #ifdef H5
186
+ if (this.isMapLoaded) {
187
+ this.updateMapOverlays()
188
+ }
189
+ // #endif
190
+ // #ifndef H5
191
+ this.fitMapView()
192
+ // #endif
193
+ },
194
+ deep: true
195
+ },
196
+ navigationPath: {
197
+ handler() {
198
+ // #ifdef H5
199
+ if (this.isMapLoaded) {
200
+ this.updateMapOverlays()
201
+ }
202
+ // #endif
203
+ // #ifndef H5
204
+ this.fitMapView()
205
+ // #endif
206
+ },
207
+ deep: true
208
+ },
209
+ riderPoint: {
210
+ handler() {
211
+ // #ifdef H5
212
+ if (this.isMapLoaded) {
213
+ this.updateMapOverlays()
214
+ }
215
+ // #endif
216
+ // #ifndef H5
217
+ this.fitMapView()
218
+ // #endif
219
+ },
220
+ deep: true
221
+ }
222
+ },
223
+ mounted() {
224
+ // #ifdef H5
225
+ this.loadBMapScript(() => {
226
+ this.$nextTick(() => {
227
+ this.initMap()
228
+ })
229
+ })
230
+ // #endif
231
+
232
+ // #ifndef H5
233
+ // 小程序:初始化地图上下文并调整视野
234
+ this.$nextTick(() => {
235
+ this.mapContext = uni.createMapContext('deliveryMap', this)
236
+ // 延迟确保地图渲染完成
237
+ setTimeout(() => {
238
+ this.fitMapView()
239
+ }, 500)
240
+ })
241
+ // #endif
242
+ },
243
+ methods: {
244
+ // ==================== 小程序相关方法 ====================
245
+ // #ifndef H5
246
+
247
+ // 小程序:调整地图视野以包含所有点
248
+ fitMapView() {
249
+ if (!this.mapContext) return
250
+
251
+ const points = [
252
+ { latitude: this.sendPoint.lat, longitude: this.sendPoint.lng },
253
+ { latitude: this.riderPoint.lat, longitude: this.riderPoint.lng },
254
+ { latitude: this.receivePoint.lat, longitude: this.receivePoint.lng }
255
+ ]
256
+
257
+ this.mapContext.includePoints({
258
+ points: points,
259
+ padding: [60, 60, 60, 60]
260
+ })
261
+ },
262
+
263
+ // #endif
264
+
265
+ // ==================== H5 百度地图相关方法 ====================
266
+ // #ifdef H5
267
+
268
+ // 加载百度地图脚本
269
+ loadBMapScript(callback) {
270
+ if (window.BMapGL) {
271
+ callback && callback()
272
+ return
273
+ }
274
+
275
+ window.initBMapGLCallback = () => {
276
+ console.log('百度地图脚本加载完成')
277
+ callback && callback()
278
+ delete window.initBMapGLCallback
279
+ }
280
+
281
+ const script = document.createElement('script')
282
+ script.src = `//api.map.baidu.com/api?type=webgl&v=1.0&ak=${this.ak}&callback=initBMapGLCallback`
283
+ script.onerror = () => {
284
+ console.error('百度地图脚本加载失败')
285
+ }
286
+ document.head.appendChild(script)
287
+ },
288
+
289
+ // 创建 BMapGL.Point 对象
290
+ createPoint(lng, lat) {
291
+ return new BMapGL.Point(lng, lat)
292
+ },
293
+
294
+ // 初始化地图
295
+ initMap() {
296
+ this.map = new BMapGL.Map('delivery-map-container')
297
+ this.map.enableScrollWheelZoom()
298
+ this.isMapLoaded = true
299
+ this.updateMapView()
300
+
301
+ setTimeout(() => {
302
+ this.updateMapOverlays()
303
+ }, 300)
304
+ },
305
+
306
+ // 更新地图视野
307
+ updateMapView() {
308
+ const receivePt = this.createPoint(this.receivePoint.lng, this.receivePoint.lat)
309
+ const sendPt = this.createPoint(this.sendPoint.lng, this.sendPoint.lat)
310
+ const riderPt = this.createPoint(this.riderPoint.lng, this.riderPoint.lat)
311
+
312
+ const points = [sendPt, riderPt, receivePt]
313
+ this.map.setViewport(points, {
314
+ margins: [80, 80, 80, 80]
315
+ })
316
+ },
317
+
318
+ // 清除所有覆盖物
319
+ clearOverlays() {
320
+ this.overlays.forEach(overlay => {
321
+ this.map.removeOverlay(overlay)
322
+ })
323
+ this.overlays = []
324
+ },
325
+
326
+ // 更新地图覆盖物
327
+ updateMapOverlays() {
328
+ this.clearOverlays()
329
+ this.updateMapView()
330
+
331
+ const receivePt = this.createPoint(this.receivePoint.lng, this.receivePoint.lat)
332
+ const sendPt = this.createPoint(this.sendPoint.lng, this.sendPoint.lat)
333
+ const riderPt = this.createPoint(this.riderPoint.lng, this.riderPoint.lat)
334
+
335
+ // 添加收货地址标记
336
+ const receiveMarker = this.createReceiveMarker(receivePt)
337
+ this.map.addOverlay(receiveMarker)
338
+ this.overlays.push(receiveMarker)
339
+
340
+ // 添加发货地址标记
341
+ const sendMarker = this.createSendMarker(sendPt)
342
+ this.map.addOverlay(sendMarker)
343
+ this.overlays.push(sendMarker)
344
+
345
+ // 添加骑手位置标记
346
+ const riderMarker = this.createRiderMarker(riderPt)
347
+ this.map.addOverlay(riderMarker)
348
+ this.overlays.push(riderMarker)
349
+
350
+ // 添加路线
351
+ this.createRouteLines()
352
+ },
353
+
354
+ // 创建收货地址标记
355
+ createReceiveMarker(point) {
356
+ const html = `
357
+ <div class="custom-marker receive-marker" style="display: flex; align-items: center; width: 82px;">
358
+ <div style="background: #fff; border: 1px solid #ff4d4f; border-radius: 10px; font-size: 12px; color: #333; padding-right:4px;">
359
+ <span style="background: #ff4d4f; color: #fff; padding: 1px 6px; border-radius: 10px; margin-right: 4px;">收</span>收货地址
360
+ </div>
361
+ </div>
362
+ `
363
+ return new BMapGL.CustomOverlay(() => {
364
+ const div = document.createElement('div')
365
+ div.innerHTML = html
366
+ return div.firstElementChild
367
+ }, {
368
+ point: point,
369
+ offsetY: -40,
370
+ anchors: [0.5, 1]
371
+ })
372
+ },
373
+
374
+ // 创建发货地址标记
375
+ createSendMarker(point) {
376
+ const html = `
377
+ <div class="custom-marker send-marker" style="width: 30px; height: 30px; background: #ff8d1a; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: bold; box-shadow: 0 2px 6px rgba(0,0,0,0.2); z-index: 10;">
378
+
379
+ </div>
380
+ `
381
+ return new BMapGL.CustomOverlay(() => {
382
+ const div = document.createElement('div')
383
+ div.innerHTML = html
384
+ return div.firstElementChild
385
+ }, {
386
+ point: point,
387
+ offsetY: -15,
388
+ anchors: [0.5, 1]
389
+ })
390
+ },
391
+
392
+ // 创建骑手位置标记
393
+ createRiderMarker(point) {
394
+ const html = `
395
+ <div class="custom-marker rider-marker" style="position: relative; z-index: 20;">
396
+ <div style="width: 30px; height: 30px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,0.15);">
397
+ <span style="font-size: 18px;">🚚</span>
398
+ </div>
399
+ </div>
400
+ `
401
+ return new BMapGL.CustomOverlay(() => {
402
+ const div = document.createElement('div')
403
+ div.innerHTML = html
404
+ return div.firstElementChild
405
+ }, {
406
+ point: point,
407
+ offsetY: -30,
408
+ anchors: [0.5, 1]
409
+ })
410
+ },
411
+
412
+ // 创建路线
413
+ createRouteLines() {
414
+ // 已完成的轨迹线(从发货地址到骑手位置)
415
+ if (this.trackItems && this.trackItems.length > 0) {
416
+ const trackPoints = this.trackItems.map(p => this.createPoint(
417
+ parseFloat(p.transporter_longitude),
418
+ parseFloat(p.transporter_latitude)
419
+ ))
420
+
421
+ const routeToRider = new BMapGL.Polyline(trackPoints, {
422
+ strokeColor: '#E2412D',
423
+ strokeWeight: 6,
424
+ strokeOpacity: 0.8,
425
+ strokeLineCap: 'round',
426
+ strokeLineJoin: 'round'
427
+ })
428
+ this.map.addOverlay(routeToRider)
429
+ this.overlays.push(routeToRider)
430
+ }
431
+
432
+ // 从骑手位置到收货地址的导航路径
433
+ if (this.navigationPath && this.navigationPath.length > 0) {
434
+ const navPoints = this.navigationPath.map(p => this.createPoint(
435
+ parseFloat(p.longitude),
436
+ parseFloat(p.latitude)
437
+ ))
438
+ const navPolyline = new BMapGL.Polyline(navPoints, {
439
+ strokeColor: '#F1AEA5',
440
+ strokeWeight: 6,
441
+ strokeOpacity: 0.8,
442
+ strokeLineCap: 'round',
443
+ strokeLineJoin: 'round'
444
+ })
445
+ this.map.addOverlay(navPolyline)
446
+ this.overlays.push(navPolyline)
447
+ }
448
+ },
449
+
450
+ // #endif
451
+
452
+ // 获取地图实例
453
+ getMap() {
454
+ return this.map
455
+ }
456
+ }
457
+ }
458
+ </script>
459
+
460
+ <style scoped lang="less">
461
+ .cus-delivery-map {
462
+ width: 100%;
463
+ height: 560rpx;
464
+ background-color: #f0f0f0;
465
+ position: relative;
466
+
467
+ .map-container {
468
+ width: 100%;
469
+ height: 100%;
470
+ }
471
+ }
472
+ </style>