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
linweijiong
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
{
usePageStatus
,
PageStatus
}
from
'@/hooks/usePageStatus'
import
{
ISchemaFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
ISchemaFormActions
,
ISchema
,
FormEffectHooks
}
from
'@formily/antd'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
...
@@ -27,8 +27,8 @@ export interface PriceSettingProps {
...
@@ -27,8 +27,8 @@ export interface PriceSettingProps {
formSubmit
?(
values
),
formSubmit
?(
values
),
}
}
const
PriceSetting
:
React
.
FC
<
PriceSettingProps
>
=
(
props
)
=>
{
const
PriceSetting
:
React
.
FC
<
PriceSettingProps
>
=
(
props
)
=>
{
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{}
}
=
props
const
{
addSchemaAction
,
schema
,
formSubmit
,
onFieldChange
=
()
=>
{
}
}
=
props
const
priceRef
=
useRef
<
any
>
({})
const
priceRef
=
useRef
<
any
>
({})
const
productRef
=
useRef
<
any
>
({})
const
productRef
=
useRef
<
any
>
({})
const
memberRef
=
useRef
<
any
>
({})
const
memberRef
=
useRef
<
any
>
({})
...
@@ -48,8 +48,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -48,8 +48,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
}
=
usePageStatus
()
}
=
usePageStatus
()
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
id
)
{
if
(
id
)
{
PublicApi
.
getProductCommodityGetUnitPriceStrategy
({
id
}).
then
(
res
=>
{
PublicApi
.
getProductCommodityGetUnitPriceStrategy
({
id
}).
then
(
res
=>
{
const
{
initValue
}
=
transformDataForNiceForm
(
res
.
data
,
addSchemaAction
)
const
{
initValue
}
=
transformDataForNiceForm
(
res
.
data
,
addSchemaAction
)
setInitialFormValue
(
initValue
)
setInitialFormValue
(
initValue
)
dataRef
.
current
=
initValue
dataRef
.
current
=
initValue
...
@@ -68,7 +68,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -68,7 +68,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
addSchemaAction
.
setFieldState
(
'commodityMemberList'
,
state
=>
{
addSchemaAction
.
setFieldState
(
'commodityMemberList'
,
state
=>
{
state
.
isDelete
=
true
state
.
isDelete
=
true
})
})
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
let
hasMember
=
memberRef
.
current
.
rowSelectionCtl
.
selectRow
let
hasMember
=
memberRef
.
current
.
rowSelectionCtl
.
selectRow
memberRef
.
current
.
rowSelectionCtl
.
setSelectRow
(
hasMember
.
filter
(
item
=>
item
.
memberId
!=
reocrd
.
memberId
))
memberRef
.
current
.
rowSelectionCtl
.
setSelectRow
(
hasMember
.
filter
(
item
=>
item
.
memberId
!=
reocrd
.
memberId
))
}
}
...
@@ -93,7 +93,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -93,7 +93,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const
handleSetProductPrice
=
(
record
:
any
)
=>
{
const
handleSetProductPrice
=
(
record
:
any
)
=>
{
console
.
log
(
record
,
'record'
)
console
.
log
(
record
,
'record'
)
if
(
record
?.
id
)
{
if
(
record
?.
id
)
{
priceRef
.
current
.
setVisible
(
true
)
priceRef
.
current
.
setVisible
(
true
)
priceRef
.
current
.
setCurrentSetPriceRow
(
record
)
priceRef
.
current
.
setCurrentSetPriceRow
(
record
)
}
}
...
@@ -125,27 +125,27 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -125,27 +125,27 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
}
}
const
searchMember
=
(
value
)
=>
{
const
searchMember
=
(
value
)
=>
{
if
(
!
value
)
{
if
(
!
value
)
{
addSchemaAction
.
setFieldValue
(
"commodityMemberList"
,
addSchemaAction
.
getFieldState
(
"commodityMemberList"
)[
"dataSource"
])
addSchemaAction
.
setFieldValue
(
"commodityMemberList"
,
addSchemaAction
.
getFieldState
(
"commodityMemberList"
)[
"dataSource"
])
return
;
return
;
}
}
let
commodityMemberList
=
addSchemaAction
.
getFieldValue
(
"commodityMemberList"
).
filter
(
item
=>
item
.
name
.
indexOf
(
value
)
!==
-
1
)
let
commodityMemberList
=
addSchemaAction
.
getFieldValue
(
"commodityMemberList"
).
filter
(
item
=>
item
.
name
.
indexOf
(
value
)
!==
-
1
)
addSchemaAction
.
setFieldValue
(
"commodityMemberList"
,
commodityMemberList
)
addSchemaAction
.
setFieldValue
(
"commodityMemberList"
,
commodityMemberList
)
}
}
/**
/**
* 生成价格设置 table 和会员 column
* 生成价格设置 table 和会员 column
* @param pId 商品id
* @param pId 商品id
* @param ctx action
* @param ctx action
* @param priceType 价格类型(可选)1现货2询价
* @param priceType 价格类型(可选)1现货2询价
*/
*/
const
producePriceTableMemerColumn
=
async
(
pId
,
ctx
,
priceType
?)
=>
{
const
producePriceTableMemerColumn
=
async
(
pId
,
ctx
,
priceType
?)
=>
{
const
res
=
await
PublicApi
.
getProductCommodityGetCommodityUnitPrice
({
id
:
pId
,})
const
res
=
await
PublicApi
.
getProductCommodityGetCommodityUnitPrice
({
id
:
pId
,
})
// 填充价格设置table(编辑采用initValue数据)
// 填充价格设置table(编辑采用initValue数据)
let
source
=
pageStatus
===
PageStatus
.
ADD
?
res
.
data
:
dataRef
.
current
[
"memberUnitPriceList"
]
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
=>
{
ctx
.
setFieldState
(
"memberUnitPriceList"
,
state
=>
{
state
.
dataSource
=
source
// 存源数据
state
.
dataSource
=
source
// 存源数据
priceType
!==
2
?
columsUnit
.
push
({
priceType
!==
2
?
columsUnit
.
push
({
...
@@ -154,8 +154,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -154,8 +154,8 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
align
:
'center'
,
align
:
'center'
,
render
:
(
_i
,
_r
)
=>
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleSetProductPrice
(
_r
)
}
>
设置价格
</
Button
>
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
state
.
props
[
"x-component-props"
].
columns
=
columsUnit
})
})
ctx
.
setFieldValue
(
"memberUnitPriceList"
,
priceType
===
2
?
tableUnitData
.
map
(
item
=>
{
delete
item
[
"单价"
];
return
item
})
:
tableUnitData
)
ctx
.
setFieldValue
(
"memberUnitPriceList"
,
priceType
===
2
?
tableUnitData
.
map
(
item
=>
{
delete
item
[
"单价"
];
return
item
})
:
tableUnitData
)
...
@@ -164,7 +164,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -164,7 +164,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// 填充适用会员table
// 填充适用会员table
ctx
.
setFieldState
(
"commodityMemberList"
,
state
=>
{
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
>
return
<
Button
disabled=
{
pageStatus
===
PageStatus
.
PREVIEW
}
type=
'link'
onClick=
{
()
=>
handleDeleteMemberTable
(
record
)
}
>
删除
</
Button
>
}
}
state
.
props
[
"x-component-props"
].
columns
=
memberColumns
state
.
props
[
"x-component-props"
].
columns
=
memberColumns
...
@@ -173,21 +173,21 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -173,21 +173,21 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// 新增会员
// 新增会员
const
tableAddMemberButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<>
const
tableAddMemberButton
=
pageStatus
!==
PageStatus
.
PREVIEW
&&
<>
<
p
style=
{
{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
flexWrap
:
'wrap'
}
}
>
<
p
style=
{
{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
flexWrap
:
'wrap'
}
}
>
<
Search
<
Search
placeholder=
"会员名称"
placeholder=
"会员名称"
onSearch=
{
value
=>
searchMember
(
value
)
}
onSearch=
{
value
=>
searchMember
(
value
)
}
style=
{
{
width
:
256
}
}
style=
{
{
width
:
256
}
}
/>
/>
</
p
>
</
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
=
<>
const
questionNameLabel
=
<>
价格策略名称
价格策略名称
...
@@ -232,16 +232,16 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -232,16 +232,16 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// state.dataSource = pageStatus === PageStatus.PREVIEW ?
// state.dataSource = pageStatus === PageStatus.PREVIEW ?
// GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id))
// 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
)
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
state
.
props
[
'x-component-props'
].
disabled
=
true
;
}
}
})
})
ctx
.
setFieldState
(
'priceType'
,
state
=>
{
ctx
.
setFieldState
(
'priceType'
,
state
=>
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
if
(
pageStatus
===
PageStatus
.
EDIT
)
{
state
.
props
[
'x-component-props'
].
disabled
=
true
;
state
.
props
[
'x-component-props'
].
disabled
=
true
;
}
}
});
});
}
}
})
})
...
@@ -254,7 +254,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
...
@@ -254,7 +254,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
$
(
"onFieldValueChange"
,
"priceType"
).
subscribe
(
parentState
=>
{
$
(
"onFieldValueChange"
,
"priceType"
).
subscribe
(
parentState
=>
{
let
pId
=
ctx
.
getFieldValue
(
"productId"
)
let
pId
=
ctx
.
getFieldValue
(
"productId"
)
if
(
pId
)
{
if
(
pId
)
{
producePriceTableMemerColumn
(
pId
,
ctx
,
parentState
.
value
)
producePriceTableMemerColumn
(
pId
,
ctx
,
parentState
.
value
)
}
}
setPriceType
(
parentState
.
value
)
setPriceType
(
parentState
.
value
)
...
...
src/pages/user/components/ScanLoginWrap.tsx
View file @
9fe9a337
...
@@ -16,17 +16,36 @@ const ScanLoginWrap: React.FC = () => {
...
@@ -16,17 +16,36 @@ const ScanLoginWrap: React.FC = () => {
time
-=
2
;
time
-=
2
;
console
.
log
(
time
);
console
.
log
(
time
);
timer
.
current
=
setTimeout
(()
=>
{
timer
.
current
=
setTimeout
(()
=>
{
loginInfo
(
authCode
)
const
code
=
getUrlParam
(
authCode
,
'authCode'
);
loginInfo
(
code
)
hanleCountdown
(
authCode
);
hanleCountdown
(
authCode
);
},
2000
);
},
2000
);
return
;
}
else
{
}
else
{
AuthCode
();
time
=
60
*
5
;
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
=
()
=>
{
const
AuthCode
=
()
=>
{
PublicApi
.
postMemberAuthCode
({},
{
ctlType
:
'none'
}).
then
(
res
=>
{
// /member/login/authUrl
hanleCountdown
(
res
.
data
.
authCode
);
PublicApi
.
postMemberLoginAuthUrl
({},
{
ctlType
:
'none'
}).
then
(
res
=>
{
QRCode
.
toDataURL
(
res
.
data
.
authCode
).
then
((
url
:
any
)
=>
{
hanleCountdown
(
res
.
data
.
authUrl
);
QRCode
.
toDataURL
(
res
.
data
.
authUrl
).
then
((
url
:
any
)
=>
{
setQrCode
(
url
)
setQrCode
(
url
)
console
.
log
(
url
)
console
.
log
(
url
)
})
})
...
@@ -53,6 +72,9 @@ const ScanLoginWrap: React.FC = () => {
...
@@ -53,6 +72,9 @@ const ScanLoginWrap: React.FC = () => {
}
else
{
}
else
{
window
.
location
.
replace
(
'/memberCenter/home'
)
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