Commit 96b6db53 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 111dcd11 b314927f
/*
* 商城能力
* @Author: Crayon
* @Date: 2021-09-28
* @Last Modified by: ghua
* @Last Modified time: 2021-09-28 11:29:36
* @Description: 商城能力路由相关
*/
import { RouterChild } from '../utils/index';
const ownMallRoute: RouterChild = {
path: '/memberCenter/ownMallAbility',
name: 'ownMallAbility',
icon: 'shop',
routes: [
// 自营商城管理
{
path: '/memberCenter/ownMallAbility/ownMallManager',
name: 'ownMallManager',
icon: 'smile',
routes: [
// 自营商城配置
{
path: '/memberCenter/ownMallAbility/ownMallManager/ownMallConfigure',
name: 'ownMallConfigure',
icon: 'smile',
component: '@/pages/ownMall/ownMallManager/ownMallConfigure',
},
// 自营商城模板管理
{
path: '/memberCenter/ownMallAbility/ownMallManager/ownMallTemplate',
name: 'ownMallTemplate',
icon: 'smile',
component: '@/pages/ownMall/ownMallManager/ownMallTemplate',
},
// 自营商城SEO设置
{
path: '/memberCenter/ownMallAbility/ownMallManager/ownMallSeo',
name: 'ownMallSeo',
icon: 'smile',
component: '@/pages/ownMall/ownMallManager/ownMallSeo',
},
// 自营商城SEO设置-新增
{
path: '/memberCenter/ownMallAbility/ownMallManager/ownMallSeo/add',
name: 'addOwnMallSeo',
hideInMenu: true,
icon: 'smile',
component: '@/pages/ownMall/ownMallManager/ownMallSeo/add',
},
// 自营商城关于我们信息设置
{
path: '/memberCenter/ownMallAbility/ownMallManager/ownMallAboutUs',
name: 'ownMallAboutUs',
icon: 'smile',
component: '@/pages/ownMall/ownMallManager/ownMallAboutUs',
},
]
},
]
}
export default ownMallRoute
import React from 'react'
export default function index() {
return (
<div>
</div>
)
}
import { useState, useImperativeHandle, forwardRef } from 'react'
import { Modal } from 'antd'
import NiceForm from '@/components/NiceForm';
import { ISchema } from '@formily/antd';
import { createFormActions } from '@formily/antd';
export type RefProps = {
show: (flag: boolean, data?: any) => void
}
const formActions = createFormActions()
const classSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
"x-component": "mega-layout",
"x-component-props": {
grid: true,
columns: 16,
labelAlign: 'top'
},
properties: {
noField1: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
full: true,
},
"x-mega-props": {
span: 1
},
properties: {
name: {
type: 'string',
title: '商城名称',
required: true,
"x-component-props": {
placeholder: '请输入商城名称'
},
"x-rules": [
{
limitByte: true,
maxByte: 20
}
]
},
describe: {
type: 'string',
title: '商城描述',
"x-component-props": {
placeholder: '请输入商城描述'
},
"x-rules": [
{
limitByte: true,
maxByte: 80
}
]
},
logoUrl: {
title: '商城LOGO',
'x-component': 'CustomUpload'
},
}
},
}
}
}
}
const Page = ({ onOk }: any, ref: any) => {
const [visible, setVisible] = useState<boolean>(false)
const [initData, setInitData] = useState<any>({})
useImperativeHandle(ref, () => ({
show(flag: boolean, data?: any) {
if (data) {
setInitData(data)
}
setVisible(flag)
}
}))
const onFinish = (value) => {
onOk && onOk(value)
setVisible(false)
}
return (
<Modal
title='修改商城信息'
maskClosable={false}
destroyOnClose
visible={visible}
onOk={() => formActions.submit()}
onCancel={() => setVisible(false)}
>
<NiceForm
value={initData}
name='classForm'
onSubmit={onFinish}
actions={formActions}
schema={classSchema}
>
</NiceForm>
</Modal>
)
}
export default forwardRef(Page)
/**
* 商城类型
*/
export const MALL_TYPE = {
1: '企业商城',
2: '积分商城',
3: '渠道商城',
4: '渠道自有商城',
5: '渠道积分商城',
6: '采购门户',
7: '物流服务门户',
8: '加工服务门户',
9: '行情资讯门户'
}
/**
* 商城环境
*/
export const MALL_ENV = {
1: 'web',
2: 'H5',
3: '小程序',
4: 'APP'
}
/**
* 商城属性
*/
export const MALL_PROPERTY = {
1: 'B端商城',
2: 'C端商城 ',
3: 'B端自营商城',
4: 'C端自营商城'
}
/**
* 是否默认
*/
export const IS_DEFAULT = {
0: '否',
1: '是 ',
}
/**
* 是否默认-COLOR
*/
export const IS_DEFAULT_COLOR = {
0: 'default',
1: 'processing ',
}
\ No newline at end of file
import React, { useEffect, useState, useRef } from 'react'
import { Image, Tag, Button } from 'antd';
import { ColumnType } from 'antd/lib/table';
import { PublicApi } from '@/services/api';
import StatusSwitch from '@/components/StatusSwitch'
import { MALL_ENV, MALL_PROPERTY, IS_DEFAULT } from './constant'
import EditMallModal, { RefProps } from './components/editMallModal'
import { StandardTable } from 'god'
const OwnMallConfigure = () => {
const modalRef = useRef<RefProps>()
// 已选商城列表columns
const columns: ColumnType<any>[] = [
{
title: '商城ID',
key: 'id',
dataIndex: 'id'
},
{
title: '商城名称',
key: 'name',
dataIndex: 'name'
},
{
title: '商城LOGO',
key: 'logoUrl',
dataIndex: 'logoUrl',
render: (tetx) => <Image src={tetx} width={40} />
},
{
title: '商城环境',
key: 'environment',
dataIndex: 'environment',
render: (text) => MALL_ENV[text]
},
{
title: '商城属性',
key: 'property',
dataIndex: 'property',
render: (text) => MALL_PROPERTY[text]
},
{
title: '商城地址',
key: 'url',
dataIndex: 'url'
},
{
title: '商城描述',
key: 'describe',
dataIndex: 'describe'
},
{
title: '状态',
dataIndex: 'state',
key: 'state',
render: (text: any, record: any) => (
<StatusSwitch
fieldNames="state"
handleConfirm={() => handleModify(record)}
record={record}
/>
)
},
{
title: '是否默认',
key: 'isDefault',
dataIndex: 'isDefault',
render: (text) => IS_DEFAULT[text]
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (_text, record) => {
return (
<>
<Button type='link' onClick={() => modalRef.current.show(true, record)}>修改</Button>
<Button type='link' onClick={() => {}}>{record.isDefault === 1 ? '取消默认' : '设为默认'}</Button>
</>
)
}
}
]
// 改变状态
const handleModify = async (record: any) => {
}
// 修改商城信息回调
const onEdit = () => {
}
const fetchData = (params: any) => {
return new Promise((resolve) => {
PublicApi.getManageActivityShopRuleList({ ...params }).then(res => {
resolve(res.data)
})
})
}
return (
<>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
justify: "space-between"
}}
formilyProps={{
layouts: {
order: 3
},
ctx: {
schema: {
type: 'object',
properties: {
name: {
type: 'string',
"x-component": 'search',
"x-component-props": {
placeholder: '输入商城名称'
}
}
}
}
}
}}
/>
<EditMallModal ref={modalRef} onOk={onEdit} />
</>
)
}
export default OwnMallConfigure;
import React from 'react'
export default function index() {
return (
<div>
</div>
)
}
\ No newline at end of file
import React from 'react'
export default function index() {
return (
<div>
</div>
)
}
\ No newline at end of file
import React from 'react'
export default function index() {
return (
<div>
</div>
)
}
\ No newline at end of file
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