@conecli/cone-render 0.10.1-shop3.95 → 0.10.1-shop3.97

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.
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  WXAPP_LOGIN,
3
2
  WXAPP_BIZ,
4
3
  WXAPP_USER_INFO,
5
4
  WXAPP_NAVIGATOR,
6
5
  WXAPP_REPORT_GDT,
7
6
  WXAPP_PARAMS_SIGN,
8
7
  WXAPP_FINGER_REPORT,
9
8
  WXAPP_REPORT_MANAGE,
10
9
  WXAPP_SUBS_GUIDER,
11
10
  WXAPP_ADDRESS_V2_API,
12
11
  BUSINESS_TYPE,
13
12
  SHOP_MENU_ID_TYPE,
14
13
  SHOP_MENU_ID_NAME,
15
14
  SECTION_HOME_TAB_NAME_TYPE,
16
15
  SECTION_HOME_TAB_TYPE,
17
16
  TaroEventType,
18
17
  WX_BUSINESS_TYPE,
19
18
  WXAPP_BIZ_KEY,
20
19
  WXAPP_BIZ_SHOP_LIGHT_KEY,
21
20
  getSystemInfos,
22
21
  getTaroStorageKeyValue,
23
22
  getWxAppCookieStr,
24
23
  objectToUrlEncode,
25
24
  languageNowType,
26
25
  isAscfApp,
27
26
  abTestLabels: {},
28
27
  nonSellableSkuids: {},
29
28
  loginState: jdUserLoginState,
30
29
  cookiesStr: '',
31
30
  userInfo: userPinKey,
32
31
  isImmersive: false,
33
32
  baseAddCartSwitch: true,
34
33
  pageInfo: {
35
34
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
36
35
  address: '',
37
36
  addressCommaStr: '',
38
37
  un_area: '',
39
38
  userLbsAddress: '',
40
39
  vapptype: '1',
41
40
  pageType: 'home',
42
41
  dataType: BUSINESS_TYPE.ONLINE,
43
42
  floorExposureInfo: {},
44
43
  floorVideInfo: {},
45
44
  productVideInfo: {},
46
45
  tabsLoadAllDataInfo: {
47
46
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
48
47
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
49
48
  },
50
49
  updateShopInfosAllState: false,
51
50
  isVipShop: false,
52
51
  isJdShowNativeImmersivePlayer: false,
53
52
  isSuperBrandShop: false,
54
53
  ...shopConfig,
55
54
  pageScrollTop: 0,
56
55
  pageIdxHeightInfo: {
57
56
  list: [],
58
57
  },
59
58
  shopNavBarHeight: 0,
60
59
  },
61
60
  defaultQueryLogInfo: {
62
61
  sourceType: 'JDshop',
63
62
  sourceValue: '',
64
63
  moduleId: 'none',
65
64
  entrance: 'none',
66
65
  },
67
66
  originQueryInfo: {},
68
67
  sysInfo: {
69
68
  windowWidth: 0,
70
69
  windowHeight: 0,
71
70
  netWorkType: '4g',
72
71
  jdBottomBarHeight: 0,
73
72
  jdNativeHeaderHeight: 0,
74
73
  },
75
74
  queryInfo: {},
76
75
  shopInfo: {},
77
76
  openAppData: {},
78
77
  public info: CommonInterFace.BaseConfigInfo;
79
78
  public config: {
80
79
  [key: string]: any;
81
80
  };
82
81
  public lazyContainer: CommonInterFace.lazyContainer;
83
82
  public rootEleNode: HTMLElement | null;
84
83
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
85
84
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
86
85
  public checkStatusAndLoginPromise: object | null;
87
86
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
88
87
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
89
88
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
90
89
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
91
90
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
92
91
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
93
92
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
94
93
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
95
94
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
96
95
  public wxAppAddressV2apiInstance: CommonInterFace.wxAppAddressV2api;
97
96
  public loadJsSdkList: Array<any>;
98
97
  public loadJsSdkListCachePromise: any;
99
98
  public lbsAddressCachePromise: Promise<any> | null;
100
99
  public languageJsonData: any | null;
101
100
  public businessWorkerReady: boolean;
102
101
  public jdWorkerReadyPromise: any | null;
103
102
  constructor(opt) {
104
103
  this.info = this._getConfig(opt);
105
104
  this.config = {};
106
105
  this.lazyContainer = {
107
106
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
108
107
  appLazyContainerList: [],
109
108
  appLazyFinishContainerList: [],
110
109
  },
111
110
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
112
111
  appLazyContainerList: [],
113
112
  appLazyFinishContainerList: [],
114
113
  },
115
114
  };
116
115
  this.loadJsSdkList = [];
117
116
  this.loadJsSdkListCachePromise = {};
118
117
  this.rootEleNode = null;
119
118
  this.miniApplogUtil = MiniAppLogUtil;
120
119
  this.miniAppLogInstance = null;
121
120
  this.checkStatusAndLoginPromise = null;
122
121
  this.wxAppLoginInstance = WXAPP_LOGIN;
123
122
  this.wxAppBizInstance = WXAPP_BIZ;
124
123
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
125
124
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
126
125
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
127
126
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
128
127
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
129
128
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
130
129
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
131
130
  this.wxAppAddressV2apiInstance = WXAPP_ADDRESS_V2_API;
132
131
  this.lbsAddressCachePromise = null;
133
132
  this.languageJsonData = langeJsonDataForCn;
