Commit 643ece4f authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

feat:品牌审核,属性管理

parent eef1b6e2
/*
* 品牌审核路由
*/
const router = {
path: '/trademark',
name: 'trademark',
icon: 'SmileOutlined',
hidePageHeader: true,
routes: [
{
path: '/trademark/trademarkSearch',
name: 'trademarkSearch',
component: '@/pages/trademark/trademarkSearch',
},
{
path: '/trademark/trademarkSearch/checkBrand',
name: 'checkBrand',
hideInMenu: true,
component: '@/pages/trademark/trademarkSearch/checkBrand',
},
{
path: '/trademark/trademarkSearch/viewBrand',
name: 'viewBrand',
hideInMenu: true,
component: '@/pages/trademark/trademarkSearch/viewBrand',
},
{
path: '/trademark/trademarkWillCheck',
name: 'trademarkWillCheck',
component: '@/pages/trademark/trademarkWillCheck',
},
]
}
export default router
/*
* 商品能力路由
* @Author: ghua
* @Date: 2020-07-10 11:36:32
* @Last Modified by: ghua
* @Last Modified time: 2020-07-18 11:19:36
*/
const router = {
path: '/classAndProperty',
name: 'classAndProperty',
icon: 'SmileOutlined',
hidePageHeader: true,
routes: [
{
path: '/classAndProperty/class',
name: 'class',
component: '@/pages/classAndProperty/class',
},
{
path: '/classAndProperty/attribute',
name: 'attribute',
component: '@/pages/classAndProperty/attribute',
},
{
path: '/classAndProperty/attribute/addAttribute',
name: 'addAttribute',
component: '@/pages/classAndProperty/attribute/addAttribute',
hideInMenu: true,
},
{
path: '/classAndProperty/propertyValue',
name: 'propertyValue',
component: '@/pages/classAndProperty/propertyValue',
},
{
path: '/classAndProperty/propertyValue/addPropertyValue',
name: 'addPropertyValue',
component: '@/pages/classAndProperty/propertyValue/addPropertyValue',
hideInMenu: true,
},
{
path: '/classAndProperty/categoryAttributes',
name: 'categoryAttributes',
component: '@/pages/classAndProperty/categoryAttributes',
},
{
path: '/classAndProperty/categoryAttributes/viewAttributes',
name: 'viewAttributes',
component: '@/pages/classAndProperty/categoryAttributes/viewAttributes',
hideInMenu: true,
},
]
}
export default router
......@@ -9,10 +9,12 @@
* @description 路由配置页, 更多配置可查看 https://umijs.org/zh-CN/docs/routing#routes
*/
import pageCustomized from './pageCustomized'
import commodityRoute from './commodityRoute' // 商品能力路由
import trademarkRoute from './brandRoute' // 品牌路由
import logisticsRoutes from './logisticsRoutes'
import memberAbility from './memberAbility'
import ruleSettingRoutes from './ruleSettingRoutes'
const routeList = [pageCustomized,logisticsRoutes,memberAbility,ruleSettingRoutes]
const routeList = [pageCustomized, commodityRoute, trademarkRoute, logisticsRoutes, memberAbility, ruleSettingRoutes]
const router = [
{
path: '/login',
......
import React from 'react'
import { Link } from 'umi'
import { EyeOutlined } from '@ant-design/icons'
import { Button } from 'antd'
export interface EyePreviewProps {
url?: string,
type?: 'button' | 'link',
handleClick?()
}
const EyePreview:React.FC<EyePreviewProps> = (props) => {
return (
props.type === 'link' ?
<Link to={props.url || ''}>
{props.children} <EyeOutlined />
</Link>
:
<Button onClick={props.handleClick} type='link'>
{props.children} <EyeOutlined />
</Button>
)
}
EyePreview.defaultProps = {
type: 'link'
}
export default EyePreview
\ No newline at end of file
import React from 'react'
import { Popconfirm, Button } from 'antd'
import { PlayCircleOutlined } from '@ant-design/icons'
export interface StatusSwitchProps {
record: any,
fieldNames?: string, // 自定义字段名称
expectTrueValue?: boolean|number|string, //期望为ture(有效)的值
handleConfirm?(),
handleCancel?()
}
const StatusSwitch:React.FC<StatusSwitchProps> = (props) => {
const { record, fieldNames = 'state', expectTrueValue = 1 } = props
return (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={props.handleConfirm}
onCancel={props.handleCancel}
okText="是"
cancelText="否"
>
<Button type="link" style={record[fieldNames] === expectTrueValue?{color:'#00B37A'}:{color:'red'}}>{record[fieldNames] === expectTrueValue?'有效':'无效'} <PlayCircleOutlined /></Button>
</Popconfirm>
)
}
StatusSwitch.defaultProps = {}
export default StatusSwitch
\ No newline at end of file
import React, { useState } from 'react';
import { IApiRequest } from '@/utils/request';
export interface IHttpRequestReturn<T> {
data: T | null,
loading: boolean,
err: any,
run(params?: any)
}
/**
* 简易版本的useRequest hooks, 用于处理带有loading的业务场景
* @auth xjm
*/
export function useHttpRequest<T>(api: (params?, config?) => Promise<T>, config?: IApiRequest): IHttpRequestReturn<T> {
const [loading, setLoading] = useState(false)
const [data, setData] = useState<T | null>(null)
const [err, setErr] = useState()
const run = (params) => {
setLoading(true)
api(params).then((res: any) => {
setData(res.data)
}).catch(err => {
setErr(err)
}).finally(() => {
setTimeout(() => {
setLoading(false)
}, 200)
})
}
return {
data,
loading,
err,
run
}
}
\ No newline at end of file
import { history } from 'umi'
import { useState } from 'react'
export enum PageStatus {
ADD,
EDIT,
PREVIEW
}
export const usePageStatus = () => {
const { preview, id = '' } = history.location.query
// 默认预览状态
let pageStatus = PageStatus.PREVIEW
if (preview === '1') {
pageStatus = PageStatus.PREVIEW
} else {
if (id) {
pageStatus = PageStatus.EDIT
} else {
pageStatus = PageStatus.ADD
}
}
return {
pageStatus,
id,
preview
}
}
\ No newline at end of file
import { useState } from 'react'
import { TableRowSelection } from 'antd/es/table/interface'
interface useRowSelectionTableCtl {
selectRow: any[],
selectedRowKeys: any[],
setSelectRow(rows: any[]),
setSelectedRowKeys(rows: any)
}
interface useRowSelectionOptions {
type?: 'checkbox' | 'radio'
}
/**
* 用于处理table 多选或者单选时的hooks
* @auth xjm
*/
export const useRowSelectionTable = (options: useRowSelectionOptions = {}): [TableRowSelection<any>, useRowSelectionTableCtl] => {
const { type = 'checkbox' } = options
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<any[]>(() => [])
const rowSelection = {
selectedRowKeys: selectedRowKeys,
type,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
}
}
return [rowSelection, { selectRow, setSelectRow, selectedRowKeys, setSelectedRowKeys }]
}
\ No newline at end of file
......@@ -73,5 +73,23 @@ export default {
//规则
'menu.ruleSettingManager': '平台规则配置',
'menu.ruleSettingManager.paySetting': '平台支付参数配置',
// 品类和属性
'menu.classAndProperty': '平台品类及属性',
'menu.classAndProperty.class': '品类',
'menu.classAndProperty.attribute': '属性',
'menu.classAndProperty.viewAttributes': '查看属性',
'menu.classAndProperty.addAttribute': '新建属性',
'menu.classAndProperty.propertyValue': '属性值',
'menu.classAndProperty.addPropertyValue': '添加属性值',
'menu.classAndProperty.categoryAttributes': '品类属性',
//品牌审核
'menu.trademark': '品牌审核',
'menu.trademark.trademarkSearch': '品牌查询',
'menu.trademark.checkBrand': '品牌审核',
'menu.trademark.viewBrand': '品牌详情',
'menu.trademark.trademarkWillCheck': '待审核品牌',
}
// export default utils.transformDataPre(data, 'menu')
import React, { useState, useRef, useEffect } from 'react'
import { history } from 'umi'
import { Row, Col, Form, Input, Select, Popconfirm, Button, Card, Modal, Checkbox, Tooltip, message, Table } from 'antd';
import { LinkOutlined, QuestionCircleOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { StandardTable } from 'god'
import {ColumnType} from 'antd/lib/table/interface';
import ReutrnEle from '@/components/ReturnEle';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
const { Option } = Select;
const layout = {
labelCol: {
span: 5,
},
wrapperCol: {
span: 16,
},
};
const tailLayout = {
wrapperCol: {
offset: 6,
span: 12,
},
};
const AddAtttribute: React.FC<{}> = () => {
const ref = useRef({})
const [menuForm] = Form.useForm();
const [roleVisible, setRoleVisible] = useState(false)
const [selectRow, setSelectRow] = useState<any[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [formValue, setFormValue] = useState<any>({})
const { id, pageStatus } = usePageStatus()
useEffect(() => {
const { location } = history
if(id) {
PublicApi.getProductPlatformGetAttribute({id: id}).then(res=>{
const { data } = res
setFormValue(data)
menuForm.setFieldsValue(data)
})
console.log(usePageStatus())
}
}, [])
const handleSubmitAllSetting = () => {
menuForm.validateFields().then((values:any) => {
delete values.attributeShow
if(JSON.stringify(values.attribute)==='{}')
delete values.attribute
PublicApi.postProductCustomerSaveOrUpdateCustomerAttribute(values)
}).catch(error => {
console.error(error)
})
}
const handleSelectOk = () => {
setRoleVisible(false)
if(selectRow.length){
console.log(selectRow[0], 'handleSelectOk')
//@ts-ignore
menuForm.setFieldsValue({attribute: selectRow[0], attributeShow: `${selectRow[0].groupName}-->${selectRow[0].name}`})
}
}
const fetchData = (params:any) => {
console.log(params,'params')
return new Promise((resolve, reject) => {
//@ts-ignore
PublicApi.getProductPlatformGetAttributeList({current: params.page, pageSize: params.rows, name: params.name||'', groupName: params.groupName||'', isEnable: true}).then(res=>{
resolve(res.data)
})
})
}
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '属性名称',
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: '属性组名',
dataIndex: 'groupName',
align: 'center',
key: 'groupName',
},
{
title: '展示方式',
align: 'center',
dataIndex: 'type',
key: 'type',
render: (text:number) => {
let txt = new Map([[1, '单选'], [2, '多选'], [3, '输入']])
return txt.get(text)
}
},
{
title: '是否必填',
align: 'center',
dataIndex: 'isEmpty',
key: 'isEmpty',
render: (text: boolean) => text?'是':'否'
}
]
const rowSelection: any = {
type: 'radio',
selectedRowKeys: selectedRowKeys,
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows)
setSelectedRowKeys(selectedRowKeys)
console.log(selectedRowKeys, selectedRows, 'rowSelection')
}
};
return <PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={pageStatus === 0
? '新建属性'
: pageStatus === 1
? '编辑属性'
: '查看属性'}
>
<Card>
<Row gutter={[36, 36]}>
<Col span={16}>
<Form
form={menuForm}
name="edit_infomation"
layout="horizontal"
labelAlign="left"
{...layout}
initialValues={formValue}
>
<Row gutter={24}>
<Col span={18}>
<Form.Item
name='groupName'
label='属性组名'
rules={[
{
required: true,
message: '输入属性组名!',
},
]}
>
<Input placeholder="输入属性组名" disabled={pageStatus === 2} />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='id'
style={{display:'none'}}
>
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='name'
label='属性名称'
rules={[
{
required: true,
message: '输入属性名称!',
},
]}
>
<Input placeholder="输入属性名称" disabled={pageStatus === 2} />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='type'
label='展示方式'
rules={[
{
required: true,
message: '展示方式为必须项!',
},
]}
>
<Select placeholder="选择展示方式" disabled={pageStatus === 2}>
<Option value={1}>单选</Option>
<Option value={2}>多选</Option>
<Option value={3}>输入</Option>
</Select>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label='属性设置'
>
<Row>
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={pageStatus === 2}>必填</Checkbox></Form.Item>
</Col>
<Col span={24}>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={pageStatus === 2}>价格属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的每个属性值会在商品发布时按属性设置不同的价格!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isSearch" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled={pageStatus === 2}>搜索属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性会在商城店铺商品列表进行筛选操作时作为筛选项!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Row>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label='状态'
name="isEnable"
initialValue={true}
>
{
pageStatus === 2 ? (formValue.isEnable?<><span className="commonStatusValid"></span>有效</>:<><span className="commonStatusInvalid"></span>无效</>) :
(id?<><span className="commonStatusInvalid"></span>无效</>:<><span className="commonStatusValid"></span>有效</>)
}
</Form.Item>
</Col>
{pageStatus !== 2 && <Col span={18}>
<Form.Item {...tailLayout}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}>
保存
</Button>
<Popconfirm
title="确定要取消吗?"
onConfirm={()=>history.goBack()}
onCancel={()=>console.log('取消')}
okText="是"
cancelText="否"
>
<Button style={{ marginTop: 32, marginBottom: 16}}>
取消
</Button>
</Popconfirm>
</Form.Item>
</Col>}
</Row>
</Form>
</Col>
</Row>
</Card>
</PageHeaderWrapper>
}
export default AddAtttribute
.commonSearchBtn {
border-left: none;
border-radius: 0 2px 2px 0;
background-color: #EBECF0FF;
&:hover, &:focus, &:active{
text-decoration: none;
color: rgba(0, 0, 0, 0.65);
background: #EBECF0FF;
border-color: #d9d9d9;
}
}
\ No newline at end of file
import React, { ReactNode, useRef, useState } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
PlayCircleOutlined,
EyeOutlined,
PauseCircleOutlined
} from '@ant-design/icons'
import { StandardTable } from 'god'
import EyePreview from '@/components/EyePreview'
import StatusSwitch from '@/components/StatusSwitch'
import { ColumnType } from 'antd/lib/table/interface'
import { PublicApi } from '@/services/api'
const Attribute: React.FC<{}> = () => {
const ref = useRef({})
const fetchData = (params?: any) => {
return new Promise((resolve, reject) => {
PublicApi.getProductPlatformGetAttributeList({ ...params, name: params.name || '' }).then(res => {
resolve(res.data)
})
})
}
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
},
{
title: '属性名称',
dataIndex: 'name',
key: 'name',
render: (text: any, record: any) => <EyePreview
url={`/classAndProperty/attribute/addAttribute?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
},
{
title: '属性组名',
dataIndex: 'groupName',
key: 'groupName',
},
{
title: '展示方式',
dataIndex: 'type',
key: 'type',
render: (text: number) => {
let txt = new Map([[1, '单选'], [2, '多选'], [3, '输入']])
return txt.get(text)
}
},
{
title: '是否必填',
dataIndex: 'isEmpty',
key: 'isEmpty',
render: (text: any) => text ? '是' : '否'
},
{
title: '状态',
dataIndex: 'isEnable',
key: 'isEnable',
render: (text: any, record: any) => (
<StatusSwitch
handleConfirm={() => confirm(record)}
record={record}
fieldNames="isEnable"
expectTrueValue={true}
/>
)
},
{
title: '操作',
dataIndex: 'option',
render: (text: any, record: any) => record.isEnable ? '' : <>
<Button type='link' onClick={() => handleEdit(record)}>编辑</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
];
const confirm = (record: any) => {
PublicApi.postProductPlatformUpdateAttributeStatus({id: record.id, isEnable: !record.isEnable}).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
const clickDelete = (record: any) => {
PublicApi.postProductPlatformDeleteAttribute({ id: record.id }).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
const handleEdit = (record: any) => {
history.push(`/classAndProperty/attribute/addAttribute?id=${record.id}`)
}
const cancel = () => {
console.log('cancel')
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
layouts: {
order: 1,
span: 4
},
ctx: {
inline: false,
schema: {
type: 'object',
properties: {
megaLayout0: {
type: 'object',
'x-component': 'mega-layout',
"x-component-props": {
grid: true,
columns: 1,
},
properties: {
name: {
type: 'string',
'x-component-props': {
placeholder: '属性名称',
},
'x-component': 'Search'
}
}
}
}
}
}
}}
formilyChilds={{
layouts: {
order: 0
},
children: (
<>
<Button type="primary" icon={<PlusOutlined />} onClick={() => { history.push('/classAndProperty/attribute/addAttribute') }}>
新建
</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
export default Attribute
.innerBox{
padding: 24px;
background-color: #fff;
}
\ No newline at end of file
This diff is collapsed.
import React, { useState, useEffect } from 'react'
import { Row, Col, Form, Input, Select, Popconfirm, Button, Card, Checkbox, Tooltip } from 'antd';
import { history } from 'umi';
import { InfoCircleOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle';
import { PublicApi } from '@/services/api';
const { Option } = Select;
const layout = {
labelCol: {
span: 5,
},
wrapperCol: {
span: 16,
},
};
const viewAtttributes: React.FC<{}> = () => {
const [menuForm] = Form.useForm();
const [queryId, setQueryId] = useState('')
const [formValue, setFormValue] = useState<any>({})
useEffect(() => {
const { location } = history
if(location.query.id) {
setQueryId(location.query.id)
PublicApi.getProductCustomerGetCustomerAttribute({id: location.query.id}).then(res=>{
const { data } = res
setFormValue(data)
menuForm.setFieldsValue(data)
})
}
}, [])
return <PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title="查看品类属性"
>
<Card>
<Row gutter={[36, 36]}>
<Col span={16}>
<Form
form={menuForm}
name="edit_infomation"
layout="horizontal"
labelAlign="left"
{...layout}
initialValues={formValue}
>
<Row gutter={24}>
<Col span={18}>
<Form.Item
name='id'
label='属性ID'
>
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='groupName'
label='属性组名'
>
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='name'
label='属性名称'
>
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='type'
label='展示方式'
>
<Select disabled>
<Option value={2}>多选</Option>
<Option value={1}>单选</Option>
<Option value={3}>输入</Option>
</Select>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label='属性设置'
>
<Row>
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>必填</Checkbox></Form.Item>
</Col>
<Col span={24}>
<Form.Item name="isImage" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>上传图片</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值可以上传属性值的对应图片!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isName" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>名称属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的属性值会将属性值添加到商品名称之后,中间以/区隔!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>价格属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性的每个属性值会在商品发布时按属性设置不同的价格!">
<InfoCircleOutlined />
</Tooltip>
</Col>
<Col span={24}>
<Form.Item name="isSearch" valuePropName="checked" initialValue={false} noStyle><Checkbox disabled>搜索属性</Checkbox></Form.Item>
<Tooltip title="勾选后对于此属性会在商城店铺商品列表进行筛选操作时作为筛选项!">
<InfoCircleOutlined />
</Tooltip>
</Col>
</Row>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label='状态'
name="isEnable"
>
{formValue.isEnable?<><span className="commonStatusValid"></span>有效</>:<><span className="commonStatusInvalid"></span>无效</>}
</Form.Item>
</Col>
</Row>
</Form>
</Col>
</Row>
</Card>
</PageHeaderWrapper>
}
export default viewAtttributes
This diff is collapsed.
import React, { useState, useEffect, useRef } from 'react'
import { Row, Col, Form, Input, Select, Popconfirm, Button, Card, Modal, Tooltip, message } from 'antd';
import { LinkOutlined, QuestionCircleOutlined, } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import {MenuTree} from 'god';
import { history } from 'umi';
import ReutrnEle from '@/components/ReturnEle';
import { PropertyValueApi } from '@/services/classAndProperty/propertyValue/API'
import { PublicApi } from '@/services/api';
const layout = {
labelCol: {
span: 5,
},
wrapperCol: {
span: 16,
},
}
const tailLayout = {
wrapperCol: {
offset: 6,
span: 12,
},
}
function formatter(params:any){ // 字段title转换为name
params.name = params.title
delete params.title
if(params.children.length>0)
params.children.map((item:any) => formatter(item))
return params
}
const AddPropertyValue: React.FC<{}> = () => {
const ref = useRef({})
const [attrValueForm] = Form.useForm();
const [roleVisible, setRoleVisible] = useState(false)
const [formValue, setFormValue] = useState<any>({})
const [treeData, setTreeData] = useState<PropertyValueApi.PlatformPropertyValueTreeModel[]>([]) // 初始平台属性值树数据
const [selectKeys, setSelectKeys] = useState<any>(undefined)
const [selectRow, setSelectRow] = useState<any>({})
const [attributeValueId, setAttributeValueId] = useState(null) // url传入 可判断是编辑/新增
const [isSee, setIsSee] = useState(false) // 判断查看依据
useEffect(() => {
const { attrId, attrName, attrValueId, isSee } = history.location.query
if(attrId){
attrValueForm.setFieldsValue({customerAttribute: { id: Number(attrId)}})
}
if(attrName){
attrValueForm.setFieldsValue({attributeName: attrName})
}
if(attrValueId){ // 编辑
attrValueForm.setFieldsValue({id: attrValueId})
setAttributeValueId(attrValueId)
PublicApi.getProductCustomerGetCustomerAttributeValue({id: attrValueId}).then(res=>{
console.log(res, 'detail')
if(res.code===1000){
setFormValue(res.data)
attrValueForm.setFieldsValue(res.data)
}
})
}
if(isSee){
setIsSee(true)
}
PublicApi.getProductPlatformGetAttributeValueTree().then(res=>{ // 初始平台属性值树数据
const { data } = res
let tempArr:PropertyValueApi.PlatformPropertyValueTreeModel[] = []
//@ts-ignore
data.length > 0 && data.map((item: any) => {
let arrItem = formatter(item)
tempArr.push(arrItem)
})
setTreeData(tempArr)
})
}, [])
const handleSubmitAllSetting = () => {
attrValueForm.validateFields().then(values => {
console.log(values, 'menu values')
let pararms = {...values}
delete pararms.attributeName
if(JSON.stringify(pararms.attributeValue)==='{}')
delete pararms.attributeValue
//@ts-ignore
PublicApi.postProductCustomerSaveOrUpdateCustomerAttributeValue(pararms)
}).catch(error => {
console.error(error)
})
}
const handleSelectOk = () => {
setRoleVisible(false)
if(JSON.stringify(selectRow)!=='{}'){
attrValueForm.setFieldsValue({attributeValue: {id: selectRow.id, value: selectRow.name}})
}
}
const handleLink = () => {
setRoleVisible(true)
let formData = attrValueForm.getFieldValue('attributeValue')
console.log(formData, 'formData')
let chooseKey = formData && formData.id || undefined
setSelectKeys(`${chooseKey}`)
}
return <PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={attributeValueId?`${isSee?'查看属性值':'编辑属性值'}`:'新建属性值'}
>
<Card>
<Row gutter={[36, 36]}>
<Col span={16}>
<Form
form={attrValueForm}
name="edit_infomation"
layout="horizontal"
labelAlign="left"
{...layout}
initialValues={formValue}
>
<Row gutter={24}>
<Col span={18} style={{display:'none'}}>
<Form.Item
name='id'
label='属性值ID'
>
<Input disabled />
</Form.Item>
<Form.Item
name={['customerAttribute','id']}
label='属性ID'
>
<Input disabled />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='value'
label='属性值名称'
rules={[
{
required: true,
message: '输入属性值名称!',
},
]}
>
<Input placeholder="输入属性值名称" disabled={isSee} />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label={
<span>
对应平台属性值&nbsp;
<Tooltip title="如果需要在商城中通过平台定义的品类及属性筛选商品,需要在对应平台属性值一栏中关联平台定义的商品属性值。">
<QuestionCircleOutlined />
</Tooltip>
</span>
}
>
<Row>
<Col span={20} style={{display: 'none'}}><Form.Item name={['attributeValue', 'id']}><Input disabled /></Form.Item></Col>
<Col span={20}><Form.Item name={['attributeValue', 'value']}><Input disabled /></Form.Item></Col>
<Col span={4}>
<Button type="primary" icon={<LinkOutlined />} style={{backgroundColor: '#6B778C', borderColor: '#6B778C'}} onClick={handleLink}>
关联
</Button>
</Col>
</Row>
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
name='attributeName'
label='属性名称'
>
<Input disabled placeholder="输入属性名称" />
</Form.Item>
</Col>
<Col span={18}>
<Form.Item
label='状态'
name="isEnable"
initialValue={true}
>
{
!isSee && (attributeValueId?<><span className="commonStatusInvalid"></span>无效</>:<><span className="commonStatusValid"></span>有效</>)
}
{
isSee && (formValue.isEnable?<><span className="commonStatusValid"></span>有效</>:<><span className="commonStatusInvalid"></span>无效</>)
}
</Form.Item>
</Col>
{
!isSee && <Col span={18}>
<Form.Item {...tailLayout}>
<Button onClick={handleSubmitAllSetting} type="primary" style={{ marginTop: 32, marginBottom: 16, marginRight: 24}}>
保存
</Button>
<Popconfirm title="确定要取消吗?" okText="是" cancelText="否" onConfirm={()=>history.goBack()}>
<Button style={{ marginTop: 32, marginBottom: 16}}>
取消
</Button>
</Popconfirm>
</Form.Item>
</Col>
}
</Row>
</Form>
</Col>
</Row>
<Modal
title="关联平台属性值"
visible={roleVisible}
onOk={handleSelectOk}
onCancel={()=>setRoleVisible(false)}
okText="确认"
cancelText="取消"
>
<MenuTree
headerTitle='平台属性值列表'
menuData={treeData}
menuProps={
{
//@ts-ignore
onSelect: (key: string, item: any) => {
console.log(item, key,'onSelect')
// @ts-ignore
setSelectKeys(key)
setSelectRow(item)
},
selectedKeys: selectKeys,
}
}
/>
</Modal>
</Card>
</PageHeaderWrapper>
}
export default AddPropertyValue
import React, { useState, useRef, ReactNode, useEffect } from 'react'
import { Row, Col, message, Popconfirm, Button, Card } from 'antd';
import {
DeleteOutlined,
PauseCircleOutlined,
PlusCircleOutlined,
PlayCircleOutlined,
PlusOutlined,
EyeOutlined,
SearchOutlined
} from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { history } from 'umi';
import { MenuTree, StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import { PublicApi } from '@/services/api';
function formatter(params: any) { // 字段title转换为name
params.name = params.title
delete params.title
if (params.children.length > 0)
params.children.map((item: any) => formatter(item))
return params
}
let requestFlag: boolean = false
const PropertyValue: React.FC<{}> = () => {
const ref = useRef({})
const [selectKeys, setSelectKeys] = useState(undefined)
const [selectRow, setSelectRow] = useState<any>({})
const [attributeTreeData, setAttributeTreeData] = useState<AttributeApi.AttributeTreeModel[]>([])
// 加载属性树 转换字段
useEffect(() => {
PublicApi.getProductCustomerGetCustomerAttributeTree().then(res=>{
const { data } = res
let newArr: CategoryTreeApi.CategoryTreeModel[] = []
//@ts-ignore
data.length > 0 && data.map((item: any) => {
let arrItem = formatter(item)
newArr.push(arrItem)
})
setAttributeTreeData(newArr)
console.log(res, 'res', newArr, 'newArr')
})
}, [])
// 获取选中项的属性值列表
useEffect(() => {
if (JSON.stringify(selectRow) != '{}') {
requestFlag = true
//@ts-ignore
ref.current.reload({ page: 1, rows: 5, name: '', customerAttributeId: selectRow.id })
}
}, [selectRow])
const fetchData = (params: any) => {
if (requestFlag) {
return new Promise((resolve, reject) => {
PublicApi.getProductCustomerGetCustomerAttributeValueList({ current: params.page, pageSize: params.rows, name: params.name || '', customerAttributeId: selectRow.id }).then(res=>{
const { data } = res
resolve(data)
})
})
} else {
return new Promise((resolve, reject) => { })
}
}
const handleSee = (record: any) => {
history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=${selectRow.id}&attrName=${selectRow.name}&attrValueId=${record.id}&isSee=true`)
}
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
align: 'center',
key: 'id',
},
{
title: '属性值',
dataIndex: 'value',
align: 'center',
key: 'value',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
},
{
title: '状态',
align: 'center',
dataIndex: 'isEnable',
key: 'isEnable',
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => confirm(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button
type="link"
style={record.isEnable ? { color: '#00B37A' } : { color: 'red' }}>
{record.isEnable ? <>有效 <PlayCircleOutlined /></> : <>无效 <PauseCircleOutlined /></>}
</Button>
</Popconfirm>
)
return component
}
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text: any, record: any) => {
return (
<>
{
record.isEnable ? '' : <>
<Button
type='link'
onClick={() => history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=${selectRow.id}&attrName=${selectRow.name}&attrValueId=${record.id}`)}
>
编辑
</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => clickDelete(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
}
</>
)
}
}
];
const confirm = (record: any) => {
PublicApi.postProductCustomerUpdateCustomerAttributeValueStatus({id: record.id, isEnable: !record.isEnable}).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
const clickDelete = (record: any) => {
PublicApi.postProductCustomerDeleteCustomerAttributeValue({ id: record.id }).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
const cancel = () => {
console.log('cancel')
}
return <PageHeaderWrapper>
<Row gutter={[24, 36]}>
<Col span={8}>
<Card>
<MenuTree
headerTitle='选择要编辑的项目'
// checkedText='全选'
menuData={attributeTreeData}
menuProps={
{
//@ts-ignore
onSelect: (key: string, item: any) => {
console.log(item, key)
setSelectRow(item)
//@ts-ignore
setSelectKeys(key)
},
selectedKeys: selectKeys,
}
}
/>
</Card>
</Col>
<Col span={16}>
<Card>
{
selectKeys && (<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
justify: 'space-between'
}}
formilyProps={{
layouts: {
order: 1
},
ctx: {
schema: {
type: 'object',
properties: {
name: {
type: 'string',
'x-component-props': {
placeholder: '属性值名称'
},
'x-component': 'Search'
}
}
}
}
}}
formilyChilds={{
layouts: {
order: 0
},
children: (
<>
<Button
type="primary"
icon={<PlusOutlined />}
onClick={() => { history.push(`/memberCenter/commodityAbility/classAndProperty/propertyValue/addPropertyValue?attrId=${selectRow.id}&attrName=${selectRow.name}`) }}
>
新建
</Button>
</>
)
}}
/>)
}
</Card>
</Col>
</Row>
</PageHeaderWrapper>
}
export default PropertyValue
import React, { useState, useRef, ReactNode, useEffect } from 'react'
import { history } from 'umi'
import { Button, Steps, Card, Space, Tooltip, Row, Col, Descriptions, Table } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
QuestionCircleOutlined,
FormOutlined,
CheckSquareOutlined,
} from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface'
import ReutrnEle from '@/components/ReturnEle'
import moment from 'moment'
import styles from './index.less'
import { PublicApi } from '@/services/api'
const { Step } = Steps;
const CheckBrand: React.FC<{}> = () => {
const [queryId, setQueryId] = useState<number>()
const [brandInfo, setBrandInfo] = useState<any>({})
const [fixStep, setFixStep] = useState(0)
const [recordData, setRecordData] = useState<any[]>([])
useEffect(() => {
const { id } = history.location.query
if(id){
setQueryId(id)
PublicApi.getProductBrandGetBrand({id: id}).then(res => {
console.log(res.data, 'data')
if(res.code===1000){
setBrandInfo(res.data)
if(res.data.status===1)
setFixStep(0)
else if(res.data.status===2)
setFixStep(1)
}
})
PublicApi.getProductBrandGetBrandCheckRecord({brandId: id}).then(res=> {
if(res.code===1000)
setRecordData(res.data)
})
}
}, [])
const columns: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'id',
key: 'id',
render: (text, record, index)=> index+1
},
{
title: '角色',
dataIndex: 'merchantRoleName',
key: 'merchantRoleName',
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
render: (text:any, record:any) => {
let component: ReactNode = null
if(record.status === 1)
component = (<><span className="commonStatusInvalid"></span>待提交审核</>)
else if(record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if(record.status === 3)
component = (<><span className="commonStatusStop"></span>审核不通过</>)
else if(record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
return component
}
},
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
render: (text:any, record:any) => {
let component: ReactNode = null
if(record.operation === 1)
component = (<>新增</>)
else if(record.operation === 2)
component = (<>修改</>)
else if(record.operation === 3)
component = (<>审核</>)
return component
}
},
{
title: '操作时间',
dataIndex: 'createTime',
key: 'createTime',
render: (text:any, record:any) => moment(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '意见',
dataIndex: 'checkRemark',
key: 'checkRemark',
},
];
const fixStatus = (state: number) => {
if(state === 1)
return <><span className="commonStatusInvalid"></span>待提交审核</>
else if(state === 2)
return <><span className="commonStatusModify"></span>待审核</>
else if(state === 3)
return <><span className="commonStatusStop"></span>审核不通过</>
else if(state === 4)
return <><span className="commonStatusValid"></span>审核通过</>
else if(state === 5)
return <><span className="commonStatusValid"></span>已上架</>
else if(state === 6)
return <><span className="commonStatusStop"></span>已下架</>
}
const fixProveUrl = (proveInfo: any) => {
if(proveInfo){
let imgArray = Object.values(proveInfo)
return imgArray.map((item: any, index: number) => <Col key={index} span={3}>
<div className={styles.proveBox}>
<img src={item} alt=""/>
</div>
</Col>
)
}
}
const tips = <>证明材料<Tooltip title="证明材料:如商标注册证书、品牌授权证书等证明材料"><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>
const content = <>
<Descriptions colon={true} style={{textAlign: 'left', marginLeft: 200}}>
<Descriptions.Item span={1} label="商家名称">{brandInfo?.memberName}</Descriptions.Item>
<Descriptions.Item span={1} label="申请审核时间">{brandInfo.applyTime && moment(brandInfo.applyTime).format('YYYY-MM-DD HH:mm:ss')}</Descriptions.Item>
<Descriptions.Item span={1} label="审核状态">
{
fixStatus(brandInfo?.status)
}
</Descriptions.Item>
<Descriptions.Item span={1} label="品牌状态">{brandInfo.isEnable?'有效':'无效'}</Descriptions.Item>
</Descriptions>
</>
const handleApplyCheck = (status: string) => {
PublicApi.getProductBrandCheckBrand({ id: brandInfo.id, status: status }) // post问题
}
return (
<PageHeaderWrapper
title={brandInfo?.name}
onBack={() => history.goBack()}
backIcon={<ReutrnEle logoSrc={brandInfo?.logoUrl} />}
content={content}
extra={[
<Button
key="1"
onClick={()=>handleApplyCheck('3')}
>
审核不通过
</Button>,
<Button
icon={<CheckSquareOutlined />}
key="1"
type="primary"
onClick={()=>handleApplyCheck('4')}
>
审核通过
</Button>
]}
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title={tips}>
<Row gutter={24}>
{
fixProveUrl(brandInfo.proveUrl)
}
</Row>
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="流程进度">
<Steps progressDot current={fixStep}>
<Step title="提交审核" description="供应商" />
<Step title="审核品牌" description="平台" />
<Step title="完成" description="" />
</Steps>
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="审核历史">
<Table dataSource={recordData} columns={columns} pagination={false} />
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default CheckBrand
.proveBox{
width:175px;
height:120px;
border:1px solid rgba(235,236,240,1);
img {
height: 100%;
padding: 18px;
}
}
\ No newline at end of file
import React, { ReactNode, useRef, useEffect } from 'react'
import { history } from 'umi'
import { Button, Row, Col, Card, Input, Dropdown, Menu } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlayCircleOutlined,
EyeOutlined,
PauseCircleOutlined,
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import moment from 'moment'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
const Trademark: React.FC<{}> = () => {
const ref = useRef({})
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getProductBrandGetPlatformBrandList({ ...params, name: params.name || '', status: params.status || 0 }).then(res => {
const { data } = res
resolve(data)
})
})
}
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
},
{
title: '品牌名称',
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) => <EyePreview
url={`/trademark/trademarkSearch/viewBrand?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
},
{
title: '商家名称',
dataIndex: 'memberName',
key: 'memberName',
},
{
title: '申请时间',
dataIndex: 'applyTime',
key: 'applyTime',
render: (text: any, record: any) => text && moment(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '审核状态',
dataIndex: 'status',
key: 'status',
render: (text: any, record: any) => {
let component: ReactNode = null
if (record.status === 1)
component = (<><span className="commonStatusInvalid"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusStop"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
return component
}
},
];
const handleReset = (actions: any) => {
actions.reset({})
//@ts-ignore
ref.current.reload()
}
const handleSee = (record: any) => {
console.log('see')
history.push(`/trademark/viewBrand?id=${record.id}`)
}
const cancel = () => {
console.log('cancel')
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
formilyProps={{
layouts: {
span: 8,
},
ctx: {
inline: false,
schema: {
type: 'object',
properties: {
megaLayout0: {
type: 'object',
'x-component': 'mega-layout',
"x-component-props": {
grid: true,
columns: 2,
},
properties: {
status: {
type: 'string',
enum: [
{ label: '全部', value: 0 },
{ label: '待提交审核', value: 1 },
{ label: '待审核', value: 2 },
{ label: '审核不通过', value: 3 },
{ label: '审核通过', value: 4 }
],
'x-component-props': {
placeholder: '状态',
}
},
name: {
type: 'string',
'x-component-props': {
placeholder: '品牌名称',
},
'x-component': 'Search'
},
}
},
}
}
},
}}
formilyChilds={{
children: ({actions}) => (
<>
<Button onClick={() => handleReset(actions) } style={{marginLeft:16}}>
重置
</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
export default Trademark
import React, { useState, useRef, ReactNode, useEffect } from 'react'
import { history } from 'umi'
import { Button, Steps, Card, Space, Tooltip, Row, Col, Descriptions, Table } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
QuestionCircleOutlined,
FormOutlined,
} from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface'
import ReutrnEle from '@/components/ReturnEle'
import moment from 'moment'
import styles from './index.less'
import { PublicApi } from '@/services/api'
const { Step } = Steps;
const viewBrand: React.FC<{}> = () => {
const [queryId, setQueryId] = useState<number|null>(null)
const [brandInfo, setBrandInfo] = useState<any>({})
const [fixStep, setFixStep] = useState(0)
const [recordData, setRecordData] = useState<any[]>([])
useEffect(() => {
const { id } = history.location.query
if(id){
setQueryId(id)
PublicApi.getProductBrandGetBrand({id: id}).then(res => {
console.log(res.data, 'data')
if(res.code===1000){
setBrandInfo(res.data)
if(res.data.status===1)
setFixStep(0)
else if(res.data.status===2)
setFixStep(1)
}
})
PublicApi.getProductBrandGetBrandCheckRecord({brandId: id}).then(res=> {
if(res.code===1000)
setRecordData(res.data)
})
}
}, [])
const columns: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'id',
key: 'id',
render: (text, record, index)=> index+1
},
{
title: '角色',
dataIndex: 'merchantRoleName',
key: 'merchantRoleName',
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
render: (text:any, record:any) => {
let component: ReactNode = null
if(record.status === 1)
component = (<><span className="commonStatusInvalid"></span>待提交审核</>)
else if(record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if(record.status === 3)
component = (<><span className="commonStatusStop"></span>审核不通过</>)
else if(record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
return component
}
},
{
title: '操作',
dataIndex: 'operation',
key: 'operation',
render: (text:any, record:any) => {
let component: ReactNode = null
if(record.operation === 1)
component = (<>新增</>)
else if(record.operation === 2)
component = (<>修改</>)
else if(record.operation === 3)
component = (<>审核</>)
return component
}
},
{
title: '操作时间',
dataIndex: 'createTime',
key: 'createTime',
render: (text:any, record:any) => moment(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '意见',
dataIndex: 'checkRemark',
key: 'checkRemark',
},
];
const fixStatus = (state: number) => {
if(state === 1)
return <><span className="commonStatusInvalid"></span>待提交审核</>
else if(state === 2)
return <><span className="commonStatusModify"></span>待审核</>
else if(state === 3)
return <><span className="commonStatusStop"></span>审核不通过</>
else if(state === 4)
return <><span className="commonStatusValid"></span>审核通过</>
else if(state === 5)
return <><span className="commonStatusValid"></span>已上架</>
else if(state === 6)
return <><span className="commonStatusStop"></span>已下架</>
}
const fixProveUrl = (proveInfo: any) => {
if(proveInfo){
let imgArray = Object.values(proveInfo)
return imgArray.map((item: any, index: number) => <Col key={index} span={3}>
<div className={styles.proveBox}>
<img src={item} alt=""/>
</div>
</Col>
)
}
}
const tips = <>证明材料<Tooltip title="证明材料:如商标注册证书、品牌授权证书等证明材料"><span>&nbsp;<QuestionCircleOutlined /></span></Tooltip></>
const content = <>
<Descriptions colon={true} style={{textAlign: 'left', marginLeft: 200}}>
<Descriptions.Item span={1} label="商家名称">{brandInfo?.memberName}</Descriptions.Item>
<Descriptions.Item span={1} label="申请审核时间">{brandInfo.applyTime && moment(brandInfo.applyTime).format('YYYY-MM-DD HH:mm:ss')}</Descriptions.Item>
<Descriptions.Item span={1} label="审核状态">
{
fixStatus(brandInfo?.status)
}
</Descriptions.Item>
<Descriptions.Item span={1} label="品牌状态">{brandInfo.isEnable?'有效':'无效'}</Descriptions.Item>
</Descriptions>
</>
return (
<PageHeaderWrapper
title={brandInfo?.name}
onBack={() => history.goBack()}
backIcon={<ReutrnEle logoSrc={brandInfo?.logoUrl} />}
content={content}
extra={[
// <Button
// icon={<FormOutlined />}
// key="1"
// type="primary"
// onClick={()=>history.push(`/trademark/addBrand?id=${brandInfo.id}`)}
// disabled={!(brandInfo.status===1||brandInfo.status===3)}
// >
// 修改
// </Button>,
]}
>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title={tips}>
<Row gutter={24}>
{
fixProveUrl(brandInfo.proveUrl)
}
</Row>
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="流程进度">
<Steps progressDot current={fixStep}>
<Step title="提交审核" description="供应商" />
<Step title="审核品牌" description="平台" />
<Step title="完成" description="" />
</Steps>
</Card>
</Space>
<Space direction="vertical" style={{width:'100%'}}>
<Card headStyle={{borderBottom:'none'}} title="审核历史">
<Table dataSource={recordData} columns={columns} pagination={false} />
</Card>
</Space>
</PageHeaderWrapper>
)
}
export default viewBrand
.proveBox{
width:175px;
height:120px;
border:1px solid rgba(235,236,240,1);
img {
height: 100%;
padding: 18px;
}
}
\ No newline at end of file
import React, { ReactNode, useRef, useEffect } from 'react'
import { history } from 'umi'
import { Button, Popconfirm, Card, message, Dropdown, Menu } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
PlayCircleOutlined,
EyeOutlined,
PauseCircleOutlined,
CaretDownOutlined
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import moment from 'moment'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
const Trademark: React.FC<{}> = () => {
const ref = useRef({})
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
PublicApi.getProductBrandGetPlatformBrandList({ ...params, name: params.name || '', status: 2 }).then(res => {
const { data } = res
resolve(data)
})
})
}
const columns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'id',
key: 'id',
},
{
title: '品牌名称',
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) => <EyePreview
url={`/trademark/trademarkSearch/viewBrand?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
},
{
title: '商家名称',
dataIndex: 'memberName',
key: 'memberName',
},
{
title: '申请时间',
dataIndex: 'applyTime',
key: 'applyTime',
render: (text: any, record: any) => text && moment(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '审核状态',
dataIndex: 'status',
key: 'status',
render: (text: any, record: any) => {
let component: ReactNode = null
if (record.status === 1)
component = (<><span className="commonStatusInvalid"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusStop"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
return component
}
},
{
title: '操作',
dataIndex: 'option',
render: (text: any, record: any) => {
return (
<>
<Button type='link' onClick={()=> history.push(`/trademark/trademarkSearch/checkBrand?id=${record.id}`)}>审核</Button>
</>
)
}
}
];
const handleSee = (record: any) => {
console.log('see')
// history.push(`/memberCenter/commodityAbility/trademark/viewBrand?id=${record.id}`)
}
const confirm = (record: any) => {
PublicApi.postProductBrandUpdateBrandEnable({ id: record.id, isEnable: !record.isEnable }).then(res => {
//@ts-ignore
ref.current.reload()
})
}
const cancel = () => {
console.log('cancel')
}
const handelDelete = (record: any) => {
PublicApi.postProductBrandDeleteBrand({ id: record.id }).then(res => {
//@ts-ignore
ref.current.reload()
})
}
const handleApplyCheck = (record:any) => {
PublicApi.getProductBrandApplyCheckBrand({id: record.id}).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
const handleReset = (actions: any) => {
actions.reset({})
//@ts-ignore
ref.current.reload()
}
return (
<PageHeaderWrapper>
<Card>
<StandardTable
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
formilyProps={{
layouts: {
span: 4,
},
ctx: {
inline: false,
schema: {
type: 'object',
properties: {
megaLayout0: {
type: 'object',
'x-component': 'mega-layout',
"x-component-props": {
grid: true,
columns: 2,
},
properties: {
// status: {
// type: 'string',
// enum: [
// { label: '全部', value: 0 },
// { label: '待提交审核', value: 1 },
// { label: '待审核', value: 2 },
// { label: '审核不通过', value: 3 },
// { label: '审核通过', value: 4 }
// ],
// default: 2,
// 'x-component-props': {
// placeholder: '状态',
// }
// },
name: {
type: 'string',
'x-component-props': {
placeholder: '品牌名称',
},
'x-component': 'Search'
}
}
}
}
}
}
}}
// formilyChilds={{
// layouts: {
// order: 0
// },
// children: ({actions}) => (
// <>
// <Button onClick={() => handleReset(actions) } style={{marginLeft:16}}>
// 重置
// </Button>
// </>
// )
// }}
/>
</Card>
</PageHeaderWrapper>
)
}
export default Trademark
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