gxd-uni-library-editx 1.0.8-beta98 → 1.0.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gxd-uni-library-editx",
3
- "version": "1.0.8-beta98",
3
+ "version": "1.0.8",
4
4
  "private": false,
5
5
  "description": "聚福宝基础插件专用库",
6
6
  "main": "index.js",
@@ -33,6 +33,7 @@
33
33
  "@dcloudio/uni-quickapp-webview": "^2.0.1-33920220208001",
34
34
  "@dcloudio/uni-stat": "^2.0.1-33920220208001",
35
35
  "@vue/shared": "^3.0.0",
36
+ "alife-logger": "^1.8.30",
36
37
  "color": "^3.1.3",
37
38
  "core-js": "^2.6.5",
38
39
  "dompurify": "^2.3.4",
@@ -51,6 +51,7 @@
51
51
  import BmGeolocation from 'vue-baidu-map/components/controls/Geolocation';
52
52
  import BmNavigation from 'vue-baidu-map/components/controls/Navigation';
53
53
  import BmLabel from 'vue-baidu-map/components/overlays/Label';
54
+ import storage from "@/common/storage";
54
55
 
55
56
  export default {
56
57
  name: "XdBaiduMap",
@@ -95,6 +96,7 @@
95
96
  BMap: null, //百度SDK对象
96
97
  BMapLoaded: false, //地图加载完成状态
97
98
  map: null, //百度SDK对象实例化对象
99
+ threeLocationContentSave: 'xd-three-Location-content',
98
100
  }
99
101
  },
100
102
  watch:{
@@ -110,6 +112,12 @@
110
112
  }
111
113
  },
112
114
  created() {
115
+ //缓存中获取
116
+ if (storage.get(this.threeLocationContentSave)) {
117
+ this.$emit('onLocationSuccess', storage.get(this.threeLocationContentSave));
118
+ return
119
+ }
120
+
113
121
  if(!this.ak) throw new Error('请传入百度AK值');
114
122
  else{
115
123
  let page = this.$xdUniHelper.parseURL();
@@ -138,11 +146,19 @@
138
146
  this.uiLevel = 15;
139
147
  this.uiCenter = point;
140
148
  this.location = location;
149
+ storage.set(this.threeLocationContentSave, location, 1/60)
141
150
  this.$emit('onLocationSuccess',location);
142
151
  },
143
152
 
144
153
  reLoad(){
145
154
  if(this.count > 10) {
155
+ let date = new Date();
156
+ this.$xdLog.setARMSCustomError('baidu_Location_fail', {
157
+ time: date.getTime(),
158
+ dataTime: date.toLocaleString(),
159
+ count: this.count
160
+ });
161
+ this.$emit('onLocationSuccess', null);
146
162
  return;
147
163
  }
148
164
  this.initStatus = false;
@@ -162,30 +178,18 @@
162
178
  geolocation['enableSDKLocation']();
163
179
  geolocation.getCurrentPosition(
164
180
  (location) => {
165
- console.log('handleInitDone',location)
166
181
  let point = this.$xdUniHelper.cloneDeep(location.point);
167
182
  delete point['of']
168
183
  this.uiGeolocation = point;
169
184
  this.uiLevel = 15;
170
185
  this.uiCenter = point;
171
186
  this.location = location;
187
+ storage.set(this.threeLocationContentSave, location, 1/60)
172
188
  this.LocationContent = `我的坐标:{lat:${location.latitude}, lng:${location.longitude}}`
173
189
  this.$emit('onLocationSuccess',location);
174
190
  },
175
191
  (error) => {
176
192
  this.reLoad();
177
- //百度定位失败
178
- if (typeof getApp()['saveLogs'] === 'function') {
179
- getApp()['saveLogs']({
180
- location: this.location,
181
- status: 'fail',
182
- baiduStatus: geolocation.getStatus(),
183
- result: res,
184
- locationType: 'baidu.com',
185
- pos: 'XdCityLocation'
186
- }, 'info');
187
- }
188
- this.$emit('onLocationSuccess',this.location);
189
193
  }
190
194
  )
191
195
  },
@@ -121,8 +121,13 @@
121
121
  //135deg 左上到右下(角度)
122
122
  //45deg 左下到右上(角度)
123
123
  default: 'to bottom',
124
- }
124
+ },
125
125
  /**仅支持线性渐变******/