134
133
  this.businessWorkerReady = false;
135
134
  this.jdWorkerReadyPromise = Promise.resolve(false);
136
135
  }
137
136
  _getConfig(opt) {
138
137
  return Object.assign({}, DefaultConfig, opt);
139
138
  }
140
139
  loadApiSafeSteadyReayPromise() {
141
140
  return Promise.resolve(true);
142
141
  }
143
142
  loadH5tagReayPromise() {
144
143
  return Promise.resolve(true);
145
144
  }
146
145
 
147
146
  jmfeReayPromise(): Promise<any> {
148
147
  return Promise.reject(false);
149
148
  }
150
149
 
151
150
  taskTimeoutPromise(callBack, timeout = 2000) {
152
151
  return new Promise((resolve) => {
153
152
  setTimeout(() => {
154
153
  const getCallBackRes = typeof callBack === 'function' && callBack();
155
154
  return resolve(getCallBackRes || false);
156
155
  }, timeout);
157
156
  });
158
157
  }
159
158
 
160
159
  updateBusinessDomainAndApi(domain, api) {
161
160
  console.log('=================>', 'updateBusinessDomainAndApi');
162
161
  }
163
162
 
164
163
  getFullScreenHeight(systemInfo) {
165
164
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
166
165
  let result = screenHeight;
167
166
  if (statusBarHeight > 20 && isAndroid) {
168
167
  result = screenHeight + statusBarHeight;
169
168
  }
170
169
  return result;
171
170
  }
172
171
 
173
172
  getTabBarHeight(systemInfo) {
174
173
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
175
174
  let result = 50;
176
175
  if (statusBarHeight > 20) {
177
176
  if (isIOS) {
178
177
  result = 84;
179
178
  } else if (isAndroid) {
180
179
  result = 53;
181
180
  }
182
181
  }
183
182
  return result;
184
183
  }
185
184
 
186
185
  getSystemInfo() {
187
186
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
188
187
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
189
188
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
190
189
  const fullScreenHeight = this.getFullScreenHeight(info);
191
190
  const tabBarHeight = this.getTabBarHeight(info);
192
191
  const safeContentHeight = fullScreenHeight - headerHeight;
193
192
  this.info.sysInfo = {
194
193
  ...this.info.sysInfo,
195
194
  ...info,
196
195
  actualNavBarHeight,
197
196
  headerHeight,
198
197
  fullScreenHeight,
199
198
  tabBarHeight,
200
199
  safeContentHeight,
201
200
  languageType: languageNowType,
202
201
  };
203
202
  if (this.info.sysInfo['hostVersionName']) {
204
203
  this.info.sysInfo['hostAppVersion'] = Number(
205
204
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
206
205
  );
207
206
  }
208
207
  if (isPublishToWxapp) {
209
208
  this.getAddressCachePromise();
210
209
  this.getLbsAddressCachePromise();
211
210
  }
212
211
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
213
212
  this.getNetWorkType();
214
213
  console.log('获取系统信息', this.info.sysInfo);
215
214
  }
216
215
  async updateMPaasConfig() {}
217
216
 
218
217
  getNetWorkType() {
219
218
  Taro.getNetworkType().then((getRes) => {
220
219
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
221
220
  });
222
221
  }
223
222
  getAPPUseStraightCorner() {
224
223
  return Promise.resolve(false);
225
224
  }
226
225
 
227
226
  checkStatusAndLogin(options = {}) {
228
227
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
229
228
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
230
229
  this.toLogin(options)
231
230
  .then((res) => {
232
231
  console.log('微信小程序登录状态结果,成功', res);
233
232
  this.info.loginState = true;
234
233
  resolve(res);
235
234
  })
236
235
  .catch((err) => {
237
236
  console.log('微信小程序登录异常状态结果', err);
238
237
  this.doLogin(options)
239
238
  .then((res2) => {
240
239
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
241
240
  this.info.loginState = true;
242
241
  resolve(res2);
243
242
  })
244
243
  .catch((err2) => {
245
244
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
246
245
  this.checkStatusAndLoginPromise = null;
247
246
  reject(err2);
248
247
  });
249
248
  });
250
249
  });
251
250
  return this.checkStatusAndLoginPromise;
252
251
  }
253
252
 
254
253
  checkJdStatusAndLogin(
255
254
  options = {
256
255
  loginColor: {
257
256
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
258
257
  dpin: 0,
259
258
  },
260
259
  },
261
260
  ) {
262
261
  return this.checkStatusAndLogin(options);
263
262
  }
264
263
 
265
264
  toLogin(options = {}): Promise<any> {
266
265
  return this.wxAppLoginInstance
267
266
  .getLoginPromise({
268
267
  mode: 'common',
269
268
  loginColor: {
270
269
  biz: WXAPP_BIZ_KEY,
271
270
  dpin: 1,
272
271
  },
273
272
  ...options,
274
273
  })
275
274
  .then((res) => {
276
275
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
277
276
  setTimeout(() => {
278
277
  console.log(
279
278
  '微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
280
279
  );
281
280
  this.getLoginCookie(`${Date.now()}`);
282
281
  }, 500);
283
282
  })
284
283
  .catch((err) => {
285
284
  console.log('微信app登录异常返回信息,也获取cookie', err);
286
285
  this.getLoginCookie(`${Date.now()}`);
287
286
  });
288
287
  }
289
288
 
