@conecli/cone-render 0.10.1-shop3.86 → 0.10.1-shop3.87
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
|
TaroEventType,
|
|
3
2
|
JUMP_MEMBER_CHANNEL,
|
|
4
3
|
CENTERDISPATCH_JUMPPAGE_VALUE,
|
|
5
4
|
|
|
6
5
|
CARD_BANNER = 'shopMemberCardVenderCardBanner',
|
|
7
6
|
|
|
8
7
|
CARD_NAME = 'shopMemberCardVenderCardName',
|
|
9
8
|
|
|
10
9
|
MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
|
|
11
10
|
|
|
12
11
|
MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
|
|
13
12
|
|
|
14
13
|
MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
|
|
15
14
|
return new Promise((resolve) => {
|
|
16
15
|
requestServer
|
|
17
16
|
.getCustomerCenterDispatch(params)
|
|
18
17
|
.then((response) => {
|
|
19
18
|
if (response.result && response.code === '0') {
|
|
20
19
|
resolve(response.result);
|
|
21
20
|
} else {
|
|
22
21
|
resolve({
|
|
23
22
|
jumpPage:
|
|
24
23
|
response.code === '1'
|
|
25
24
|
? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
26
25
|
: CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
})
|
|
30
29
|
.catch((err) => {
|
|
31
30
|
resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
|
|
32
31
|
console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
const currentVenderId = global.info.queryInfo.venderId;
|
|
36
35
|
const currentShopId = global.info.queryInfo.shopId;
|
|
37
36
|
const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
|
|
38
37
|
const toastOpt = {
|
|
39
38
|
duration: 3000,
|
|
40
39
|
image:
|
|
41
40
|
'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
|
|
42
41
|
};
|
|
43
42
|
if (isAppHomeForMarketPage) {
|
|
44
43
|
JumpEventReport.jdJumpToBottomTabBrandMember({
|
|
45
44
|
shopId: currentShopId,
|
|
46
45
|
venderId: currentVenderId,
|
|
47
46
|
});
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
49
|
const params = {
|
|
51
50
|
venderId: currentVenderId,
|
|
52
51
|
channel,
|
|
53
52
|
queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
|
|
54
53
|
};
|
|
55
54
|
const centerDispatchResult = await getCenterDispatchResult(params);
|
|
56
55
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
|
|
57
56
|
const { jumpPage } = centerDispatchResult;
|
|
58
57
|
if (typeof jumpPage !== 'number') {
|
|
59
58
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
|
|
60
59
|
showFailToast({
|
|
61
60
|
title: '网络繁忙,稍后再试吧~',
|
|
62
61
|
...toastOpt,
|
|
63
62
|
});
|
|
64
63
|
return;
|
|
65
64
|
}
|
|
66
65
|
const centerDispatchJumpPageValue = Number(jumpPage);
|
|
67
66
|
if (
|
|
68
67
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
|
|
69
68
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
|
|
70
69
|
) {
|
|
71
70
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
|
|
72
71
|
showFailToast({
|
|
73
72
|
title: '网络繁忙,稍后再试吧~',
|
|
74
73
|
...toastOpt,
|
|
75
74
|
});
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
77
|
if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
|
|
79
78
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
|
|
80
79
|
global
|
|
81
80
|
.doLogin()
|
|
82
81
|
.then((res) => {
|
|
83
82
|
console.log('登录成功', res);
|
|
84
83
|
})
|
|
85
84
|
.catch((err) => {
|
|
86
85
|
console.log('登录失败', err);
|
|
87
86
|
});
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
89
|
const memberRoleJumpPageValueArr = [
|
|
91
90
|
CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
|
|
92
91
|
CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
|
|
93
92
|
CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
|
|
94
93
|
];
|
|
95
94
|
const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
|
|
96
95
|
if (isMemberRole) {
|
|
97
96
|
showFailToast({
|
|
98
97
|
title: '您已是本店会员,无需再次入会',
|
|
99
98
|
...toastOpt,
|
|
100
99
|
});
|
|
101
100
|
return;
|
|
102
101
|
}
|
|
103
102
|
if (!isH5AndJdShopView) {
|
|
104
103
|
JumpEventReport.jdJumpToNewH5MemberCard();
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
106
|
const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
|
|
108
107
|
console.log('一键入会,是否已降级', isDegrade);
|
|
109
108
|
console.log('一键入会,是否低版本', isLowVersion);
|
|
110
109
|
if (isDegrade) {
|
|
111
110
|
console.log('一键入会,已降级');
|
|
112
111
|
showFailToast({
|
|
113
112
|
title: '网络繁忙,稍后再试吧~',
|
|
114
113
|
...toastOpt,
|
|
115
114
|
});
|
|
116
115
|
return;
|
|
117
116
|
}
|
|
118
117
|
if (isLowVersion) {
|
|
119
118
|
console.log('一键入会,低版本');
|
|
120
119
|
JumpEventReport.jdJumpToMemberTab();
|
|
121
120
|
return;
|
|
122
121
|
}
|
|
123
122
|
return new Promise((resolve) => {
|
|
124
123
|
const getOpenCardUrlParams = {
|
|
125
124
|
venderId: currentVenderId,
|
|
126
125
|
shopId: currentShopId,
|
|
127
126
|
channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
|
|
128
127
|
device: global.info.sysInfo?.isJdTabletDevice ? 'tablet' : 'all',
|
|
129
128
|
memberSceneType: 'view',
|
|
130
129
|
...options,
|
|
131
130
|
};
|
|
132
131
|
const memberCardurl =
|
|
133
132
|
window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
|
|
134
133
|
? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
|
|
135
134
|
: `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
|
|
136
135
|
const sourceUrl = encodeURIComponent(window.location.href || '');
|
|
137
136
|
let url =
|
|
138
137
|
sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
|
|
139
138
|
if(!url.includes('http')){
|
|
140
139
|
url = 'https:' + url;
|
|
141
140
|
}
|
|
142
141
|
console.log('openPopWebview url', url);
|
|
143
142
|
nativeOpenPopWebView({
|
|
144
143
|
url,
|
|
145
144
|
});
|
|
146
145
|
Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
|
|
147
146
|
Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
|
|
148
147
|
console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
|
|
149
148
|
const { shopId, venderId } = res;
|
|
150
149
|
if (shopId === currentShopId && venderId === currentVenderId) {
|
|
151
150
|
resolve(true);
|
|
152
151
|
} else {
|
|
153
152
|
console.log(
|
|
154
153
|
'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
|
|
155
154
|
currentShopId,
|
|
156
155
|
currentVenderId,
|
|
157
156
|
);
|
|
158
157
|
resolve(false);
|
|
159
158
|
}
|
|
160
159
|
});
|
|
161
160
|
});
|
|
161
|
+
import Taro from '@tarojs/taro';
|
|
162
162
|
TaroEventType,
|
|
163
163
|
JUMP_MEMBER_CHANNEL,
|
|
164
164
|
CENTERDISPATCH_JUMPPAGE_VALUE,
|
|
165
165
|
|
|
166
166
|
CARD_BANNER = 'shopMemberCardVenderCardBanner',
|
|
167
167
|
|
|
168
168
|
CARD_NAME = 'shopMemberCardVenderCardName',
|
|
169
169
|
|
|
170
170
|
MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
|
|
171
171
|
|
|
172
172
|
MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
|
|
173
173
|
|
|
174
174
|
MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
|
|
175
175
|
return new Promise((resolve) => {
|
|
176
176
|
requestServer
|
|
177
177
|
.getCustomerCenterDispatch(params)
|
|
178
178
|
.then((response) => {
|
|
179
179
|
if (response.result && response.code === '0') {
|
|
180
180
|
resolve(response.result);
|
|
181
181
|
} else {
|
|
182
182
|
resolve({
|
|
183
183
|
jumpPage:
|
|
184
184
|
response.code === '1'
|
|
185
185
|
? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
186
186
|
: CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
})
|
|
190
190
|
.catch((err) => {
|
|
191
191
|
resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
|
|
192
192
|
console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
195
|
const currentVenderId = global.info.queryInfo.venderId;
|
|
196
196
|
const currentShopId = global.info.queryInfo.shopId;
|
|
197
197
|
const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
|
|
198
198
|
const forceMemberCardPopup = options?.forceMemberCardPopup;
|
|
199
199
|
const toastOpt = {
|
|
200
200
|
duration: 3000,
|
|
201
201
|
image:
|
|
202
202
|
'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
|
|
203
203
|
};
|
|
204
204
|
if (isAppHomeForMarketPage) {
|
|
205
205
|
JumpEventReport.jdJumpToBottomTabBrandMember({
|
|
206
206
|
shopId: currentShopId,
|
|
207
207
|
venderId: currentVenderId,
|
|
208
208
|
});
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
211
|
const params = {
|
|
212
212
|
venderId: currentVenderId,
|
|
213
213
|
channel,
|
|
214
214
|
queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
|
|
215
215
|
};
|
|
216
216
|
const centerDispatchResult = await getCenterDispatchResult(params);
|
|
217
217
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
|
|
218
218
|
const { jumpPage } = centerDispatchResult;
|
|
219
219
|
if (typeof jumpPage !== 'number') {
|
|
220
220
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
|
|
221
221
|
showFailToast({
|
|
222
222
|
title: '网络繁忙,稍后再试吧~',
|
|
223
223
|
...toastOpt,
|
|
224
224
|
});
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
const centerDispatchJumpPageValue = Number(jumpPage);
|
|
228
228
|
if (
|
|
229
229
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
|
|
230
230
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
|
|
231
231
|
) {
|
|
232
232
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
|
|
233
233
|
showFailToast({
|
|
234
234
|
title: '网络繁忙,稍后再试吧~',
|
|
235
235
|
...toastOpt,
|
|
236
236
|
});
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
239
|
if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
|
|
240
240
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
|
|
241
241
|
global
|
|
242
242
|
.doLogin()
|
|
243
243
|
.then((res) => {
|
|
244
244
|
console.log('登录成功', res);
|
|
245
245
|
})
|
|
246
246
|
.catch((err) => {
|
|
247
247
|
console.log('登录失败', err);
|
|
248
248
|
});
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
251
|
const memberRoleJumpPageValueArr = [
|
|
252
252
|
CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
|
|
253
253
|
CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
|
|
254
254
|
CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
|
|
255
255
|
];
|
|
256
256
|
const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
|
|
257
257
|
if (isMemberRole) {
|
|
258
258
|
showFailToast({
|
|
259
259
|
title: '您已是本店会员,无需再次入会',
|
|
260
260
|
...toastOpt,
|
|
261
261
|
});
|
|
262
262
|
return;
|
|
263
263
|
}
|
|
264
264
|
if (!isH5AndJdShopView && !forceMemberCardPopup) {
|
|
265
265
|
JumpEventReport.jdJumpToNewH5MemberCard();
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
268
|
const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
|
|
269
269
|
console.log('一键入会,是否已降级', isDegrade);
|
|
270
270
|
console.log('一键入会,是否低版本', isLowVersion);
|
|
271
271
|
if (isDegrade) {
|
|
272
272
|
console.log('一键入会,已降级');
|
|
273
273
|
showFailToast({
|
|
274
274
|
title: '网络繁忙,稍后再试吧~',
|
|
275
275
|
...toastOpt,
|
|
276
276
|
});
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
if (isLowVersion && !forceMemberCardPopup) {
|
|
280
280
|
console.log('一键入会,低版本');
|
|
281
281
|
JumpEventReport.jdJumpToMemberTab();
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
return new Promise((resolve) => {
|
|
285
285
|
const getOpenCardUrlParams = {
|
|
286
286
|
venderId: currentVenderId,
|
|
287
287
|
shopId: currentShopId,
|
|
288
288
|
channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
|
|
289
289
|
device: global.info.sysInfo?.isJdTabletDevice ? 'tablet' : 'all',
|
|
290
290
|
memberSceneType: 'view',
|
|
291
291
|
...options,
|
|
292
292
|
};
|
|
293
293
|
const memberCardurl =
|
|
294
294
|
window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
|
|
295
295
|
? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
|
|
296
296
|
: `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
|
|
297
297
|
const sourceUrl = encodeURIComponent(window.location.href || '');
|
|
298
298
|
let url =
|
|
299
299
|
sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
|
|
300
300
|
if (!url.includes('http')) {
|
|
301
301
|
url = 'https:' + url;
|
|
302
302
|
}
|
|
303
303
|
console.log('openPopWebview url', url);
|
|
304
304
|
nativeOpenPopWebView({
|
|
305
305
|
url,
|
|
306
306
|
});
|
|
307
307
|
Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
|
|
308
308
|
Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
|
|
309
309
|
console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
|
|
310
310
|
const { shopId, venderId } = res;
|
|
311
311
|
if (shopId === currentShopId && venderId === currentVenderId) {
|
|
312
312
|
resolve(true);
|
|
313
313
|
} else {
|
|
314
314
|
console.log(
|
|
315
315
|
'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
|
|
316
316
|
currentShopId,
|
|
317
317
|
currentVenderId,
|
|
318
318
|
);
|
|
319
319
|
resolve(false);
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
322
|
});
|