Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
79adc898
Commit
79adc898
authored
Nov 08, 2023
by
guang.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加竞价模版
parent
e020b0fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
2 deletions
+63
-2
SearchForm.jsx
...s/GoodsManage/SupplyPriceUpdate/components/SearchForm.jsx
+19
-1
staticdata.js
src/pages/GoodsManage/SupplyPriceUpdate/staticdata.js
+14
-1
service.js
src/pages/GoodsManage/service.js
+30
-0
No files found.
src/pages/GoodsManage/SupplyPriceUpdate/components/SearchForm.jsx
View file @
79adc898
import
{
Form
,
Button
,
Input
,
Select
,
notification
,
Cascader
,
InputNumber
}
from
'
antd
'
;
import
{
Form
,
Button
,
Input
,
Select
,
notification
,
Cascader
,
InputNumber
,
Upload
}
from
'
antd
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
SwapRightOutlined
}
from
'
@ant-design/icons
'
;
import
{
SwapRightOutlined
}
from
'
@ant-design/icons
'
;
import
{
connect
}
from
'
dva
'
;
import
{
connect
}
from
'
dva
'
;
import
styles
from
'
../../style.less
'
;
import
styles
from
'
../../style.less
'
;
import
{
stateList
}
from
'
../../staticdata
'
;
import
{
stateList
}
from
'
../../staticdata
'
;
import
{
uploadConfig
}
from
'
../staticdata
'
;
import
{
apiDownBiddingTemplate
}
from
'
../../service
'
;
const
FormItem
=
Form
.
Item
;
const
FormItem
=
Form
.
Item
;
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
...
@@ -32,6 +34,14 @@ class goodsManage extends Component {
...
@@ -32,6 +34,14 @@ class goodsManage extends Component {
this
.
props
.
handleSearch
(
1
);
this
.
props
.
handleSearch
(
1
);
};
};
// 下载模版
onDownload
=
()
=>
{
const
form
=
this
.
formRef
.
current
;
const
values
=
form
.
getFieldsValue
();
console
.
log
(
'
values :>>
'
,
values
);
apiDownBiddingTemplate
(
values
);
};
valueMin
=
value
=>
{
valueMin
=
value
=>
{
const
{
getFieldValue
,
setFieldsValue
}
=
this
.
formRef
.
current
;
const
{
getFieldValue
,
setFieldsValue
}
=
this
.
formRef
.
current
;
const
minVal
=
getFieldValue
(
'
supplyPriceMin
'
);
const
minVal
=
getFieldValue
(
'
supplyPriceMin
'
);
...
@@ -167,6 +177,14 @@ class goodsManage extends Component {
...
@@ -167,6 +177,14 @@ class goodsManage extends Component {
<
Button
onClick=
{
()
=>
this
.
onReset
()
}
className=
{
styles
.
button
}
>
<
Button
onClick=
{
()
=>
this
.
onReset
()
}
className=
{
styles
.
button
}
>
重置
重置
</
Button
>
</
Button
>
<
Upload
{
...
uploadConfig
}
>
<
Button
type=
"primary"
ghost
className=
{
styles
.
button
}
>
导入
</
Button
>
</
Upload
>
<
Button
onClick=
{
()
=>
this
.
onDownload
()
}
type=
"link"
className=
{
styles
.
button
}
>
下载模板
</
Button
>
</
FormItem
>
</
FormItem
>
</
Form
>
</
Form
>
);
);
...
...
src/pages/GoodsManage/SupplyPriceUpdate/staticdata.js
View file @
79adc898
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
Input
,
Form
,
InputNumber
,
Button
}
from
'
antd
'
;
import
{
Input
,
Form
,
InputNumber
,
Button
,
notification
}
from
'
antd
'
;
import
{
isIntegerNotMust
,
isCheckPriceTwoDecimal
}
from
'
@/utils/validator
'
;
import
{
isIntegerNotMust
,
isCheckPriceTwoDecimal
}
from
'
@/utils/validator
'
;
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
import
{
apiUploadGoodsFile
}
from
'
../service
'
;
export
function
column
(
specArr
=
[])
{
export
function
column
(
specArr
=
[])
{
return
[
return
[
...
@@ -143,3 +144,15 @@ export function columnManage() {
...
@@ -143,3 +144,15 @@ export function columnManage() {
},
},
];
];
}
}
export
const
uploadConfig
=
{
name
:
'
file
'
,
async
customRequest
(
info
)
{
const
result
=
await
apiUploadGoodsFile
(
info
.
file
);
if
(
result
.
businessCode
===
'
0000
'
)
{
notification
.
success
({
message
:
'
导入成功
'
});
}
},
accept
:
'
.xlsx
'
,
showUploadList
:
false
,
};
src/pages/GoodsManage/service.js
View file @
79adc898
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
import
request
from
'
@/utils/request
'
;
import
request
from
'
@/utils/request
'
;
import
config
from
'
../../../config/env.config
'
;
import
config
from
'
../../../config/env.config
'
;
import
{
stringify
}
from
'
qs
'
;
import
{
stringify
}
from
'
qs
'
;
import
{
saveAs
}
from
'
file-saver
'
;
import
{
format
}
from
'
date-fns
'
;
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
const
{
goodsApi
,
kdspApi
}
=
config
;
const
{
goodsApi
,
kdspApi
}
=
config
;
...
@@ -421,3 +423,31 @@ export async function apiBiddingList(params) {
...
@@ -421,3 +423,31 @@ export async function apiBiddingList(params) {
headers
,
headers
,
});
});
}
}
/**
* 导入竞价商品信息
* yApi:
* * */
export
async
function
apiUploadGoodsFile
(
file
)
{
const
params
=
new
FormData
();
params
.
append
(
'
file
'
,
file
);
const
data
=
await
request
.
post
(
'
/api/merchants/orders/deliveries/batches/import
'
,
{
data
:
params
,
prefix
:
goodsApi
,
});
return
data
;
}
/**
* 下载竞价商品模版
* yApi: http://yapi.quantgroups.com/project/389/interface/api/67269
* * */
export
async
function
apiDownBiddingTemplate
(
params
)
{
const
res
=
await
request
.
post
(
'
/api/merchants/products/bidding-template/export
'
,
{
data
:
stringify
(
_
.
omitBy
(
params
,
v
=>
v
===
undefined
&&
v
===
null
&&
v
===
''
)),
headers
,
prefix
:
goodsApi
,
responseType
:
'
arrayBuffer
'
,
});
const
blob
=
new
Blob
([
res
]);
saveAs
(
blob
,
`自营商品供货价更新表-
${
format
(
new
Date
(),
'
yyyy-MM-dd
'
)}
.xlsx`
);
}
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