Commit 454c67c5 authored by Bill's avatar Bill

Merge branch 'v2' of 10.0.0.22:lingxi/lingxi-business-system into v2

parents b28dc3cb b18ae729
......@@ -235,6 +235,7 @@ const viewProducts: React.FC<{}> = () => {
if (type === 1) return '现货价格'
if (type === 2) return '价格需要询价'
if (type === 3) return '积分兑换商品'
if (type === 4) return '赠品'
}
const renderDeliveryType = (type: number) => {
......
......@@ -73,6 +73,8 @@ const Products: React.FC<{}> = () => {
return '价格需要询价'
else if (text === 3)
return '积分兑换商品'
else if (text === 4)
return '赠品'
},
},
{
......
......@@ -73,6 +73,8 @@ const Products: React.FC<{}> = () => {
return '价格需要询价'
else if (text === 3)
return '积分兑换商品'
else if (text === 4)
return '赠品'
},
},
{
......
......@@ -225,6 +225,7 @@ const viewProducts: React.FC<{}> = () => {
if(type === 1 ) return '现货价格'
if(type === 2 ) return '价格需要询价'
if(type === 3 ) return '积分兑换商品'
if(type === 3 ) return '赠品'
}
const renderDeliveryType = (type: number) => {
......
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)
import React, { Fragment, useEffect, useState } from 'react'
import { Form, Radio, Table, Button } from 'antd';
import React, { Fragment, useEffect, useState, useContext } from 'react'
import { Form, Table, Button } from 'antd';
import { ColumnType } from 'antd/lib/table';
import ModalTable from '@/components/ModalTable'
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
......@@ -13,18 +13,24 @@ import { PublicApi } from '@/services/api';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { PlusOutlined } from '@ant-design/icons';
import LevelBrand from '@/components/LevelBrand';
import { Context } from '../context/memberContext'
interface Iprops {
rowCtl: (key: string, e) => void,
initData: any,
/** ID */
id?: number
}
const MemberInfo: React.FC<Iprops> = (props: any) => {
const { rowCtl, id } = props;
const MemberInfo: React.FC<Iprops> = (props) => {
const { rowCtl, initData, id } = props;
const { fnSetMemberId } = useContext(Context) || {};
const [visibleChannelRroduct, setVisibleChannelRroduct] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'id', type: 'radio' })
const [dataSource, setDataSource] = useState<any>([])
const columns: ColumnType<any>[] = [
{
title: 'ID',
......@@ -33,8 +39,8 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
},
{
title: '会员名称',
key: 'name',
dataIndex: 'name'
key: 'memberName',
dataIndex: 'memberName'
},
{
title: '会员类型',
......@@ -48,16 +54,18 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag'
key: 'level',
dataIndex: 'level',
render: (text) => <LevelBrand level={text} />
},
{
title: '操作',
key: 'operate',
dataIndex: 'operate',
render: (_text, record) => <Button type='link' onClick={() => handleDelect(record.memberId)}>删除</Button>
render: (_text, record) => !id && <Button type='link' onClick={() => handleDelect(record.memberId)}>删除</Button>
}
]
const columnsSetProduct: any[] = [
{
dataIndex: 'memberRoleId',
......@@ -71,9 +79,9 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
key: 'memberId'
},
{
dataIndex: 'name',
dataIndex: 'memberName',
title: '会员名称',
key: 'name'
key: 'memberName'
},
{
dataIndex: 'memberTypeName',
......@@ -86,12 +94,13 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
key: 'roleName'
},
{
dataIndex: 'levelTag',
dataIndex: 'level',
title: '会员等级',
key: 'levelTag',
render: (text, record) => <LevelBrand level={record.level} />
key: 'level',
render: (text) => <LevelBrand level={text} />
},
]
const formMember: ISchema = {
type: 'object',
properties: {
......@@ -156,8 +165,11 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
const handleDelect = (id) => {
const data = [...dataSource];
const source = data.filter(item => item.memberId !== id);
memberRowCtl.setSelectedRowKeys(source.map(v => v.memberId))
memberRowCtl.setSelectRow(source);
setDataSource(source);
rowCtl('members', source)
fnSetMemberId && fnSetMemberId(undefined)
}
// 会员弹框筛选select值
......@@ -183,7 +195,7 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
const fetchMembersList = async (params) => {
const res = await PublicApi.getMemberManageAllProviderPage(params)
const { code, data } = res
let _data = data.data.map(item => ({ ...item, memberRoleId: item.memberId + '_' + item.roleId }))
let _data = data.data.map(item => ({ ...item, memberName: item.name, memberRoleId: item.memberId + '_' + item.roleId }))
return { totalCount: data.totalCount, data: _data }
}
......@@ -194,41 +206,45 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
const handleOkAddMember = () => {
setVisibleChannelRroduct(false)
setDataSource(memberRowCtl.selectRow)
fnSetMemberId && fnSetMemberId(memberRowCtl.selectRow[0]?.memberId)
rowCtl('members', memberRowCtl.selectRow.map(item => {
return {
memberId: item.memberId,
roleId: item.roleId,
memberName: item.memberName,
memberTypeName: item.memberTypeName,
roleName: item.roleName,
level: item.level,
memberRoleId: item.roleId
}
}))
}
useEffect(() => {
if (id) {
PublicApi.getOrderPlatformPaymentMemberPage({ paymentId: id, pageSize: '999', current: '1', name: '' }).then(res => {
if (res.code !== 1000) {
return
}
const { data } = res.data;
memberRowCtl.setSelectedRowKeys(data.map(v => v.memberId))
memberRowCtl.setSelectRow(data);
rowCtl('members', data)
setDataSource(data)
})
if (initData.members) {
memberRowCtl.setSelectedRowKeys(initData.members.map(v => v.memberId))
memberRowCtl.setSelectRow(initData.members);
rowCtl('members', initData.members)
setDataSource(initData.members)
}
}
}, [id])
}, [initData])
return (
<Fragment>
<Form.Item name='members' wrapperCol={{ span: 24 }}>
<Button
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => setVisibleChannelRroduct(true)}
>
选择会员
</Button>
{
!id &&
<Button
type='dashed'
block
icon={<PlusOutlined />}
style={{ marginBottom: '24px' }}
onClick={() => setVisibleChannelRroduct(true)}
>
选择会员
</Button>
}
<Table
pagination={{
size: 'small'
......
/**
* 商城类型
*/
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 from 'react';
export const Context = React.createContext<{
memberId: number | string
fnSetMemberId: Function
} | null>(null);
export const MemberProvider = Context.Provider;
import React, { useEffect, useState } from 'react';
import { Card, Tabs, Form, Button } from 'antd';
import { Card, Tabs, Form, Button, message } from 'antd';
import { history, Prompt } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import ReutrnEle from '@/components/ReturnEle';
......@@ -7,6 +7,7 @@ import Mall from './components/mall';
import Member from './components/member';
import { SaveOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { MemberProvider } from './context/memberContext'
const layout: any = {
colon: false,
......@@ -17,28 +18,38 @@ const layout: any = {
const { TabPane } = Tabs;
const PaymentConfigLayout = () => {
const {
query: {
id,
},
pathname,
}: any = history.location;
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const { query: { id } }: any = history.location;
const [loading, setLoading] = useState<boolean>(false)
const [unsaved, setUnsaved] = useState<boolean>(false);
const [initData, setInitData] = useState<any>({});
const [memberId, setMemberId] = useState<any>();
const [form] = Form.useForm();
const handleSubmit = () => {
form.validateFields().then(res => {
console.log(`res`, res)
const params: any = {
name: res.name,
if (!res.members || !res.members?.length) {
return message.warning('请选择会员')
}
if (res.members) {
params.members = res.members
if (!res.shopList || !res.shopList?.length) {
return message.warning('请选择商城')
}
id && (params.paymentId = id);
return
const fetchApi = id ? PublicApi.postOrderPlatformPaymentUpdate : PublicApi.postOrderPlatformPaymentCreate;
const params: any = {
id,
...res.members[0],
shopList: res.shopList.map(item => {
return {
...item,
id: !id ? undefined : item.id
}
})
}
console.log(`params`, params)
const fetchApi = id ? PublicApi.postManageShopRuleUpdate : PublicApi.postManageShopRuleAdd;
setLoading(true)
fetchApi(params).then(res => {
if (res.code !== 1000) {
......@@ -58,15 +69,41 @@ const PaymentConfigLayout = () => {
})
}
const fnSetMemberId = (mId) => {
setMemberId(mId)
let shopList = form.getFieldValue('shopList')
if (shopList && shopList.length) {
shopList = shopList.map(item => {
const urlArr = item.url.split('/')
urlArr[urlArr.length - 1] = mId || ''
return {
...item,
url: urlArr.join('/')
}
})
setInitData({ shopList })
}
}
useEffect(() => {
if (id) {
PublicApi.getOrderPlatformPaymentDetail({ paymentId: id }).then(res => {
if (res.code !== 1000) {
return
PublicApi.getManageShopRuleGet({ id }).then(res => {
if (res.code === 1000) {
const { shopList, ...rest } = res.data
const data = {
members: [{ ...rest }],
shopList: shopList.map(item => {
let url = item.url.split('/')
url.pop()
return {
...item,
domainName: url.join('/') +'/'
}
})
}
setMemberId(rest.memberId)
setInitData(data)
}
form.setFieldsValue({
...res.data,
})
})
}
}, [])
......@@ -95,14 +132,16 @@ const PaymentConfigLayout = () => {
}
}}
>
<Tabs>
<TabPane tab='适用会员' key={1} forceRender>
<Member id={id} rowCtl={rowCtl} />
</TabPane>
<TabPane tab='适用商城' key={2} forceRender>
<Mall id={id} rowCtl={rowCtl} />
</TabPane>
</Tabs>
<MemberProvider value={{ memberId, fnSetMemberId }}>
<Tabs>
<TabPane tab='适用会员' key={1} forceRender>
<Member id={id} rowCtl={rowCtl} initData={initData} />
</TabPane>
<TabPane tab='适用商城' key={2} forceRender>
<Mall id={id} rowCtl={rowCtl} initData={initData} />
</TabPane>
</Tabs>
</MemberProvider>
</Form>
</Card>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
......
......@@ -14,15 +14,15 @@ const List: React.FC<{}> = () => {
const columns: ColumnType<any>[] = [
{
title: '会员ID',
dataIndex: 'paymentId',
key: 'paymentId',
dataIndex: 'memberId',
key: 'memberId',
},
{
title: '会员名称',
dataIndex: 'name',
key: 'name',
dataIndex: 'memberName',
key: 'memberName',
render: (text: any, record: any) => (
<EyePreview url={`/ruleSettingManager/mallRules/preview?id=${record.paymentId}`}>
<EyePreview url={`/ruleSettingManager/mallRules/preview?id=${record.id}`}>
{text}
</EyePreview>
)
......@@ -37,15 +37,15 @@ const List: React.FC<{}> = () => {
{
title: '会员角色',
align: 'center',
dataIndex: 'roleTypeName',
key: 'roleTypeName',
dataIndex: 'roleName',
key: 'roleName',
// render: (data) => findArrayItem(MEMBER_ROLE_LISTS, data).label
},
{
title: '会员等级',
align: 'center',
dataIndex: 'levelTag',
key: 'levelTag',
dataIndex: 'level',
key: 'level',
render: (text, record) => <LevelBrand level={record.level} />
},
{
......@@ -66,10 +66,10 @@ const List: React.FC<{}> = () => {
dataIndex: 'operate',
render: (_, record) => !record.status && (
<Fragment>
<Button type='link' onClick={() => history.push(`/ruleSettingManager/mallRules/edit?id=${record.paymentId}`)}>修改</Button>
<Button type='link' onClick={() => history.push(`/ruleSettingManager/mallRules/edit?id=${record.id}`)}>修改</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handleDelete(record.paymentId)}
onConfirm={() => handleDelete(record.id)}
>
<Button type='link'>删除</Button>
</Popconfirm>
......@@ -78,16 +78,16 @@ const List: React.FC<{}> = () => {
}
]
const handleModify = async (record: any) => {
await PublicApi.postOrderPlatformPaymentStatus({
paymentId: record.paymentId,
await PublicApi.getManageShopRuleUpdateStatus({
id: record.id,
status: record.status === 1 ? 0 : 1
})
ref.current.reload()
}
//删除
const handleDelete = async (paymentId) => {
await PublicApi.postOrderPlatformPaymentDelete({ paymentId })
const handleDelete = async (id) => {
await PublicApi.getManageShopRuleDelete({ id })
ref.current.reload()
}
const handleToAdd = () => {
......@@ -95,7 +95,7 @@ const List: React.FC<{}> = () => {
}
const fetchData = (params: any) => {
return new Promise((resolve) => {
PublicApi.getOrderPlatformPaymentPage({ ...params }).then(res => {
PublicApi.getManageShopRuleList({ ...params }).then(res => {
resolve(res.data)
})
})
......@@ -104,7 +104,7 @@ const List: React.FC<{}> = () => {
<Card>
<StandardTable
currentRef={ref}
tableProps={{ rowKey: 'paymentId' }}
tableProps={{ rowKey: 'id' }}
columns={columns}
fetchTableData={(params: any) => fetchData(params)}
formilyLayouts={{
......@@ -132,7 +132,7 @@ const List: React.FC<{}> = () => {
schema: {
type: 'object',
properties: {
name: {
memberName: {
type: 'string',
"x-component": 'search',
"x-component-props": {
......
import React, { Fragment, useEffect, useState } from 'react';
import { useEffect, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { Card, Tabs, Form, Typography, Space } from 'antd';
import { Card, Tabs, Form, Image, Table } from 'antd';
import { history } from 'umi'
import { PublicApi } from '@/services/api';
import ReutrnEle from '@/components/ReturnEle';
import style from './components/index.less';
import ListLayout from '@/components/DetailLayout/components/listLayout';
import { ColumnType } from 'rc-table/lib/interface';
import { StandardTable } from 'god';
import { isEmpty } from '@formily/shared';
import StatusSwitch from '@/components/StatusSwitch'
import LevelBrand from '@/components/LevelBrand';
import { MALL_ENV, MALL_PROPERTY, IS_DEFAULT } from './constant'
const layout: any = {
colon: false,
......@@ -18,89 +16,13 @@ const layout: any = {
};
const { TabPane } = Tabs;
type GetOrderPlatformPaymentDetailResponse = {
/**
* 支付策略Id
*/
paymentId: number
/**
* 指定会员
*/
allMembers?: boolean,
/**
* 支付策略名称
*/
name: string
/**
* 支付方式与支付渠道列表 ,PlatformPaymentPayTypeDetailVO
*/
payTypes: {
/**
* 支付方式枚举
*/
payType: number
/**
* 支付方式名称
*/
payTypeName: string
/**
* 资金归集模式列表 ,PlatformPaymentFundModeVO
*/
fundModes: {
/**
* 资金归集模式枚举
*/
fundMode?: number
/**
* 资金归集模式名称
*/
fundModeName?: string
}[]
/**
* 已选择的资金归集模式枚举值
*/
fundMode: number
/**
* 支付渠道列表 ,PlatformPaymentPayChannelVO
*/
channels: {
/**
* 支付渠道类型枚举
*/
payChannel?: number
/**
* 支付渠道类型名称
*/
payChannelName?: string
}[]
/**
* 已选择的支付渠道枚举值列表 ,Integer
*/
payChannels: number[]
}[]
}
const Preview = () => {
const {
query: {
id,
},
}: any = history.location;
const [data, setData] = useState<GetOrderPlatformPaymentDetailResponse>();
const { query: { id } }: any = history.location;
useEffect(() => {
if (id) {
PublicApi.getOrderPlatformPaymentDetail({ paymentId: id }).then(res => {
if (res.code !== 1000) {
return
}
const { data } = res;
setData(data)
})
}
}, [])
const [sourceData, setSourceData] = useState<any>({ members: [], shopList: [] })
const columns: any[] = [
// 会员columns
const memberColumns = [
{
title: 'ID',
key: 'memberId',
......@@ -108,8 +30,8 @@ const Preview = () => {
},
{
title: '会员名称',
key: 'name',
dataIndex: 'name'
key: 'memberName',
dataIndex: 'memberName'
},
{
title: '会员类型',
......@@ -123,21 +45,85 @@ const Preview = () => {
},
{
title: '会员等级',
key: 'levelTag',
dataIndex: 'levelTag'
key: 'level',
dataIndex: 'level',
render: (text) => <LevelBrand level={text} />
}
]
// 商城列表columns
const mallColumns = [
{
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"
record={record}
/>
)
},
{
title: '是否默认',
key: 'isDefault',
dataIndex: 'isDefault',
render: (text) => IS_DEFAULT[text]
}
]
const fetchTableData = (params) => {
return new Promise(resolve => {
PublicApi.getOrderPlatformPaymentMemberPage({ paymentId: id, ...params }).then(res => {
if (res.code !== 1000) {
return
useEffect(() => {
if (id) {
PublicApi.getManageShopRuleGet({ id }).then(res => {
console.log(`res`, res)
if (res.code === 1000) {
const { shopList, ...rest } = res.data
setSourceData({
members: [{ ...rest }],
shopList
})
}
resolve(res.data);
})
})
}
}
}, [])
return (
<PageHeaderWrapper
......@@ -150,17 +136,17 @@ const Preview = () => {
>
<Tabs>
<TabPane tab='适用会员' key={1} forceRender>
<StandardTable
columns={columns}
tableProps={{ rowKey: 'id' }}
fetchTableData={(params: any) => fetchTableData(params)}
<Table
rowKey={record => record.memberId}
columns={memberColumns}
dataSource={sourceData.members}
/>
</TabPane>
<TabPane tab='适用商城' key={2} forceRender>
<StandardTable
columns={columns}
tableProps={{ rowKey: 'id' }}
fetchTableData={(params: any) => fetchTableData(params)}
<Table
rowKey={record => record.id}
columns={mallColumns}
dataSource={sourceData.shopList}
/>
</TabPane>
</Tabs>
......
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