jufubao-base 1.0.235 → 1.0.236-beta2

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.235",
3
+ "version": "1.0.236-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -274,6 +274,17 @@ export default {
274
274
  inline: false,
275
275
  notice: '当未设置文案时,页面默认展示为"<span style="color:red">购买新卡</span>",建议不超过<span style="color:red">4</span>个汉字'
276
276
  },
277
+ {
278
+ label: "优惠券是否单独展示:",
279
+ ele: 'xd-radio',
280
+ valueKey: 'show_coupon_tab',
281
+ groupKey: 'content',
282
+ value: data.show_coupon_tab || 'N',
283
+ list: [
284
+ { label: "是", value: "Y" },
285
+ { label: "否", value: "N" }
286
+ ],
287
+ },
277
288
  {
278
289
  ele: 'title',
279
290
  label: '登录样式设置',
@@ -16,7 +16,11 @@
16
16
  <view class="jfb-base-card__edit-icon" @click="delEdit">删除</view>
17
17
  </view>
18
18
  <!-- #endif -->
19
- <view :style="{paddingTop: bindCard!=='1'?'35rpx':'55rpx'}" class="jfb-base-card__body">
19
+ <view :style="{
20
+ paddingTop: bindCard!=='1'?'35rpx':'55rpx',
21
+ '--main-color': mainColor,
22
+ '--main-alpha-color': mainSubBorderColor
23
+ }" class="jfb-base-card__body">
20
24
  <view v-if="bindCard==='1'" class="jfb-base-card__body-cut">
21
25
  <template v-if="isQrCode">
22
26
  <view
@@ -101,22 +105,25 @@
101
105
  </view>
102
106
  <!--notice end-->
103
107
  <view class="jfb-base-card__body-tab">
104
- <view
105
- @click="tabIndex = 1"
106
- :style="{
107
- color: tabIndex === 1 ? '#fff' : '#B8B7BE',
108
- background: tabIndex === 1 ? mainColor : '#fff',
109
- }"
110
- >已绑定票券</view>
111
- <view
112
- v-if="changeList.length > 0"
113
- @click="tabIndex = 2"
114
- :style="{
115
- color: tabIndex === 2 ? '#fff' : '#B8B7BE',
116
- background: tabIndex === 2 ? mainColor : '#fff',
117
- }"
118
- >可转换票券</view>
119
- <view class="debuger" v-if="cardList.length === 0" @click="openDebugger(true)" style="opacity: 0">debuger</view>
108
+ <view v-if="show_coupon_tab==='Y'" class="show_type_tab">
109
+ <view class="type_item" :class="{active: show_type==='normal'}" @click="switchShowType('normal')">已绑定票券</view>
110
+ <view class="type_item" :class="{active: show_type==='coupon'}" @click="switchShowType('coupon')">优惠券</view>
111
+ </view>
112
+ <view class="tab_index_wrap">
113
+ <view
114
+ @click="tabIndex = 1"
115
+ class="tab_item"
116
+ :class="{sub: show_coupon_tab==='Y', active: tabIndex===1}"
117
+ >{{ show_coupon_tab==='Y' ? '可用票券' : '已绑定票券' }}</view>
118
+ <view
119
+ v-if="changeList.length > 0"
120
+ @click="tabIndex = 2"
121
+ class="tab_item"
122
+ :class="{sub: show_coupon_tab==='Y', active: tabIndex===2}"
123
+ >可转换票券</view>
124
+ <view class="debuger" v-if="cardList.length === 0" @click="openDebugger(true)" style="opacity: 0">debuger</view>
125
+ </view>
126
+
120
127
  </view>
121
128
  <view
122
129
  class="jfb-base-card__body-tips"
@@ -343,6 +350,7 @@ export default {
343
350
  },
