dolphin-weex-bc 0.0.37 → 0.0.39

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.
@@ -0,0 +1,645 @@
1
+ <template>
2
+ <dof-popup
3
+ :show="showAddCartInsidePopup"
4
+ @dofPopupOverlayClicked="handleAddCartClose"
5
+ :height="980"
6
+ pos="bottom"
7
+ :popupColor="isDiablo ? '#1e2326' : ''"
8
+ >
9
+ <div class="content-add-card">
10
+ <div class="add-card-title-box">
11
+ <text :class="['add-card-title', isDiablo && 'add-card-title-isDiablo']">耗材购买</text>
12
+ <image
13
+ class="add-card-close"
14
+ :src="isDiablo ? './assets/img/material/close_diablo@3x.png' : './assets/img/material/close@3x.png'"
15
+ @click="handleAddCartClose"
16
+ ></image>
17
+ </div>
18
+ <div class="filter-box">
19
+ <text :class="['filter-all', !filterInsufficientGoodinfo && 'filter-hit']" @click="filterShopInfo(1)"
20
+ >全部</text
21
+ >
22
+ <text :class="['filter-insufficient', filterInsufficientGoodinfo && 'filter-hit']" @click="filterShopInfo(2)"
23
+ >耗材不足</text
24
+ >
25
+ </div>
26
+ <scroller class="add-card-scroller" show-scrollbar="false" scroll-direction="vertical">
27
+ <div class="detail-wrapper" :style="{ marginBottom: '16px' }" v-if="goodinfoList.length > 0">
28
+ <div
29
+ :class="['shop-card', isDiablo && 'shop-card-isDiablo']"
30
+ v-for="(item, index) in goodinfoList"
31
+ :key="index"
32
+ >
33
+ <div :class="['card-content', isDiablo && 'card-content-isDiablo']" @click="showGoodsDetail(item)">
34
+ <image :class="['img-shop', isDiablo && 'img-shop-isDiablo']" :src="item.picInfo"></image>
35
+ <div class="shop-info">
36
+ <div class="shop-title">
37
+ <text :class="['shop-title-txt', isDiablo && 'shop-title-txt-isDiablo']">{{ item.title }}</text>
38
+ </div>
39
+ <text :class="['description-txt', isDiablo && 'description-txt-isDiablo']">{{
40
+ item.sellingPoints != 'N/A' && item.sellingPoints != '/' ? item.sellingPoints : ''
41
+ }}</text>
42
+ <!-- <text :class="['description-txt', isDiablo && 'description-txt-isDiablo']"
43
+ >x{{ repeatProductCodesCount[item.itemCode] }}</text
44
+ > -->
45
+ <!-- <div class="price-box">
46
+ <text :class="['rmb-1', isDiablo && 'rmb-1-isDiablo']">¥</text><text :class="['pblic-price', isDiablo && 'pblic-price-isDiablo']">199</text>
47
+ <text :class="['rmb-2', isDiablo && 'rmb-2-isDiablo']">¥</text><text :class="['discount-price', isDiablo && 'discount-price-isDiablo']">99.5</text>
48
+ <image src="./assets/img/material/mei_price@3x.png" class="discount-img" style="width:70px; height:28px;"></image>
49
+ </div> -->
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="no-data-steper" v-else>
56
+ <image class="no-data-img-steper" :src="detailNoData"></image>
57
+ <text class="no-data-txt">暂无设备耗材</text>
58
+ </div>
59
+ </scroller>
60
+ <dof-button
61
+ v-if="goodinfoList.length > 0"
62
+ pattern="base"
63
+ text="加入购物车"
64
+ size="full"
65
+ :btnStyle="{ backgroundColor: isDiablo ? '#0490D3' : '#00A4F2', height: '92px', 'margin-top': '12px' }"
66
+ :textStyle="{ color: isDiablo ? '#CFCFD0' : '#fff', 'font-size': '32px' }"
67
+ :isHighlight="false"
68
+ @dofButtonClicked="addCartThrottle"
69
+ ></dof-button>
70
+ </div>
71
+ </dof-popup>
72
+ </template>
73
+
74
+ <script>
75
+ // import nativeService from '../settings/nativeService'
76
+ import utils from './settings/utils'
77
+ const bridgeModule = weex.requireModule('bridgeModule')
78
+ import { throttle } from 'lodash'
79
+ import Icon from './settings/icon.base64'
80
+ const mlModule = weex.requireModule('MallModule')
81
+ import { DofPopup, DofButton } from 'dolphin-weex-ui'
82
+ export default {
83
+ components: {
84
+ DofPopup,
85
+ DofButton
86
+ },
87
+ props: {
88
+ showAddCartPopup: {
89
+ //加购弹窗展示与否
90
+ type: Boolean,
91
+ default: false
92
+ },
93
+ insufficientGoodinfoList: {
94
+ //不足耗材商品数据
95
+ type: Object,
96
+ default: () => {
97
+ return []
98
+ }
99
+ },
100
+ repeatProductCodesCount: {
101
+ //不足耗材商品code件数
102
+ type: Object,
103
+ default: () => {
104
+ return {}
105
+ }
106
+ },
107
+ insufficientProductCodeJson: {
108
+ //是否是不足耗材商品
109
+ type: Object,
110
+ default: () => {
111
+ return {}
112
+ }
113
+ },
114
+ isDiablo: {
115
+ type: Boolean,
116
+ default: false
117
+ },
118
+ channel: {
119
+ //来源----用于埋点等定制化需求
120
+ type: String,
121
+ default: 'materialList'
122
+ }
123
+ },
124
+ data() {
125
+ return {
126
+ showAddCartInsidePopup: false,
127
+ goodinfoList: [],
128
+ detailNoData: Icon.detail_no_data,
129
+ filterInsufficientGoodinfo: true
130
+ }
131
+ },
132
+ watch: {
133
+ showAddCartPopup: {
134
+ handler(val) {
135
+ this.showAddCartInsidePopup = val
136
+ }
137
+ },
138
+ showAddCartInsidePopup: {
139
+ handler(val) {
140
+ if (!val) {
141
+ this.$emit('cancleShowAddCartPopup')
142
+ }
143
+ }
144
+ },
145
+ insufficientGoodinfoList: {
146
+ handler(val) {
147
+ if (val) {
148
+ if (this.filterInsufficientGoodinfo) {
149
+ this.goodinfoList = this.insufficientGoodinfoList.filter(
150
+ item => this.insufficientProductCodeJson[item.itemCode]
151
+ )
152
+ } else {
153
+ this.goodinfoList = val
154
+ }
155
+ }
156
+ },
157
+ immediate: true
158
+ }
159
+ },
160
+
161
+ methods: {
162
+ filterShopInfo(index) {
163
+ if (index == 1) {
164
+ this.goodinfoList = this.insufficientGoodinfoList
165
+ this.filterInsufficientGoodinfo = false
166
+ } else {
167
+ this.goodinfoList = this.insufficientGoodinfoList.filter(
168
+ item => this.insufficientProductCodeJson[item.itemCode]
169
+ )
170
+ this.filterInsufficientGoodinfo = true
171
+ }
172
+
173
+ let trackParam = {
174
+ event: 'user_behavior_event',
175
+ eventParams: {
176
+ page_name: '耗材购买弹窗',
177
+ page_id: 'consumables_purchase_pop-up',
178
+ event_name: 'user_behavior_event',
179
+ module: '插件耗材组件',
180
+ widget_name: index == 1 ? '筛选全部耗材' : '筛选不足耗材',
181
+ widget_id: index == 1 ? 'filter_all_consumables' : 'filter_shortage_consumables',
182
+ }
183
+ }
184
+ this.$bridge.trackEvent(trackParam)
185
+ },
186
+
187
+ showGoodsDetail(item){
188
+ this.$bridge.goToPage({
189
+ type: 'jumpElecBusinessWeexNew',
190
+ param: {
191
+ url: '/dist/v2/pages/product/product_details.js?skuId=' + item.skuId + '&entrance=consumables',
192
+ needNavi: '1'
193
+ }
194
+ })
195
+ },
196
+
197
+ addCartThrottle: throttle(
198
+ function() {
199
+ this.handleAddCart()
200
+ },
201
+ 2000,
202
+ { leading: true, trailing: false }
203
+ ),
204
+
205
+ async handleAddCart() {
206
+ bridgeModule.showLoading()
207
+ const itemCodeList = this.goodinfoList.map(item => item.itemCode)
208
+ let productList = []
209
+ console.log('paramsitemCodeList' + JSON.stringify(itemCodeList))
210
+ try {
211
+ //根据itemCode查询SkuId
212
+ // const res = await this.querySkuIdByItemCodes(itemCodeList)
213
+
214
+ // if(res.code == '000000'){
215
+ // //只要有失败的就显示加购失败
216
+ // if(res.failedMap && JSON.stringify(obj) !== '{}'){
217
+ // this.$bridge.showToast('加购失败')
218
+ // return
219
+ // }
220
+ // if(res.data && res.data.successMap){
221
+ // for(let k in res.data.successMap){
222
+ // productList.push({
223
+ // skuId: res.data.successMap[k].skuId,
224
+ // productQty: this.repeatProductCodesCount[k]
225
+ // })
226
+ // }
227
+ // }
228
+ // }
229
+ this.goodinfoList.forEach(item => {
230
+ productList.push({
231
+ skuId: item.skuId,
232
+ productQty: this.repeatProductCodesCount[item.itemCode]
233
+ })
234
+ })
235
+
236
+ console.log('productList列表:' + JSON.stringify(productList))
237
+ if (productList.length > 0) {
238
+ const ucAccessToken = await this.getUcAccessToken()
239
+ console.log('获取ucAccessToken:' + ucAccessToken)
240
+
241
+ //批量保存购物车
242
+ const batchSaveRes = await utils.sendMideaCloundSaleRequest(
243
+ utils.serviceList.shopCartBatchSave,
244
+ {
245
+ headParams: {
246
+ userKey: ucAccessToken
247
+ },
248
+ restParams: {
249
+ productList
250
+ }
251
+ },
252
+ {
253
+ isShowLoading: false
254
+ }
255
+ )
256
+
257
+ if (batchSaveRes && batchSaveRes.code !== '000000') {
258
+ this.$bridge.showToast('加购失败')
259
+ return
260
+ }
261
+ const { data = [] } = batchSaveRes
262
+ if (!batchSaveRes.data || !batchSaveRes.data.length) {
263
+ this.$bridge.showToast('加购失败')
264
+ return
265
+ }
266
+ // if( data.length != productList.length){
267
+ // //只要有失败的就显示加购失败并且移除已加入购物车的商品
268
+ // this.$bridge.showToast('加购失败')
269
+ // this.shopCartBatchRemove(data)
270
+ // return
271
+ // }
272
+ this.$bridge.showToast('已加入购物车')
273
+ this.$bridge.goToPage({
274
+ type: 'jumpElecBusinessWeexNew',
275
+ param: {
276
+ url: '/dist/v2/pages/cart/cart_page.js?entrance=consumables',
277
+ needNavi: '1'
278
+ }
279
+ })
280
+ } else {
281
+ this.$bridge.showToast('加购失败')
282
+ }
283
+ } catch (error) {
284
+ this.$bridge.showToast('加购失败')
285
+ console.log('获取商品id失败:' + JSON.stringify(error))
286
+ } finally {
287
+ this.showAddCartInsidePopup = false
288
+ bridgeModule.hideLoading()
289
+ let trackParam = {
290
+ event: 'user_behavior_event',
291
+ eventParams: {
292
+ page_name: '耗材列表',
293
+ page_id: 'consumables_list',
294
+ event_name: 'user_behavior_event',
295
+ module: '耗材管理',
296
+ widget_name: '加入购物车点击',
297
+ widget_id: 'consumables_allbuy_cart_click'
298
+ }
299
+ }
300
+ this.$bridge.trackEvent(trackParam)
301
+ }
302
+ },
303
+
304
+ async shopCartBatchRemove(data) {
305
+ const ucAccessToken = await this.getUcAccessToken()
306
+ return new Promise(async (resolve, reject) => {
307
+ try {
308
+ const res = await utils.sendMideaCloundSaleRequest(
309
+ utils.serviceList.shopCartBatchRemove,
310
+ {
311
+ headParams: {
312
+ userKey: ucAccessToken
313
+ },
314
+ restParams: {
315
+ ids: data.map(item => item.id)
316
+ }
317
+ },
318
+ {
319
+ isShowLoading: false
320
+ }
321
+ )
322
+ console.log('删除加购的商品成功' + JSON.stringify(res))
323
+ resolve(res)
324
+ } catch (error) {
325
+ reject(error)
326
+ }
327
+ })
328
+ },
329
+
330
+ getUcAccessToken() {
331
+ return new Promise(async (resolve, reject) => {
332
+ let ucAccessTokenTemp = 'ucAccessToken'
333
+ if (weex.config.env.platform == 'android') {
334
+ // 兼容android cookie匹配逻辑,后续android上线后去掉这段代码
335
+ ucAccessTokenTemp = 'ucAccessToken='
336
+ }
337
+ mlModule.getCookie(ucAccessTokenTemp, async ucAccessToken => {
338
+ resolve(ucAccessToken)
339
+ })
340
+ })
341
+ },
342
+
343
+ async querySkuIdByItemCodes(itemCodeList) {
344
+ return new Promise(async (resolve, reject) => {
345
+ try {
346
+ const res = await utils.sendMideaCloundSaleRequest(
347
+ utils.serviceList.querySkuIdByItemCodes,
348
+ {
349
+ restParams: {
350
+ itemCodeList: [...new Set(itemCodeList)]
351
+ }
352
+ },
353
+ {
354
+ isShowLoading: false
355
+ }
356
+ )
357
+ console.log('获取商品id成功:' + JSON.stringify(res))
358
+ resolve(res)
359
+ } catch (error) {
360
+ reject(error)
361
+ }
362
+ })
363
+ },
364
+
365
+ handleAddCartClose() {
366
+ if (!this.showAddCartInsidePopup) return
367
+ this.showAddCartInsidePopup = false
368
+ }
369
+ }
370
+ }
371
+ </script>
372
+
373
+ <style>
374
+ .content-add-card {
375
+ padding: 40px 32px 36px;
376
+ }
377
+
378
+ .add-card-title-box {
379
+ justify-content: center;
380
+ flex-direction: row;
381
+ align-items: center;
382
+ margin-bottom: 54px;
383
+ position: relative;
384
+ }
385
+
386
+ .add-card-title {
387
+ font-size: 32px;
388
+ color: #1e2e37;
389
+ font-weight: 500;
390
+ }
391
+
392
+ .add-card-close {
393
+ width: 32px;
394
+ height: 32px;
395
+ position: absolute;
396
+ top: 0;
397
+ right: 0;
398
+ }
399
+
400
+ .filter-box {
401
+ flex-direction: row;
402
+ margin-bottom: 34px;
403
+ }
404
+
405
+ .filter-all {
406
+ width: 108px;
407
+ height: 52px;
408
+ line-height: 52px;
409
+ margin-right: 40px;
410
+ background-color: #f6f7f9;
411
+ font-size: 24px;
412
+ color: #8e969b;
413
+ text-align: center;
414
+ border-radius: 26px;
415
+ }
416
+
417
+ .filter-insufficient {
418
+ width: 156px;
419
+ height: 52px;
420
+ line-height: 52px;
421
+ background-color: #f6f7f9;
422
+ text-align: center;
423
+ color: #8e969b;
424
+ font-size: 24px;
425
+ font-weight: 500;
426
+ border-radius: 26px;
427
+ }
428
+
429
+ .filter-hit {
430
+ background-color: #1e2e37;
431
+ font-weight: 500;
432
+ color: #ffffff;
433
+ }
434
+
435
+ .add-card-scroller {
436
+ height: 546px;
437
+ }
438
+
439
+ .detail-wrapper {
440
+ width: 686px;
441
+ display: flex;
442
+ align-items: center;
443
+ position: relative;
444
+ z-index: 100;
445
+ }
446
+ .shop-card {
447
+ width: 686px;
448
+ /* height: 370px; */
449
+ background-color: #fff;
450
+ border-radius: 32px;
451
+ margin-bottom: 16px;
452
+ box-sizing: border-box;
453
+ position: relative;
454
+ }
455
+ .corner-mark {
456
+ position: absolute;
457
+ left: 0;
458
+ top: 0;
459
+ }
460
+
461
+ .card-content {
462
+ padding: 28px;
463
+ /* flex: 1; */
464
+ box-sizing: border-box;
465
+ display: flex;
466
+ flex-direction: row;
467
+ background: #f6f7f9;
468
+ border-radius: 32px;
469
+ align-items: center;
470
+ }
471
+ .img-shop {
472
+ width: 144px;
473
+ height: 144px;
474
+ margin-right: 28px;
475
+ border-radius: 10px;
476
+ }
477
+ .shop-info {
478
+ flex: 1;
479
+ display: flex;
480
+ flex-direction: column;
481
+ }
482
+ .shop-title {
483
+ margin-bottom: 16px;
484
+ flex-wrap: wrap;
485
+ display: flex;
486
+ flex-direction: row;
487
+ }
488
+ .mark-txt {
489
+ }
490
+ .shop-title-txt {
491
+ flex: 1;
492
+ font-size: 32px;
493
+ line-height: 40px;
494
+ font-weight: 400;
495
+ color: #1e2e37;
496
+ lines: 2;
497
+ text-overflow: ellipsis;
498
+ }
499
+ .description-txt {
500
+ font-size: 24px;
501
+ font-weight: 400;
502
+ line-height: 30px;
503
+ lines: 1;
504
+ color: #8a8a8f;
505
+ text-overflow: ellipsis;
506
+ }
507
+ .price-box {
508
+ flex-direction: row;
509
+ align-items: center;
510
+ margin-top: 25px;
511
+ }
512
+ .rmb-1 {
513
+ font-size: 20px;
514
+ color: #1e2e37;
515
+ font-weight: 500;
516
+ }
517
+ .pblic-price {
518
+ font-size: 28px;
519
+ color: #1e2e37;
520
+ font-weight: 500;
521
+ margin-right: 35px;
522
+ }
523
+ .rmb-2 {
524
+ font-size: 16px;
525
+ color: #1e2e37;
526
+ font-weight: 500;
527
+ }
528
+ .discount-price {
529
+ font-size: 24px;
530
+ color: #1e2e37;
531
+ font-weight: 400;
532
+ margin-right: 20px;
533
+ }
534
+ .discount-img {
535
+ border-radius: 3px;
536
+ width: 70px;
537
+ height: 28px;
538
+ }
539
+
540
+ .no-data-steper {
541
+ width: 686px;
542
+ height: 546px;
543
+ border-radius: 32px;
544
+ margin-top: 8px;
545
+ display: flex;
546
+ flex-direction: column;
547
+ justify-content: flex-start;
548
+ align-items: center;
549
+ }
550
+
551
+ .no-data-img-steper {
552
+ width: 360px;
553
+ height: 300px;
554
+ }
555
+
556
+ .no-data-txt {
557
+ font-size: 28px;
558
+ color: #8a8a8f;
559
+ }
560
+
561
+ .add-card-button {
562
+ /* background: #00A4F2;
563
+ border-radius: 24px;
564
+ width: 686px; */
565
+ }
566
+
567
+ .add-card-title-isDiablo {
568
+ color: #cfcfd0;
569
+ }
570
+
571
+ .shop-card-isDiablo {
572
+ background-color: #2b2f32;
573
+ }
574
+
575
+ .card-content-isDiablo {
576
+ background: #2b2f32;
577
+ }
578
+
579
+ .img-shop-isDiablo {
580
+ opacity: 0.85;
581
+ }
582
+
583
+ .shop-title-txt-isDiablo {
584
+ color: #cfcfd0;
585
+ }
586
+
587
+ .description-txt-isDiablo {
588
+ color: #a2a4a5;
589
+ }
590
+
591
+ .rmb-1-isDiablo {
592
+ color: #cfcfd0;
593
+ }
594
+
595
+ .pblic-price-isDiablo {
596
+ color: #cfcfd0;
597
+ }
598
+
599
+ .rmb-2-isDiablo {
600
+ color: #cfcfd0;
601
+ }
602
+
603
+ .discount-price-isDiablo {
604
+ color: #cfcfd0;
605
+ }
606
+
607
+ /* diablo模式 */
608
+ @media screen and (weex-theme: diablo) {
609
+ .add-card-title {
610
+ color: #cfcfd0;
611
+ }
612
+
613
+ .shop-card {
614
+ background-color: #2b2f32;
615
+ }
616
+
617
+ .card-content {
618
+ background: #2b2f32;
619
+ }
620
+
621
+ .img-shop {
622
+ opacity: 0.85;
623
+ }
624
+
625
+ .shop-title-txt {
626
+ color: #cfcfd0;
627
+ }
628
+ .description-txt {
629
+ color: #a2a4a5;
630
+ }
631
+
632
+ .rmb-1 {
633
+ color: #cfcfd0;
634
+ }
635
+ .pblic-price {
636
+ color: #cfcfd0;
637
+ }
638
+ .rmb-2 {
639
+ color: #cfcfd0;
640
+ }
641
+ .discount-price {
642
+ color: #cfcfd0;
643
+ }
644
+ }
645
+ </style>
@@ -0,0 +1,8 @@
1
+ const appConfig = {
2
+ plugin_version: '10.2.0.1_2025043014',
3
+ plugin_name: '',
4
+ default_locale: 'cn',
5
+ enable_debug: false,
6
+ isMock: false
7
+ }
8
+ export default appConfig