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