Commit 2f088a76 authored by GuanHua's avatar GuanHua
parents e4cadcb1 6b73cb29
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 18:02:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-30 19:38:32
* @LastEditTime: 2021-09-07 15:24:26
* @Description: 退款明细
*/
import React, { useState } from 'react';
......@@ -360,7 +360,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
</Descriptions.Item>
<Descriptions.Item label="支付环节">{item.payNode}</Descriptions.Item>
<Descriptions.Item label="已支付金额(元)">{item.payAmount}</Descriptions.Item>
<Descriptions.Item label="支付比例">{item.payRatio}%</Descriptions.Item>
<Descriptions.Item label="支付比例">{item.payRatio * 100}%</Descriptions.Item>
<Descriptions.Item label="退款金额(元)">{item.refundAmount}</Descriptions.Item>
<Descriptions.Item label="支付方式">{item.payWayName}</Descriptions.Item>
<Descriptions.Item label="退款时间">{item.refundTime}</Descriptions.Item>
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 17:36:45
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-09-07 10:02:55
* @LastEditTime: 2021-09-07 15:22:20
* @Description: 查看退货数量与退款金额 抽屉
*/
import React, { useEffect, useState } from 'react';
......@@ -194,7 +194,10 @@ const ReturnInfoDrawer: React.FC<ReturnInfoDrawerProps> = ({
if (!applyInfo || !applyInfo.orderId) {
return;
}
let payList = applyInfo.payList || [];
let payList = applyInfo.payList ? applyInfo.payList.map((item) => ({
...item,
payRatio: item.payRatio * 100,
})) : [];
setPayInfoLoading(true);
try {
// 编辑状态才请求支付信息,否则默认取申请信息里边的支付信息
......
......@@ -303,7 +303,7 @@ const AddProducts: React.FC<{}> = (props) => {
throw new Error('请完善商品其他信息!')
}
} catch (e) {
return e
return { message: '请完善商品其他信息!' }
}
// 校验价格
try {
......
......@@ -296,7 +296,7 @@ const InquiryOfferDetail = () => {
return fetchSoure
}
const fetchTableData = useCallback((params: any) => {
const fetchTableData = (params: any) => {
return new Promise(resolve => {
PublicApi.getTransactionProductQuotationHistoryList({ ...params, commoditySkuId }).then(res => {
if (res.code !== 1000) {
......@@ -305,7 +305,7 @@ const InquiryOfferDetail = () => {
resolve(res.data);
})
})
}, [commoditySkuId])
}
return (
<Context.Provider value={dataSource}>
......@@ -367,6 +367,7 @@ const InquiryOfferDetail = () => {
title='历史报价'
visible={historyVisible}
onClose={() => setHistoryVisible(false)}
destroyOnClose
>
<StandardTable
columns={hitoryColumns}
......
......@@ -9,6 +9,7 @@ import RulesLayout from './components/rulesLayout';
import ShopLayout from './components/shopLayout';
import ProductListLayout from '../../components/productListLayout';
import PartakeUserLayout from './components/partakeUserLayout';
import PrizeListLayout from './components/prizeListLayout';
import moment from 'moment';
import { PublicApi } from '@/services/api';
......@@ -49,6 +50,7 @@ const AddedMarketing = () => {
const [memberLevelList, setMemberLevelList] = useState<any[]>([]);
const [memberType, setMemberType] = useState<any[]>([]);
const [activityId, setActivityId] = useState<number>();
const [value, setValue] = useState<number>();
const handleGetShopList = (mall) => {
const checkedList = mall.filter(item => item.checked);
......@@ -194,6 +196,11 @@ const AddedMarketing = () => {
}
}, [id])
focus$.useSubscription((val: any) => {
setValue(val.value);
form.resetFields(['activityDefinedBO']);
});
return (
<Fragment>
<PeripheralLayout
......@@ -202,7 +209,7 @@ const AddedMarketing = () => {
{ id: 'basicInfoLayout', title: '基本信息' },
{ id: 'shopLayout', title: '适用商城' },
{ id: 'rulesLayout', title: '活动规则' },
{ id: 'activityProductLayout', title: '活动商品' },
{ id: 'activityProductLayout', title: value === 10 ? '奖品设置' : '活动商品' },
{ id: 'partakeUserLayout', title: '参与用户' },
]}
effect={
......@@ -229,7 +236,8 @@ const AddedMarketing = () => {
<BasicInfoLayout form={form} focus$={focus$} />
<ShopLayout onGetShopList={handleGetShopList} onSetShopList={shopList} />
<RulesLayout form={form} focus$={focus$} />
<ProductListLayout activityId={activityId && { activityId: activityId }} form={form} focus$={focus$} shopIdList={shopIdList} fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsPage} />
{value !== 10 && (<ProductListLayout activityId={activityId && { activityId: activityId }} form={form} focus$={focus$} shopIdList={shopIdList} fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsPage} />)}
{value === 10 && (<PrizeListLayout form={form} />)}
<PartakeUserLayout onGetLevel={handleGetLevel} onSetLevel={memberLevelList} setMemberType={memberType} />
</Form>
}
......
import React, { useEffect, useState } from 'react';
import { Form, Table, Tooltip, Button, Select, Input, Popconfirm } from 'antd';
import { ColumnType } from 'antd/lib/table';
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import CardLayout from '../card';
import { FormInstance } from 'antd/es/form/Form';
import { isEmpty } from '@antv/util';
const levelList = [
{ value: 1, name: '一等奖' },
{ value: 2, name: '二等奖' },
{ value: 3, name: '三等奖' },
{ value: 4, name: '四等奖' },
{ value: 5, name: '五等奖' },
]
const typeList = [
{ value: 1, name: '商品' },
{ value: 2, name: '优惠卷' },
{ value: 3, name: '现金' },
{ value: 4, name: '积分' },
{ value: 5, name: '谢谢参与' },
]
interface PrizeListProps {
form?: FormInstance,
}
const PrizeListLayout: React.FC<PrizeListProps> = (props: any) => {
const { form } = props;
const [dataSource, setDataSource] = useState<any[]>([]);
const [levelIds, setLevelIds] = useState<number[]>([]);
/** 选择奖项等级 */
const handleChangeLevel = (e, _index) => {
const fields = [...dataSource];
const ids = [...levelIds];
console.log(ids)
ids[_index] = e;
setLevelIds(ids);
const newData = fields.map((_item, _i) => {
if (_i === _index) {
return {
..._item,
level: e
}
}
return _item
})
setDataSource(newData)
}
/** 删除一条奖项 */
const handleDelete = (_index) => {
const fields = [...dataSource];
const ids = [...levelIds];
fields.splice(_index, 1)
fields.forEach((_item, index) => {
form.setFieldsValue({
[`level_${index}`]: _item.level,
[`type_${index}`]: _item.type,
[`probability_${index}`]: _item.probability,
[`prize_${index}`]: _item.prize,
})
})
setLevelIds(ids.splice(_index, 1))
setDataSource(fields)
}
const columns: ColumnType<any>[] = [
{
title: '奖项等级',
key: 'level',
dataIndex: 'level',
width: 240,
render: (_text, _record, _index) => (
<Form.Item
style={{ margin: 0 }}
name={`level_${_index}`}
rules={[{ required: true, message: '请选择奖项等级' }]}
>
<Select onChange={(e) => handleChangeLevel(e, _index)}>
{levelList.map(_item => (
<Select.Option disabled={levelIds.includes(_item.value)} key={_item.value} value={_item.value}>{_item.name}</Select.Option>
))}
</Select>
</Form.Item>
)
},
{
title: '奖品类别',
key: 'type',
dataIndex: 'type',
width: 240,
render: (_text, _record, _index) => (
<Form.Item
style={{ margin: 0 }}
name={`type_${_index}`}
rules={[{ required: true, message: '请选择奖品类别' }]}
>
<Select>
{typeList.map(_item => (
<Select.Option key={_item.value} value={_item.value}>{_item.name}</Select.Option>
))}
</Select>
</Form.Item>
)
},
{
title: <Tooltip placement="top" title="中奖概率为当前奖项等级的中奖概率,如设置一等奖的中奖概率为10%,则表示用户抽中一等奖的概率是10%">
中奖概率 <QuestionCircleOutlined />
</Tooltip>,
key: 'probability',
dataIndex: 'probability',
width: 176,
render: (_text, _record, _index) => (
<Form.Item
style={{ margin: 0 }}
name={`probability_${_index}`}
rules={[{ required: true, message: '请输入中奖概率' }]}
>
<Input style={{ width: 176 }} addonAfter='%' />
</Form.Item>
)
},
{
title: '奖品',
key: 'prize',
dataIndex: 'prize',
render: (_text, _record, _index) => (
<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues[`type_${_index}`] !== currentValues[`type_${_index}`]}
>
{({ getFieldValue }) => getFieldValue([`type_${_index}`]) === 1 ? (
<Form.Item
style={{ margin: 0 }}
name={`prize_${_index}`}
rules={[{ required: true, message: '请输选择优惠券' }]}
>
<div>123</div>
</Form.Item>
) : getFieldValue([`type_${_index}`]) === 2 ? (
<Form.Item
style={{ margin: 0 }}
name={`prize_${_index}`}
rules={[{ required: true, message: '请输选择优惠券' }]}
>
<div>123</div>
</Form.Item>
) : getFieldValue([`type_${_index}`]) === 3 ? (
<Form.Item
style={{ margin: 0 }}
name={`prize_${_index}`}
rules={[{ required: true, message: '请输入金额' }]}
>
<Input addonAfter='元' />
</Form.Item>
) : getFieldValue([`type_${_index}`]) === 4 ? (
<Form.Item
style={{ margin: 0 }}
name={`prize_${_index}`}
rules={[{ required: true, message: '请输入积分' }]}
>
<Input addonAfter='积分' />
</Form.Item>
) : '无'}
</Form.Item>
)
},
{
title: '操作',
key: 'level',
dataIndex: 'level',
width: 128,
render: (_text, _record, _index) => (
<Popconfirm
title="是否删除?"
onConfirm={() => handleDelete(_index)}
>
<Button type='link'>删除</Button>
</Popconfirm>
)
},
]
/** 添加新奖项 */
const handleApped = () => {
const field_Obj = {
level: null,
type: null,
probability: null,
prize: null,
}
const field = [...dataSource];
setDataSource([...field, field_Obj]);
}
return (
<CardLayout
id="productListLayout"
title="奖品设置"
weight
>
<Form.Item
name={['activityDefinedBO', 'prizeBOList']}
rules={[{ required: true, message: '请选择奖品设置!' }]}
>
<Table
rowKey={(_record, _index) => _index}
columns={columns}
dataSource={dataSource}
pagination={false}
/>
</Form.Item>
<Button style={{ marginBottom: '16px' }} block type="dashed" icon={<PlusOutlined />} onClick={handleApped}>添加新奖项</Button>
</CardLayout>
)
}
export default PrizeListLayout;
import React, { useState } from 'react';
import { Form, Checkbox, Radio, Input, Space, Button, DatePicker } from 'antd';
import { Form, Checkbox, Radio, Input, Space, Button, DatePicker, Select } from 'antd';
import { EventEmitter } from '@umijs/hooks/lib/useEventEmitter'
import { isEmpty } from '@formily/shared';
import { FormInstance } from 'antd/es/form/Form';
......@@ -530,7 +530,6 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
}
/** 试用 */
const probation = (int = 1) => {
console.log(int)
switch (Number(int)) {
case 16:
return (
......@@ -569,6 +568,109 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
)
}
}
/** 抽奖 */
const lottery = (int = 1) => {
switch (Number(int)) {
case 10:
return (
<>
<Form.Item
tooltip='订单抽奖表示用户订单满N元且支付成功后可参与一次抽奖,积分抽奖表示用户消耗N积分可参与一次抽奖,行为抽奖表示用户签到或申请会员后可参与一次抽奖,活动抽奖表示在抽奖活动中,用户可无条件参与抽奖'
label='抽奖类型'
required
>
<Space direction='vertical'>
<Form.Item
name={['activityDefinedBO', 'lotteryType']}
style={{ margin: 0 }}
rules={[{ required: true, message: '请选择抽奖类型' }]}
>
<Radio.Group>
<Radio.Button value={1}>订单抽奖</Radio.Button>
<Radio.Button value={2}>积分抽奖</Radio.Button>
<Radio.Button value={3}>行为抽奖</Radio.Button>
<Radio.Button value={4}>活动抽奖</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item
noStyle
shouldUpdate={(prevValues, currentValues) => prevValues.activityDefinedBO !== currentValues.activityDefinedBO}
>
{({ getFieldValue }) => getFieldValue(['activityDefinedBO', 'lotteryType']) === 1 ? (
<Space style={{ display: 'flex' }}>
订单金额满
<Form.Item
style={{ margin: 0 }}
name={['activityDefinedBO', 'orderPrice']}
rules={[{ required: true, message: '请输入' }]}
>
<Input style={{ width: '160px' }} addonAfter="元" />
</Form.Item>
且支付成功后参与抽奖
</Space>
) : getFieldValue(['activityDefinedBO', 'lotteryType']) === 2 ? (
<Space style={{ display: 'flex' }}>
每次抽奖消耗
<Form.Item
style={{ margin: 0 }}
name={['activityDefinedBO', 'integral']}
rules={[{ required: true, message: '请输入' }]}
>
<Input style={{ width: '160px' }} addonAfter="积分" />
</Form.Item>
</Space>
) : getFieldValue(['activityDefinedBO', 'lotteryType']) === 3 && (
<Space style={{ display: 'flex' }}>
用户完成
<Form.Item
style={{ margin: 0 }}
name={['activityDefinedBO', 'behavior']}
rules={[{ required: true, message: '请选择' }]}
>
<Select style={{ width: 160 }} placeholder='请选择'>
<Select.Option value={1}>申请会员</Select.Option>
<Select.Option value={2}>签到</Select.Option>
</Select>
</Form.Item>
参与抽奖
</Space>
)}
</Form.Item>
</Space>
</Form.Item>
<Form.Item
tooltip='抽奖次数可限制每日允许抽奖次数,每周允许抽奖次数,每月允许抽奖次数,也可限制在活动期间允许抽奖次数'
label='抽奖次数'
required
className={style.rulesLayout}
>
<Space style={{ display: 'flex' }}>
<Form.Item
style={{ margin: 0 }}
name={['activityDefinedBO', 'lotteryNumType']}
rules={[{ required: true, message: '请选择抽奖次数类型' }]}
>
<Select style={{ width: 160 }} placeholder='请选择'>
<Select.Option value={1}>每日</Select.Option>
<Select.Option value={2}>每周</Select.Option>
<Select.Option value={3}>每月</Select.Option>
<Select.Option value={4}>活动期内</Select.Option>
</Select>
</Form.Item>
<Form.Item
style={{ margin: 0 }}
name={['activityDefinedBO', 'lotteryNum']}
rules={[{ required: true, message: '请输入抽奖次数' }]}
>
<Input style={{ width: '160px' }} addonAfter="次" />
</Form.Item>
</Space>
</Form.Item>
</>
)
}
}
return (
<CardLayout
......@@ -587,6 +689,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
{grouPing(option?.value)}
{exceedRule(option?.value)}
{probation(option?.value)}
{lottery(option?.value)}
<Form.Item
name={['activityDefinedBO', 'describe']}
label="活动描述"
......
import React, { useRef, useEffect, useState, useContext } from 'react'
import { Button, Table } from 'antd'
import { StandardTable } from 'god'
import { formatTimeString } from '@/utils'
import './index.less'
import cx from 'classnames'
import { ReadyAddOrderDetailContext } from '../../context'
import StatusColors from '../StatusColors'
export interface CirculationRecordProps {}
/**
* 流转记录控制
*/
const outOrderCols: any[] = [
{
title: '流转顺序号',
dataIndex: 'no',
align: 'center',
key: 'no',
render: (_, __, index: number) => index + 1
},
{
title: '操作角色',
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: '状态',
dataIndex: 'state',
align: 'center',
key: 'state',
render: text => <StatusColors status={text} type='out'/>
// @todo 需传递工作流状态重新render
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
key: 'operation',
},
{
title: '操作时间',
dataIndex: 'operationTime',
align: 'center',
key: 'operationTime',
render: time => formatTimeString(time)
},
{
title: '审核意见',
dataIndex: 'auditOpinion',
align: 'center',
key: 'auditOpinion',
},
]
const sideOrderCols: any[] = [
{
title: '流转记录',
dataIndex: 'no',
align: 'center',
key: 'no',
render: (_, __, index: number) => index + 1
},
{
title: '操作人',
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: '部门',
dataIndex: 'department',
align: 'center',
key: 'department',
},
{
title: '职位',
dataIndex: 'position',
align: 'center',
key: 'position',
},
{
title: '状态',
dataIndex: 'state',
align: 'center',
key: 'state',
render: text => <StatusColors status={text} type='inside'/>
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
key: 'operation',
},
{
title: '操作时间',
dataIndex: 'operationTime',
align: 'center',
key: 'operationTime',
},
{
title: '审核意见',
dataIndex: 'auditOpinion',
align: 'center',
key: 'auditOpinion',
},
]
const CirculationRecord:React.FC<CirculationRecordProps> = (props) => {
const colRef = useRef<any>({
columns: outOrderCols
})
const { detailData } = useContext(ReadyAddOrderDetailContext)
const [orderState, setOrderState] = useState<number>(0)
const [dataSource, setDataSource] = useState<any>([])
useEffect(() => {
if (detailData) {
colRef.current = {
columns: orderState === 1 ? sideOrderCols : outOrderCols
}
setDataSource(orderState === 1 ? detailData.interiorProcurementOrderLogResponses : detailData.externalProcurementOrderLogResponses)
}
}, [colRef, orderState, detailData])
return (
<div>
<div className='com-switch-btn-group' style={{margin: '20px 0'}}>
<div className={cx('switch-btn', orderState === 0 ? 'active' : '')} onClick={() => setOrderState(0)}>外部单据</div>
<div className={cx('switch-btn', orderState === 1 ? 'active' : '')} onClick={() => setOrderState(1)}>内部单据</div>
</div>
<Table
columns={colRef.current.columns}
dataSource={dataSource}
rowKey="id"
/>
</div>
)
}
CirculationRecord.defaultProps = {}
export default CirculationRecord
\ No newline at end of file
import React, { useRef, useEffect, useState, useContext } from 'react'
import { Button, Table } from 'antd'
import { StandardTable } from 'god'
import { formatTimeString } from '@/utils'
import './index.less'
import cx from 'classnames'
import { ReadyAddOrderDetailContext } from '../../context'
import StatusColors from '../statusColors'
export interface CirculationRecordProps {}
/**
* 流转记录控制
*/
const outOrderCols: any[] = [
{
title: '流转顺序号',
dataIndex: 'no',
align: 'center',
key: 'no',
render: (_, __, index: number) => index + 1
},
{
title: '操作角色',
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: '状态',
dataIndex: 'state',
align: 'center',
key: 'state',
render: text => <StatusColors status={text} type='out'/>
// @todo 需传递工作流状态重新render
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
key: 'operation',
},
{
title: '操作时间',
dataIndex: 'operationTime',
align: 'center',
key: 'operationTime',
render: time => formatTimeString(time)
},
{
title: '审核意见',
dataIndex: 'auditOpinion',
align: 'center',
key: 'auditOpinion',
},
]
const sideOrderCols: any[] = [
{
title: '流转记录',
dataIndex: 'no',
align: 'center',
key: 'no',
render: (_, __, index: number) => index + 1
},
{
title: '操作人',
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: '部门',
dataIndex: 'department',
align: 'center',
key: 'department',
},
{
title: '职位',
dataIndex: 'position',
align: 'center',
key: 'position',
},
{
title: '状态',
dataIndex: 'state',
align: 'center',
key: 'state',
render: text => <StatusColors status={text} type='inside'/>
},
{
title: '操作',
dataIndex: 'operation',
align: 'center',
key: 'operation',
},
{
title: '操作时间',
dataIndex: 'operationTime',
align: 'center',
key: 'operationTime',
},
{
title: '审核意见',
dataIndex: 'auditOpinion',
align: 'center',
key: 'auditOpinion',
},
]
const CirculationRecord:React.FC<CirculationRecordProps> = (props) => {
const colRef = useRef<any>({
columns: outOrderCols
})
const { detailData } = useContext(ReadyAddOrderDetailContext)
const [orderState, setOrderState] = useState<number>(0)
const [dataSource, setDataSource] = useState<any>([])
useEffect(() => {
if (detailData) {
colRef.current = {
columns: orderState === 1 ? sideOrderCols : outOrderCols
}
setDataSource(orderState === 1 ? detailData.interiorProcurementOrderLogResponses : detailData.externalProcurementOrderLogResponses)
}
}, [colRef, orderState, detailData])
return (
<div>
<div className='com-switch-btn-group' style={{margin: '20px 0'}}>
<div className={cx('switch-btn', orderState === 0 ? 'active' : '')} onClick={() => setOrderState(0)}>外部单据</div>
<div className={cx('switch-btn', orderState === 1 ? 'active' : '')} onClick={() => setOrderState(1)}>内部单据</div>
</div>
<Table
columns={colRef.current.columns}
dataSource={dataSource}
rowKey="id"
/>
</div>
)
}
CirculationRecord.defaultProps = {}
export default CirculationRecord
import React from 'react'
import { Tag } from 'antd'
export interface IStatusColor {
[key: string]: {
value: string | number,
color: string
}
}
// 用于标签状态控制
export interface StatusColorsProps {
status: number,
text?: string,
type: 'out' | 'inside' | 'saleInside'
}
export enum ORDER_EXAMINE_ENUM {
/**
* 新增订单
*/
ADD_ORDER = 1,
/**
* 一级审核
*/
ONE_LEVEL_VALIDATE,
/**
* 二级审核
*/
TWO_LEVEL_VALIDATE,
/**
* 提交订单中
*/
SUBMIT_ORDER_PROCESS,
/**
* 提交订单成功
*/
SUBMIT_ORDER_SUCCESS,
/**
* 一级审核失败
*/
ONE_LEVEL_VALIDATE_ERROR,
/**
* 二级审核失败
*/
TWO_LEVEL_VALIDATE_ERROR
}
export const ORDER_EXAMINE_LIST = ['',
'新增订单',
'一级审核中',
'二级审核中',
'提交订单',
'提交成功',
'一级审核不通过',
'二级审核不通过'
]
// 状态颜色映射
export const StatusColorsMaps = {
ready: '#C0C4CC',
process: '#FFC400',
submit: '#6C9CEB',
success: '#41CC9E',
error: '#EF6260'
}
const matchStatusColor = (status: number): string => {
const maps = {
[ORDER_EXAMINE_ENUM.ADD_ORDER]: StatusColorsMaps.ready,
[ORDER_EXAMINE_ENUM.ONE_LEVEL_VALIDATE]: StatusColorsMaps.process,
[ORDER_EXAMINE_ENUM.TWO_LEVEL_VALIDATE]: StatusColorsMaps.process,
[ORDER_EXAMINE_ENUM.SUBMIT_ORDER_PROCESS]: StatusColorsMaps.submit,
[ORDER_EXAMINE_ENUM.SUBMIT_ORDER_SUCCESS]: StatusColorsMaps.success
}
// 默认返回错误的状态颜色
return maps[status] || StatusColorsMaps.error
}
// 订单内部状态显示
const StatusColors: React.FC<StatusColorsProps> = (props) => {
const { status, type, text = null } = props
const statusShowColor = matchStatusColor(status)
// 优先显示 后端返回的状态文本
return (<Tag color={statusShowColor}>{ text }</Tag>)
}
StatusColors.defaultProps = {}
export default StatusColors
import React from 'react'
import { history } from 'umi'
import { formatTimeString } from '@/utils'
import StatusColors from '../components/StatusColors'
import StatusColors from '../components/statusColors'
import EyePreview from '@/components/EyePreview'
export const baseOrderListColumns: any = () => {
......
......@@ -50,6 +50,8 @@ const InquiryModalTable:React.FC<InquiryModalTableProps> = (props) => {
let newData = data.map((v: any) => {
v.memberId = item.offerMemberId
v.memberRoleId = item.offerMemberRoleId
v.orderMode = schemaAction.getFieldValue('orderMode')
v.shopId = schemaAction.getFieldValue('shopId')
return v
})
......
......@@ -70,6 +70,9 @@ export const procurementRenderField = (data) => {
memberRoleId: data.vendorRoleId,
// 冗余运费
freight: data.product.freight,
// 冗余shopId orderMode查询支付方式使用
shopId: data.shopId,
orderMode: data.orderMode,
}
})
}
......@@ -84,8 +87,9 @@ export const procurementProcessField = (value) => {
name: item.productName,
logo: item.imgUrl,
quantity: item.purchaseCount,
logisticTemplateId: item.logistics.templateId,
logisticsTemplateId: item.logistics.templateId,
weight: item.logistics.weight,
stockId: item.upperCommoditySkuId,
}
})
return value
......
......@@ -3,7 +3,6 @@ import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { fetchOrderApi } from '../apis';
import { PublicApi } from '@/services/api';
import moment from 'moment';
// 异步填充表格字段
......@@ -18,39 +17,20 @@ const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsync
ctx.setFieldState(productValue.path, state => {
state.loading = true
})
// // 折扣请求
// const asyncPriceRequests: any[] = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => {
// const {code, data} = await PublicApi.getMemberManageUpperCreditParamGet({
// parentMemberId: v.memberId,
// parentMemberRoleId: v.memberRoleId
// }, {ttl: 60 * 1000, useCache: true})
// return code === 1000 ? { value: data.parameter, id: v.id } : { value: '', id: 0 }
// }
// ))
// // 存在需要异步请求的, 则进行赋值
// if (asyncPriceRequests.length > 0) {
const newData = productData.map((v, i) => {
// if (!v.memberPrice) {
// v.memberPrice = asyncPriceRequests.find(j => j.id === v.id)?.value || ''
// }
// // @ b2b订单不考虑会员折扣 字段固定100
v.discount = 100
return v
})
ctx.setFieldValue('products', newData)
// }
const newData = productData.map((v, i) => {
//@ b2b订单不考虑会员折扣 字段固定100
v.discount = 100
return v
})
ctx.setFieldValue('products', newData)
ctx.setFieldState(productValue.path, state => {
state.loading = false
})
}
export const createEffects = context => () => {
}
export const useModelTypeChange = (callback) => {
const utils = useLinkageUtils()
// 下单模式发生改变时
FormEffectHooks.onFieldValueChange$('orderMode').subscribe(state => {
callback(state)
......@@ -83,39 +63,37 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用
// 请求一次并复制给支付信息
const productItem = value[0]
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
const shopId = ctx.getFieldValue('shopId')
const products = value.map(item => ({ productId: item.commodityId, skuId: item.productId }))
if(shopId && products?.length) {
// 判断不存在物流 隐藏交付地址
if(!value.some(item => item.logistics.deliveryType === 1)) {
ctx.setFieldState('deliveryAddresId', state => state.visible = false )
} else {
ctx.setFieldState('deliveryAddresId', state => state.visible = true )
if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
const shopId = ctx.getFieldValue('shopId')
const products = value.map(item => ({ productId: item.commodityId, skuId: item.productId }))
if(shopId && products?.length) {
// 判断不存在物流 隐藏交付地址
if(!value.some(item => item.logistics.deliveryType === 1)) {
ctx.setFieldState('deliveryAddresId', state => state.visible = false )
} else {
ctx.setFieldState('deliveryAddresId', state => state.visible = true )
}
fetchOrderApi.getPayInfoList({
products: products,
memberId: productItem?.memberId,
roleId: productItem?.memberRoleId,
orderMode: orderMode,
shopId: shopId
}).then(data => {
ctx.setFieldValue('payments', data.map(item => ({
...item,
payPrice: (sumPrice * Number(item.payRate) / 100).toFixed(2)
})))
}).catch(err => { })
}
fetchOrderApi.getPayInfoList({
products: products,
memberId: productItem?.memberId,
roleId: productItem?.memberRoleId,
orderMode: orderMode,
shopId: shopId
}).then(data => {
ctx.setFieldValue('payments', data.map(item => ({
...item,
payPrice: (sumPrice * Number(item.payRate) / 100).toFixed(2)
})))
}).catch(err => {
})
}
}
}
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
// 由于商品存在多个, 需对接口做一定缓存
asyncPadDataForProduct(ctx, state)
const numberInputs = document.getElementsByClassName("purchase_amount_input")
if(numberInputs?.length) {
for(let i = 0; i < numberInputs.length; i++) {
......@@ -132,17 +110,14 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
// 写入收货地址数据
useProductAddress(ctx)
})
FormEffectHooks.onFieldValueChange$('hasInvoice').subscribe(state => {
if (state.value) {
useInvoiceList(ctx)
}
})
}
export const useProductAddress = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
fetchOrderApi.getProductAddressAll().then(data => {
ctx.setFieldState('deliveryAddresId', state => {
if (data.length > 0 && !state.value) {
......@@ -169,62 +144,6 @@ export const useInvoiceList = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
})
}
// 编辑订单 地址和发票变动 触发订单更新
export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const { pageStatus, id } = usePageStatus()
FormEffectHooks.onFieldValueChange$('theInvoiceId').subscribe(state => {
const { value, path } = state
if(pageStatus === PageStatus.EDIT){
if(state?.dataSource?.length && state.loading && state.props["x-component-props"].times > 2) {
ctx.submit((values) => {
if(values){
PublicApi.postOrderProcurementOrderUpdate({
...values,
deliveryTime: moment(values.deliveryTime).valueOf(),
theInvoiceId: value?.id || null,
hasInvoice: values.hasInvoice,
deliveryAddresId: values.deliveryAddresId,
id,
}, { ctlType: "none" })
}
})
} else {
ctx.setFieldState(path, _state => {
_state.loading = true
_state.props["x-component-props"].times++
})
}
}
})
FormEffectHooks.onFieldValueChange$('deliveryAddresId').subscribe(state => {
const { value, path } = state
if(pageStatus === PageStatus.EDIT){
if(state?.dataSource?.length && state.loading && state.props["x-component-props"].times > 2) {
ctx.submit((values) => {
if(values){
PublicApi.postOrderProcurementOrderUpdate({
...values,
deliveryTime: moment(values.deliveryTime).valueOf(),
theInvoiceId: values.theInvoiceId,
hasInvoice: values.hasInvoice,
deliveryAddresId: value?.id ? value.id : value,
id,
}, { ctlType: "none" })
}
})
} else {
ctx.setFieldState(path, _state => {
_state.loading = true
_state.props["x-component-props"].times++
})
}
}
})
}
// 高级筛选schema中用于输入搜索商品品类的Effect
/**
* @param ctx 外部表单action
......
......@@ -8,7 +8,7 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd
import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay, useOrderUpdateChangeOther } from './effects'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { OrderModalType } from '@/constants/order'
import ProductModalTable from './components/productModalTable'
......@@ -83,18 +83,10 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
if (logsiticsDataMaps.length > 0) {
PublicApi.postLogisticsFreightTemplateCalFreightPrice({
orderProductList: pageStatus === PageStatus.ADD
?
logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId,
weight: v.logistics.weight,
orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId || v.logisticsTemplateId,
weight: v.logistics.weight || v.weight,
count: v?.purchaseCount || 0
}))
:
logsiticsDataMaps.map(v => ({
templateId: v.logisticTemplateId,
weight: v.weight,
count: v.purchaseCount
})),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......@@ -147,8 +139,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const [products, setProducts] = useState<any>([])
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(
addSchemaAction,
addSchemaAction.getFieldValue('vendorMemberId'),
addSchemaAction.getFieldValue('vendorRoleId'),
pageStatus === PageStatus.ADD ? addSchemaAction.getFieldValue('products') : products
)
// 订单商品
......@@ -332,7 +322,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
memberRef.current.setVisible(true)
}
const orderNoPrice = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderNo}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const orderNoPrice = pageStatus === PageStatus.ADD && <div className='connectBtn' onClick={handleOrderNo}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const orderMember = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{marginRight: 4}}/>选择</div>
// @todo 未实现金额合计
......@@ -388,28 +378,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
]}
>
<ReadyAddOrderDetailContext.Provider value={providerValue}>
{/* { pageStatus !== PageStatus.ADD && initFormValue && initFormValue.externalWorkflowFlowRecordLogResponses && <AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
initFormValue.externalWorkflowFlowRecordLogResponses ?
initFormValue.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
initFormValue.interiorWorkflowFlowRecordLogResponses ?
initFormValue.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess> } */}
<Card className={styles.orderCollectCard} style={{marginTop: 24}}>
<NiceForm
loading={formLoading}
......@@ -431,6 +399,11 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
state.editable = false
})
}
if (id) {
ctx.setFieldState('shopId', state => {
state.editable = false
})
}
})
$('onFieldInputChange', 'orderMode').subscribe(state => {
const { value } = state
......@@ -459,9 +432,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update)
// 编辑 地址和发票信息变动 触发订单更新
useOrderUpdateChangeOther(ctx)
// 监听商品总价的变更, 支付比例计算
$('sumPrice').subscribe(payload => {
const payment = addSchemaAction.getFieldValue('payments')
......@@ -486,6 +456,14 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
})
// 新增下 切换商城 清空受影响的字段
$('onFieldValueChange', 'shopId').subscribe(state => {
pageStatus === PageStatus.ADD && ctx.reset({
validate: false,
selector: '*(quoteNo,quoteId,vendorMemberName,vendorMemberId,vendorRoleId,products,payments)'
})
})
}}
expressionScope={{
orderNoPrice,
......
......@@ -4,7 +4,7 @@ import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useEffect, useState, useRef } from 'react'
import { PublicApi } from '@/services/api'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, products: any = []): any => {
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, products: any = []): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const markRef = useRef<boolean>(true)
......@@ -40,11 +40,12 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}
const getPayLists = (memberId, memberRoleId) => {
console.log('1')
PublicApi.postOrderBuyerCreateB2bPaymentFind({
memberId,
roleId: memberRoleId,
shopId: ctx.getFieldValue('shopId'),
orderMode: ctx.getFieldValue('orderMode'),
shopId: products[0]['shopId'],
orderMode: products[0]['orderMode'],
products: products.map(item => ({ productId: item.commodityId, skuId: item.productId }))
}, { ctlType: 'none' }).then(res => {
const { code, data } = res
......
......@@ -74,63 +74,6 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
})
}
// 编辑订单 地址和发票变动 触发订单更新
export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
// const { pageStatus, id } = usePageStatus()
// FormEffectHooks.onFieldValueChange$('theInvoiceId').subscribe(state => {
// const { value, path } = state
// if(pageStatus === PageStatus.EDIT){
// if(state?.dataSource?.length && state.loading && state.props["x-component-props"].times > 2) {
// ctx.submit((values) => {
// if(values){
// PublicApi.postOrderProcurementOrderUpdate({
// ...values,
// deliveryTime: moment(values.deliveryTime).valueOf(),
// theInvoiceId: value?.id || null,
// hasInvoice: Number(values.hasInvoice),
// deliveryAddresId: values.deliveryAddresId,
// id,
// }, { ctlType: "none" })
// }
// })
// } else {
// ctx.setFieldState(path, _state => {
// _state.loading = true
// _state.props["x-component-props"].times++
// })
// }
// }
// })
// FormEffectHooks.onFieldValueChange$('deliveryAddresId').subscribe(state => {
// const { value, path } = state
// if(pageStatus === PageStatus.EDIT){
// if(state?.dataSource?.length && state.loading && state.props["x-component-props"].times > 2) {
// ctx.submit((values) => {
// if(values){
// PublicApi.postOrderProcurementOrderUpdate({
// ...values,
// deliveryTime: moment(values.deliveryTime).valueOf(),
// theInvoiceId: values.theInvoiceId,
// hasInvoice: Number(values.hasInvoice),
// deliveryAddresId: value?.id ? value.id : value,
// id,
// }, { ctlType: "none" })
// }
// })
// } else {
// ctx.setFieldState(path, _state => {
// _state.loading = true
// _state.props["x-component-props"].times++
// })
// }
// }
// })
}
// 高级筛选schema中用于输入搜索商品品类的Effect
/**
* @param ctx 外部表单action
......
......@@ -8,7 +8,7 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd
import { SaveOutlined, LinkOutlined, PlusOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { mergeAllSchemas } from './schema'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useOrderUpdateChangeOther, useProductTableChangeForPay } from './effects'
import { useModelTypeChange, useEditHideField, useOrderFormInitEffect, useProductTableChangeForPay } from './effects'
import { orderCombination, orderTypeLabelMap, procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import CirculationRecord from '../components/circulationRecord'
import SelectAddress from './components/selectAddress'
......@@ -16,11 +16,9 @@ import TheInvoiceList from './components/theInvoiceList'
import styled from 'styled-components'
import { useUpdate } from '@umijs/hooks'
import { PublicApi } from '@/services/api'
import { findLastIndexFlowState } from '@/utils'
import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { help } from '../../common'
import { ReadyAddOrderDetailContext } from '../context'
import AuditProcess from '@/components/AuditProcess'
import styles from './index.less'
import { useMaterialTable } from './model/useMaterialTable'
import ContractModalTable from './components/contractModalTable'
......@@ -253,7 +251,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
contractOrderRef.current.setVisible(true)
}
const orderContract = pageStatus !== PageStatus.PREVIEW && <div className='connectBtn' onClick={handleOrderContract}><LinkOutlined style={{marginRight: 4}}/>选择</div>
const orderContract = pageStatus === PageStatus.ADD && <div className='connectBtn' onClick={handleOrderContract}><LinkOutlined style={{marginRight: 4}}/>选择</div>
// 新增收货地址
const addNewAddress = <Button block icon={<PlusOutlined/>}>新增收货地址</Button>
......@@ -275,28 +273,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
]}
>
<ReadyAddOrderDetailContext.Provider value={providerValue}>
{/* { pageStatus !== PageStatus.ADD && initFormValue && initFormValue.externalWorkflowFlowRecordLogResponses && <AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
initFormValue.externalWorkflowFlowRecordLogResponses ?
initFormValue.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
initFormValue.interiorWorkflowFlowRecordLogResponses ?
initFormValue.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess> } */}
<Card className={styles.orderCollectCard} style={{marginTop: 24}}>
<NiceForm
loading={formLoading}
......@@ -336,9 +312,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update)
// 编辑 地址和发票信息变动 触发订单更新
useOrderUpdateChangeOther(ctx)
}}
expressionScope={{
orderContract,
......
......@@ -57,7 +57,8 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
// 渲染单价
materialInfoColumns[7].render = (t, r) => <span style={{color: 'red'}}>{Number(r.price).toFixed(2)}</span>
materialInfoColumns[materialInfoColumns.length - 1].render = (t, r) => null
// materialInfoColumns[materialInfoColumns.length - 1].render = (t, r) => null
materialInfoColumns.pop()
}
return materialInfoColumns
......
......@@ -4,7 +4,7 @@ import { Row, Col, Progress } from 'antd'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
import StatusColors from '../../components/StatusColors'
import StatusColors from '../../components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons'
import {
Chart,
......
import React from 'react'
import React, { useRef, useState } from 'react'
import { formatTimeString } from '@/utils'
import StatusColors from '@/pages/transaction/components/statusColors'
import EyePreview from '@/components/EyePreview'
import { history } from 'umi'
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { getSaleOrderAuditPageSelectOption } from '@/pages/transaction/effect';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useModalTable } from '../../purchaseOrder/orderCollectB2b/model/useModalTable'
import { Button } from 'antd'
import { PublicApi } from '@/services/api'
import { setAuth, setRouters } from '@/utils/auth'
/** 订单审核各个页面 只有订单类型查询的Schema */
export const tableListSchema: any = (align?: String, colStyle?: Object) => {
......@@ -105,6 +110,7 @@ export const baseOrderListColumns: any = () => {
align: 'center',
dataIndex: 'memberName',
key: 'memberName',
render: (t, r) => r.memberName ? t : r.buyerMemberName
},
{
title: '下单时间',
......@@ -141,3 +147,93 @@ export const baseOrderListColumns: any = () => {
},
]
}
// 转单适用
export const useTransformOrderTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const transformRef = useRef<any>({})
const { visible, setVisible } = useModalTable()
const handleDelete = (record) => {
}
const handleModify = (record) => {
alert('转单修改')
// PublicApi.postMemberLoginSwitchrole({
// memberRoleId: 11,
// }).then(res => {
// if (res.code === 1000) {
// // @ts-ignore
// setAuth(res.data);
// setRouters(res.data.urls);
// setTimeout(() => {
// window.location.replace(`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/two?id=${record.order}`);
// }, 800);
// }
// }).catch(err => { })
}
const [orderColumns, setOrderColumns] = useState(() => {
const orderInfoColumns = [
{
title: '订单号',
align: 'center',
dataIndex: 'orderNo',
key: 'orderNo',
render: (text, record) => {
return (
<EyePreview url={`${history.location.pathname}/preview?id=${record.orderId}`}>
{text}
</EyePreview>
)
},
ellipsis: true,
},
{
title: '订单摘要',
align: 'center',
dataIndex: 'digest',
key: 'digest',
ellipsis: true,
},
{
title: '供应会员',
align: 'center',
dataIndex: 'vendorMemberName',
key: 'vendorMemberName',
ellipsis: true,
render: (t, r) => t ? t : r.memberName
},
{
title: '下单时间',
align: 'center',
dataIndex: 'createTime',
key: 'createTime',
render: (text) => formatTimeString(text)
},
{
title: '订单总额',
align: 'center',
dataIndex: 'amount',
key: 'amount',
ellipsis: true,
render: (t) => `¥${t}`
},
]
// 渲染操作
orderInfoColumns[orderInfoColumns.length - 1].render = (text, record) => <>
<Button type='link' size="small" onClick={() => handleModify(record)}>修改</Button>
<Button type='link' size="small" onClick={() => handleDelete(record)}>删除</Button>
</>
return orderInfoColumns
})
return {
transformRef,
orderColumns,
visible,
setVisible,
}
}
......@@ -25,7 +25,7 @@ const FirstApprovedOrderDetail: React.FC = () => {
approvedRef.current.actions.submit().then(async (v) => {
const params = {
orderId: Number(id),
...v,
...v.values,
}
const result = await run(params)
......
import React, { useCallback, useRef } from 'react'
import { Card, Button, Dropdown, Menu } from 'antd'
import React, { useRef } from 'react'
import { Card, Button, Space } from 'antd'
import { StandardTable } from 'god'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PublicApi } from '@/services/api'
import { baseOrderListColumns } from './constant'
import { baseOrderListColumns, useTransformOrderTable } from './constant'
import { history } from 'umi'
import { PurchaseOrderOutWorkState } from '@/constants/order'
import { saleTableListSchema as tableListSchema } from '../_public/order/constant'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePickerUnix'
import Submit from '@/components/NiceForm/components/Submit'
import NiceForm from '@/components/NiceForm'
import { createFormActions } from '@formily/antd'
import { createFormActions, registerVirtualBox } from '@formily/antd'
import ModalForm from '@/components/ModalForm'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import { CaretDownOutlined } from '@ant-design/icons'
import TableOperation from '@/components/TableOperation'
// 销售订单查询
......@@ -30,6 +28,7 @@ const fetchTableData = async (params) => {
const formActions = createFormActions();
const destroyActions = createFormActions();
const pauseActions = createFormActions();
const transformActions = createFormActions();
const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const ref = useRef<any>({})
......@@ -38,6 +37,8 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
const { run, loading } = useHttpRequest(PublicApi.postOrderVendorCancel)
const { run: runPause, loading: loadingEnd } = useHttpRequest(PublicApi.postOrderVendorTerminate)
const { transformRef, orderColumns } = useTransformOrderTable(transformActions)
// 提交取消
const handleSubmit = () => {
destroyActions.submit().then(async ({values}: any) => {
......@@ -80,14 +81,30 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
pauseActions.setFieldValue('state', 1)
}
// 单个转单
const handelTransformOrder = (r) => {
console.log(r)
transformRef.current.setVisible(true)
transformActions.setFieldValue('orders', [
{ id: 1, orderNo: 'TYBHU', digest: '666', vendorMemberName: '999', createTime: '2015-12-20 20:15:12', amount: '123'},
{ id: 2, orderNo: 'IYGUIH', digest: '56', vendorMemberName: '651', createTime: '2015-02-15 20:15:12', amount: '123'}
])
}
// 批量转单
const handleSubmitTransform = () => {
}
/** 参照后台数据生成 */
const renderOptionButton = (record: any) => {
const buttonGroup = { '取消订单': record.showCancel, '中止': record.showTerminate, '评价': record.showComment }
const buttonGroup = { '取消订单': record.showCancel, '中止': record.showTerminate, '评价': record.showComment, '转单': true }
const operationHandler = {
'取消订单': () => handleCancel(record),
'中止': () => handleSuspend(record),
'评价': () => handleEvaluate(record.orderId),
'转单': () => handelTransformOrder(record),
}
return (
......@@ -113,7 +130,14 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}
}
const controllerBtns = <Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
const controllerBtns = <Space>
<Button style={{width: 140}} onClick={() => {}} type='default'>导出</Button>
<Button type="primary">转单</Button>
</Space>
registerVirtualBox("CustomTitle", ({ children, schema }) => {
return <p>当前勾运了3张订单进行转单,转单后生成的采购订单可通过账号“广州中石科技采购商角色”进行查看</p>
})
return <PageHeaderWrapper>
<Card>
......@@ -148,6 +172,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}}
/>
</Card>
{/* 取消原因 */}
<ModalForm
modalTitle='取消原因'
currentRef={destoryRef}
......@@ -192,6 +217,7 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}}
modalProps={{confirmLoading: loading}}
/>
{/* 中止原因 */}
<ModalForm
modalTitle='中止原因'
currentRef={pauseRef}
......@@ -241,6 +267,38 @@ const SaleOrder: React.FC<SaleOrderProps> = (props) => {
}}
modalProps={{confirmLoading: loadingEnd}}
/>
{/* 确认转单 */}
<ModalForm
modalTitle='确认转单'
currentRef={transformRef}
confirm={handleSubmitTransform}
actions={transformActions}
schema={{
type: 'object',
properties: {
NOT_SUBMIT_TITLE: {
type: 'object',
"x-component": "CustomTitle",
},
orders: {
type: 'array',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'id',
columns: "{{orderColumns}}",
pagination: false,
},
},
}
}}
expressionScope={{
orderColumns,
}}
// components={{
// CustomTitle
// }}
// modalProps={{confirmLoading: loadingTransform}}
/>
</PageHeaderWrapper>
}
......
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