jufubao-base 1.0.403-beta4 → 1.0.404

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": "jufubao-base",
3
- "version": "1.0.403-beta4",
3
+ "version": "1.0.404",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -51,4 +51,12 @@ module.exports = [
51
51
  },
52
52
  disabled: true,
53
53
  },
54
+ {
55
+ mapFnName: 'getListPlusCouponRights',
56
+ isRule: false,
57
+ title: '获得绑定的卡的优惠券权益列表',
58
+ path: '/card/v1/card-bind/list-plus-coupon-rights',
59
+ params: {},
60
+ disabled: true,
61
+ },
54
62
  ];
@@ -320,6 +320,17 @@ export default {
320
320
  { label: "一行滑块展示", value: "one" }
321
321
  ]
322
322
  },
323
+ {
324
+ label: "是否展示plus权益:",
325
+ ele: "xd-radio",
326
+ valueKey: "isShowPlus",
327
+ groupKey:'content',
328
+ value: data.isShowPlus || "N",
329
+ list: [
330
+ { label: "展示", value: "Y" },
331
+ { label: "隐藏", value: "N" }
332
+ ]
333
+ },
323
334
  {
324
335
  label: "二维码文案",
325
336
  ele: "el-input",
@@ -561,6 +572,85 @@ export default {
561
572
  });
562
573
  },
563
574
  },
575
+ {
576
+ ele: "title",
577
+ label: "plus权益样式配置",
578
+ size: "small",
579
+ groupKey: "style",
580
+ hidden: data.isShowPlus !== 'Y',
581
+ },
582
+ {
583
+ label: "列表项背景图:",
584
+ ele: "xd-upload",
585
+ valueKey: "plusItemBgImage",
586
+ groupKey:'style',
587
+ value: data.plusItemBgImage || {},
588
+ defaultValue: data.plusItemBgImage || null,
589
+ slot: true,
590
+ type: ['jpg', 'png', 'jpeg'],
591
+ styleType: 'one',
592
+ uploadType: 'aliyun',
593
+ size: 5,
594
+ action: 'action',
595
+ oneWidth: 375,
596
+ oneHeight: 120,
597
+ sort: true,
598
+ hidden: data.isShowPlus !== 'Y',
599
+ inline: true,
600
+ },
601
+ {
602
+ label: "套餐名称颜色:",
603
+ ele: "xd-color",
604
+ valueKey: "plusPackageNameColor",
605
+ groupKey:'style',
606
+ value: data.plusPackageNameColor || '#8C530D',
607
+ hidden: data.isShowPlus !== 'Y',
608
+ inline: true,
609
+ },
610
+ {
611
+ label: "兑换有效期颜色:",
612
+ ele: "xd-color",
613
+ valueKey: "plusValidDateColor",
614
+ groupKey:'style',
615
+ value: data.plusValidDateColor || '#A8630D',
616
+ hidden: data.isShowPlus !== 'Y',
617
+ inline: true,
618
+ },
619
+ {
620
+ label: "按钮文字颜色:",
621
+ ele: "xd-color",
622
+ valueKey: "plusBtnTextColor",
623
+ groupKey:'style',
624
+ value: data.plusBtnTextColor || '#A8630D',
625
+ hidden: data.isShowPlus !== 'Y',
626
+ inline: true,
627
+ },
628
+ {
629
+ label: "按钮背景颜色:",
630
+ ele: "xd-gradient-color",
631
+ valueKey: "plusBtnBgColor",
632
+ groupKey:'style',
633
+ value: data.plusBtnBgColor || 'linear-gradient(90deg, #FFF6E5 0%, #FEE4AA 100%)',
634
+ hidden: data.isShowPlus !== 'Y',
635
+ inline: true,
636
+ },
637
+ {
638
+ ele: "title",
639
+ label: "tab按钮样式配置",
640
+ size: "small",
641
+ groupKey: "style",
642
+ },
643
+ {
644
+ label: "选中时文字背景色设置: ",
645
+ ele: "xd-text-and-bgc",
646
+ groupKey:'style',
647
+ valueKey: "tabBtnStyle",
648
+ value: data.tabBtnStyle || null,
649
+ setting: {
650
+ color: true,
651
+ bgColor: true,
652
+ },
653
+ },
564
654
  ]
565
655
  },
566
656
  };
@@ -104,18 +104,17 @@
104
104
  <view class="jfb-base-card-entry__body-tab">
105
105
  <view
106
106
  @click="tabIndex = 1"
107
- :style="{
108
- color: tabIndex === 1 ? '#fff' : '#B8B7BE',
109
- background: tabIndex === 1 ? mainColor : '#fff',
110
- }"
111
- >已绑定票券</view>
107
+ :style="tabIndex === 1 ? tabSelectedStyle : tabNormalStyle"
108
+ >已绑票券({{totalCardNum}})</view>
112
109
  <view