290
289
  doLogin(options = {}) {
291
290
  const getParams = {
292
291
  loginColor: {
293
292
  biz: WXAPP_BIZ_KEY,
294
293
  dpin: 1,
295
294
  },
296
295
  ...options,
297
296
  };
298
297
  if (isPublishToWxapp) {
299
298
  getParams['returnUrl'] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
300
299
  ...this.info.originQueryInfo,
301
300
  loadShopxType: 'redirect',
302
301
  })}`;
303
302
  }
304
303
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
305
304
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
306
305
  setTimeout(() => {
307
306
  console.log('微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie');
308
307
  this.getLoginCookie(`${Date.now()}`);
309
308
  }, 500);
310
309
  return res;
311
310
  });
312
311
  }
313
312
 
314
313
  doLoginForJdPin(options = {}) {
315
314
  return this.doLogin({
316
315
  loginColor: {
317
316
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
318
317
  dpin: 0,
319
318
  },
320
319
  ...options,
321
320
  });
322
321
  }
323
322
 
324
323
  getLoginCookie(updateKey = 'wxapp') {
325
324
  return new Promise(async (resolve) => {
326
325
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
327
326
  if (
328
327
  this.config.wqCookie &&
329
328
  this.config.wqCookieStr &&
330
329
  this.config.getWqCookieKey === updateKey
331
330
  ) {
332
331
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
333
332
  resolve({
334
333
  wqCookie: this.config.wqCookie,
335
334
  wqCookieStr: this.config.wqCookieStr,
336
335
  });
337
336
  } else {
338
337
  if (isPublishToWxapp) {
339
338
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
340
339
  if (getWxappCookieObj) {
341
340
  const getCookieObj = getWxappCookieObj['_data'];
342
341
  if (isAscfApp) {
343
342
  const ptKey = this.wxAppLoginInstance.getPtKey();
344
343
  const ptPin = this.wxAppLoginInstance.getPtPin();
345
344
  getCookieObj.pt_key = { name: 'pt_key', value: ptKey };
346
345
  getCookieObj.pt_pin = { name: 'pt_pin', value: ptPin };
347
346
  }
348
347
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
349
348
  const {
350
349
  pin = '',
351
350
  pt_pin = '',
352
351
  visitkey = '-1',
353
352
  wq_unionid = '',
354
353
  wxapp_openid = '',
355
354
  } = wqCookie;
356
355
  this.info.loginState = true;
357
356
  this.info.userInfo.wqCookie = wqCookieStr;
358
357
  this.info.userInfo.wqVisitkey = visitkey;
359
358
  console.log('获取用户完整cookie信息', getCookieObj);
360
359
  if (this.miniAppLogInstance && this.miniAppLogInstance.setCommon) {
361
360
  this.miniAppLogInstance.setCommon({
362
361
  account: pin || pt_pin,
363
362
  unionid: wq_unionid,
364
363
  openid: wxapp_openid,
365
364
  });
366
365
  }
367
366
  this.config.wqCookie = wqCookie;
368
367
  this.config.wqCookieStr = wqCookieStr;
369
368
  this.config.getWqCookieKey = updateKey;
370
369
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
371
370
  resolve({
372
371
  wqCookie,
373
372
  wqCookieStr,
374
373
  });
375
374
  } else {
376
375
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
377
376
  resolve({
378
377
  wqCookie: false,
379
378
  wqCookieStr: false,
380
379
  });
381
380
  }
382
381
  } else {
383
382
  resolve({
384
383
  wqCookie: false,
385
384
  wqCookieStr: false,
386
385
  });
387
386
  }
388
387
  }
389
388
  });
390
389
  }
391
390
 
392
391
 
393
392
  checkLoginStatus() {
394
393
  return this.getLoginCookie();
395
394
  }
396
395
 
397
396
  getAddressCachePromise = () => {
398
397
  return new Promise((resolve) => {
399
398
  if (this.info.sysInfo?.area) {
400
399
  resolve({
401
400
  lat: this.info.sysInfo?.lat,
402
401
  lng: this.info.sysInfo?.lng,
403
402
  area: this.info.sysInfo?.area,
404
403
  });
405
404
  } else {
406
405
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
407
406
  console.info('京购原生获取用户基地址信息', getUserAddress);
408
407
  if (getUserAddress) {
409
408
  const { areaId = '', latitude, longitude } = getUserAddress;
410
409
  this.info.sysInfo['lat'] = `${latitude || ''}`;
411
410
  this.info.sysInfo['lng'] = `${longitude || ''}`;
412
411
  if (areaId && areaId !== '') {
413
412
  this.info.pageInfo.address = areaId;
414
413
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
415
414
  this.info.pageInfo.un_area = areaId;
416
415
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
417
416
  area: areaId,
418
417
  });
419
418
  this.info.sysInfo['area'] = areaId;
420
419
  }
421
420
  resolve({
422
421
  lat: this.info.sysInfo['lat'],
423
422
  lng: this.info.sysInfo['lng'],
424
423
  area: areaId,
425
424
  });
426
425
  } else {
427
426
  resolve({ lat: '', lng: '', area: '' });
428
427
  }
429
428
  }
430
429
  });
431
430
  };
432
431
 
433
432
  getLbsAddressCachePromise(): Promise<{
434
433
  ok: boolean;
435
434
  msg?: string;
436
435
  realTimeArea: string;
437
436
  data?: any;
438
437
  }> {
439
438
  if (!this.lbsAddressCachePromise) {
440
439
  this.lbsAddressCachePromise = new Promise((resolve) => {
441
440
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
442
441
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
443
442
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
444
443
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
445
444
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
446
445
  realTimeArea: this.info.pageInfo.userLbsAddress,
447
446
  });
448
447
  resolve({
449
448
  ok: true,
450
449
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
451
450
  });
452
451
  } else {
453
452
  this.wxAppAddressV2apiInstance
454
453
  .fetchLbsAddr({
455
454
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
456
455
  from: 'wxapp_shop_real_area',
457
456
  })
458
457
  .then((res) => {
459
458
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
460
459
  const { provinceId, cityId, countyId, townId } = res;
461
460
  let realTimeArea = '';
462
461
  if (provinceId) {
463
462
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
464
463
  this.info.pageInfo.userLbsAddress = realTimeArea;
465
464
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
466
465
  realTimeArea: realTimeArea,
467
466
  });
468
467
  } else {
469
468
  this.lbsAddressCachePromise = null;
470
469
  }
471
470
  const getValidRealTimeArea = realTimeArea !== '';
472
471
  resolve({
473
472
  ok: getValidRealTimeArea,
474
473
  msg: getValidRealTimeArea
475
474
  ? '成功'
476
475
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
477
476
  data: getValidRealTimeArea ? null : res,
478
477
  realTimeArea: realTimeArea,
479
478
  });
480
479
  })
481
480
  .catch((err) => {
482
481
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
483
482
  this.lbsAddressCachePromise = null;
484
483
  resolve({
485
484
  ok: false,
486
485
  msg: '微信京购里面获取静默实时lbs地址信息异常',
487
486
  realTimeArea: '',
488
487
  });
489
488
  });
490
489
  }
491
490
  });
492
491
  }
493
492
  return this.lbsAddressCachePromise;
494
493
  }
495
494
 
496
495
  updatePageAndLogInfo(updateQuery = {}) {
497
496
  const createUpdateQueryInfo: {
498
497
  query: {
499
498
  shopId?: string | number;
500
499
  venderId?: string | number;
501
500
  };
502
501
  updateShopInfoState: boolean;
503
502
  } = Object.assign(
504
503
  {},
505
504
  {
506
505
  query: {},
507
506
  updateShopInfoState: false,
508
507
  },
509
508
  updateQuery,
510
509
  );
511
510
  console.log(
512
511
  '获取当前下发的店铺查询参数',
513
512
  updateQuery,
514
513
  '获取之前保存的shopInfo店铺查询参数',
515
514
  this.info?.shopInfo,
516
515
  );
517
516
  const { query, updateShopInfoState } = createUpdateQueryInfo;
518
517
  const { shopId, venderId } = query;
519
518
  if (updateShopInfoState) {
520
519
  this.info.queryInfo = {
521
520
  ...this.info.queryInfo,
522
521
  ...query,
523
522
  };
524
523
  if (shopId && venderId) {
525
524
  this.info.shopInfo = {
526
525
  shopId: `${shopId}`,
527
526
  venderId: `${venderId}`,
528
527
  };
529
528
  }
530
529
  } else {
531
530
  this.info.queryInfo = {
532
531
  ...query,
533
532
  };
534
533
  this.info.originQueryInfo = {
535
534
  ...query,
536
535
  };
537
536
  if (
538
537
  this.info.shopInfo?.shopId &&
539
538
  this.info.shopInfo?.venderId &&
540
539
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
541
540
  ) {
542
541
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
543
542
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
544
543
  console.log(
545
544
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
546
545
  this.info.queryInfo,
547
546
  );
548
547
  }
549
548
  }
550
549
  this.info.queryInfo['shopId'] &&
551
550
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
552
551
  this.info.queryInfo['venderId'] &&
553
552
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
554
553
  console.log(
555
554
  'weapp===获取店铺下发查询参数\n',
556
555
  query,
557
556
  '\n获取店铺最后查询参数\n',
558
557
  this.info.queryInfo,
559
558
  '\n是否为更新店铺状态\n',
560
559
  updateShopInfoState,
561
560
  );
562
561
  }
563
562
 
564
563
  getDynamicConfig(key: string) {
565
564
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
566
565
  return null;
567
566
  }
568
567
  renderNextTickLoadSdk() {
569
568
  console.warn('暂未实现 index.weapp.ts');
570
569
  }
571
570
  loadOtherSdk() {
572
571
  console.warn('暂未实现 index.weapp.ts');
573
572
  }
574
573
  loadItemSdkPromise() {
575
574
  console.warn('暂未实现 index.weapp.ts');
576
575
  }
577
576
  createLanguageProimse() {
578
577
  return Promise.reject({
579
578
  msg: '暂未实现',
580
579
  });
581
580
  }
581
+ import Taro from '@tarojs/taro';
582
582
  WXAPP_LOGIN,
583
583
  WXAPP_BIZ,
584
584
  WXAPP_USER_INFO,
585
585
  WXAPP_NAVIGATOR,
586
586
  WXAPP_REPORT_GDT,
587
587
  WXAPP_PARAMS_SIGN,
588
588
  WXAPP_FINGER_REPORT,
589
589
  WXAPP_REPORT_MANAGE,
590
590
  WXAPP_SUBS_GUIDER,
591
591
  WXAPP_ADDRESS_V2_API,
592
592
  BUSINESS_TYPE,
593
593
  SHOP_MENU_ID_TYPE,
594
594
  SHOP_MENU_ID_NAME,
595
595
  SECTION_HOME_TAB_NAME_TYPE,
596
596
  SECTION_HOME_TAB_TYPE,
597
597
  TaroEventType,
598
598
  WX_BUSINESS_TYPE,
599
599
  WXAPP_BIZ_KEY,
600
600
  WXAPP_BIZ_SHOP_LIGHT_KEY,
601
601
  getSystemInfos,
602
602
  getTaroStorageKeyValue,
603
603
  getWxAppCookieStr,
604
604
  objectToUrlEncode,
605
605
  languageNowType,
606
606
  isAscfApp,
607
607
  abTestLabels: {},
608
608
  nonSellableSkuids: {},
609
609
  loginState: jdUserLoginState,
610
610
  cookiesStr: '',
611
611
  userInfo: userPinKey,
612
612
  isImmersive: false,
613
613
  baseAddCartSwitch: true,
614
614
  pageInfo: {
615
615
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
616
616
  address: '',
617
617
  addressCommaStr: '',
618
618
  un_area: '',
619
619
  fullAddress: '',
620
620
  userLbsAddress: '',
621
621
  vapptype: '1',
622
622
  pageType: 'home',
623
623
  dataType: BUSINESS_TYPE.ONLINE,
624
624
  floorExposureInfo: {},
625
625
  floorVideInfo: {},
626
626
  productVideInfo: {},
627
627
  tabsLoadAllDataInfo: {
628
628
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
629
629
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
630
630
  },
631
631
  updateShopInfosAllState: false,
632
632
  isVipShop: false,
633
633
  isJdShowNativeImmersivePlayer: false,
634
634
  isSuperBrandShop: false,
635
635
  ...shopConfig,
636
636
  pageScrollTop: 0,
637
637
  pageIdxHeightInfo: {
638
638
  list: [],
639
639
  },
640
640
  shopNavBarHeight: 0,
641
641
  },
642
642
  defaultQueryLogInfo: {
643
643
  sourceType: 'JDshop',
644
644
  sourceValue: '',
645
645
  moduleId: 'none',
646
646
  entrance: 'none',
647
647
  },
648
648
  originQueryInfo: {},
649
649
  sysInfo: {
650
650
  windowWidth: 0,
651
651
  windowHeight: 0,
652
652
  netWorkType: '4g',
653
653
  jdBottomBarHeight: 0,
654
654
  jdNativeHeaderHeight: 0,
655
655
  },
656
656
  queryInfo: {},
657
657
  shopInfo: {},
658
658
  openAppData: {},
659
659
  public info: CommonInterFace.BaseConfigInfo;
660
660
  public config: {
661
661
  [key: string]: any;
662
662
  };
663
663
  public lazyContainer: CommonInterFace.lazyContainer;
664
664
  public rootEleNode: HTMLElement | null;
665
665
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
666
666
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
667
667
  public checkStatusAndLoginPromise: object | null;
668
668
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
669
669
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
670
670
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
671
671
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
672
672
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
673
673
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
674
674
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
675
675
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
676
676
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
677
677
  public wxAppAddressV2apiInstance: CommonInterFace.wxAppAddressV2api;
678
678
  public loadJsSdkList: Array<any>;
679
679
  public loadJsSdkListCachePromise: any;
680
680
  public lbsAddressCachePromise: Promise<any> | null;
681
681
  public languageJsonData: any | null;
682
682
  public businessWorkerReady: boolean;
683
683
  public jdWorkerReadyPromise: any | null;
684
684
  constructor(opt) {
685
685
  this.info = this._getConfig(opt);
686
686
  this.config = {};
687
687
  this.lazyContainer = {
688
688
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
689
689
  appLazyContainerList: [],
690
690
  appLazyFinishContainerList: [],
691
691
  },
692
692
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
693
693
  appLazyContainerList: [],
694
694
  appLazyFinishContainerList: [],
695
695
  },
696
696
  };
697
697
  this.loadJsSdkList = [];
698
698
  this.loadJsSdkListCachePromise = {};
699
699
  this.rootEleNode = null;
700
700
  this.miniApplogUtil = MiniAppLogUtil;
701
701
  this.miniAppLogInstance = null;
702
702
  this.checkStatusAndLoginPromise = null;
703
703
  this.wxAppLoginInstance = WXAPP_LOGIN;
704
704
  this.wxAppBizInstance = WXAPP_BIZ;
705
705
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
706
706
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
707
707
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
708
708
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
709
709
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
710
710
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
711
711
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
712
712
  this.wxAppAddressV2apiInstance = WXAPP_ADDRESS_V2_API;
713
713
  this.lbsAddressCachePromise = null;
714
714
  this.languageJsonData = langeJsonDataForCn;
715
715
  this.businessWorkerReady = false;
716
716
  this.jdWorkerReadyPromise = Promise.resolve(false);
717
717
  }
718
718
  _getConfig(opt) {
719
719
  return Object.assign({}, DefaultConfig, opt);
720
720
  }
721
721
  loadApiSafeSteadyReayPromise() {
722
722
  return Promise.resolve(true);
723
723
  }
724
724
  loadH5tagReayPromise() {
725
725
  return Promise.resolve(true);
726
726
  }
727
727
 
728
728
  jmfeReayPromise(): Promise<any> {
729
729
  return Promise.reject(false);
730
730
  }
731
731
 
732
732
  taskTimeoutPromise(callBack, timeout = 2000) {
733
733
  return new Promise((resolve) => {
734
734
  setTimeout(() => {
735
735
  const getCallBackRes = typeof callBack === 'function' && callBack();
736
736
  return resolve(getCallBackRes || false);
737
737
  }, timeout);
738
738
  });
739
739
  }
740
740
 
741
741
  updateBusinessDomainAndApi(domain, api) {
742
742
  console.log('=================>', 'updateBusinessDomainAndApi');
743
743
  }
744
744
 
745
745
  getFullScreenHeight(systemInfo) {
746
746
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
747
747
  let result = screenHeight;
748
748
  if (statusBarHeight > 20 && isAndroid) {
749
749
  result = screenHeight + statusBarHeight;
750
750
  }
751
751
  return result;
752
752
  }
753
753
 
754
754
  getTabBarHeight(systemInfo) {
755
755
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
756
756
  let result = 50;
757
757
  if (statusBarHeight > 20) {
758
758
  if (isIOS) {
759
759
  result = 84;
760
760
  } else if (isAndroid) {
761
761
  result = 53;
762
762
  }
763
763
  }
764
764
  return result;
765
765
  }
766
766
 
767
767
  getSystemInfo() {
768
768
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
769
769
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
770
770
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
771
771
  const fullScreenHeight = this.getFullScreenHeight(info);
772
772
  const tabBarHeight = this.getTabBarHeight(info);
773
773
  const safeContentHeight = fullScreenHeight - headerHeight;
774
774
  this.info.sysInfo = {
775
775
  ...this.info.sysInfo,
776
776
  ...info,
777
777
  actualNavBarHeight,
778
778
  headerHeight,
779
779
  fullScreenHeight,
780
780
  tabBarHeight,
781
781
  safeContentHeight,
782
782
  languageType: languageNowType,
783
783
  };
784
784
  if (this.info.sysInfo['hostVersionName']) {
785
785
  this.info.sysInfo['hostAppVersion'] = Number(
786
786
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
787
787
  );
788
788
  }
789
789
  if (isPublishToWxapp) {
790
790
  this.getAddressCachePromise();
791
791
  this.getLbsAddressCachePromise();
792
792
  }
793
793
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
794
794
  this.getNetWorkType();
795
795
  console.log('获取系统信息', this.info.sysInfo);
796
796
  }
797
797
  async updateMPaasConfig() {}
798
798
 
799
799
  getNetWorkType() {
800
800
  Taro.getNetworkType().then((getRes) => {
801
801
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
802
802
  });
803
803
  }
804
804
  getAPPUseStraightCorner() {
805
805
  return Promise.resolve(false);
806
806
  }
807
807
 
808
808
  checkStatusAndLogin(options = {}) {
809
809
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
810
810
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
811
811
  this.toLogin(options)
812
812
  .then((res) => {
813
813
  console.log('微信小程序登录状态结果,成功', res);
814
814
  this.info.loginState = true;
815
815
  resolve(res);
816
816
  })
817
817
  .catch((err) => {
818
818
  console.log('微信小程序登录异常状态结果', err);
819
819
  this.doLogin(options)
820
820
  .then((res2) => {
821
821
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
822
822
  this.info.loginState = true;
823
823
  resolve(res2);
824
824
  })
825
825
  .catch((err2) => {
826
826
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
827
827
  this.checkStatusAndLoginPromise = null;
828
828
  reject(err2);
829
829
  });
830
830
  });
831
831
  });
832
832
  return this.checkStatusAndLoginPromise;
833
833
  }
834
834
 
835
835
  checkJdStatusAndLogin(
836
836
  options = {
837
837
  loginColor: {
838
838
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
839
839
  dpin: 0,
840
840
  },
841
841
  },
842
842
  ) {
843
843
  return this.checkStatusAndLogin(options);
844
844
  }
845
845
 
846
846
  toLogin(options = {}): Promise<any> {
847
847
  return this.wxAppLoginInstance
848
848
  .getLoginPromise({
849
849
  mode: 'common',
850
850
  loginColor: {
851
851
  biz: WXAPP_BIZ_KEY,
852
852
  dpin: 1,
853
853
  },
854
854
  ...options,
855
855
  })
856
856
  .then((res) => {
857
857
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
858
858
  setTimeout(() => {
859
859
  console.log(
860
860
  '微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
861
861
  );
862
862
  this.getLoginCookie(`${Date.now()}`);
863
863
  }, 500);
864
864
  })
865
865
  .catch((err) => {
866
866
  console.log('微信app登录异常返回信息,也获取cookie', err);
867
867
  this.getLoginCookie(`${Date.now()}`);
868
868
  });
869
869
  }
870
870
 
871
871
  doLogin(options = {}) {
872
872
  const getParams = {
873
873
  loginColor: {
874
874
  biz: WXAPP_BIZ_KEY,
875
875
  dpin: 1,
876
876
  },
877
877
  ...options,
878
878
  };
879
879
  if (isPublishToWxapp) {
880
880
  getParams['returnUrl'] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
881
881
  ...this.info.originQueryInfo,
882
882
  loadShopxType: 'redirect',
883
883
  })}`;
