@conecli/cone-render 0.10.1-shop3.113 → 0.10.1-shop3.115

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