113
110
  @click="tabIndex = 2"
114
- :style="{
115
- color: tabIndex === 2 ? '#fff' : '#B8B7BE',
116
- background: tabIndex === 2 ? mainColor : '#fff',
117
- }"
118
- >优惠券</view>
111
+ :style="tabIndex === 2 ? tabSelectedStyle : tabNormalStyle"
112
+ >优惠券({{totalCouponCardNum}})</view>
113
+ <view
114
+ v-if="isShowPlus === 'Y'"
115
+ @click="tabIndex = 3"
116
+ :style="tabIndex === 3 ? tabSelectedStyle : tabNormalStyle"
117
+ >plus权益({{totalPlusCardNum}})</view>
119
118
  </view>
120
119
  <view class="jfb-base-card-entry__body-sub-tab" v-if="tabIndex === 1">
121
120
  <view :style="{
@@ -333,6 +332,35 @@
333
332
  <view v-else>暂无数据</view>
334
333
  </view>
335
334
  <!--content coupon-->
335
+ <!--content plus-->
336
+ <view v-if="tabIndex === 3 && plusList && plusList.length > 0" class="jfb-base-card-entry__body-plus">
337
+ <view class="jfb-base-card-entry__body-plus-list">
338
+ <view
339
+ class="jfb-base-card-entry__body-plus-item"
340
+ v-for="(item, idx) in plusList"
341
+ :key="idx"
342
+ @click="handlePlusClick(item)"
343
+ :style="{
344
+ backgroundImage: plusItemBgImageUrl ? 'url(' + plusItemBgImageUrl + ')' : '',
345
+ backgroundSize: '100% 100%',
346
+ }"
347
+ >
348
+ <view class="jfb-base-card-entry__body-plus-item-top">
349
+ <view class="jfb-base-card-entry__body-plus-item-name" :style="{ color: plusPackageNameColor }">{{ item.plus_product_name }}</view>
350
+ <view
351
+ class="jfb-base-card-entry__body-plus-item-btn"
352
+ :class="{ redeemed: item.button_text === '去使用' }"
353
+ :style="{
354
+ color: plusBtnTextColor,
355
+ background: item.button_text === '去使用' ? '' : plusBtnBgColor,
356
+ }"
357
+ >{{ item.button_text }}</view>
358
+ </view>
359
+ <view class="jfb-base-card-entry__body-plus-item-date" :style="{ color: plusValidDateColor }">兑换有效期:{{ item.end_time | formatTimestamp }}</view>
360
+ </view>
361
+ </view>
362
+ </view>
363
+ <!--content plus-->
336
364
  <!--no data-->
337
365
  <view v-else-if="cardList !== null && cardList.length === 0">
338
366
  <view class="jfb-base-card-entry__body-empty">
@@ -516,10 +544,34 @@ export default {
516
544
  return this.getNoData();
517
545
  },
518
546
  },
547
+ computed: {
548
+ tabSelectedStyle() {
549
+ let styleObj = {
550
+ color: this.tabBtnStyle && this.tabBtnStyle['actColor'] || '#fff',
551
+ background: this.tabBtnStyle && this.tabBtnStyle['actBgColor'] || this.mainColor,
552
+ }
553
+ return this.styleObjectToString(styleObj);
554
+ },
555
+ tabNormalStyle() {
556
+ let styleObj = {
557
+ color: this.tabBtnStyle['color']||'#ccc',
558
+ background:this.tabBtnStyle['bgColor']|| '#eee',
559
+ }
560
+ return this.styleObjectToString(styleObj);
561
+ },
562
+ },
519
563
  filters:{
520
564
  cutstr(val){
521
565
  if(typeof val.entry_name === 'string') return val.entry_name.slice(0,4);
522
566
  return ''
567
+ },
568
+ formatTimestamp(val) {
569
+ if (!val) return '';
570
+ const date = new Date(Number(val) * 1000);
571
+ const y = date.getFullYear();
572
+ const m = String(date.getMonth() + 1).padStart(2, '0');
573
+ const d = String(date.getDate()).padStart(2, '0');
574
+ return `${y}-${m}-${d}`;
523
575
  }
524
576
  },
525
577
  watch: {
@@ -655,6 +707,20 @@ export default {
655
707
  buy_name: "",
656
708
  code_name: "",
657
709
  bussShowType: "",
710
+ isShowPlus: 'N',
711
+ plusList: [],
712
+ plusItemBgImage: {},
713
+ plusItemBgImageUrl: '',
714
+ plusPackageNameColor: '',
715
+ plusValidDateColor: '',
716
+ plusBtnTextColor: '',
717
+ plusBtnBgColor: '',
718
+ tabBtnStyle: null,
719
+ totalCardNum: 0,
720
+ totalPlusCardNum: 0,
721
+ totalCouponCardNum: 0,
722
+ isInitialized: false,
723
+ exchange_url: '',
658
724
  };
659
725
  },