884
884
  }
885
885
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
886
886
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
887
887
  setTimeout(() => {
888
888
  console.log('微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie');
889
889
  this.getLoginCookie(`${Date.now()}`);
890
890
  }, 500);
891
891
  return res;
892
892
  });
893
893
  }
894
894
 
895
895
  doLoginForJdPin(options = {}) {
896
896
  return this.doLogin({
897
897
  loginColor: {
898
898
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
899
899
  dpin: 0,
900
900
  },
901
901
  ...options,
902
902
  });
903
903
  }
904
904
 
905
905
  getLoginCookie(updateKey = 'wxapp') {
906
906
  return new Promise(async (resolve) => {
907
907
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
908
908
  if (
909
909
  this.config.wqCookie &&
910
910
  this.config.wqCookieStr &&
911
911
  this.config.getWqCookieKey === updateKey
912
912
  ) {
913
913
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
914
914
  resolve({
915
915
  wqCookie: this.config.wqCookie,
916
916
  wqCookieStr: this.config.wqCookieStr,
917
917
  });
918
918
  } else {
919
919
  if (isPublishToWxapp) {
920
920
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
921
921
  if (getWxappCookieObj) {
922
922
  const getCookieObj = getWxappCookieObj['_data'];
923
923
  if (isAscfApp) {
924
924
  const ptKey = this.wxAppLoginInstance.getPtKey();
925
925
  const ptPin = this.wxAppLoginInstance.getPtPin();
926
926
  getCookieObj.pt_key = { name: 'pt_key', value: ptKey };
927
927
  getCookieObj.pt_pin = { name: 'pt_pin', value: ptPin };
928
928
  }
929
929
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
930
930
  const {
931
931
  pin = '',
932
932
  pt_pin = '',
933
933
  visitkey = '-1',
934
934
  wq_unionid = '',
935
935
  wxapp_openid = '',
936
936
  } = wqCookie;
937
937
  this.info.loginState = true;
938
938
  this.info.userInfo.wqCookie = wqCookieStr;
939
939
  this.info.userInfo.wqVisitkey = visitkey;
940
940
  console.log('获取用户完整cookie信息', getCookieObj);
941
941
  if (this.miniAppLogInstance && this.miniAppLogInstance.setCommon) {
942
942
  this.miniAppLogInstance.setCommon({
943
943
  account: pin || pt_pin,
944
944
  unionid: wq_unionid,
945
945
  openid: wxapp_openid,
946
946
  });
947
947
  }
948
948
  this.config.wqCookie = wqCookie;
949
949
  this.config.wqCookieStr = wqCookieStr;
950
950
  this.config.getWqCookieKey = updateKey;
951
951
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
952
952
  resolve({
953
953
  wqCookie,
954
954
  wqCookieStr,
955
955
  });
956
956
  } else {
957
957
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
958
958
  resolve({
959
959
  wqCookie: false,
960
960
  wqCookieStr: false,
961
961
  });
962
962
  }
963
963
  } else {
964
964
  resolve({
965
965
  wqCookie: false,
966
966
  wqCookieStr: false,
967
967
  });
968
968
  }
969
969
  }
970
970
  });
971
971
  }
