Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
9fe9a337
Commit
9fe9a337
authored
Oct 18, 2021
by
alwayOnlie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flx: 更换app扫码接口
parent
15624697
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
36 deletions
+58
-36
priceSetting.tsx
...ages/priceManage/priceStrategy/component/priceSetting.tsx
+32
-32
ScanLoginWrap.tsx
src/pages/user/components/ScanLoginWrap.tsx
+26
-4
No files found.
src/pages/priceManage/priceStrategy/component/priceSetting.tsx
View file @
9fe9a337
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'react'
import
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
{
ISchemaFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
...
...
@@ -27,8 +27,8 @@ export interface PriceSettingProps {
formSubmit
?(
values
),
}
const
PriceSetting
:
React
.
FC
<
PriceSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
PriceSetting
:
React
.
FC
<
PriceSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{
}
}
=
props
const
priceRef
=
useRef
<
any
>
({})
const
productRef
=
useRef
<
any
>
({})
const
memberRef
=
useRef
<
any
>
({})
...
...
@@ -48,8 +48,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
}
=
usePageStatus
()
useEffect
(()
=>
{
if
(
id
)
{
PublicApi
.
getProductCommodityGetUnitPriceStrategy
({
id
}).
then
(
res
=>
{
if
(
id
)
{
PublicApi
.
getProductCommodityGetUnitPriceStrategy
({
id
}).
then
(
res
=>
{
const
{
initValue
}
=
transformDataForNiceForm
(
res
.
data
,
addSchemaAction
)
setInitialFormValue
(
initValue
)
dataRef
.
current
=
initValue
...
...
@@ -68,7 +68,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
addSchemaAction
.
setFieldState
(
'commodityMemberList'
,
state
=>
{
state
.
isDelete
=
true
})
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
let
hasMember
=
memberRef
.
current
.
rowSelectionCtl
.
selectRow
memberRef
.
current
.
rowSelectionCtl
.
setSelectRow
(
hasMember
.
filter
(
item
=>
item
.
memberId
!=
reocrd
.
memberId
))
}
...
...
@@ -93,7 +93,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const
handleSetProductPrice
=
(
record
:
any
)
=>
{
console
.
log
(
record
,
'record'
)
if
(
record
?.
id
)
{
if
(
record
?.
id
)
{
priceRef
.
current
.
setVisible
(
true
)
priceRef
.
current
.
setCurrentSetPriceRow
(
record
)
}
...
...
@@ -125,27 +125,27 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
}
const
searchMember
=
(
value
)
=>
{
if
(
!
value
)
{
if
(
!
value
)
{
addSchemaAction
.
setFieldValue
(
"commodityMemberList"
,
addSchemaAction
.
getFieldState
(
"commodityMemberList"
)[
"dataSource"
])
return
;
return
;
}
let
commodityMemberList
=
addSchemaAction
.
getFieldValue
(
"commodityMemberList"
).
filter
(
item
=>
item
.
name
.
indexOf
(
value
)
!==
-
1
)
addSchemaAction
.
setFieldValue
(
"commodityMemberList"
,
commodityMemberList
)
}
/**
* 生成价格设置 table 和会员 column
* @param pId 商品id
* @param ctx action
* @param priceType 价格类型(可选)1现货2询价
*/
/**
* 生成价格设置 table 和会员 column
* @param pId 商品id
* @param ctx action
* @param priceType 价格类型(可选)1现货2询价
*/
const
producePriceTableMemerColumn
=
async
(
pId
,
ctx
,
priceType
?)
=>
{
const
res
=
await
PublicApi
.
getProductCommodityGetCommodityUnitPrice
({
id
:
pId
,})
const
res
=
await
PublicApi
.
getProductCommodityGetCommodityUnitPrice
({
id
:
pId
,
})
// 填充价格设置table(编辑采用initValue数据)
let
source
=
pageStatus
===
PageStatus
.
ADD
?
res
.
data
:
dataRef
.
current
[
"memberUnitPriceList"
]
const
{
columsUnit
,
tableUnitData
}
=
constructTableData
(
source
,
ctx
,
pageStatus
)
const
{
columsUnit
,
tableUnitData
}
=
constructTableData
(
source
,
ctx
,
pageStatus
)
ctx
.
setFieldState
(
"memberUnitPriceList"
,
state
=>
{
state
.
dataSource
=
source
// 存源数据
priceType
!==
2
?
columsUnit
.
push
({
...
...
@@ -154,8 +154,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
align
:
'center'
,
render
:
(
_i
,
_r
)
=>
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleSetProductPrice
(
_r
)
}
>
设置价格
</
Button
>
})
:
columsUnit
.
pop
()
:
columsUnit
.
pop
()
state
.
props
[
"x-component-props"
].
columns
=
columsUnit
})
ctx
.
setFieldValue
(
"memberUnitPriceList"
,
priceType
===
2
?
tableUnitData
.
map
(
item
=>
{
delete
item
[
"单价"
];
return
item
})
:
tableUnitData
)
...
...
@@ -164,7 +164,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// 填充适用会员table
ctx
.
setFieldState
(
"commodityMemberList"
,
state
=>
{
memberColumns
[
memberColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
{
memberColumns
[
memberColumns
.
length
-
1
].
render
=
(
text
,
record
)
=>
{
return
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleDeleteMemberTable
(
record
)
}
>
删除
</
Button
>
}
state
.
props
[
"x-component-props"
].
columns
=
memberColumns
...
...
@@ -173,21 +173,21 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// 新增会员
const
tableAddMemberButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<>
<
p
style=
{
{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
flexWrap
:
'wrap'
}
}
>
<
p
style=
{
{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
flexWrap
:
'wrap'
}
}
>
<
Search
placeholder=
"会员名称"
onSearch=
{
value
=>
searchMember
(
value
)
}
style=
{
{
width
:
256
}
}
/>
</
p
>
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
选择指定会员
</
Button
>
<
Button
style=
{
{
marginBottom
:
16
}
}
block
icon=
{
<
PlusOutlined
/>
}
onClick=
{
handleAddMemberBtn
}
type=
'dashed'
>
选择指定会员
</
Button
>
</>
// 批量设置价格按钮
const
batchPriceButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
priceType
!==
2
&&
<
Button
type=
"text"
onClick=
{
clickBatchSetPrice
}
style=
{
{
marginBottom
:
12
,
float
:
"right"
}
}
><
SettingOutlined
/>
批量设置价格
</
Button
>
const
batchPriceButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
priceType
!==
2
&&
<
Button
type=
"text"
onClick=
{
clickBatchSetPrice
}
style=
{
{
marginBottom
:
12
,
float
:
"right"
}
}
><
SettingOutlined
/>
批量设置价格
</
Button
>
// 选择商品
const
connectProduct
=
pageStatus
===
PageStatus
.
ADD
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
const
connectProduct
=
pageStatus
===
PageStatus
.
ADD
&&
<
div
className=
'connectBtn'
onClick=
{
handleAddProductBtn
}
><
LinkOutlined
style=
{
{
marginRight
:
4
}
}
/>
选择
</
div
>
const
questionNameLabel
=
<>
价格策略名称
...
...
@@ -232,16 +232,16 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// state.dataSource = pageStatus === PageStatus.PREVIEW ?
// GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id))
// :
state
.
dataSource
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
id
===
parentState
.
value
)
state
.
dataSource
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
id
===
parentState
.
value
)
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
}
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
}
})
ctx
.
setFieldState
(
'priceType'
,
state
=>
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
}
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
}
});
}
})
...
...
@@ -254,7 +254,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
$
(
"onFieldValueChange"
,
"priceType"
).
subscribe
(
parentState
=>
{
let
pId
=
ctx
.
getFieldValue
(
"productId"
)
if
(
pId
)
{
if
(
pId
)
{
producePriceTableMemerColumn
(
pId
,
ctx
,
parentState
.
value
)
}
setPriceType
(
parentState
.
value
)
...
...
src/pages/user/components/ScanLoginWrap.tsx
View file @
9fe9a337
...
...
@@ -16,17 +16,36 @@ const ScanLoginWrap: React.FC = () => {
time
-=
2
;
console
.
log
(
time
);
timer
.
current
=
setTimeout
(()
=>
{
loginInfo
(
authCode
)
const
code
=
getUrlParam
(
authCode
,
'authCode'
);
loginInfo
(
code
)
hanleCountdown
(
authCode
);
},
2000
);
return
;
}
else
{
AuthCode
();
time
=
60
*
5
;
}
}
const
getUrlParam
=
(
url
:
string
,
name
:
string
)
=>
{
const
paraString
:
any
=
url
.
substring
(
url
.
indexOf
(
"?"
)
+
1
,
url
.
length
).
split
(
"&"
);
const
paraObj
:
any
=
{};
let
j
:
any
;
// eslint-disable-next-line no-cond-assign
// eslint-disable-next-line no-plusplus
for
(
let
i
=
0
;
j
=
paraString
[
i
];
i
++
)
{
paraObj
[
j
.
substring
(
0
,
j
.
indexOf
(
"="
)).
toLowerCase
()]
=
j
.
substring
(
j
.
indexOf
(
"="
)
+
1
,
j
.
length
);
}
const
returnValue
:
any
=
paraObj
[
name
.
toLowerCase
()];
if
(
typeof
(
returnValue
)
===
"undefined"
)
{
return
""
;
}
return
returnValue
;
}
const
AuthCode
=
()
=>
{
PublicApi
.
postMemberAuthCode
({},
{
ctlType
:
'none'
}).
then
(
res
=>
{
hanleCountdown
(
res
.
data
.
authCode
);
QRCode
.
toDataURL
(
res
.
data
.
authCode
).
then
((
url
:
any
)
=>
{
// /member/login/authUrl
PublicApi
.
postMemberLoginAuthUrl
({},
{
ctlType
:
'none'
}).
then
(
res
=>
{
hanleCountdown
(
res
.
data
.
authUrl
);
QRCode
.
toDataURL
(
res
.
data
.
authUrl
).
then
((
url
:
any
)
=>
{
setQrCode
(
url
)
console
.
log
(
url
)
})
...
...
@@ -53,6 +72,9 @@ const ScanLoginWrap: React.FC = () => {
}
else
{
window
.
location
.
replace
(
'/memberCenter/home'
)
}
console
.
log
(
redirect
,
'redirect'
)
clearTimeout
(
timer
.
current
)
timer
.
current
=
null
}
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment