@conecli/cone-render 0.8.28 → 0.8.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.ts +1 -1
- package/dist/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/token/index.h5.ts +1 -1
- package/dist/common/token/token.ts +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +1 -1
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CustomVideo/index.module.scss +3 -2
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +6 -2
- package/dist/components/base/Dialog/index.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/{const.ts → Base/const.ts} +0 -0
- package/dist/components/base/Price/Base/index.module.scss +136 -0
- package/dist/components/base/Price/Base/index.tsx +1 -0
- package/dist/components/base/Price/Double/index.module.scss +158 -0
- package/dist/components/base/Price/Double/index.tsx +1 -0
- package/dist/components/base/Price/index.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/service/bMallConst.ts +1 -1
- package/dist/service/bMallConst.wxapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/colorSign.wxapp.ts +1 -0
- package/dist/service/http/const.ts +1 -1
- package/dist/service/requestServer.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/jm-common.js +1 -1
- package/dist/utils/memberFormatUtils.js +1 -0
- package/dist/utils/priceUtils.js +1 -0
- package/dist/utils/utils.ts +1 -1
- package/package.json +3 -3
- package/dist/components/base/Price/index.module.scss +0 -136
|
@@ -1 +1 @@
|
|
|
1
|
-
export enum ShopMemberCardNodeType {
|
|
2
1
|
|
|
3
2
|
CARD_BANNER = "shopMemberCardVenderCardBanner",
|
|
4
3
|
|
|
5
4
|
CARD_NAME = "shopMemberCardVenderCardName",
|
|
6
5
|
|
|
7
6
|
MEMBERSHIP_LEVEL = "shopMemberCardMembershipLevel",
|
|
8
7
|
|
|
9
8
|
MEMBERSHIP_RULE_ENTRANCE = "shopMemberCardMembershipRuleEntrance",
|
|
10
9
|
|
|
11
10
|
MEMBERSHIP_POINT = "shopMemberCardMembershipPoint"
|
|
11
|
+
import Taro from '@tarojs/taro'
|
|
12
12
|
TaroEventType,
|
|
13
13
|
JUMP_MEMBER_CHANNEL,
|
|
14
14
|
CENTERDISPATCH_JUMPPAGE_VALUE,
|
|
15
15
|
|
|
16
16
|
CARD_BANNER = 'shopMemberCardVenderCardBanner',
|
|
17
17
|
|
|
18
18
|
CARD_NAME = 'shopMemberCardVenderCardName',
|
|
19
19
|
|
|
20
20
|
MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
|
|
21
21
|
|
|
22
22
|
MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
|
|
23
23
|
|
|
24
24
|
MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
|
|
25
25
|
return new Promise((resolve) => {
|
|
26
26
|
requestServer
|
|
27
27
|
.getCustomerCenterDispatch(params)
|
|
28
28
|
.then(async (response) => {
|
|
29
29
|
if (response.result && response.code === '0') {
|
|
30
30
|
resolve(response.result)
|
|
31
31
|
} else {
|
|
32
32
|
resolve({
|
|
33
33
|
jumpPage:
|
|
34
34
|
response.code === '1'
|
|
35
35
|
? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
36
36
|
: CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
.catch((err) => {
|
|
41
41
|
resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR })
|
|
42
42
|
console.log('oneKeyJoinMember getcustomerCenterDispatch err', err)
|
|
43
43
|
})
|
|
44
44
|
})
|
|
45
45
|
const currentVenderId = global.info.queryInfo.venderId
|
|
46
46
|
const currentShopId = global.info.queryInfo.shopId
|
|
47
47
|
const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW
|
|
48
48
|
const toastOpt = {
|
|
49
49
|
duration: 3000,
|
|
50
50
|
image:
|
|
51
51
|
'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
|
|
52
52
|
}
|
|
53
53
|
const params = {
|
|
54
54
|
venderId: currentVenderId,
|
|
55
55
|
channel,
|
|
56
56
|
queryVersion:
|
|
57
57
|
isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
|
|
58
58
|
}
|
|
59
59
|
const centerDispatchResult = await getCenterDispatchResult(params)
|
|
60
60
|
console.log(
|
|
61
61
|
'oneKeyJoinMember getcustomerCenterDispatch 接口返回值',
|
|
62
62
|
centerDispatchResult,
|
|
63
63
|
)
|
|
64
64
|
const { jumpPage } = centerDispatchResult
|
|
65
65
|
if (typeof jumpPage !== 'number') {
|
|
66
66
|
console.log(
|
|
67
67
|
'oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字',
|
|
68
68
|
)
|
|
69
69
|
showFailToast({
|
|
70
70
|
title: '网络繁忙,稍后再试吧~',
|
|
71
71
|
...toastOpt,
|
|
72
72
|
})
|
|
73
73
|
return
|
|
74
74
|
}
|
|
75
75
|
const centerDispatchJumpPageValue = Number(jumpPage)
|
|
76
76
|
if (
|
|
77
77
|
centerDispatchJumpPageValue ===
|
|
78
78
|
CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
|
|
79
79
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
|
|
80
80
|
) {
|
|
81
81
|
console.log(
|
|
82
82
|
'oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常',
|
|
83
83
|
jumpPage,
|
|
84
84
|
)
|
|
85
85
|
showFailToast({
|
|
86
86
|
title: '网络繁忙,稍后再试吧~',
|
|
87
87
|
...toastOpt,
|
|
88
88
|
})
|
|
89
89
|
return
|
|
90
90
|
}
|
|
91
91
|
if (
|
|
92
92
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
93
93
|
) {
|
|
94
94
|
console.log(
|
|
95
95
|
'oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页',
|
|
96
96
|
)
|
|
97
97
|
global
|
|
98
98
|
.doLogin()
|
|
99
99
|
.then((res) => {
|
|
100
100
|
console.log('登录成功', res)
|
|
101
101
|
})
|
|
102
102
|
.catch((err) => {
|
|
103
103
|
console.log('登录失败', err)
|
|
104
104
|
})
|
|
105
105
|
return
|
|
106
106
|
}
|
|
107
107
|
const memberRoleJumpPageValueArr = [
|
|
108
108
|
CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
|
|
109
109
|
CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
|
|
110
110
|
CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
|
|
111
111
|
]
|
|
112
112
|
const isMemberRole = memberRoleJumpPageValueArr.includes(
|
|
113
113
|
centerDispatchJumpPageValue,
|
|
114
114
|
)
|
|
115
115
|
if (isMemberRole) {
|
|
116
116
|
showFailToast({
|
|
117
117
|
title: '您已是本店会员,无需再次入会',
|
|
118
118
|
...toastOpt,
|
|
119
119
|
})
|
|
120
120
|
return
|
|
121
121
|
}
|
|
122
122
|
if (!isH5AndJdShopView) {
|
|
123
123
|
JumpEventReport.jdJumpToNewH5MemberCard()
|
|
124
124
|
return
|
|
125
125
|
}
|
|
126
126
|
const { isDegrade = true, isLowVersion = true } = centerDispatchResult
|
|
127
127
|
console.log('一键入会,是否已降级', isDegrade)
|
|
128
128
|
console.log('一键入会,是否低版本', isLowVersion)
|
|
129
129
|
if (isDegrade) {
|
|
130
130
|
console.log('一键入会,已降级')
|
|
131
131
|
showFailToast({
|
|
132
132
|
title: '网络繁忙,稍后再试吧~',
|
|
133
133
|
...toastOpt,
|
|
134
134
|
})
|
|
135
135
|
return
|
|
136
136
|
}
|
|
137
137
|
if (isLowVersion) {
|
|
138
138
|
console.log('一键入会,低版本')
|
|
139
139
|
JumpEventReport.jdJumpToMemberTab()
|
|
140
140
|
return
|
|
141
141
|
}
|
|
142
142
|
return new Promise((resolve) => {
|
|
143
143
|
const memberCardurl = `${JumpWebUrl.shopH5MemberCardAPP}?venderId=${currentVenderId}&shopId=${currentShopId}&channel=${JUMP_MEMBER_CHANNEL.POP_WEBVIEW}`
|
|
144
144
|
const sourceUrl = encodeURIComponent(window.location.href || '')
|
|
145
145
|
const url =
|
|
146
146
|
sourceUrl && sourceUrl !== ''
|
|
147
147
|
? `${memberCardurl}&sourceUrl=${sourceUrl}`
|
|
148
148
|
: memberCardurl
|
|
149
149
|
console.log('openPopWebview url', url)
|
|
150
150
|
nativeOpenPopWebView({
|
|
151
151
|
url,
|
|
152
152
|
})
|
|
153
153
|
Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS)
|
|
154
154
|
Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
|
|
155
155
|
console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res)
|
|
156
156
|
const { shopId, venderId } = res
|
|
157
157
|
if (shopId === currentShopId && venderId === currentVenderId) {
|
|
158
158
|
resolve(true)
|
|
159
159
|
} else {
|
|
160
160
|
console.log(
|
|
161
161
|
'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
|
|
162
162
|
currentShopId,
|
|
163
163
|
currentVenderId,
|
|
164
164
|
)
|
|
165
165
|
resolve(false)
|
|
166
166
|
}
|
|
167
167
|
})
|
|
168
168
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import { isAndroidDevice } from '../utils'
|
|
2
1
|
buId: '',
|
|
3
2
|
console.log('getBMallUserInfo')
|
|
4
3
|
if (!isApp('jdb')) {
|
|
5
4
|
return null
|
|
6
5
|
}
|
|
7
6
|
const requestTimeoutPromise = new Promise((resolve) => {
|
|
8
7
|
setTimeout(() => {
|
|
9
8
|
resolve({})
|
|
10
9
|
}, 3000)
|
|
11
10
|
})
|
|
12
11
|
const userInfoPromise = new Promise((resolve) => {
|
|
13
12
|
let result: any = {}
|
|
14
13
|
try {
|
|
15
14
|
if (isAndroidDevice) {
|
|
16
15
|
result = JSON.parse(
|
|
17
16
|
window.WebViewCommon && window.WebViewCommon.getUserInfo(),
|
|
18
17
|
)
|
|
19
18
|
commonParam.buId = result?.data?.buId
|
|
20
19
|
resolve(result)
|
|
21
20
|
} else {
|
|
22
21
|
window.getUserInfoCallBack = null
|
|
23
22
|
window.getUserInfoCallBack = function (callBackJson) {
|
|
24
23
|
console.log('in???callBackJson', callBackJson)
|
|
25
24
|
if (callBackJson) {
|
|
26
25
|
result.data = JSON.parse(callBackJson)
|
|
27
26
|
commonParam.buId = result?.data?.buId
|
|
28
27
|
resolve(result)
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
console.log(
|
|
32
31
|
'window?.webkit?.messageHandlers?.WebViewCommon?.postMessage',
|
|
33
32
|
window?.webkit?.messageHandlers?.WebViewCommon?.postMessage,
|
|
34
33
|
)
|
|
35
34
|
window?.webkit?.messageHandlers?.WebViewCommon?.postMessage({
|
|
36
35
|
businessType: 'router://com.jd.jlstudio/getUserInfo',
|
|
37
36
|
params: {},
|
|
38
37
|
callBackName: 'getUserInfoCallBack',
|
|
39
38
|
method: 'callRouterModuleWithParams',
|
|
40
39
|
})
|
|
41
40
|
}
|
|
42
41
|
} catch (e) {
|
|
43
42
|
resolve(result)
|
|
44
43
|
}
|
|
45
44
|
})
|
|
46
45
|
return Promise.race([userInfoPromise, requestTimeoutPromise])
|
|
47
46
|
process.env.NODE_ENV === 'development'
|
|
48
47
|
? {
|
|
49
48
|
apolloId: '48ee955b0fb04d19b9f9fe8cb73d387f',
|
|
50
49
|
apolloSecret: '0d9c76ee66b0487da4e17d3cf1d7af7a',
|
|
51
50
|
}
|
|
52
51
|
: {
|
|
53
52
|
apolloId: '80c46fd06e4442998609d9f6a4ab96f0',
|
|
54
53
|
apolloSecret: 'f36bef08bcba4683b409732095793fb2',
|
|
55
54
|
}
|
|
56
55
|
if (typeof window.crypto === 'object') {
|
|
57
56
|
if (typeof (window.crypto as any).randomUUID === 'function') {
|
|
58
57
|
return (window.crypto as any).randomUUID()
|
|
59
58
|
}
|
|
60
59
|
if (
|
|
61
60
|
typeof (window.crypto as any).getRandomValues === 'function' &&
|
|
62
61
|
typeof Uint8Array === 'function'
|
|
63
62
|
) {
|
|
64
63
|
const callback = (c) => {
|
|
65
64
|
const num = Number(c)
|
|
66
65
|
return (
|
|
67
66
|
num ^
|
|
68
67
|
((window.crypto as any).getRandomValues(new Uint8Array(1))[0] &
|
|
69
68
|
(15 >> (num / 4)))
|
|
70
69
|
).toString(16)
|
|
71
70
|
}
|
|
72
71
|
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, callback)
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
let timestamp = new Date().getTime()
|
|
76
75
|
let perforNow =
|
|
77
76
|
(typeof window.performance !== 'undefined' &&
|
|
78
77
|
window.performance.now &&
|
|
79
78
|
window.performance.now() * 1000) ||
|
|
80
79
|
0
|
|
81
80
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
82
81
|
let random = Math.random() * 16
|
|
83
82
|
if (timestamp > 0) {
|
|
84
83
|
random = (timestamp + random) % 16 | 0
|
|
85
84
|
timestamp = Math.floor(timestamp / 16)
|
|
86
85
|
} else {
|
|
87
86
|
random = (perforNow + random) % 16 | 0
|
|
88
87
|
perforNow = Math.floor(perforNow / 16)
|
|
89
88
|
}
|
|
90
89
|
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
|
|
91
90
|
})
|
|
92
91
|
skuId,
|
|
93
92
|
bMallTag = 1,
|
|
94
93
|
num,
|
|
95
94
|
skuUuid,
|
|
96
95
|
...otherGoodParams
|
|
97
96
|
let buId = commonParam.buId
|
|
98
97
|
if (!buId) {
|
|
99
98
|
const useInfo: any = await getBMallUserInfo()
|
|
100
99
|
buId = useInfo?.data?.buId
|
|
101
100
|
}
|
|
102
101
|
let params: any = {
|
|
103
102
|
uniformBizInfo: {
|
|
104
103
|
tenantId: 1024,
|
|
105
104
|
ua: 1,
|
|
106
105
|
buId: buId || 456,
|
|
107
106
|
bMallTag: bMallTag,
|
|
108
107
|
},
|
|
109
108
|
commonParam: {
|
|
110
109
|
pid: 100,
|
|
111
110
|
verticalCode: 'cn_retail_bmall',
|
|
112
111
|
ua: 1,
|
|
113
112
|
language: 'zh',
|
|
114
113
|
},
|
|
115
114
|
operations: [{ TheSkus: [{ Id: skuId, num: num ?? 1 }] }],
|
|
116
115
|
apolloId: APOLLO.apolloId,
|
|
117
116
|
apolloSecret: APOLLO.apolloSecret,
|
|
118
117
|
client: 'H5',
|
|
119
118
|
verticalTag: 'cn_retail_bmall',
|
|
120
119
|
carttype: bMallTag == 1 ? 21 : 22,
|
|
121
120
|
bMallTag: bMallTag,
|
|
122
121
|
traceId: getUuid(),
|
|
123
122
|
noResponse: true,
|
|
124
123
|
}
|
|
125
124
|
if (skuUuid) {
|
|
126
125
|
params.operations[0].TheSkus[0].skuUuid = skuUuid
|
|
127
126
|
}
|
|
128
127
|
if (otherGoodParams.buId) {
|
|
129
128
|
const uniformBizInfo = {
|
|
130
129
|
buId: otherGoodParams.buId,
|
|
131
130
|
}
|
|
132
131
|
params.operations[0].TheSkus[0].uniformBizInfo = uniformBizInfo
|
|
133
132
|
}
|
|
134
133
|
if (window?.siteTransResult?.gridInfoList) {
|
|
135
134
|
params = {
|
|
136
135
|
...params,
|
|
137
136
|
cartLocationList: [
|
|
138
137
|
{
|
|
139
138
|
gridInfos:
|
|
140
139
|
window?.siteTransResult?.gridInfoList &&
|
|
141
140
|
JSON.parse(window?.siteTransResult?.gridInfoList),
|
|
142
141
|
areaIdSet:
|
|
143
142
|
window?.siteTransResult?.area &&
|
|
144
143
|
window?.siteTransResult?.area?.split('-'),
|
|
145
144
|
},
|
|
146
145
|
],
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
148
|
return params
|
|
149
|
+
import { isAndroidDevice } from '../utils'
|
|
150
150
|
buId: '',
|
|
151
151
|
console.log('getBMallUserInfo')
|
|
152
152
|
if (!isApp('jdb')) {
|
|
153
153
|
return null
|
|
154
154
|
}
|
|
155
155
|
if (bMallUserInfo) {
|
|
156
156
|
return new Promise((resolve) => resolve(bMallUserInfo))
|
|
157
157
|
}
|
|
158
158
|
const requestTimeoutPromise = new Promise((resolve) => {
|
|
159
159
|
setTimeout(() => {
|
|
160
160
|
resolve({})
|
|
161
161
|
}, 3000)
|
|
162
162
|
})
|
|
163
163
|
const userInfoPromise = new Promise((resolve) => {
|
|
164
164
|
let result: any = {}
|
|
165
165
|
try {
|
|
166
166
|
if (isAndroidDevice) {
|
|
167
167
|
result = JSON.parse(
|
|
168
168
|
window.WebViewCommon && window.WebViewCommon.getUserInfo(),
|
|
169
169
|
)
|
|
170
170
|
bMallUserInfo = result
|
|
171
171
|
commonParam.buId = result?.data?.buId
|
|
172
172
|
resolve(result)
|
|
173
173
|
} else {
|
|
174
174
|
window.getUserInfoCallBack = null
|
|
175
175
|
window.getUserInfoCallBack = function (callBackJson) {
|
|
176
176
|
if (callBackJson) {
|
|
177
177
|
result.data = JSON.parse(callBackJson)
|
|
178
178
|
bMallUserInfo = result
|
|
179
179
|
commonParam.buId = result?.data?.buId
|
|
180
180
|
resolve(result)
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
window?.webkit?.messageHandlers?.WebViewCommon?.postMessage({
|
|
184
184
|
businessType: 'router://com.jd.jlstudio/getUserInfo',
|
|
185
185
|
params: {},
|
|
186
186
|
callBackName: 'getUserInfoCallBack',
|
|
187
187
|
method: 'callRouterModuleWithParams',
|
|
188
188
|
})
|
|
189
189
|
}
|
|
190
190
|
} catch (e) {
|
|
191
191
|
resolve(result)
|
|
192
192
|
}
|
|
193
193
|
})
|
|
194
194
|
return Promise.race([userInfoPromise, requestTimeoutPromise])
|
|
195
195
|
process.env.NODE_ENV === 'development'
|
|
196
196
|
? {
|
|
197
197
|
apolloId: '48ee955b0fb04d19b9f9fe8cb73d387f',
|
|
198
198
|
apolloSecret: '0d9c76ee66b0487da4e17d3cf1d7af7a',
|
|
199
199
|
}
|
|
200
200
|
: {
|
|
201
201
|
apolloId: '80c46fd06e4442998609d9f6a4ab96f0',
|
|
202
202
|
apolloSecret: 'f36bef08bcba4683b409732095793fb2',
|
|
203
203
|
}
|
|
204
204
|
if (typeof window.crypto === 'object') {
|
|
205
205
|
if (typeof (window.crypto as any).randomUUID === 'function') {
|
|
206
206
|
return (window.crypto as any).randomUUID()
|
|
207
207
|
}
|
|
208
208
|
if (
|
|
209
209
|
typeof (window.crypto as any).getRandomValues === 'function' &&
|
|
210
210
|
typeof Uint8Array === 'function'
|
|
211
211
|
) {
|
|
212
212
|
const callback = (c) => {
|
|
213
213
|
const num = Number(c)
|
|
214
214
|
return (
|
|
215
215
|
num ^
|
|
216
216
|
((window.crypto as any).getRandomValues(new Uint8Array(1))[0] &
|
|
217
217
|
(15 >> (num / 4)))
|
|
218
218
|
).toString(16)
|
|
219
219
|
}
|
|
220
220
|
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, callback)
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
let timestamp = new Date().getTime()
|
|
224
224
|
let perforNow =
|
|
225
225
|
(typeof window.performance !== 'undefined' &&
|
|
226
226
|
window.performance.now &&
|
|
227
227
|
window.performance.now() * 1000) ||
|
|
228
228
|
0
|
|
229
229
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
230
230
|
let random = Math.random() * 16
|
|
231
231
|
if (timestamp > 0) {
|
|
232
232
|
random = (timestamp + random) % 16 | 0
|
|
233
233
|
timestamp = Math.floor(timestamp / 16)
|
|
234
234
|
} else {
|
|
235
235
|
random = (perforNow + random) % 16 | 0
|
|
236
236
|
perforNow = Math.floor(perforNow / 16)
|
|
237
237
|
}
|
|
238
238
|
return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16)
|
|
239
239
|
})
|
|
240
240
|
skuId,
|
|
241
241
|
bMallTag = 1,
|
|
242
242
|
num,
|
|
243
243
|
skuUuid,
|
|
244
244
|
...otherGoodParams
|
|
245
245
|
let buId = commonParam.buId
|
|
246
246
|
if (!buId) {
|
|
247
247
|
const useInfo: any = await getBMallUserInfo()
|
|
248
248
|
buId = useInfo?.data?.buId
|
|
249
249
|
}
|
|
250
250
|
let params: any = {
|
|
251
251
|
uniformBizInfo: {
|
|
252
252
|
tenantId: 1024,
|
|
253
253
|
ua: 1,
|
|
254
254
|
buId: buId || 456,
|
|
255
255
|
bMallTag: bMallTag,
|
|
256
256
|
},
|
|
257
257
|
commonParam: {
|
|
258
258
|
pid: 100,
|
|
259
259
|
verticalCode: 'cn_retail_bmall',
|
|
260
260
|
ua: 1,
|
|
261
261
|
language: 'zh',
|
|
262
262
|
},
|
|
263
263
|
operations: [{ TheSkus: [{ Id: skuId, num: num ?? 1 }] }],
|
|
264
264
|
apolloId: APOLLO.apolloId,
|
|
265
265
|
apolloSecret: APOLLO.apolloSecret,
|
|
266
266
|
client: 'H5',
|
|
267
267
|
verticalTag: 'cn_retail_bmall',
|
|
268
268
|
carttype: bMallTag == 1 ? 21 : 22,
|
|
269
269
|
bMallTag: bMallTag,
|
|
270
270
|
traceId: getUuid(),
|
|
271
271
|
noResponse: true,
|
|
272
272
|
}
|
|
273
273
|
if (skuUuid) {
|
|
274
274
|
params.operations[0].TheSkus[0].skuUuid = skuUuid
|
|
275
275
|
}
|
|
276
276
|
if (otherGoodParams.buId) {
|
|
277
277
|
const uniformBizInfo = {
|
|
278
278
|
buId: otherGoodParams.buId,
|
|
279
279
|
}
|
|
280
280
|
params.operations[0].TheSkus[0].uniformBizInfo = uniformBizInfo
|
|
281
281
|
}
|
|
282
282
|
if (window?.siteTransResult?.gridInfoList) {
|
|
283
283
|
params = {
|
|
284
284
|
...params,
|
|
285
285
|
cartLocationList: [
|
|
286
286
|
{
|
|
287
287
|
gridInfos:
|
|
288
288
|
window?.siteTransResult?.gridInfoList &&
|
|
289
289
|
JSON.parse(window?.siteTransResult?.gridInfoList),
|
|
290
290
|
areaIdSet:
|
|
291
291
|
window?.siteTransResult?.area &&
|
|
292
292
|
window?.siteTransResult?.area?.split('-'),
|
|
293
293
|
},
|
|
294
294
|
],
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
return params
|