jufubao-base 1.0.238-beta1 → 1.0.238-beta67

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.238-beta1",
3
+ "version": "1.0.238-beta67",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -183,7 +183,7 @@
183
183
  :style="{marginRight: '18rpx'}"
184
184
  :color="mainColor"
185
185
  ></xd-font-icon>
186
- <view class="card_name_text">{{ item.card_type_name }}</view>
186
+ <view class="card_name_text">{{ item.card_type_name }}-{{item.entries.length}}</view>
187
187
  </view>
188
188
  <view>
189
189
  <view>{{ item.card_number }}{{showIndex?(':' + index):''}}</view>
@@ -564,8 +564,9 @@ export default {
564
564
  * @param item
565
565
  */
566
566
  handleBindLogin(item) {
567
+ if(this.$configProject.isPreview) return;
568
+ //普通卡
567
569
  if (this.tabIndex === 1) {
568
-
569
570
  //无效卡
570
571
  if (item["is_valid"] !== "Y") {
571
572
  console.log(
@@ -576,6 +577,8 @@ export default {
576
577
  );
577
578
  return;
578
579
  }
580
+
581
+ //正常卡券
579
582
  this.$xdShowLoading({});
580
583
  jfbRootExec("loginCardBind", {
581
584
  vm: this,
@@ -587,32 +590,30 @@ export default {
587
590
  //#ifdef MP-WEIXIN
588
591
  if (this.jfbAuthorize !== null) {
589
592
  this.jfbAuthorize.setCardToken(res);
590
- // this.jfbAuthorize.setToken("card", res["card_token"], {
591
- // expires: res["card_expire_in"] / 60 / 60,
592
- // });
593
593
  }
594
594
  //#endif
595
595
 
596
- if (this.$configProject.isPreview) {
597
- console.log("handleBindLogin", "预览模式不跳转", this.inCallback);
598
- } else {
599
- this.$xdUniHelper.redirectTo({
600
- url: this.inCallback,
601
- });
596
+ //单业务线卡券直接跳转到业务线
597
+ if(item.entries.length ===1) {
598
+ this.handleOneBussClick(item.entries[0]);
599
+ return
602
600
  }
601
+
602
+ //其他情况
603
+ this.$xdUniHelper.redirectTo({
604
+ url: this.inCallback,
605
+ });
603
606
  })
604
607
  .catch((res) => {
605
608
  this.$xdHideLoading();
606
609
  });
607
- } else {
608
- this.$xdUniHelper.navigateTo(
609
- {
610
- url: `${this.changeUrl}?card_number=${item["card_number"]}`,
611
- },
612
- false
613
- );
610
+ }
611
+ //转移卡券
612
+ else {
613
+ this.$xdUniHelper.navigateTo({url: `${this.changeUrl}?card_number=${item["card_number"]}`}, false);
614
614
  }
615
615
  },
616
+
616
617
  toDetail(item) {
617
618
  this.$xdUniHelper.navigateTo(
618
619
  {
@@ -652,7 +653,7 @@ export default {
652
653
  if(this.show_coupon_tab === 'Y'){
653
654
  params.show_type = this.show_type;
654
655
  }
655
- if(this.entryGroupId && this.show_type === 'normal') params['group_id'] = this.entryGroupId;
656
+ if(this.entryGroupId) params['group_id'] = this.entryGroupId;
656
657
  this.$xdShowLoading({});
657
658
  jfbRootExec("getListCardBind", {
658
659
  vm: this,
@@ -674,12 +675,18 @@ export default {
674
675
  ),
675
676
  };
676
677
  });
678
+
679
+ //过滤入口配置
680
+ res['site_entry_settings'] = this.filterNotSupportEntry(res['site_entry_settings']);
681
+
677
682
  this.cardList = res.list.filter((item,index) => {
678
683
  return item["is_valid"] === "Y";
679
684
  }).map((item,index)=>{
680
685
  item['index'] = index;
686
+ item['entries'] = this.getEntry(item['business_codes'], res['site_entry_settings'])
681
687
  return item
682
688
  });
689
+
683
690
  console.warn(`cardList:${this.cardList.length}`)
684
691
  this.disableList = res.list.filter((item) => {
685
692
  return item["is_valid"] === "N";
@@ -690,7 +697,6 @@ export default {
690
697
  })
691
698
  console.warn(`changeList:${this.changeList.length}`)
692
699
  this.showList = this.getPageCardContent(this.cardList);
693
- // this.showList = []
694
700
  if(this.hasContent) this.offsetIndex++;
695
701
  this.$xdHideLoading();
696
702
  })
@@ -812,68 +812,69 @@ export default {
812
812
  },
813
813
 
814
814
  handleClick(entry){
815
- if (this.$configProject['isPreview']) return;
816
-
817
- //登陆成功,有回调地址返回回调地址
818
- if(this.inCallbackUrlOrg) {
819
- this.$xdUniHelper.redirectTo({
820
- url:this.inCallback
821
- }, false);
822
- return;
823
- }
824
-
825
- const {dir, path, host, appType} = entry['redirect_data'];
826
- let regHttp = /^(\/\/|http:\/\/|https:\/\/).+$/;
827
- let regSp = /(-apiuri\/v)/;
828
-
829
- if(!appType) entry.redirect_data.appType = 'h5';
830
- let nsp = Base64.encodeURI(JSON.stringify({business_code: entry['business_code']}));
831
-
832
- //外站配置地址
833
- if(entry.redirect_type === 'URL') {
834
- if(regHttp.test(entry.redirect_data['path']) || regSp.test(entry.redirect_data['path'])) {
835
- let urlPath = entry.redirect_data['path'];
836
- if(urlPath.indexOf('?') === -1) urlPath = `${urlPath}?x-common=${nsp}&vs=${new Date().getTime()}`;
837
- else urlPath = `${urlPath}&x-common=${nsp}&vs=${new Date().getTime()}`;
838
- this.$xdUniHelper.redirectTo({
839
- url:urlPath
840
- }, false)
841
- }
842
- else {
843
- console.error(`配置错误:${entry.redirect_data['path']}`);
844
- throw new Error(`配置错误:${entry.redirect_data['path']}`)
845
- }
846
- return
847
- }
848
-
849
- //站内应用处理
850
- let jumpUrl = path;
851
- let cardPathStr = '';
852
- const {deploy_dir} = this.projectAttr;
853
- if(host === this.projectAttr.host && deploy_dir !== dir){
854
- jumpUrl = `//${host}/${dir}${path}`;
855
- //#ifdef MP-WEIXIN
856
- jumpUrl = `https:${jumpUrl}`;
857
- //#endif
858
- }
859
-
860
-
861
- //#ifdef MP-WEIXIN
862
- //获取自定义卡券登录地址(微信小程序跳转到H5平台起作用)
863
- if(entry.redirect_data.appType === 'h5') {
864
- const custom_redirect_data = this.$xdUniHelper.checkVarType(entry['custom_redirect_data']) === 'object'?entry['custom_redirect_data']:{};
865
- const cardPathObject = this.getCardPath(custom_redirect_data);
866
- if(cardPathObject !== null) {
867
- const {cardPath, cardSelf} =cardPathObject
868
- if(cardPath) cardPathStr = `&card-login=${encodeURIComponent(cardPath)}&cardSelf=${cardSelf}`
869
- }
870
- }
871
- //#endif
872
-
873
- jumpUrl = `${jumpUrl}?x-common=${nsp}&vs=${new Date().getTime()}${cardPathStr}`;
874
- console.warn(`entry.path:${jumpUrl}`);
875
- if(regHttp.test(jumpUrl)) this.$xdUniHelper.redirectTo({url:jumpUrl}, false)
876
- else this.$xdUniHelper.navigateTo({url:jumpUrl}, false)
815
+ this.handleOneBussClick(entry);
816
+ // if (this.$configProject['isPreview']) return;
817
+ //
818
+ // //登陆成功,有回调地址返回回调地址
819
+ // if(this.inCallbackUrlOrg) {
820
+ // this.$xdUniHelper.redirectTo({
821
+ // url:this.inCallback
822
+ // }, false);
823
+ // return;
824
+ // }
825
+ //
826
+ // const {dir, path, host, appType} = entry['redirect_data'];
827
+ // let regHttp = /^(\/\/|http:\/\/|https:\/\/).+$/;
828
+ // let regSp = /(-apiuri\/v)/;
829
+ //
830
+ // if(!appType) entry.redirect_data.appType = 'h5';
831
+ // let nsp = Base64.encodeURI(JSON.stringify({business_code: entry['business_code']}));
832
+ //
833
+ // //外站配置地址
834
+ // if(entry.redirect_type === 'URL') {
835
+ // if(regHttp.test(entry.redirect_data['path']) || regSp.test(entry.redirect_data['path'])) {
836
+ // let urlPath = entry.redirect_data['path'];
837
+ // if(urlPath.indexOf('?') === -1) urlPath = `${urlPath}?x-common=${nsp}&vs=${new Date().getTime()}`;
838
+ // else urlPath = `${urlPath}&x-common=${nsp}&vs=${new Date().getTime()}`;
839
+ // this.$xdUniHelper.redirectTo({
840
+ // url:urlPath
841
+ // }, false)
842
+ // }
843
+ // else {
844
+ // console.error(`配置错误:${entry.redirect_data['path']}`);
845
+ // throw new Error(`配置错误:${entry.redirect_data['path']}`)
846
+ // }
847
+ // return
848
+ // }
849
+ //
850
+ // //站内应用处理
851
+ // let jumpUrl = path;
852
+ // let cardPathStr = '';
853
+ // const {deploy_dir} = this.projectAttr;
854
+ // if(host === this.projectAttr.host && deploy_dir !== dir){
855
+ // jumpUrl = `//${host}/${dir}${path}`;
856
+ // //#ifdef MP-WEIXIN
857
+ // jumpUrl = `https:${jumpUrl}`;
858
+ // //#endif
859
+ // }
860
+ //
861
+ //
862
+ // //#ifdef MP-WEIXIN
863
+ // //获取自定义卡券登录地址(微信小程序跳转到H5平台起作用)
864
+ // if(entry.redirect_data.appType === 'h5') {
865
+ // const custom_redirect_data = this.$xdUniHelper.checkVarType(entry['custom_redirect_data']) === 'object'?entry['custom_redirect_data']:{};
866
+ // const cardPathObject = this.getCardPath(custom_redirect_data);
867
+ // if(cardPathObject !== null) {
868
+ // const {cardPath, cardSelf} =cardPathObject
869
+ // if(cardPath) cardPathStr = `&card-login=${encodeURIComponent(cardPath)}&cardSelf=${cardSelf}`
870
+ // }
871
+ // }
872
+ // //#endif
873
+ //
874
+ // jumpUrl = `${jumpUrl}?x-common=${nsp}&vs=${new Date().getTime()}${cardPathStr}`;
875
+ // console.warn(`entry.path:${jumpUrl}`);
876
+ // if(regHttp.test(jumpUrl)) this.$xdUniHelper.redirectTo({url:jumpUrl}, false)
877
+ // else this.$xdUniHelper.navigateTo({url:jumpUrl}, false)
877
878
  },
878
879
 
879
880
  toDetail(item, out=true) {
@@ -7,6 +7,28 @@ export default {
7
7
  style: [],
8
8
  content: (data) => {
9
9
  return [
10
+ {
11
+ label: '选择综合入口类型:',
12
+ ele: 'xd-site-select-list',
13
+ valueKey: 'entryGroupId',
14
+ value: data.entryGroupId || 'default',
15
+ placeholder: '请选择综合入口类型',
16
+ multiple: false,
17
+ groupKey:'content',
18
+ className: 'input50',
19
+ rules: [
20
+ {required: true, message: '请选择综合入口类型', trigger: ['blur', 'change']}
21
+ ],
22
+ handleCustom({action, data}) {
23
+ XdBus.getParentApi('getEntryGroupOption')({key: Date.now()})
24
+ .then(res => {
25
+ data.cb(res.list)
26
+ })
27
+ .catch(error => {
28
+ console.error(error);
29
+ });
30
+ },
31
+ },
10
32
  {
11
33
  label: '票券登录文案:',
12
34
  ele: 'el-input',
@@ -183,7 +183,8 @@
183
183
  inCallbackUrlOrg:'',//是否带有回调地址
184
184
  buy_new_url: '',
185
185
  isShowBuy: "",
186
- buy_name: ""
186
+ buy_name: "",
187
+ entryGroupId:'default'
187
188
  }
188
189
  },
189
190
  watch: {
@@ -231,9 +232,15 @@
231
232
  }
232
233
  }
233
234
  this.inCallback = inCallback || this.settings.index;
235
+
234
236
  this.getList();
235
237
  },
236
238
 
239
+ onJfbShow(options) {
240
+ this.cardList = [];
241
+ this.onJfbLoad(options);
242
+ },
243
+
237
244
  /**
238
245
  * @description 监听事件变化
239
246
  * @param container {object} 业务组件对象自己
@@ -251,40 +258,51 @@
251
258
  this.buy_name = getContainerPropsValue(container, "content.buy_name", "购买新卡");
252
259
  this.buy_new_url = getContainerPropsValue(container,"content.buy_new_url",{value: ""}).value;
253
260
  this.show_coupon_tab = getContainerPropsValue(container, "content.show_coupon_tab", "N");
261
+ this.entryGroupId = getContainerPropsValue(container,"content.entryGroupId","default");
254
262
  },
263
+
255
264
  getList(){
256
265
  let options = this.options;
257
- let params = {is_all: 'Y'};
266
+ let params = {is_all: 'Y',is_show_entry_settings: 'Y'};
258
267
  if (options['jfb_business_code']) {
259
268
  params['card_business_code'] = options['jfb_business_code'];
260
269
  }
261
270
  if(this.show_coupon_tab === 'Y'){
262
271
  params.show_type = this.show_type;
263
272
  }
264
-
273
+ if(this.entryGroupId) params['group_id'] = this.entryGroupId;
265
274
  jfbRootExec("getListCardBind", {
266
275
  vm: this,
267
276
  data: params,
268
277
  }).then((res) => {
269
278
  this.loadingCardList = false;
279
+ //过滤入口配置
280
+ res['site_entry_settings'] = this.filterNotSupportEntry(res['site_entry_settings']);
281
+
270
282
  this.cardList = res.list.map((item) => {
271
283
  item['card_point'] = this.$xdUniHelper.divisionFloatNumber(item.card_point,100);
272
284
  item['other_card_point'] = this.$xdUniHelper.divisionFloatNumber(item.other_card_point,100);
285
+ item['entries'] = this.getEntry(item['business_codes'], res['site_entry_settings'])
273
286
  return item;
274
287
  }).filter((item) => item["is_valid"] === "Y");
275
288
  })
276
289
  },
290
+
277
291
  switchShowType(type){
278
292
  this.show_type = type;
293
+ this.getList();
279
294
  },
295
+
280
296
  handleBindLogin(item){
297
+ if(this.$configProject.isPreview) return;
298
+
281
299
  this.$xdShowLoading({});
282
300
  jfbRootExec("loginCardBind", {
283
301
  vm: this,
284
302
  data: { card_number: item["card_number"] },
285
303
  })
286
- .then((res) => {
287
- this.$xdHideLoading();
304
+ .then(async (res) => {
305
+ await this.$xdHideLoading();
288
306
 
289
307
  //#ifdef MP-WEIXIN
290
308
  if (this.jfbAuthorize !== null) {
@@ -292,21 +310,23 @@
292
310
  }
293
311
  //#endif
294
312
 
295
- if (this.$configProject.isPreview) {
296
- console.log("handleBindLogin", "预览模式不跳转", this.inCallback);
297
- }
298
- else {
299
- console.warn(`handleBindLogin: ${this.inCallback}`);
300
- this.$xdUniHelper.redirectTo({
301
- url: this.inCallback,
302
- });
313
+ //单业务线卡券直接跳转到业务线
314
+ if(item.entries.length ===1) {
315
+ this.handleOneBussClick(item.entries[0]);
316
+ return
303
317
  }
318
+
319
+ //其他情况
320
+ this.$xdUniHelper.redirectTo({
321
+ url: this.inCallback,
322
+ });
304
323
  })
305
324
  .catch((res) => {
306
325
  console.error(res);
307
326
  this.$xdHideLoading();
308
327
  });
309
328
  },
329
+
310
330
  toBindCard(){
311
331
  let path = this.getUrlCallback(this.cardBindPath)
312
332
  this.$xdUniHelper.navigateTo({
@@ -7,6 +7,28 @@ export default {
7
7
  style: [],
8
8
  content: (data) => {
9
9
  return [
10
+ {
11
+ label: '选择综合入口类型:',
12
+ ele: 'xd-site-select-list',
13
+ valueKey: 'entryGroupId',
14
+ value: data.entryGroupId || 'default',
15
+ placeholder: '请选择综合入口类型',
16
+ multiple: false,
17
+ groupKey:'content',
18
+ className: 'input50',
19
+ rules: [
20
+ {required: true, message: '请选择综合入口类型', trigger: ['blur', 'change']}
21
+ ],
22
+ handleCustom({action, data}) {
23
+ XdBus.getParentApi('getEntryGroupOption')({key: Date.now()})
24
+ .then(res => {
25
+ data.cb(res.list)
26
+ })
27
+ .catch(error => {
28
+ console.error(error);
29
+ });
30
+ },
31
+ },
10
32
  {
11
33
  label: '票券登录文案:',
12
34
  ele: 'el-input',
@@ -39,7 +39,8 @@
39
39
  @bindLogin="handleBindLogin(item)"
40
40
  ></xd-card-v2>
41
41
  </view>
42
- <view v-else class="empty_data">暂时没有票券
42
+ <view v-else class="empty_data">
43
+ <view>暂时没有票券</view>
43
44
  <view v-if="isShowBuy==='Y'" class="buy_new" @click="toBuyNew" :style="{color: mainColor}"><view>{{buy_name}}</view> <xd-font-icon size="20" icon="iconxiangyou_xian"></xd-font-icon></view>
44
45
  </view>
45
46
  </template>
@@ -62,6 +63,7 @@
62
63
  import extsMixins from "@/mixins/extsMixins";
63
64
  import {Base64} from "js-base64";
64
65
  import {mapState} from "vuex";
66
+ import colorCardMixins from "@/mixins/colorCardMixins";
65
67
 
66
68
  export default {
67
69
  name: "JfbBaseCardV3",
@@ -72,7 +74,7 @@
72
74
  XdCardV2Skeleton
73
75
  },
74
76
  mixins: [
75
- componentsMixins, extsMixins, JfbBaseCardV3Mixin
77
+ componentsMixins, extsMixins, JfbBaseCardV3Mixin,colorCardMixins
76
78
  ],
77
79
  data() {
78
80
  return {
@@ -92,7 +94,8 @@
92
94
  inCallbackUrlOrg:'',//是否带有回调地址
93
95
  buy_new_url: '',
94
96
  isShowBuy: "",
95
- buy_name: ""
97
+ buy_name: "",
98
+ entryGroupId:'default'
96
99
  }
97
100
  },
98
101
  watch: {
@@ -130,6 +133,7 @@
130
133
 
131
134
  this.getList();
132
135
  },
136
+
133
137
  /**
134
138
  * @description 监听事件变化
135
139
  * @param container {object} 业务组件对象自己
@@ -145,30 +149,37 @@
145
149
  this.buy_new_url = getContainerPropsValue(container,"content.buy_new_url",{value: ""}).value;
146
150
  this.show_coupon_tab = getContainerPropsValue(container, "content.show_coupon_tab", "N");
147
151
  },
152
+
148
153
  getList(){
149
154
  let options = this.options;
150
- let params = {is_all: 'Y'};
155
+ let params = {is_all: 'Y',is_show_entry_settings: 'Y'};
151
156
  if (options['jfb_business_code']) {
152
157
  params['card_business_code'] = options['jfb_business_code'];
153
158
  }
154
159
  if(this.show_coupon_tab === 'Y'){
155
160
  params.show_type = this.show_type;
156
161
  }
157
-
162
+ if(this.entryGroupId) params['group_id'] = this.entryGroupId;
158
163
  jfbRootExec("getListCardBind", {
159
164
  vm: this,
160
165
  data: params,
161
166
  }).then((res) => {
162
167
  this.loadingCardList = false;
168
+
169
+ //过滤入口配置
170
+ res['site_entry_settings'] = this.filterNotSupportEntry(res['site_entry_settings']);
171
+
163
172
  this.cardList = res.list.map((item) => {
164
173
  item['card_point'] = this.$xdUniHelper.divisionFloatNumber(item.card_point,100);
165
174
  item['other_card_point'] = this.$xdUniHelper.divisionFloatNumber(item.other_card_point,100);
175
+ item['entries'] = this.getEntry(item['business_codes'], res['site_entry_settings'])
166
176
  return item;
167
177
  }).filter((item) => item["is_valid"] === "Y");
168
178
  });
169
179
  },
170
180
  switchShowType(type){
171
181
  this.show_type = type;
182
+ this.getList();
172
183
  },
173
184
  toBindCard(){
174
185
  let path = this.getUrlCallback(this.cardBindPath)
@@ -189,9 +200,9 @@
189
200
  * @param item
190
201
  */
191
202
  handleBindLogin(item) {
192
- if (this.tabIndex === 1) {
193
- console.log("bindCardLogin", this.inCallback);
203
+ if(this.$configProject.isPreview) return;
194
204
 
205
+ if (this.tabIndex === 1) {
195
206
  //无效卡
196
207
  if (item["is_valid"] !== "Y") {
197
208
  console.log(
@@ -207,38 +218,38 @@
207
218
  vm: this,
208
219
  data: { card_number: item["card_number"] },
209
220
  })
210
- .then((res) => {
211
- console.log(res);
212
- this.$xdHideLoading();
221
+ .then(async (res) => {
222
+ await this.$xdHideLoading();
223
+
213
224
  //#ifdef MP-WEIXIN
214
225
  if (this.jfbAuthorize !== null) {
215
226
  this.jfbAuthorize.setCardToken(res, null);
216
227
  }
217
228
  //#endif
218
- console.log(this.inCallback);
219
- debugger
220
- if (this.$configProject.isPreview) {
221
- console.log("handleBindLogin", "预览模式不跳转", this.inCallback);
222
- } else {
223
- this.$xdUniHelper.redirectTo({
224
- url: this.inCallback,
225
- });
229
+
230
+ //单业务线卡券直接跳转到业务线
231
+ if(item.entries.length ===1) {
232
+ this.handleOneBussClick(item.entries[0]);
233
+ return
226
234
  }
235
+
236
+ //其他情况
237
+ this.$xdUniHelper.redirectTo({
238
+ url: this.inCallback,
239
+ });
227
240
  })
228
241
  .catch((res) => {
229
242
  this.$xdHideLoading();
230
243
  });
231
244
  }
232
245
  else {
233
- this.$xdUniHelper.navigateTo({
234
- url: `${this.changeUrl}?card_number=${item["card_number"]}`,
235
- },
236
- false
237
- );
246
+ this.$xdUniHelper.navigateTo({url: `${this.changeUrl}?card_number=${item["card_number"]}`,}, false);
238
247
  }
239
248
  },
240
249
 
241
250
  onJfbShow(options) {
251
+ this.cardList = [];
252
+ this.tabIndex = 1;
242
253
  this.onJfbLoad(options);
243
254
  },
244
255
  }