660
726
  created() {
@@ -739,11 +805,22 @@ export default {
739
805
  let bussShowType = getContainerPropsValue(container, "content.bussShowType", "one");
740
806
  if(this.isPreview) {
741
807
  this.tabIndex = this.isShowCoupon==='Y'?2:1;
742
- if(this.bussShowType !== bussShowType){
743
- this.clearDefault();
744
- this.cardPageNum = 0;
745
- this.onJfbLoad(this.options);
746
- }
808
+ }
809
+ this.isShowPlus = getContainerPropsValue(container, "content.isShowPlus", "N");
810
+ let plusItemBgImage = getContainerPropsValue(container, "content.plusItemBgImage", '');
811
+ this.plusItemBgImageUrl = plusItemBgImage ? getServiceUrl(plusItemBgImage.url) : '';
812
+ this.plusPackageNameColor = getContainerPropsValue(container, "content.plusPackageNameColor", '#8C530D');
813
+ this.plusValidDateColor = getContainerPropsValue(container, "content.plusValidDateColor", '#A8630D');
814
+ this.plusBtnTextColor = getContainerPropsValue(container, "content.plusBtnTextColor", '#A8630D');
815
+ this.plusBtnBgColor = getContainerPropsValue(container, "content.plusBtnBgColor", 'linear-gradient(90deg, #FFF6E5 0%, #FEE4AA 100%)');
816
+ this.tabBtnStyle = getContainerPropsValue(container, "content.tabBtnStyle", {
817
+ color: '#fff',
818
+ bgColor: '',
819
+ });
820
+ if(this.bussShowType !== bussShowType){
821
+ this.clearDefault();
822
+ this.cardPageNum = 0;
823
+ this.onJfbLoad(this.options);
747
824
  }
748
825
  this.bussShowType = bussShowType;
749
826
  },
@@ -979,10 +1056,17 @@ export default {
979
1056
  // #endif
980
1057
 
981
1058
  this.getContent();
982
- if(this.tabIndex===1) {
1059
+ if(!this.isInitialized){
1060
+ this.isInitialized = true;
983
1061
  this.getCardList(options);
984
- } else {
985
1062
  this.getCouponList(options);
1063
+ this.getPlusList(options);
1064
+ } else if(this.tabIndex===1) {
1065
+ this.getCardList(options);
1066
+ } else if(this.tabIndex===2) {
1067
+ this.getCouponList(options);
1068
+ } else if(this.tabIndex===3) {
1069
+ this.getPlusList(options);
986
1070
  }
987
1071
  },
988
1072
 
@@ -998,6 +1082,7 @@ export default {
998
1082
  data: params
999
1083
  }).then(res=>{
1000
1084
  this.loadingCardList = false;
1085
+ this.totalCouponCardNum = res.list.length || 0;
1001
1086
  this.showDisabled = res.is_show_invalid_card_entrance;
1002
1087
  if(this.isPreview) {
1003
1088
  res.list = this.testCouponList
@@ -1014,6 +1099,48 @@ export default {
1014
1099
 
1015
1100
  },
1016
1101
 
1102
+ getPlusList(options) {
1103
+ this.$xdShowLoading({});
1104
+ let params = {}
1105
+ if(this.entryGroupId) params['group_id'] = this.entryGroupId;
1106
+ jfbRootExec("getListPlusCouponRights", {
1107
+ vm: this,
1108
+ data: params
1109
+ })
1110
+ .then((res) => {
1111
+ this.loadingCardList = false;
1112
+ this.totalPlusCardNum = res.list.length || 0;
1113
+ //过滤入口配置
1114
+ this.plusList = res.list
1115
+ this.exchange_url = res.exchange_url
1116
+ this.$xdHideLoading();
1117
+ })
1118
+ .catch(() => {
1119
+ this.loadingCardList = false;
1120
+ this.$xdHideLoading();
1121
+ });
1122
+ },
1123
+
1124
+ handlePlusClick(item) {
1125
+ let site_path = this.exchange_url;
1126
+ jfbRootExec("getBaseByIdCardDetail", {
1127
+ vm: this,
1128
+ data: {
1129
+ card_number: item.card_number
1130
+ }
1131
+ }).then(res => {
1132
+ let code_content = this.getParams(res.card_qrcode, "code_content")
1133
+ let sitePath = `${site_path}?ecode=${Base64.encodeURI(code_content)}`;
1134
+ sitePath = `${sitePath}&is_return_is_used=Y`
1135
+ let sitePathPre = sitePath.split("?")[0];
1136
+ let sitePathAfter = sitePath.split("?")[1];
1137
+ sitePath = `${sitePathPre}?ecode-params=${Base64.encodeURI(sitePathAfter)}`;
1138
+ this.$xdUniHelper.redirectTo({
1139
+ url: sitePath,
1140
+ });
1141
+ })
1142
+ },
1143
+
1017
1144
  getCardList(options) {
1018
1145
  let params = {is_all: 'Y', is_show_entry_settings: 'Y', show_type: 'normal'};
1019
1146
  if(options['jfb_business_code']) {
@@ -1028,6 +1155,7 @@ export default {
1028
1155
  .then((res) => {
1029
1156
  this.loadingCardList = false;
1030
1157
  this.showDisabled = res.is_show_invalid_card_entrance;
1158
+ this.totalCardNum = res.list.length || 0;
1031
1159
  res.list = res.list.map((item) => {
1032
1160
  return {
1033
1161
  ...item,
@@ -1256,6 +1384,64 @@ export default {
1256
1384
  }
1257
1385
  }
1258
1386
 
1387
+ .jfb-base-card-entry__body-plus {
1388
+ padding: 0 0 30rpx;
1389
+
1390
+ &-header {
1391
+ font-size: 28rpx;
1392
+ color: #666;
1393
+ margin-bottom: 20rpx;
1394
+
1395
+ &-num {
1396
+ color: #333;
1397
+ font-weight: 700;
1398
+ font-size: 32rpx;
1399
+ }
1400
+ }
1401
+
1402
+ &-list {
1403
+ display: flex;
1404
+ flex-direction: column;
1405
+ gap: 24rpx;
1406
+ }
1407
+
1408
+ &-item {
1409
+ padding: 30rpx 40rpx;
1410
+ background: #fff;
1411
+ border-radius: 16rpx;
1412
+ box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
1413
+
1414
+ &-top {
1415
+ display: flex;
1416
+ align-items: center;
1417
+ justify-content: space-between;
1418
+ }
1419
+
1420
+ &-name {
1421
+ font-size: 32rpx;
1422
+ font-weight: 500;
1423
+ color: #8C530D;
1424
+ }
1425
+
1426
+ &-date {
1427
+ font-size: 28rpx;
1428
+ color: #A8630D;
1429
+ margin-top: 72rpx;
1430
+ }
1431
+
1432
+ &-btn {
1433
+ flex-shrink: 0;
1434
+ margin-left: 20rpx;
1435
+ padding: 12rpx 36rpx;
1436
+ font-size: 32rpx;
1437
+ color: #A8630D;
1438
+ border-radius: 54rpx;
1439
+ text-align: center;
1440
+ background: linear-gradient(90deg, #FFF6E5 0%, #FEE4AA 100%);
1441
+ }
1442
+ }
1443
+ }
1444
+
1259
1445
  .card-list {
1260
1446
  overflow: hidden;
1261
1447
  border-radius: unit(16, rpx);
@@ -393,5 +393,8 @@ module.exports = {
393
393
  "card_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhM2U4YjQ5OWEwNzUwN2EyIiwiaWF0IjoxNjc0OTYzODE3LjY2OTM1MywiZXhwIjoxNjc1MDIwNTc3LjY2OTM1MywiY2FyZF9udW1iZXIiOiIxMDEwMDEwMDAwMDUxOTUiLCJjYXJkX3R5cGVfbmFtZSI6IjZJR2E1NmFQNWE2ZDU2YVA1WTJoNXJXTDZLK1Y2SnVMNTdPViIsInByaWNlIjoxMDAsIm9ubGluZV9wcmljZSI6MTAwLCJ1c2Vfc2NlbmNlIjozLCJidXNpbmVzc19jb2RlcyI6IjAsMSwyLDMsNCJ9.LsoBJq4pC_gSc1jZRwDhD2rAfOf1DMCy29VHomGiqYE",
394
394
  "card_expire_in": 56760,
395
395
  "request_id": "8fde2506c426a55d"
396
- }
396
+ },
397
+ getListPlusCouponRights:{ "total_size": 1, "list": [{ "card_number": "101001000141415", "card_type_name": "聚福宝福卡(点12位)", "plus_product_id": 60038520, "plus_product_name": "体验卡7天", "start_time": 1754841600, "end_time": 1800547199, "exchange_expire_time": 1800547099, "exchange_status": "N", "exchange_status_name": "未兑换", "business_codes": ["market", "cake"], "exchange_card_numbers": "", "exchange_time": 0, "button_text": "去兑换" }], "request_id": "f2043ea4806956cb" }
398
+
399
+
397
400
  }