972
972
 
973
973
 
974
974
  checkLoginStatus() {
975
975
  return this.getLoginCookie();
976
976
  }
977
977
 
978
978
  getAddressCachePromise = () => {
979
979
  return new Promise((resolve) => {
980
980
  if (this.info.sysInfo?.area) {
981
981
  resolve({
982
982
  lat: this.info.sysInfo?.lat,
983
983
  lng: this.info.sysInfo?.lng,
984
984
  area: this.info.sysInfo?.area,
985
985
  fullAddress: this?.info?.pageInfo?.fullAddress,
986
986
  });
987
987
  } else {
988
988
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
989
989
  if (getUserAddress) {
990
990
  const { areaId = '', addressName, latitude, longitude } = getUserAddress;
991
991
  this.info.sysInfo['lat'] = `${latitude || ''}`;
992
992
  this.info.sysInfo['lng'] = `${longitude || ''}`;
993
993
  const getEncodeFullAddress = addressName ? encodeURIComponent(addressName) : "";
994
994
  if (areaId && areaId !== '') {
995
995
  this.info.pageInfo.address = areaId;
996
996
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
997
997
  this.info.pageInfo.un_area = areaId;
998
998
  const getUpdateData = {
999
999
  area: areaId,
1000
1000
  }
1001
1001
  if(addressName && addressName.length > 0) {
1002
1002
  getUpdateData.fullAddress = getEncodeFullAddress;
1003
1003
  this.info.pageInfo.fullAddress = getEncodeFullAddress;
1004
1004
  }
1005
1005
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, getUpdateData);
1006
1006
  this.info.sysInfo['area'] = areaId;
1007
1007
  }
1008
1008
  resolve({
1009
1009
  lat: this.info.sysInfo['lat'],
1010
1010
  lng: this.info.sysInfo['lng'],
1011
1011
  fullAddress: getEncodeFullAddress,
1012
1012
  area: areaId,
1013
1013
  });
1014
1014
  } else {
1015
1015
  resolve({ lat: '', lng: '', area: '', fullAddress: "" });
1016
1016
  }
1017
1017
  }
1018
1018
  });