126
+
127
+ isBoxShadow:{
128
+ type: Boolean,
129
+ default: false,
130
+ }
126
131
  },
127
132
  data(){
128
133
  return {
@@ -194,6 +199,7 @@
194
199
  },
195
200
 
196
201
  getBoxShadow(){
202
+ if(!this.isBoxShadow) return `0 0 0 rgba(0,0,0,0)`
197
203
  if(this.uiType === 'default' || this.uiType === 'text'|| this.boxShadow === null) return `0 0 0 rgba(0,0,0,0)`
198
204
  let color = this.$color(this.getColor(this.uiType)).alpha(0.4).toString();
199
205
  if(this.boxShadow) return this.boxShadow;
@@ -85,7 +85,7 @@
85
85
  :isOld="false"
86
86
  :font-size="24"
87
87
  :icon-size="0.3"
88
- :unit="ticket.unit"
88
+ :unit="ticket.unit || ''"
89
89
  ></xd-unit>
90
90
  </view>
91
91
  <view
@@ -97,7 +97,7 @@
97
97
  :isOld="false"
98
98
  :font-size="24"
99
99
  :icon-size="0.3"
100
- :unit="ticket.unit"
100
+ :unit="ticket.unit || ''"
101
101
  ></xd-unit>
102
102
  </view>
103
103
  </view>
@@ -107,9 +107,7 @@
107
107
  <view
108
108
  v-if="xdDownDrawer"
109
109
  class="bottom_btn"
110
- :style="{
111
- bottom: layoutInfo.bottom+'rpx'
112
- }"
110
+ :style="alert_bottom"
113
111
  >
114
112
  <xd-button
115
113
  width="360rpx"
@@ -332,6 +330,9 @@ export default {
332
330
  submitCardList(){
333
331
  return this.selectedCardList.filter(item => item.card_use_point > 0);
334
332
  },
333
+ alert_bottom(){
334
+ return this.fixedStyle({paddingBottom: 24, zIndex: 110})
335
+ },
335
336
  },
336
337
  created(){
337
338
 
@@ -339,6 +340,28 @@ export default {
339
340
 
340
341
  },
341
342
  methods: {
343
+ fixedStyle(options = {}, type = 'bottom') {
344
+ let paddingBottom = options.paddingBottom || options.height || 0;
345
+ if (options.paddingBottom) delete options.paddingBottom;
346
+ if (options.height) delete options.height;
347
+ let obj = Object.assign({}, {
348
+ top: 0, left: 0, right: 0, bottom: 0, zIndex: 100,
349
+ }, options);
350
+ let style = 'position: fixed';
351
+ style = `${style};left:${obj.left}rpx`;
352
+ style = `${style};right:${obj.right}rpx`;
353
+ style = `${style};z-index:${obj.zIndex}`;
354
+ if (type === 'bottom') {
355
+ let padding = (this.layoutInfo.bottomHeight + this.layoutInfo.footerHeight + paddingBottom) * this.$rpxNum;
356
+ style = `${style}; padding-bottom:calc(${padding}px + constant(safe-area-inset-bottom));`;
357
+ style = `${style}; padding-bottom:calc(${padding}px + env(safe-area-inset-bottom));`;
358
+ style = `${style};bottom:0;`;
359
+ }
360
+ if (type === 'top') {
361
+ style = `${style};top:${obj.top}rpx`;
362
+ }
363
+ return style;
364
+ },
342
365
  getTimeFormat(time){
343
366
  let date = null;
344
367
  if(time == +time){
@@ -351,6 +374,7 @@ export default {
351
374
  getList(){
352
375
  //获取卡券列表
353
376
  this.getSettleListCards((cardList) => {
377
+ this.$xdLog.setARMSInfo(this.filterMGinfo(cardList), 'init_binded_list');
354
378
  this.cardList = cardList;
355
379
  })
356
380
  },
@@ -367,7 +391,11 @@ export default {
367
391
  resolve(2);
368
392
  } else if (res.cancel) {
369
393
  // reject("取消支付");
370
- resolve(3);
394
+ if(data.pop_type == 'confirm'){
395
+ resolve();
396
+ }else{
397
+ resolve(3);
398
+ }
371
399
  }
372
400
  },
373
401
  fail: function (res) {
@@ -376,9 +404,9 @@ export default {
376
404
  });
377
405
  })
378
406
  },
407
+
379
408
  //选择卡券
380
409
  handlerTicketSelect(flat, ticket, options){
381
- console.log("handlerTicketSelect", ticket)
382
410
  if(flat){ //选择卡券,重新调用接口获取 selectedCardList, neePayPrice
383
411
  const {submitCardList, total_price} = this;
384
412
  let callThis = this;
@@ -392,11 +420,26 @@ export default {
392
420
  selected_card_list_json: JSON.stringify(submitCardList),
393
421
  ...options
394
422
  }, (res) => {
423
+ let resOptions = JSON.parse(JSON.stringify(res));
424
+ if(resOptions['selected_card_list1']) delete resOptions['selected_card_list1'];
425
+ if (resOptions['selected_card_list']){
426
+ resOptions['selected_card_list'] = this.filterMGinfo(resOptions['selected_card_list']);
427
+ }
428
+ this.$xdLog.setARMSInfo({
429
+ card_number: ticket.card_number,
430
+ selected_card_list_json: this.filterMGinfo(submitCardList),
431
+ ...options,
432
+ res: resOptions
433
+ },'select_binded_card');
395
434
  this.$xdHideLoading();
396
435
  const {selected_card_list, need_pay_price, is_need_pop} = res;
397
436
  if(is_need_pop){
398
437
  this.useCardPop(res).then((select_content) => {
399
- this.handlerTicketSelect(true, ticket, {select_content})
438
+ if(select_content){
439
+ this.handlerTicketSelect(true, ticket, {select_content})
440
+ }else{
441
+ this.handlerTicketSelect(false, ticket);
442
+ }
400
443
  }).catch(() => {})
401
444
  }else{
402
445
  this.selectedCardList = selected_card_list;
@@ -408,10 +451,15 @@ export default {
408
451
  this.renderChecked = Date.now();
409
452
  })
410
453
  }else{
454
+ this.$xdLog.setARMSInfo({
455
+ ticket: this.filterMGinfo(ticket),
456
+ ...options,
457
+ },'cancel_card');
411
458
  //不走接口, selectedCardList不是真实选中的
412
459
  this.selectedCardList = this.selectedCardList.map(item => {
413
460
  if(item.card_number == ticket.card_number){
414
- this.needPayPrice = +this.needPayPrice + item['card_use_point']
461
+ this.needPayPrice = +this.needPayPrice + item['card_use_price']
462
+ item['card_use_price'] = 0;
415
463
  item['card_use_point'] = 0;
416
464
  }
417
465
  return item;
@@ -424,14 +472,37 @@ export default {
424
472
  }
425
473
 
426
474
  },
475
+
476
+ filterMGinfo(list){
477
+ //深拷贝
478
+ if(this.$xdUniHelper.checkVarType(list) === 'object'
479
+ || this.$xdUniHelper.checkVarType(list) === 'array'
480
+ ) {
481
+ list = JSON.parse(JSON.stringify(list));
482
+ }
483
+ //object
484
+ if(this.$xdUniHelper.checkVarType(list) === 'object') {
485
+ if (list.card_use_certificate) list.card_use_certificate = list.card_use_certificate.substr(0, 2) + '********' + list.card_use_certificate.substr(-3);
486
+ if (list.card_cert) list.card_cert = list.card_cert.substr(0, 2) + '********' + list.card_cert.substr(-3);
487
+ if (list.card_password) list.card_password = list.card_password.substr(0, 2) + '********' + list.card_password.substr(-3);
488
+ return list;
489
+ }
490
+
491
+ //array
492
+ return list.map(item => {
493
+ if(item.card_use_certificate) item.card_use_certificate = item.card_use_certificate.substr(0, 2) + '********' + item.card_use_certificate.substr(-3);
494
+ if(item.card_cert) item.card_cert = item.card_cert.substr(0, 2) + '********' + item.card_cert.substr(-3);
495
+ if(item.card_password) item.card_password = item.card_password.substr(0, 2) + '********' + item.card_password.substr(-4);
496
+ return item
497
+ });
498
+ },
499
+
427
500
  //添加新卡券
428
501
  addNewCard(options={}){
429
502
  const { cardForm, total_price, submitCardList } = this;
430
503
  let err_tip = "";
431
504
  if(!cardForm.card_qrcode){
432
- if(!cardForm.card_number) err_tip = "票券号码不能为空";
433
- else if(!cardForm.card_password) err_tip = "票券密码不能为空";
434
- else if(!cardForm.valid_code) err_tip = "验证码不能为空";
505
+ if(!cardForm.card_number && !cardForm.card_password) err_tip = "票券和密码不能为空";
435
506
  }
436
507
  if(err_tip) {
437
508
  return uni.showToast({
@@ -450,19 +521,56 @@ export default {
450
521
  total_price,
451
522
  ...options
452
523
  }, (res) => {
524
+ let resOptions = JSON.parse(JSON.stringify(res));
525
+ resOptions.selected_card_list = this.filterMGinfo(resOptions.selected_card_list)
526
+ this.$xdLog.setARMSInfo({
527
+ ...options,
528
+ total_price,
529
+ cardForm: {
530
+ ...cardForm,
531
+ card_password: cardForm.card_password ? cardForm.card_password.substr(0, 2) + '********' + cardForm.card_password.substr(-3) : '',
532
+ },
533
+ selected_card_list_json: this.filterMGinfo(submitCardList),
534
+ res: resOptions
535
+ },'add_card');
453
536
  this.$xdHideLoading();
537
+
454
538
  //成功回调
455
539
  let {selected_card_list=[], need_pay_price, is_need_pop} = res;
540
+
456
541
  if(is_need_pop){
457
542
  this.useCardPop(res).then((select_content) => {
458
- this.addNewCard({select_content});
543
+ if(select_content) this.addNewCard({select_content});
459
544
  // this.handlerTicketSelect(true, cardForm.card_number, {select_content})
460
545
  }).catch((e) => {
461
546
  console.error(e)
462
547
  })
463
548
  return;
464
549
  }else{
465
- selected_card_list = selected_card_list.map(item => {
550
+ // filterCard 去重后的卡券
551
+ let r_cards = this.cardList.map(item => item.card_number);
552
+ let filterCard = selected_card_list.filter(item => !r_cards.includes(item.card_number));
553
+ //重合的卡券列表
554
+ let repeatCardList = selected_card_list.filter(item => r_cards.includes(item.card_number));
555
+
556
+ if(repeatCardList.length > 0){
557
+ let repeatCard = repeatCardList[0];
558
+ //重复的以前的卡数据
559
+ let oldCard = this.cardList.find(item => item.card_number == repeatCard.card_number);
560
+ //自动选中当前重合的卡券
561
+ if(this.selectedCardList.findIndex(item => item.card_number == repeatCard.card_number) == -1){
562
+ this.selectedCardList.push({...oldCard, ...repeatCard});
563
+ }else{
564
+ this.selectedCardList = this.selectedCardList.map(item => {
565
+ if(item.card_number == repeatCard.card_number){
566
+ item = {...oldCard, ...repeatCard};
567
+ }
568
+ return item;
569
+ })
570
+ }
571
+ }
572
+
573
+ selected_card_list = filterCard.map(item => {
466
574
  item['is_new'] = true;
467
575
  return item;
468
576
  })
@@ -484,6 +592,7 @@ export default {
484
592
  this.switchValidToken();
485
593
  })
486
594
  },
595
+
487
596
  handleConfirmAllWxPay(){
488
597
  return new Promise((resolve, reject) => {
489
598
  uni.showModal({
@@ -516,6 +625,12 @@ export default {
516
625
  callThis = this.$parent;
517
626
  // #endif
518
627
  callThis.createSettleOrder(postData, (order) => {
628
+ this.$xdLog.setARMSInfo({
629
+ total_price,
630
+ selected_card_list_json: this.filterMGinfo(submitCardList),
631
+ need_pay_price: needPayPrice,
632
+ res: order
633
+ }, 'create_order');
519
634
  this.$emit("onCreateOrder", {need_pay_price: needPayPrice, ...order}); //支付完成,触发
520
635
  })
521
636
  },
@@ -687,6 +802,8 @@ export default {
687
802
  background: #FFFFFF;
688
803
  box-shadow: 0 0 0px 1px rgba(0, 0, 0, 0.1);
689
804
  transition: 500ms all;
805
+ padding-bottom: calc(24rpx + env(safe-area-inset-bottom));
806
+ padding-bottom: calc(24rpx + constant(safe-area-inset-bottom));
690
807
  }
691
808
  }
692
809
  }
@@ -0,0 +1,167 @@
1
+ <template>
2
+ <view class="layout2-card-item" @click="handleBindLogin">
3
+ <view v-if="showLeft" class="item-left" @click.stop="toDetail">
4
+ <xd-font-icon
5
+ class="xd-font-icon"
6
+ size="34"
7
+ :color="mainColor"
8
+ icon="iconchakan1"
9
+ ></xd-font-icon>
10
+ <view class="cha_kan">查看</view>
11
+ </view>
12
+ <view class="item-right">
13
+ <view class="item_info">
14
+ <view class="_title">
15
+ <xd-font-icon
16
+ icon="iconkaquan"
17
+ size="38"
18
+ style="margin-right: 18rpx"
19
+ :color="mainColor"
20
+ ></xd-font-icon>
21
+ <view>{{ cardInfo.card_type_name }}</view>
22
+ </view>
23
+ <view class="identify">
24
+ <view class="_id">ID:{{ cardInfo.card_number }}</view>
25
+ <view>有效期至:{{ cardInfo.end_time }}</view>
26
+ </view>
27
+ <view class="remain">
28
+ 剩余{{ cardInfo.unit }}数:{{ cardInfo.card_point }}{{ cardInfo.unit }}
29
+ </view>
30
+ <view class="other">
31
+ 购买其他物品可抵:{{ cardInfo.other_card_point }}
32
+ </view>
33
+ </view>
34
+ <view class="btn" :style="{ background: mainColor }">
35
+ <view >{{ tabIndex === 1 ? "登录" : "转换" }}</view>
36
+ </view>
37
+ </view>
38
+ </view>
39
+ </template>
40
+
41
+ <script>
42
+ import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
43
+ export default {
44
+ components: {
45
+ XdFontIcon
46
+ },
47
+ props: {
48
+ cardInfo: {
49
+ type: Object,
50
+ default: () => ({})
51
+ },
52
+ tabIndex: {
53
+ type: Number,
54
+ default: 1
55
+ },
56
+ mainColor: {
57
+ type: String,
58
+ default: "#FF6A00"
59
+ },
60
+ showLeft: {
61
+ type: Boolean,
62
+ default: true
63
+ }
64
+ },
65
+ data(){
66
+ return {
67
+
68
+ }
69
+ },
70
+ methods: {
71
+ handleBindLogin(){
72
+ this.$emit('bindLogin', this.cardInfo)
73
+ },
74
+ toDetail(){
75
+ this.$emit('toDetail', this.cardInfo)
76
+ }
77
+ }
78
+ }
79
+ </script>
80
+
81
+ <style lang="less" scoped>
82
+ .layout2-card-item {
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: flex-start;
86
+ border: unit(2, rpx) solid #eeeeee;
87
+ border-radius: unit(20, rpx);
88
+ margin-bottom: unit(30, rpx);
89
+ background: #fff;
90
+ .item-left {
91
+ width: unit(140, rpx);
92
+ display: flex;
93
+ flex-direction: column;
94
+ align-items: center;
95
+ justify-content: center;
96
+ font-size: unit(24, rpx);
97
+ .xd-font-icon {
98
+ margin-bottom: 10rpx;
99
+ }
100
+ .cha_kan{
101
+ font-size: 22rpx;
102
+ color: #666666;
103
+ }
104
+ }
105
+ .item-right {
106
+ display: flex;
107
+ flex: 1;
108
+ flex-direction: row;
109
+ justify-content: space-between;
110
+ align-items: center;
111
+ font-size: 24rpx;
112
+ padding: 24rpx;
113
+ border-left: 1px solid #eeeeee;
114
+ .item_info {
115
+ display: flex;
116
+ flex-direction: column;
117
+ justify-content: space-between;
118
+ flex: 1;
119
+ width: 100rpx;
120
+
121
+ ._title{
122
+ display: flex;
123
+ font-size: 28rpx;
124
+ color: #333333;
125
+ line-height: 32rpx;
126
+ }
127
+ .identify{
128
+ display: flex;
129
+ flex-direction: row;
130
+ flex-wrap: wrap;
131
+ font-size: 22rpx;
132
+ color: #999999;
133
+ font-weight: 400;
134
+ margin-top: 24rpx;
135
+ & > view{
136
+ word-break: break-all;
137
+ }
138
+
139
+ ._id{
140
+ margin-right: 20rpx;
141
+ }
142
+ }
143
+ .remain{
144
+ font-size: 24rpx;
145
+ color: #333333;
146
+ margin-top: 24rpx;
147
+ line-height: 28rpx;
148
+ }
149
+ .other{
150
+ font-size: 22rpx;
151
+ color: #999999;
152
+ margin-top: 8rpx;
153
+ }
154
+ }
155
+ .btn{
156
+ width: 104rpx;
157
+ height: 104rpx;
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ border-radius: 8rpx;
162
+ color: #FFFFFF;
163
+ font-size: 28rpx;
164
+ }
165
+ }
166
+ }
167
+ </style>
@@ -211,6 +211,7 @@
211
211
  this.$nextTick(() => {
212
212
  this.loaded = true;
213
213
  })
214
+ this.init();
214
215
  },
215
216
 
216
217
  mounted(){
@@ -232,7 +233,7 @@
232
233
  handleDone(location){
233
234
  console.log('location', location);
234
235
  this.threeLocation = location;
235
- this.init();
236
+ this.getLocationCityName();
236
237
  },
237
238
 
238
239
  init(){
@@ -261,7 +262,7 @@
261
262
  this.cityLetter = this.listInfo.classify_nav;
262
263
 
263
264
  console.log('toList', this.allCityList, this.hotCityList, this.cityList, this.cityLetter);
264
- this.getLocationCityName();
265
+ // this.getLocationCityName();
265
266
  this.setAppLettersList();
266
267
  },
267
268
 
@@ -458,7 +459,7 @@
458
459
  .xd-city {
459
460
  &__header {
460
461
  position: fixed;
461
- background: #eee;
462
+ background: #fff;
462
463
  left: 0;
463
464
  top: 0;
464
465
  right: 0;
@@ -485,8 +486,8 @@
485
486
  height: unit(70, rpx);
486
487
  max-height: unit(60, rpx);
487
488
  border-radius: unit(30, rpx);
488
- background-color: @xd-bg-color;
489
- padding-left: unit(20, rpx);
489
+ background-color: #eee;
490
+ padding-left: unit(40, rpx);
490
491
  padding-right: unit(20, rpx);
491
492
  box-sizing: border-box;
492
493
  }