Commit 3c73a337 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents cd47d972 5aebd008
......@@ -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',
},
]
},
// 价格管理
......
......@@ -58,8 +58,8 @@ const AnchorPage = (props: IProps) => {
onBack,
children,
} = props;
const firstKey = anchors.length ? `#${anchors[0].key}` : '';
const [current, setCurrent] = useState(firstKey);
const defaultKey = anchors.length ? `#${anchors[0].key}` : '';
const [current, setCurrent] = useState(defaultKey);
const [rect, measuredRef] = useClientRect();
const mounted = useRef(false);
......@@ -72,6 +72,13 @@ const AnchorPage = (props: IProps) => {
};
}, []);
useEffect(() => {
const firstKey = anchors.length ? `#${anchors[0].key}` : '';
if (firstKey && firstKey !== current) {
setCurrent(firstKey);
}
}, [anchors]);
const handleBack = () => {
if (onBack) {
onBack();
......@@ -86,7 +93,8 @@ const AnchorPage = (props: IProps) => {
return;
}
if (!currentActiveLink) {
mounted.current && setCurrent(firstKey);
const firstKey = anchors.length ? `#${anchors[0].key}` : '';
mounted.current && firstKey && setCurrent(firstKey);
}
};
......
// 这里是处理比较特殊的url 跳转的
export const AuthUrl = (menuCode: string, urlCode: string, btnCode?: string) => {
const userBtn = require('../../../config/router.config.json')
const AuthRoutes = userBtn.filter((item: any) => item.relationParentCode === urlCode);
const AuthButton = AuthRoutes[0]?.routes;
const AuthCode: any = [];
for (let i = 0; i < AuthButton.length; i++) {
if (AuthButton[i].btns.length != 0) {
for (let j = 0; j < AuthButton[i].btns.length; j++) {
if (AuthButton[i].btns[j].buttonCode === menuCode) {
AuthCode.push(AuthButton[i].btns[j]);
break;
}
}
}
}
if (btnCode === 'DevTest') return true
for (let i = 0; i < AuthCode.length; i++) {
if (menuCode) {
// 是否有页面标识
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
if (AuthCode[i].buttonCode === menuCode) {
return true
}
}
continue
}
return false
}
\ No newline at end of file
export interface AuthButtonProps {
btnCode?: string
menuCode: string
children: any,
urlCode: string,
}
/**
* 按钮权限
* @param {String} menuCode 页面标识
* @param {String} btnCode 按钮标识
*/
const AuthButton = (props: AuthButtonProps) => {
const {
children,
btnCode, // 按钮标识
menuCode, // 按钮页面标识
urlCode, // 父级别菜单
} = props
const userBtn = require('../../../config/router.config.json')
const AuthRoutes = userBtn.filter((item: any) => item.relationParentCode === urlCode);
const AuthButton = AuthRoutes[0]?.routes;
const AuthCode: any = [];
for (let i = 0; i < AuthButton.length; i++) {
if (AuthButton[i].btns.length != 0) {
for (let j = 0; j < AuthButton[i].btns.length; j++) {
if (AuthButton[i].btns[j].buttonCode === menuCode) {
AuthCode.push(AuthButton[i].btns[j]);
break;
}
}
}
}
// console.log(AuthCode, 'AuthCode');
const _authorityBtn = () => {
// 本地开发时传的特殊标识,直接开放权限
if (btnCode === 'DevTest') return true
for (let i = 0; i < AuthCode.length; i++) {
if (menuCode) {
// 是否有页面标识
// 找到该页面标识的按钮权限数据,并匹配权限按钮是否勾选
if (AuthCode[i].buttonCode === menuCode) {
return true
}
}
continue
}
return false
}
return _authorityBtn() ? children : null
}
export default AuthButton;
priceManage.add" 价格策略列表新曾
priceManage.del 价格策略列表删除
priceManage.edit 价格策略编辑
priceManage.state 价格策略设置是否有效按钮
priceManage.see 价格策略查看详情
\ No newline at end of file
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: '查询',
},
},
},
},
},
},
},
};
......@@ -14,6 +14,8 @@ import { history, useIntl } from 'umi'
import StatusSwitch from '@/components/StatusSwitch'
import { PlusOutlined } from '@ant-design/icons'
import { getProductCommodityGetUnitPriceStrategyList, postProductCommodityDeleteUnitPriceStrategy, postProductCommodityUpdateUnitPriceStrategyStatus } from '@/services/ProductV2Api'
import AuthButton from '@/components/AuthButton'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
const formActions = createFormActions();
......@@ -32,11 +34,14 @@ const PriceManage: React.FC<{}> = () => {
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/detail?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
render: (text: any, record: any) =>
<EyePreview
url={`/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/detail?id=${record.id}&preview=1`}
type={AuthUrl('priceManage.see', 'jiageguanl') ? 'link' : 'button'}
>
{text}
</EyePreview>
},
// {
// title: '商品ID',
......@@ -133,10 +138,14 @@ const PriceManage: React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
<Button type='link' className="padLeft0" onClick={() => handleModify(record)}>{intl.formatMessage({ id: 'dealAbility.xiugai' })}</Button>
<Popconfirm title={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.title' })} okText={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.okText' })} cancelText={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.cancelText' })} onConfirm={() => handleDelete(record)}>
<Button type='link' className="padLeft0">{intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.link' })}</Button>
</Popconfirm>
<AuthButton menuCode='priceManage.edit' urlCode='jiageguanl'>
<Button type='link' className="padLeft0" onClick={() => handleModify(record)}>{intl.formatMessage({ id: 'dealAbility.xiugai' })}</Button>
</AuthButton>
<AuthButton menuCode='priceManage.del' urlCode='jiageguanl'>
<Popconfirm title={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.title' })} okText={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.okText' })} cancelText={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.cancelText' })} onConfirm={() => handleDelete(record)}>
<Button type='link' className="padLeft0">{intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.link' })}</Button>
</Popconfirm>
</AuthButton>
</>
)
}
......@@ -178,12 +187,14 @@ const PriceManage: React.FC<{}> = () => {
const controllerBtns = (
<Space>
<Button
type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add')}
>
<PlusOutlined />{intl.formatMessage({ id: 'priceManage.priceStrategy.controllerBtns' })}
</Button>
<AuthButton menuCode='priceManage.add' urlCode='jiageguanl'>
<Button
type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add')}
>
<PlusOutlined />{intl.formatMessage({ id: 'priceManage.priceStrategy.controllerBtns' })}
</Button>
</AuthButton>
</Space>
)
......
......@@ -54,15 +54,15 @@ const SetStrategy: React.FC<{}> = () => {
backIcon={<ReutrnEle description={intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.description' })} />}
className="setStrategy"
title={pageStatus === PageStatus.PREVIEW ? intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.title1' }) : (pageStatus === PageStatus.ADD ? intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.title2' }) : intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.title3' }))}
extra={(
pageStatus !== PageStatus.PREVIEW
? (
<Button key="1" loading={btnLoading} onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
{intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.extra' })}
</Button>
)
: null
)}
// extra={(
// pageStatus !== PageStatus.PREVIEW
// ? (
// <Button key="1" loading={btnLoading} onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
// {intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.extra' })}
// </Button>
// )
// : null
// )}
>
<Card>
<PriceSetting addSchemaAction={addSchemaAction} schema={setPriceSchema} formSubmit={formSubmit} />
......
......@@ -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