1019
1019
  };
1020
1020
 
1021
1021
  getLbsAddressCachePromise(): Promise<{
1022
1022
  ok: boolean;
1023
1023
  msg?: string;
1024
1024
  realTimeArea: string;
1025
1025
  data?: any;
1026
1026
  }> {
1027
1027
  if (!this.lbsAddressCachePromise) {
1028
1028
  this.lbsAddressCachePromise = new Promise((resolve) => {
1029
1029
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
1030
1030
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
1031
1031
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
1032
1032
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
1033
1033
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
1034
1034
  realTimeArea: this.info.pageInfo.userLbsAddress,
1035
1035
  });
1036
1036
  resolve({
1037
1037
  ok: true,
1038
1038
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
1039
1039
  });
1040
1040
  } else {
1041
1041
  this.wxAppAddressV2apiInstance
1042
1042
  .fetchLbsAddr({
1043
1043
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
1044
1044
  from: 'wxapp_shop_real_area',
1045
1045
  })
1046
1046
  .then((res) => {
1047
1047
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
1048
1048
  const { provinceId, cityId, countyId, townId } = res;
1049
1049
  let realTimeArea = '';
1050
1050
  if (provinceId) {
1051
1051
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
1052
1052
  this.info.pageInfo.userLbsAddress = realTimeArea;
1053
1053
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
1054
1054
  realTimeArea: realTimeArea,
1055
1055
  });
1056
1056
  } else {
1057
1057
  this.lbsAddressCachePromise = null;
1058
1058
  }
1059
1059
  const getValidRealTimeArea = realTimeArea !== '';
1060
1060
  resolve({
1061
1061
  ok: getValidRealTimeArea,
1062
1062
  msg: getValidRealTimeArea
1063
1063
  ? '成功'
1064
1064
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
1065
1065
  data: getValidRealTimeArea ? null : res,
1066
1066
  realTimeArea: realTimeArea,
1067
1067
  });
1068
1068
  })
1069
1069
  .catch((err) => {
1070
1070
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
1071
1071
  this.lbsAddressCachePromise = null;
1072
1072
  resolve({
1073
1073
  ok: false,
1074
1074
  msg: '微信京购里面获取静默实时lbs地址信息异常',
1075
1075
  realTimeArea: '',
1076
1076
  });
1077
1077
  });
1078
1078
  }
1079
1079
  });
1080
1080
  }
1081
1081
  return this.lbsAddressCachePromise;
1082
1082
  }
1083
1083
 
1084
1084
  updatePageAndLogInfo(updateQuery = {}) {
1085
1085
  const createUpdateQueryInfo: {
1086
1086
  query: {
1087
1087
  shopId?: string | number;
1088
1088
  venderId?: string | number;
1089
1089
  };
1090
1090
  updateShopInfoState: boolean;
1091
1091
  } = Object.assign(
1092
1092
  {},
1093
1093
  {
1094
1094
  query: {},
1095
1095
  updateShopInfoState: false,
1096
1096
  },
1097
1097
  updateQuery,
1098
1098
  );
1099
1099
  console.log(
1100
1100
  '获取当前下发的店铺查询参数',
1101
1101
  updateQuery,
1102
1102
  '获取之前保存的shopInfo店铺查询参数',
1103
1103
  this.info?.shopInfo,
1104
1104
  );
1105
1105
  const { query, updateShopInfoState } = createUpdateQueryInfo;
1106
1106
  const { shopId, venderId } = query;
1107
1107
  if (updateShopInfoState) {
1108
1108
  this.info.queryInfo = {
1109
1109
  ...this.info.queryInfo,
1110
1110
  ...query,
1111
1111
  };
1112
1112
  if (shopId && venderId) {
1113
1113
  this.info.shopInfo = {
1114
1114
  shopId: `${shopId}`,
1115
1115
  venderId: `${venderId}`,
1116
1116
  };
1117
1117
  }
1118
1118
  } else {
1119
1119
  this.info.queryInfo = {
1120
1120
  ...query,
1121
1121
  };
1122
1122
  this.info.originQueryInfo = {
1123
1123
  ...query,
1124
1124
  };
1125
1125
  if (
1126
1126
  this.info.shopInfo?.shopId &&
1127
1127
  this.info.shopInfo?.venderId &&
1128
1128
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
1129
1129
  ) {
1130
1130
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
1131
1131
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
1132
1132
  console.log(
1133
1133
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
1134
1134
  this.info.queryInfo,
1135
1135
  );
1136
1136
  }
1137
1137
  }
1138
1138
  this.info.queryInfo['shopId'] &&
1139
1139
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
1140
1140
  this.info.queryInfo['venderId'] &&
1141
1141
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
1142
1142
  console.log(
1143
1143
  'weapp===获取店铺下发查询参数\n',
1144
1144
  query,
1145
1145
  '\n获取店铺最后查询参数\n',
1146
1146
  this.info.queryInfo,
1147
1147
  '\n是否为更新店铺状态\n',
1148
1148
  updateShopInfoState,
1149
1149
  );
1150
1150
  }
1151
1151
 
1152
1152
  getDynamicConfig(key: string) {
1153
1153
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
1154
1154
  return null;
1155
1155
  }
1156
1156
  renderNextTickLoadSdk() {
1157
1157
  console.warn('暂未实现 index.weapp.ts');
1158
1158
  }
1159
1159
  loadOtherSdk() {
1160
1160
  console.warn('暂未实现 index.weapp.ts');
1161
1161
  }
1162
1162
  loadItemSdkPromise() {
1163
1163
  console.warn('暂未实现 index.weapp.ts');
1164
1164
  }
1165
1165
  createLanguageProimse() {
1166
1166
  return Promise.reject({
1167
1167
  msg: '暂未实现',
1168
1168
  });
1169
1169
  }