Commit 7fed9f56 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

feat: 添加待审核商品页面

parent d3423e81
......@@ -262,6 +262,21 @@ const CommodityRoute: RouterChild = {
icon: 'smile',
component: '@/pages/commodity/products/viewDirectChannel',
},
// 待审核商品
{
path: '/memberCenter/commodityAbility/commodity/checkProduct',
name: 'checkProduct',
icon: 'smile',
component: '@/pages/commodity/products/checkProduct',
},
// 待审核商品-详情
{
path: '/memberCenter/commodityAbility/commodity/checkProduct/detail',
name: 'checkProductDetail',
hideInMenu: true,
icon: 'smile',
component: '@/pages/commodity/products/checkProductDetail',
},
]
},
// 价格管理
......
import React, { useRef, ReactNode } from 'react'
import { history } from 'umi'
import { Button, Card } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import moment from 'moment'
import EyePreview from '@/components/EyePreview'
import { productWillSchema } from './schema/productSchema'
import NiceForm from '@/components/NiceForm'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { createFormActions, FormEffectHooks } from '@formily/antd'
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effect'
import { getProductCommodityGetPlatformCommodityList } from '@/services/ProductV2Api'
const formActions = createFormActions();
const CheckProduct: React.FC<{}> = () => {
const ref = useRef<any>({})
const MENU_NODE = 'commodity.productWillCheck'
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
},
{
title: '商品名称',
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text, record) => <EyePreview
url={`/memberCenter/commodityAbility/commodity/checkProduct/detail?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
},
{
title: '商家名称',
dataIndex: 'memberName',
key: 'memberName',
},
{
title: '会员品类',
dataIndex: ['customerCategory', 'name'],
key: 'customerCategory.name',
},
{
title: '平台品类',
dataIndex: ['customerCategory', 'category', 'name'],
key: 'customerCategory.category.name',
},
{
title: '品牌',
dataIndex: ['brand', 'name'],
key: 'brand.name',
},
{
title: '单位',
dataIndex: 'unitName',
key: 'unitName',
},
{
title: '产品定价',
dataIndex: 'priceType',
key: 'priceType',
render: (text) => {
if (text === 1)
return '现货价格'
else if (text === 2)
return '价格需要询价'
else if (text === 3)
return '积分兑换商品'
else if (text === 4)
return '赠品'
},
},
{
title: '价格',
dataIndex: 'min',
key: 'min',
render: (text, reocrd) => {
if (reocrd.priceType === 1) {
if (reocrd.max === reocrd.min)
return <>{reocrd.min}</>
else
return <>{reocrd.min} ~ ¥{reocrd.max}</>
}
if (reocrd.priceType === 3) {
if (reocrd.max === reocrd.min)
return <>{reocrd.min}</>
else
return <>{reocrd.min} ~ {reocrd.max}</>
}
if (reocrd.priceType === 2)
return null
}
},
{
title: '申请审核时间',
dataIndex: 'applyTime',
key: 'applyTime',
render: (text) => text && moment(text).format('YYYY-MM-DD HH:mm:ss'),
defaultSortOrder: 'descend',
sorter: (a, b) => a.applyTime - b.applyTime,
},
{
title: '审核状态',
dataIndex: 'status',
key: 'status',
render: (text, record) => {
let component: ReactNode = null
if (record.status === 1)
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusValid"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid"></span>审核通过</>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
return component
},
},
{
title: '操作',
dataIndex: 'option',
render: (text, record) => {
return (
<>
{/* <AuthButton menuCode={MENU_NODE} btnCode="DevTest"> */}
<Button type='link' onClick={() => history.push(`/memberCenter/commodityAbility/commodity/checkProduct/detail?id=${record.id}`)}>审核</Button>
{/* </AuthButton> */}
</>
)
}
},
];
const fetchData = (params) => {
return new Promise((resolve, reject) => {
getProductCommodityGetPlatformCommodityList({ ...params, status: 2 }).then(res => {
const { data } = res
resolve(data)
})
})
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
columns={columns}
currentRef={ref}
tableProps={{ rowKey: 'id' }}
fetchTableData={(params) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
)
FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
searchBrandOptionEffect(actions, 'brandId')
})
FormEffectHooks.onFieldChange$('categoryId').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'categoryId')
})
}}
schema={productWillSchema}
/>
}
/>
</Card>
</PageHeaderWrapper>
)
}
export default CheckProduct
This diff is collapsed.
......@@ -259,3 +259,130 @@ export const fastSchema: ISchema = {
},
},
};
// 待审核商品列表高级搜索
export const productWillSchema: ISchema = {
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
topLayout: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
},
properties: {
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '商品名称',
},
},
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
memberName: {
type: 'string',
'x-component-props': {
placeholder: '商家名称',
},
},
brandId: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
},
},
categoryId: {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: '平台品类',
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
'NO_NAME_FIELD_$2': {
type: 'object',
'x-component': 'layout',
'x-component-props': {
style: { width: '174px', display: 'flex', justifyContent: 'flex-start' },
},
properties: {
min: {
type: 'string',
"x-component-props": {
placeholder: '最低价',
type: 'number',
min: 0,
style: { width: '70px', textAlign: 'center', borderRight: 0 }
}
},
"gap": {
type: 'string',
"x-component-props": {
style: {
width: '34px',
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
backgroundColor: '#fff',
textAlign: 'center'
},
placeholder: "~",
disabled: true,
}
},
max: {
type: 'string',
"x-component-props": {
placeholder: '最高价',
type: 'number',
min: 0,
style: { width: '70px', textAlign: 'center', borderLeft: 0 }
}
},
}
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
......@@ -205,7 +205,6 @@ const AddBrand: React.FC<{}> = () => {
<Col span={24}>
<Form.Item
name="proveUrl"
// valuePropName="fileList"
>
<UploadImage
listType="picture-card"
......
......@@ -6,6 +6,7 @@
width: 100%;
height: 100%;
padding: 18px;
object-fit: contain;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment