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

feat:添加交易规则列表页

parent 7ccac348
......@@ -67,7 +67,7 @@ const CommodityRoute = {
{
path: '/memberCenter/commodityAbility/trademark',
name: 'trademark',
key: 'trademark',
// key: 'trademark',
icon: 'smile',
component: '@/pages/trademark',
},
......@@ -165,7 +165,7 @@ const CommodityRoute = {
{
path: '/memberCenter/commodityAbility/repositories',
name: 'repositories',
key: 'repositories',
// key: 'repositories',
icon: 'smile',
component: './repositories',
},
......
......@@ -177,7 +177,20 @@ const TranactionRoute = {
component: '@/pages/transaction/purchaseOrder/readyAddOrder/detail'
},
]
}
},
// 交易规则
{
path: '/memberCenter/tranactionAbility/transactionRules',
name: 'transactionRules',
component: '@/pages/transaction/transactionRules',
},
{
path: '/memberCenter/tranactionAbility/transactionRules/addRule',
name: 'addRule',
hideInMenu: true,
component: '@/pages/transaction/transactionRules/addRule',
},
]
}
......
......@@ -119,6 +119,8 @@ export default {
'menu.tranactionAbility.stockSellStorage.bills': '单据',
'menu.tranactionAbility.stockSellStorage.addBills': '新增单据',
'menu.tranactionAbility.stockSellStorage.inventory': '库存',
'menu.tranactionAbility.transactionRules': '交易规则',
'menu.tranactionAbility.addRule': '新增交易规则',
//需求发布
'menu.tranactionAbility.enquirySubmit': '需求发布',
......
......@@ -188,6 +188,7 @@ const SelectProduct:React.FC<IProps> = (props) => {
ref={productFormRef}
name="add-channel-origin"
labelAlign="left"
colon={false}
>
<Form.Item
name="source"
......
......@@ -8,7 +8,6 @@ import {
MinusOutlined,
QuestionCircleOutlined
} from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface';
import styles from '../index.less'
import { PublicApi } from '@/services/api';
......@@ -310,6 +309,7 @@ const SetPrice:React.FC<IProps> = (props) => {
form={formPrice}
name="add-channel-discount"
labelAlign="left"
colon={false}
initialValues={{isMemberPrice: true}}
>
<Form.Item
......@@ -317,7 +317,7 @@ const SetPrice:React.FC<IProps> = (props) => {
label={
<span>
会员折扣&nbsp;
<Tooltip title="这是一段描述?">
<Tooltip title="是否允许会员使用会员折扣价购买当前商品?">
<QuestionCircleOutlined />
</Tooltip>
</span>
......
......@@ -101,23 +101,23 @@ export const channelSchema: ISchema = {
}
],
'x-component-props': {
placeholder: '商品状态',
placeholder: '商品来源',
style: { width: '174px' },
},
},
status: {
statusList: {
type: 'string',
enum: [
{
label: '未上架',
value: 4,
value: 7,
},
{
label: '上架',
label: '上架',
value: 5,
},
{
label: '下架',
label: '下架',
value: 6,
}
],
......@@ -126,7 +126,7 @@ export const channelSchema: ISchema = {
style: { width: '174px' },
},
},
priceType: {
priceTypeList: {
type: 'string',
enum: [
{
......
import React, { useState, useEffect } from 'react'
import { history } from 'umi'
import { Card, Space, Radio, Row, Col, Descriptions, Table, Avatar } from 'antd'
import { Card, Space, Row, Col, Descriptions, Table, Avatar } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
EyeOutlined,
UserOutlined
} from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface'
import ReutrnEle from '@/components/ReturnEle'
import styles from "./index.less"
import { PublicApi } from '@/services/api'
......
......@@ -126,7 +126,7 @@ const Trademark: React.FC<{}> = () => {
];
const handleSee = (record: any) => {
console.log('see')
// console.log('see')
history.push(`/memberCenter/commodityAbility/trademark/viewBrand?id=${record.id}`)
}
......
import React, {useState, useRef, useEffect} from 'react'
import { history } from 'umi'
import { Button, Card } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import './index.less'
import { ruleDetailSchema } from './schema'
import { createFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { findItemAndDelete, omit } from '@/utils'
import { PublicApi } from '@/services/api'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import RuleSetting from './components/RuleSetting'
const addSchemaAction = createFormActions()
const AddRule:React.FC<{}> = (props) => {
const {
id,
preview,
pageStatus
} = usePageStatus()
// 整体表单提交
const formSubmit = async (values) => {
const params = omit(values, ['NO_SUBMIT3'])
if (params['applyMember']) {
params['applyMember'] = params['applyMember'].map(v => v.memberId)
}
await PublicApi.postWarehouseFreightSpaceAdd(params)
setTimeout(() => {
history.goBack(-1)
}, 1000)
}
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={pageStatus === PageStatus.PREVIEW ? '查看交易规则' : ( pageStatus === PageStatus.EDIT ? '编辑交易规则' : '新增交易规则' )}
className="addRule"
extra={[
<Button key="1" onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
保存
</Button>,
]}
>
<Card className=''>
<RuleSetting addSchemaAction={addSchemaAction} schema={ruleDetailSchema} formSubmit={formSubmit}/>
</Card>
</PageHeaderWrapper>
)
}
export default AddRule
import React, { useEffect } from 'react'
import { ISchemaFormActions, FormEffectHooks, IFormActions } from '@formily/antd';
import { PublicApi } from '@/services/api';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
const { onFieldValueChange$ } = FormEffectHooks
export const useWarehouseSelect = (context: ISchemaFormActions) => {
onFieldValueChange$('warehouseId').subscribe(state => {
// 货品ID
const goodsId = context.getFieldValue('productId')
const warehouseId = state.value
PublicApi.getWarehouseInventoryByItemNo({
warehouseId,
itemId: goodsId
}).then(res => {
const { data } = res
context.setFieldValue('NO_SUBMIT3', data.inventory)
})
})
}
export const createAddRepositoryEffect = (context: ISchemaFormActions) => {
const fetchWarehouseAll = async () => {
const { data } = await PublicApi.getWarehouseWarehouseAll()
context.setFieldState('warehouseId', state => {
state.warehouseLists = data
})
return data.map(v => ({
value: v.id,
label: v.name
}))
}
useAsyncSelect('warehouseId', fetchWarehouseAll)
useWarehouseSelect(context)
}
export const useUnitPreview = (initValue, context) => {
useEffect(() => {
if (initValue) {
context.setFieldState('inventory', state => {
if (!state.props['x-props']) {
state.props['x-props'] = {}
}
state.props['x-props'].addonAfter = <div style={{marginLeft: 4}}>{initValue.unit}</div>
})
context.setFieldValue('itemNo', initValue.itemNo)
}
}, [initValue])
}
\ No newline at end of file
.addRule {
.ant-input-group-addon {
padding: 0;
border: none;
}
.connectBtn {
width: 80px;
height: 32px;
line-height: 32px;
background: #6B778C;
color: #fff;
text-align: center;
cursor: pointer;
}
}
// 添加仓位
.storeItemRadio{
display: flex;
flex-wrap: wrap;
// width: 320px;
margin: 0 auto;
& label{
width: 320px !important;
height: 48px !important;
line-height: 48px !important;
margin: 8px 0;
margin-right: 24px;
}
}
//仓位调拨
.circleAmount{
width: 160px;
height: 160px;
border: 4px solid #edeef2;
background-color: #fafbfc;
border-radius: 50%;
& p{
height: 160px;
line-height: 160px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
}
//查看仓位
.amount{
font-size:24px;
font-weight:bold;
color:rgba(23,43,77,1);
}
\ 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 EyePreview from '@/components/EyePreview';
import { PublicApi } from '@/services/api'
const TransactionRules: React.FC<{}> = () => {
const ref = useRef<any>({})
const fetchData = (params: any) => {
console.log(params, 'params')
if(!params?.name) delete params.name
return new Promise((resolve, reject) => {
PublicApi.getOrderTradingRulesList(params).then(res => {
const { data } = res
resolve(data)
})
})
}
// id
// name
// state
// 状态:1.有效 0.无效
// transactionProcess
// operationTime
const columns: ColumnType<any>[] = [
{
title: '交易规则ID',
dataIndex: 'id',
key: 'id',
},
{
title: '流程规则名称',
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) => <EyePreview
url={`/memberCenter/tranactionAbility/transactionRules/addRule?id=${record.id}&preview=1`}
>
{text}
</EyePreview>
},
{
title: '交易流程名称',
dataIndex: 'transactionProcess',
key: 'transactionProcess',
},
{
title: '操作时间',
dataIndex: 'operationTime',
key: 'operationTime',
render: (text: any, record: any) => text && moment(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '状态',
dataIndex: 'state',
key: 'state',
render: (text: any, record: any) => {
let component: ReactNode = null
component = (
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => confirm(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button
type="link"
style={record.state ? { color: '#00B37A' } : { color: 'red' }}>{record.state ? <>有效 <PlayCircleOutlined /></> : <>无效 <PauseCircleOutlined /></>}</Button>
</Popconfirm>
)
return component
}
},
{
title: '操作',
dataIndex: 'option',
render: (text: any, record: any) => {
return (
<>
{
(record.state === 0) ? <>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handelDelete(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
<Button type='link' onClick={()=>history.push(`/memberCenter/tranactionAbility/transactionRules/addRule?id=${record.id}`)}>修改</Button>
</> : ''
}
</>
)
}
}
];
const confirm = (record: any) => {
PublicApi.postOrderTradingRulesUpdateState({ id: record.id, state: record.state ? 0 : 1 }).then(res => {
ref.current.reload()
})
}
const cancel = () => {
console.log('cancel')
}
const handelDelete = (record: any) => {
PublicApi.postOrderTradingRulesDelete({ id: record.id }).then(res => {
if(res.code === 1000)
ref.current.reload()
})
}
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: 2,
},
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/tranactionAbility/transactionRules/addRule')}>
新建
</Button>
</>
)
}}
/>
</Card>
</PageHeaderWrapper>
)
}
export default TransactionRules
This diff is collapsed.
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