344
351
  data() {
345
352
  return {
353
+ show_type: "normal", //normal正常票券;coupon 满减券
346
354
  options: {},
347
355
  inCallbackUrlOrg:'',//是否带有回调地址
348
356
  mainBorderColor:'',
@@ -396,6 +404,7 @@ export default {
396
404
  showDisabled: 'Y',
397
405
 
398
406
  dialogEvent: false,
407
+ show_coupon_tab: "N",
399
408
  // is_show_change: false,
400
409
  popup: "https://img.zcool.cn/community/01784158abe781a801219c77e981ee.jpg?x-oss-process=image/auto-orient,1/resize,m_lfit,w_1280,limit_1/sharpen,100",
401
410
  buy_name: '',
@@ -460,6 +469,7 @@ export default {
460
469
  this.isShowBuy = getContainerPropsValue(container, "content.isShowBuy", "N");
461
470
  this.buy_name = getContainerPropsValue(container, "content.buy_name", "购买新卡");
462
471
  this.buy_new_url = getContainerPropsValue(container,"content.buy_new_url",{value: ""}).value;
472
+ this.show_coupon_tab = getContainerPropsValue(container, "content.show_coupon_tab", "N");
463
473
  },
464
474
 
465
475
  handleToLink(path) {
@@ -468,7 +478,10 @@ export default {
468
478
  url: path,
469
479
  });
470
480
  },
471
-
481
+ switchShowType(show_type) {
482
+ this.show_type = show_type;
483
+ this.getCardList(this.options);
484
+ },
472
485
  getContent() {
473
486
  jfbRootExec("getListBaseNewsContent", {
474
487
  vm: this,
@@ -631,6 +644,9 @@ export default {
631
644
  if(options['jfb_business_code']) {
632
645
  params['card_business_code'] = options['jfb_business_code'];
633
646
  }
647
+ if(this.show_coupon_tab === 'Y'){
648
+ params.show_type = this.show_type;
649
+ }
634
650
  this.$xdShowLoading({});
635
651
  jfbRootExec("getListCardBind", {
636
652
  vm: this,
@@ -741,6 +757,30 @@ export default {
741
757
  padding: unit(55, rpx) unit(35, rpx);
742
758
  color: #333;
743
759
 
760
+ .show_type_tab{
761
+ display: flex;
762
+ align-items: center;
763
+ margin-bottom: 24rpx;
764
+ .type_item{
765
+ padding: unit(5, rpx) unit(22, rpx);
766
+ text-align: center;
767
+ line-height: unit(60, rpx);
768
+ border-radius: unit(60, rpx);
769
+ color: #B8B7BE;
770
+ & + .type_item{
771
+ margin-left: unit(30, rpx);
772
+ }
773
+ &.active{
774
+ background-color: var(--main-color);
775
+ color: #FFFFFF;
776
+ }
777
+ }
778
+ }
779
+ .tab_index_wrap{
780
+ display: flex;
781
+ align-items: center;
782
+ }
783
+
744
784
  &-empty {
745
785
  color: #888;
746
786
  font-size: unit(24,rpx);
@@ -889,12 +929,13 @@ export default {
889
929
 
890
930
  &-tab {
891
931
  display: flex;
892
- align-items: center;
932
+ flex-direction: column;
933
+ align-items: flex-start;
893
934
  font-size: unit(28, rpx);
894
935
  margin-bottom: unit(46, rpx);
895
936
  margin-top: unit(46, rpx);
896
937
 
897
- & > view {
938
+ .tab_item {
898
939
  // width: unit(214, rpx);
899
940
  // height: unit(60, rpx);
900
941
  padding: unit(5, rpx) unit(22, rpx);
@@ -902,6 +943,22 @@ export default {
902
943
  line-height: unit(60, rpx);
903
944
  margin-right: unit(30, rpx);
904
945
  border-radius: unit(60, rpx);
946
+ color: #B8B7BE;
947
+ background: #FFFFFF;
948
+ &.active{
949
+ color: #FFFFFF;
950
+ background-color: var(--main-color);
951
+ }
952
+ &.sub{
953
+ border-radius: unit(8, rpx);
954
+ line-height: unit(40, rpx);
955
+ color: #FFFFFF;
956
+ background-color: #B8B7BE;
957
+ &.active{
958
+ color: var(--main-color);
959
+ background-color: var(--main-alpha-color);
960
+ }
961
+ }
905
962
  }
906
963
  }
907
964
 
@@ -39,4 +39,17 @@ module.exports = [
39
39
  },
40
40
  disabled: true,
41
41
  },
42
+ {
43
+ mapFnName: "generateQrCode",
44
+ title: "生成二维码",
45
+ path: "/common/v1/image/qrcode",
46
+ isRule: false,
47
+ params: {
48
+ code_content: ['二维码内容', 'String', true],
49
+ size: ['二维码大小', 'Number', true],
50
+ margin: ['二维码边距', 'Number', true]
51
+ },
52
+ isConsole: true,
53
+ disabled: true
54
+ }
42
55
  ];
@@ -38,7 +38,7 @@ export default {
38
38
  ]
39
39
  },
40
40
  {
41
- label: '分享图片:', //label
41
+ label: '分享图片(适用于小程序):', //label
42
42
  ele: 'xd-upload', //package 名称
43
43
  valueKey: 'shareImage', //form[valueKey]
44
44
  value: data.shareImage || null, //v-model
@@ -60,6 +60,29 @@ export default {
60
60
  { required: true, message: '请上传图片', trigger: ['blur', 'change'] },
61
61
  ]
62
62
  },
63
+ {
64
+ label: '分享图片(适用于下载保存):', //label
65
+ ele: 'xd-upload', //package 名称
66
+ valueKey: 'shareDownloadImage', //form[valueKey]
67
+ value: data.shareDownloadImage || null, //v-model
68
+ defaultValue: data.shareDownloadImage || null, //默认图片对象
69
+ groupKey: "style",
70
+ slot: true, //按钮是否使用slot
71
+ oneWidth: 218, //单个图片显示宽度
72
+ oneHeight: 323, //单个图片显示高度
73
+ elinputClassName: 'input40',
74
+ tipsformet: '上传文件格式:@imageType@,不超过@size@MB.建议尺寸:654*968px.',
75
+ type: ['jpg', 'png', 'jpeg'],
76
+ styleType: 'one', //其值:one=>单文件上传 auth=>证件正反面上传 list=>多文件上传
77
+ uploadType: 'aliyun', //''=>API服务上传 qiniu=>七牛云OSS上传 aliyun=> 阿里云OSS上传
78
+ size: 5, //5M
79
+ action: 'aliyun',
80
+ sort: true, //当上传图片列表时候,是否启用排序
81
+ maxlen: 100, //当上传图片列表时候,最大数量数量
82
+ rules: [
83
+ { required: true, message: '请上传图片', trigger: ['blur', 'change'] },
84
+ ]
85
+ },
63
86
  ].filter(i=>i)
64
87
  },
65
88
  advanced: [],
@@ -130,9 +130,13 @@
130
130
  </button>
131
131
  <!-- #endif -->
132
132
  <!-- #ifdef H5 -->
133
- <xd-button @click="handleShare" width="360rpx" type="primary"
134
- >通知微信好友</xd-button
135
- >
133
+ <view style="display: flex;align-items: center;justify-content: space-between;">
134
+ <xd-button @click="handleShare" width="260rpx" type="primary" size="small"
135
+ >通知微信好友</xd-button>
136
+ <xd-button @click="toSeeShareImg" width="260rpx" type="primary" size="small"
137
+ >查看分享图片</xd-button>
138
+ </view>
139
+
136
140
  <!-- #endif -->
137
141
  </view>
138
142
  </xd-dailog>
@@ -149,6 +153,16 @@
149
153
  >
150
154
  </view>
151
155
  </xd-dailog>
156
+ <view class="share_card_dialog" v-show="showShareCard">
157
+ <view class="share_modal" @click="showShareCard=false"></view>
158
+ <view class="share_content">
159
+ <view class="share_close" @click="showShareCard=false">
160
+ <xd-font-icon icon="iconguanbi" :size="32" color="#FFFFFF"></xd-font-icon>
161
+ </view>
162
+ <image :src="canvasUrl" v-if="canvasUrl" class="share_img" style="width: 654rpx; height: 968rpx;"></image>
163
+ </view>
164
+ </view>
165
+ <canvas class="renderCanvas" canvas-id="shareCanvas" id="shareCanvas" style="width: 654rpx; height: 968rpx;" ></canvas>
152
166
  </view>
153
167
  </view>
154
168
  </template>
@@ -183,13 +197,21 @@ export default {
183
197
  get_url: null,
184
198
  back_url: null,
185
199
  shareImage: "",
200
+ shareDownloadImage: "",
186
201
  isPreview: false,
187
202
  errMsg: "",
188
203
  resultDialog: false,
204
+ showShareDialog: true,
205
+ imageCache: {},
206
+ showShareCard: false,
207
+ canvasUrl: "",
189
208
  };
190
209
  },
191
210
  computed: {
192
211
  ...mapState(["shareInfo"]),
212
+ ...mapState({
213
+ brandInfo: state => state.brandInfo
214
+ }),
193
215
  prod_bottom() {
194
216
  return this.fixedStyle({ height: 0, zIndex: 111 });
195
217
  },
@@ -211,6 +233,20 @@ export default {
211
233
  this.card_number = options.card_number;
212
234
  await this.getDetail();
213
235
  },
236
+ toSetShareImg(){
237
+ if(this.info.transfer_record && this.info.transfer_record.transfer_auth_code){
238
+ let url = `${document.location.origin}/${this.projectAttr.deploy_dir}${this.get_url}?transfer_auth_code=${this.info.transfer_record.transfer_auth_code}`;
239
+ let ctx = uni.createCanvasContext("shareCanvas");
240
+ console.log(ctx);
241
+ ctx.save();
242
+ ctx.drawImage(this.shareDownloadImage, 0, 0, 654*this.$rpxNum, 968*this.$rpxNum);
243
+ ctx.restore();
244
+
245
+ let qrImg = this.brandInfo['api_host'] + `/common/v1/image/qrcode?code_content=${url}`
246
+ ctx.drawImage(qrImg, 200*this.$rpxNum, 500*this.$rpxNum, 250*this.$rpxNum, 250*this.$rpxNum);
247
+ ctx.draw();
248
+ }
249
+ },
214
250
  getDetail() {
215
251
  this.$xdShowLoading({});
216
252
  jfbRootExec("getBaseByIdCardDetailGive", {
@@ -244,6 +280,9 @@ export default {
244
280
  return this.info.business_codes.includes(item.business_code);
245
281
  });
246
282
  }
283
+ setTimeout(() => {
284
+ this.toSetShareImg()
285
+ }, 300);
247
286
  })
248
287
  .catch((err) => {
249
288
  this.$xdHideLoading({});
@@ -266,6 +305,7 @@ export default {
266
305
  "content.shareImage",
267
306
  { url: "" }
268
307
  ).url;
308
+ this.shareDownloadImage = getServiceUrl(getContainerPropsValue(container, 'content.shareDownloadImage', { url: '' }).url);
269
309
  },
270
310
  handleCancel() {
271
311
  this.resultDialog = false;
@@ -329,10 +369,27 @@ export default {
329
369
  });
330
370
  // #endif
331
371
  },
372
+ toSeeShareImg(){
373
+ this.dialogShow = false;
374
+ this.showShareCard = true;
375
+ if(this.canvasUrl) return;
376
+ this.$nextTick(() => {
377
+ uni.canvasToTempFilePath({
378
+ canvasId: "shareCanvas",
379
+ success: (res) => {
380
+ this.canvasUrl = res.tempFilePath;
381
+ console.log(res, 'canvasUrl');
382
+ },
383
+ fail: (err) => {
384
+ this.$xdHideLoading({});
385
+ console.log(err);
386
+ },
387
+ })
388
+ })
389
+ },
332
390
  handleShare() {
333
391
  //#ifdef H5
334
- let share = `${document.location.origin}/${this.projectAttr.deploy_dir}${this.get_url}?transfer_auth_code=${this.info.transfer_record.transfer_auth_code}`;
335
- this.copy(share);
392
+ this.dialogShow = true;
336
393
  // #endif
337
394
  // #ifdef MP-WEIXIN
338
395
  this.setShareInfo({
@@ -361,6 +418,58 @@ export default {
361
418
  &__body {
362
419
  padding: 28rpx;
363
420
  color: #333;
421
+ .renderCanvas{
422
+ position: fixed;
423
+ bottom: -999999px;
424
+ }
425
+ .share_card_dialog{
426
+ .share_modal{
427
+ width: 100vh;
428
+ height: 100vh;
429
+ position: fixed;
430
+ top: 0;
431
+ left: 0;
432
+ background: rgba(0, 0, 0, 0.7);
433
+ z-index: 112;
434
+ }
435
+ .share_content{
436
+ width: 654rpx;
437
+ height: 968rpx;
438
+ position: fixed;
439
+ top: 50%;
440
+ left: 50%;
441
+ transform: translate(-50%, -50%);
442
+ z-index: 113;
443
+ &::before{
444
+ content: "长按图片,并选择保存到手机";
445
+ position: absolute;
446
+ top: -70rpx;
447
+ left: 0;
448
+ width: 100%;
449
+ height: 100%;
450
+ font-size: 32rpx;
451
+ color: #FFFFFF;
452
+ text-align: center;
453
+ font-weight: 500;
454
+ }
455
+ .share_close{
456
+ position: absolute;
457
+ top: 0;
458
+ right: 0;
459
+ width: 80rpx;
460
+ height: 80rpx;
461
+ display: flex;
462
+ justify-content: center;
463
+ align-items: center;
464
+ z-index: 9999;
465
+ }
466
+ .share_img{
467
+ position: absolute;
468
+ top: 0;
469
+ left: 0;
470
+ }
471
+ }
472
+ }
364
473
  .qrcode_card {
365
474
  position: relative;
366
475
  border-radius: unit(16, rpx);
@@ -67,6 +67,17 @@ export default {
67
67
  inline: false,
68
68
  notice: '当未设置文案时,页面默认展示为"<span style="color:red">购买新卡</span>",建议不超过<span style="color:red">4</span>个汉字'
69
69
  },
70
+ {
71
+ label: "优惠券是否单独展示:",
72
+ ele: 'xd-radio',
73
+ valueKey: 'show_coupon_tab',
74
+ groupKey: 'content',
75
+ value: data.show_coupon_tab || 'N',
76
+ list: [
77
+ { label: "是", value: "Y" },
78
+ { label: "否", value: "N" }
79
+ ],
80
+ },
70
81
  {
71
82
  label: '填充设置:',
72
83
  ele: 'xd-margin-padding',
@@ -13,7 +13,9 @@
13
13
  <view class="jfb-base-card-v2__edit-icon" @click="delEdit">删除</view>
14
14
  </view>
15
15
  <!-- #endif -->
16
- <view class="jfb-base-card-v2__body">
16
+ <view class="jfb-base-card-v2__body" :style="{
17
+ '--main-color': mainColor,
18
+ }">
17
19
  <view v-if="loadingCardList">
18
20
  <view
19
21
  class="jfb-base-card__body-card skeleton-card"
@@ -49,6 +51,12 @@
49
51
  class="jfb-base-card__body-card"
50
52
  :style="{padding: marginUi}"
51
53
  >
54
+ <view class="card_filter">
55
+ <view v-if="show_coupon_tab==='Y'" class="show_type_tab">
56
+ <view class="type_item" :class="{active: show_type==='normal'}" @click="switchShowType('normal')">已绑定票券</view>
57
+ <view class="type_item" :class="{active: show_type==='coupon'}" @click="switchShowType('coupon')">优惠券</view>
58
+ </view>
59
+ </view>
52
60
  <view v-if="cardList&&cardList.length>0">
53
61
  <view
54
62
  v-for="(item, index) in cardList"
@@ -153,12 +161,15 @@
153
161
  ],
154
162
  data() {
155
163
  return {
164
+ options: {},
156
165
  cardList: [],
157
166
  inCallback: "",
158
167
  mainBorderColor:'',
159
168
  mainSubBorderColor:'',
169
+ show_type: "normal",
160
170
 
161
171
  //面板
172
+ show_coupon_tab: "N",
162
173
  cardInfoPath: "", //卡券详情
163
174
  cardBindPath: "",
164
175
  orderListPath: "",
@@ -205,6 +216,7 @@
205
216
  },
206
217
  methods: {
207
218
  onJfbLoad(options) {
219
+ this.options = options;
208
220
  let { inCallback } = options;
209
221
  if(!inCallback) this.$storage.remove("inCallback"); //作为入口
210
222
  else {
@@ -219,24 +231,7 @@
219
231
  }
220
232
  }
221
233
  this.inCallback = inCallback || this.settings.index;
222
-
223
-
224
- let params = {is_all: 'Y'};
225
- if (options['jfb_business_code']) {
226
- params['card_business_code'] = options['jfb_business_code'];
227
- }
228
-
229
- jfbRootExec("getListCardBind", {
230
- vm: this,
231
- data: params,
232
- }).then((res) => {
233
- this.loadingCardList = false;
234
- this.cardList = res.list.map((item) => {
235
- item['card_point'] = this.$xdUniHelper.divisionFloatNumber(item.card_point,100);
236
- item['other_card_point'] = this.$xdUniHelper.divisionFloatNumber(item.other_card_point,100);
237
- return item;
238
- }).filter((item) => item["is_valid"] === "Y");
239
- })
234
+ this.getList();
240
235
  },
241
236
 
242
237
  /**
@@ -255,9 +250,33 @@
255
250
  this.isShowBuy = getContainerPropsValue(container, "content.isShowBuy", "N");
256
251
  this.buy_name = getContainerPropsValue(container, "content.buy_name", "购买新卡");
257
252
  this.buy_new_url = getContainerPropsValue(container,"content.buy_new_url",{value: ""}).value;
258
-
253
+ this.show_coupon_tab = getContainerPropsValue(container, "content.show_coupon_tab", "N");
259
254
  },
255
+ getList(){
256
+ let options = this.options;
257
+ let params = {is_all: 'Y'};
258
+ if (options['jfb_business_code']) {
259
+ params['card_business_code'] = options['jfb_business_code'];
260
+ }
261
+ if(this.show_coupon_tab === 'Y'){
262
+ params.show_type = this.show_type;
263
+ }
260
264
 
265
+ jfbRootExec("getListCardBind", {
266
+ vm: this,
267
+ data: params,
268
+ }).then((res) => {
269
+ this.loadingCardList = false;
270
+ this.cardList = res.list.map((item) => {
271
+ item['card_point'] = this.$xdUniHelper.divisionFloatNumber(item.card_point,100);
272
+ item['other_card_point'] = this.$xdUniHelper.divisionFloatNumber(item.other_card_point,100);
273
+ return item;
274
+ }).filter((item) => item["is_valid"] === "Y");
275
+ })
276
+ },
277
+ switchShowType(type){
278
+ this.show_type = type;
279
+ },
261
280
  handleBindLogin(item){
262
281
  this.$xdShowLoading({});
263
282
  jfbRootExec("loginCardBind", {
@@ -324,6 +343,25 @@
324
343
 
325
344
  .jfb-base-card-v2 {
326
345
  &__body{
346
+ .show_type_tab{
347
+ display: flex;
348
+ align-items: center;
349
+ margin-bottom: 24rpx;
350
+ .type_item{
351
+ padding: unit(5, rpx) unit(22, rpx);
352
+ text-align: center;
353
+ line-height: unit(60, rpx);
354
+ border-radius: unit(60, rpx);
355
+ color: #B8B7BE;
356
+ & + .type_item{
357
+ margin-left: unit(30, rpx);
358
+ }
359
+ &.active{
360
+ background-color: var(--main-color);
361
+ color: #FFFFFF;
362
+ }
363
+ }
364
+ }
327
365
  .bottom_fix{
328
366
  position: fixed;
329
367
  right: 0;
@@ -54,6 +54,17 @@ export default {
54
54
  inline: false,
55
55
  notice: '当未设置文案时,页面默认展示为"<span style="color:red">购买新卡</span>",建议不超过<span style="color:red">4</span>个汉字'
56
56
  },
57
+ {
58
+ label: "优惠券是否单独展示:",
59
+ ele: 'xd-radio',
60
+ valueKey: 'show_coupon_tab',
61
+ groupKey: 'content',
62
+ value: data.show_coupon_tab || 'N',
63
+ list: [
64
+ { label: "是", value: "Y" },
65
+ { label: "否", value: "N" }
66
+ ],
67
+ },
57
68
  {
58
69
  label: '绑定新票券地址:',
59
70
  ele: 'xd-select-pages-path',