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

fix:

parent 252817f1
......@@ -84,6 +84,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
dataIndex: 'amount',
align: 'center',
key: 'amount',
render: (t) => creditsCommodity ? t : `¥${t}`
},
{
title: '已发货',
......@@ -174,6 +175,7 @@ const OrderDeleveRecord:React.FC<OrderDeleveRecordProps> = (props) => {
dataIndex: 'amount',
align: 'center',
key: 'amount',
render: (t) => `¥${t}`
},
{
title: '已发货',
......
......@@ -10,7 +10,7 @@ import cx from 'classnames'
export interface OrderMergeInfoProps { }
const payInfo = [
{ title: '交付日期:', name: 'deliverDate', render: (text) => formatTimeString(text) },
{ title: '交付日期:', name: 'deliverDate', render: (text) => formatTimeString(text, 'YYYY-MM-DD') },
{
title: '交付地址:', name: 'areaName', render: (_, record) =>
<div>
......
......@@ -2,11 +2,10 @@ import React, { useContext, useState, useRef, useEffect } from 'react'
import { Table, Form, Input, Row, Col } from 'antd'
import { OrderDetailContext } from '../../_public/order/context'
import { EditOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import styled from 'styled-components'
import { createFormActions } from '@formily/antd'
import MellowCard from '@/components/MellowCard'
import { DELIVERY_TYPE, OrderKindType, OrderModalType } from '@/constants/order'
import { OrderKindType } from '@/constants/order'
import { AddressPop } from '../addressPop'
export interface OrderProductTableProps {
......@@ -38,13 +37,13 @@ const RowStyle = styled(props => <Row style={{marginTop: 12}} justify='end' {...
}
`
const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, preview }) => {
const { product, orderMode } = dataSource || {}
const { product, orderMode, orderKind } = dataSource || {}
const { couponAmount, freight, productAmount, promotionAmount, totalAmount, products } = product
const creditsCommodity = (orderMode === 24 || orderMode === 25) // @todo 积分或渠道积分下单模式
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
// 合计金额, 如果后端有传则用后端数据
const sum = productAmount || products.reduce((prev, next) => prev + parseInt((next.amount || 0)), 0)
......@@ -55,16 +54,20 @@ export const MoneyTotalBox = ({ dataSource, preview }) => {
return <RowStyle>
<Col span={2}>
<div>{creditsCommodity ? '合计所需积分' : '合计金额'}</div>
<div>{sum}</div>
</Col>
<Col span={2}>
<div>运费</div>
<div>{freight}</div>
</Col>
<Col span={2}>
<div>{creditsCommodity ? '总计所需积分' : '总计金额'}</div>
<div>{amountMoney}</div>
<div>{creditsCommodity ? sum : `¥${sum}`}</div>
</Col>
{
contractOrder ? null : <>
<Col span={2}>
<div>运费</div>
<div>{`¥${freight}`}</div>
</Col>
<Col span={2}>
<div>{creditsCommodity ? '总计所需积分' : '总计金额'}</div>
<div>{creditsCommodity ? amountMoney : `¥${amountMoney}`}</div>
</Col>
</>
}
</RowStyle>
}
......
......@@ -89,6 +89,7 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
dataIndex: 'amount',
align: 'center',
key: 'amount',
render: (t) => creditsCommodity ? t : `¥${t}`
},
{
title: '已发货',
......@@ -179,6 +180,7 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
dataIndex: 'amount',
align: 'center',
key: 'amount',
render: (t) => `¥${t}`
},
{
title: '已发货',
......@@ -361,7 +363,8 @@ const OrderSaleRecord:React.FC<OrderSaleRecordProps> = (props) => {
dataIndex: 'logisticsNo',
align: 'center',
key: 'logisticsNo',
render: text => <a target="blank" href={`/memberCenter/logisticsAbility/logisticsBillSubmit/logisticsBillQuery/preview?code=${text}`}>{text}</a>
// render: text => <a target="blank" href={`/memberCenter/logisticsAbility/logisticsBillSubmit/logisticsBillQuery/preview?code=${text}`}>{text}</a>
render: t => <a href={`https://www.kuaidi100.com/chaxun?nu=${t}`} target="blank">{t}</a>
},
{
title: '物流公司',
......
......@@ -93,8 +93,10 @@ const modalPriceActions = createFormActions()
// 总计金额联动框
export const MoneyTotalBox = ({ dataSource, isEditData }) => {
const { reloadFormData } = useContext(OrderDetailContext)
const { product, orderProductRequests = [], receiverAddressId, amount, orderMode, sumPrice, type } = dataSource || {}
const { product, orderProductRequests = [], receiverAddressId, amount, orderMode, sumPrice, orderKind } = dataSource || {}
const creditsCommodity = (orderMode === 24 || orderMode === 25) // @todo 积分或渠道积分下单模式
const contractOrder = (orderKind === OrderKindType.SRM_ORDER)
const { productAmount, freight, totalAmount } = product
const modelRef = useRef<any>({})
const [freePrice, setFreePrice] = useState<number>(freight || 0)
......@@ -146,22 +148,23 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
setSum(_sum)
}, [orderProductRequests])
/** 采购合同下单下不显示设置运费按钮 */
const notShowSet = type === ORDER_TYPE2_ENQUIRY_CONTRACT || type === ORDER_TYPE2_BIDDING_CONTRACT || type === ORDER_TYPE2_TENDER_CONTRACT
return <RowStyle>
<Col span={2}>
<div>{creditsCommodity ? '合计所需积分' : '合计金额'}</div>
<div>{productAmount}</div>
</Col>
<Col span={2}>
<div>运费 { isEditData && !creditsCommodity && !notShowSet && <SettingOutlined style={{marginLeft: 8}} onClick={handleSetting}/>}</div>
<div>{freePrice}</div>
</Col>
<Col span={2}>
<div>{creditsCommodity ? '总计所需积分' : '总计金额'}</div>
<div>{totalAmount}</div>
<div>{creditsCommodity ? sum : `¥${sum}`}</div>
</Col>
{
contractOrder ? null : <>
<Col span={2}>
<div>运费 { isEditData && !creditsCommodity && !contractOrder && <SettingOutlined style={{marginLeft: 8}} onClick={handleSetting}/>}</div>
<div>{`¥${freight}`}</div>
</Col>
<Col span={2}>
<div>{creditsCommodity ? '总计所需积分' : '总计金额'}</div>
<div>{creditsCommodity ? amountMoney : `¥${amountMoney}`}</div>
</Col>
</>
}
<ModalForm
modalTitle='设置运费'
currentRef={modelRef}
......
......@@ -48,6 +48,7 @@ export const baseOrderListColumns: any = () => {
dataIndex: 'amount',
key: 'amount',
ellipsis: true,
render: (t) => `¥${t}`
},
{
title: '订单类型',
......
......@@ -100,16 +100,15 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
return <RowStyle>
<Col span={2}>
<div>合计金额</div>
<div>{sum.toFixed(2)}</div>
<div>{`¥${sum.toFixed(2)}`}</div>
</Col>
<Col span={2}>
<div>运费</div>
{/* 缺乏字段 @todo */}
<div>{freePrice.toFixed(2)}</div>
<div>{`¥${freePrice.toFixed(2)}`}</div>
</Col>
<Col span={2}>
<div>总计金额</div>
<div>{(sum + freePrice).toFixed(2)}</div>
<div>{`¥${(sum + freePrice).toFixed(2)}`}</div>
</Col>
</RowStyle>
})
......
......@@ -88,15 +88,15 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
return <RowStyle>
<Col span={2}>
<div>合计金额</div>
<div>{sum.toFixed(2)}</div>
<div>{`¥${sum.toFixed(2)}`}</div>
</Col>
<Col span={2}>
<div>运费</div>
<div>{freePrice.toFixed(2)}</div>
<div>{`¥${freePrice.toFixed(2)}`}</div>
</Col>
<Col span={2}>
<div>总计金额</div>
<div>{(sum + freePrice).toFixed(2)}</div>
<div>{`¥${(sum + freePrice).toFixed(2)}`}</div>
</Col>
</RowStyle>
})
......
import React from 'react'
import { formatTimeString } from '@/utils'
import { Row } from 'antd'
import { DELIVERY_TYPE, OrderModalType, PurchaseOrderOutWorkStateTexts } from '@/constants/order'
import moment from 'moment'
import { GlobalConfig } from '@/global/config';
import { AddressPop } from '@/pages/transaction/components/addressPop'
import { OrderModalType } from '@/constants/order'
// 简单控制价格区间的组件
// @todo 后续需要优化, 样式,目录文件等。
......@@ -43,7 +40,7 @@ export const procurmentRenderInit = (initValue: any) => {
type: initValue.orderTypeName,
digest: initValue.digest,
deliverDate: initValue.consignee.deliverDate,
theInvoiceId: initValue.invoice.invoiceId,
theInvoiceId: initValue.invoice?.invoiceId || null,
hasContract: initValue.hasContract,
contractNo: initValue.contract.contractNo,
contract: {...initValue.contract},
......@@ -51,7 +48,8 @@ export const procurmentRenderInit = (initValue: any) => {
}
/** 修改采购合同下单 回显商品字段转换 */
export const procurementRenderField = (_orderProductRequests) => {
export const procurementRenderField = (data) => {
const _orderProductRequests = data.product.products
return _orderProductRequests.map(item => {
return {
...item,
......@@ -66,6 +64,9 @@ export const procurementRenderField = (_orderProductRequests) => {
id: item.productId,
code: item.productNo,
type: item.spec,
// 冗余memberId memberRoleId查询自提地址使用
memberId: data.vendorMemberId,
memberRoleId: data.vendorRoleId,
}
})
}
......@@ -125,14 +126,6 @@ export const orderTypeLabel = ['',
'渠道现货',
]
// export const orderTypeLabelMap = () => {
// let tempObject: { [key: number]: string } = {}
// GlobalConfig['web']['orderMode'].map(item => {
// tempObject[item['value']] = item['label']
// })
// return tempObject;
// }
export const orderTypeLabelMap = {
'3': '询价采购',
'12': '采购询价合同',
......@@ -272,6 +265,7 @@ export const contractColumns: any[] = [
title: '合同剩余金额',
dataIndex: 'freeAmount',
key: 'freeAmount',
render: (t) => `¥${t}`
},
{
title: '寻源类型',
......@@ -345,10 +339,11 @@ export const materialInfoColumns: any[] = [
render: (t, r) => t ? `${t}/${r.relevanceProductName || ''}/${r.relevanceProductSpec || ''}/${r.relevanceProductCategory || ''}/${r.relevanceProductBrand || ''}` : ''
},
{
title: '单价(元)',
title: '单价',
dataIndex: 'price',
align: 'left',
key: 'price',
render: (t) => `¥${t}`
},
// {
// title: '供方库存',
......@@ -384,6 +379,7 @@ export const materialInfoColumns: any[] = [
dataIndex: 'amount',
align: 'center',
key: 'amount',
render: (t) => `¥${t}`
},
// 接口调用
{
......
......@@ -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';
export const useModelTypeChange = (callback) => {
const utils = useLinkageUtils()
......@@ -78,57 +77,57 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// 编辑订单 地址和发票变动 触发订单更新
export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const { pageStatus, id } = usePageStatus()
// 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$('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++
})
}
}
})
// 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++
// })
// }
// }
// })
}
......
......@@ -16,7 +16,7 @@ import TheInvoiceList from './components/theInvoiceList'
import styled from 'styled-components'
import { useUpdate } from '@umijs/hooks'
import { PublicApi } from '@/services/api'
import { formatTimeString, omit, findLastIndexFlowState } from '@/utils'
import { findLastIndexFlowState } from '@/utils'
import { changeRouterTitleByStatus } from '../../_public/order/utils'
import { help } from '../../common'
import { ReadyAddOrderDetailContext } from '../context'
......@@ -25,9 +25,7 @@ import styles from './index.less'
import { useMaterialTable } from './model/useMaterialTable'
import ContractModalTable from './components/contractModalTable'
import MaterialModalTable from './components/materialModalTable'
import { PATTERN_MAPS } from '@/constants/regExp'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import moment from 'moment'
export interface PurchaseOrderDetailProps {}
......@@ -67,11 +65,11 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
return <RowStyle>
<Col span={2}>
<div>合计金额</div>
<div>{sum.toFixed(2)}</div>
<div>{`¥${sum.toFixed(2)}`}</div>
</Col>
<Col span={2}>
<div>总计金额</div>
<div>{(sum + freePrice).toFixed(2)}</div>
<div>{`¥${(sum + freePrice).toFixed(2)}`}</div>
</Col>
</RowStyle>
})
......@@ -99,14 +97,12 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const { materialAddButton, materialRef, materialColumns, materialComponents, ...surplusProps } = useMaterialTable(addSchemaAction)
let timerSignature = null
// 页面进入时, 当前所处的下单模式
useEffect(() => {
if (id) {
setFormLoading(true)
// @ts-ignore
PublicApi.getOrderBuyerCreateDetail({ orderId: id }).then(res => {
const { data } = res
const _orderProductRequests = procurementRenderField(data.product.products)
const _orderProductRequests = procurementRenderField(data)
setInitFormValue(() => procurmentRenderInit(data))
setTimeout(() => {
addSchemaAction.setFieldValue('products', _orderProductRequests)
......@@ -155,7 +151,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
memberId: params.vendorMemberId,
roleId: params.vendorRoleId
})
console.log(deliveryAddress)
params.products = params.products.map(item => {
const address = deliveryAddress[0]
return {
......@@ -203,7 +198,6 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const { data: addressDetail} = await PublicApi.getLogisticsReceiverAddressGet({
id: params.deliveryAddresId?.id || params.deliveryAddresId
})
const { data: countryCode } = await PublicApi.getManageCountryAreaGetTelCode({})
params.consignee = {
deliverDate: params.deliverDate,
consigneeId: addressDetail.id,
......@@ -213,7 +207,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
districtCode: addressDetail.districtCode,
address: addressDetail.address,
postalCode: addressDetail.postalCode,
countryCode: countryCode[0],
countryCode: addressDetail.areaCode,
phone: addressDetail.phone,
telephone: addressDetail.tel,
defaultConsignee: addressDetail.isDefault,
......
......@@ -16,22 +16,8 @@ interface DetailOptionsProps {
addSchemaAction: ISchemaFormActions
}
const mockDefaultValue: DetailOrderLocationState = {
productList: [
{
id: 1,
name: '甲商品',
customerCategoryName: '假品类',
brandName: '假品牌'
}
],
modelType: 5
}
export const useDetailOrder = (options: DetailOptionsProps) => {
const { addSchemaAction } = options
const formilyUtils = useLinkageUtils()
// const [productDataSource, setProductDataSource] = useState
const locationState = useLocation<DetailOrderLocationState>().state || {}
const { productList } = locationState
const { modelType } = history.location.query
......
import React, { useRef, useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { Button, message } from 'antd';
import { PriceComp, materialInfoColumns } from '../constant';
import { materialInfoColumns } from '../constant';
import MaterialTableCell, { MaterialEditableRow } from '../components/materialTableCell';
import { useModalTable } from './useModalTable';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { OrderModalType } from '@/constants/order';
const { pageStatus } = usePageStatus()
let orderMode = null;
......@@ -85,8 +82,6 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
}
const handleSave = row => {
const { pageStatus } = usePageStatus()
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')];
const index = newData.findIndex(item => row.id === item.id);
......
......@@ -229,7 +229,8 @@ export const paymentInformationColumns: any[] = [
title: '支付金额',
dataIndex: 'payPrice',
align: 'center',
key: 'payPrice'
key: 'payPrice',
render: (t) => `¥${t}`
},
{
title: '支付方式',
......@@ -287,7 +288,7 @@ export const productInfoColumns: any[] = [
key: 'unitName',
},
{
title: '单价(元)',
title: '单价',
dataIndex: 'unitPrice',
align: 'left',
key: 'unitPrice',
......@@ -321,6 +322,7 @@ export const productInfoColumns: any[] = [
dataIndex: 'price',
align: 'center',
key: 'price',
render: (t) => `¥${t}`
},
// 接口调用
{
......
......@@ -17,7 +17,6 @@ import DateRangePickerUnix from '@/components/NiceForm/components/DateRangePicke
import '../index.less'
import ModalForm from '@/components/ModalForm'
import { createFormActions } from '@formily/antd'
import { GlobalConfig } from '@/global/config'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
// 待新增订单
......@@ -98,6 +97,7 @@ const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => {
rowSelection={rowSelection}
columns={columns}
currentRef={ref}
rowKey="orderId"
formilyLayouts={{
justify: 'space-between'
}}
......@@ -132,7 +132,7 @@ const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => {
>
新建
</Button>
<Button onClick={handleBitchPush} loading={submitLoading}>批量提交审核</Button>
<Button onClick={handleBitchPush} loading={submitLoading}>批量提交</Button>
<DropDeleteDown>
<Menu onClick={(e) => handleMenuClick(e)}>
<Menu.Item key="1" icon={<DeleteOutlined />}>
......@@ -167,7 +167,6 @@ const ReadyAddOrder:React.FC<ReadyAddOrderProps> = (props) => {
type: 'string',
title: '选择下单模式',
required: true,
// enum: GlobalConfig.web.orderMode.map(v => { delete v.platformType; return v}),
enum: [],
"x-component-props": {
placeholder: '请选择下单模式'
......
......@@ -9,7 +9,7 @@ import { CaretDownOutlined } from '@ant-design/icons'
// 业务hooks, 待新增订单
export const useSelfTable = () => {
const ref = useRef<any>({})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'id'})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({customKey: 'orderId'})
const handleSubmit = async (id) => {
await PublicApi.postOrderBuyerCreateSubmit({orderId: id})
......
......@@ -47,7 +47,7 @@ export const useSelfTable = () => {
align: 'center',
dataIndex: 'amount',
key: 'amount',
render: (t, r) => r.orderType === 7 || r.orderType === 8 ? t : '¥' + t
render: (t, r) => '¥' + t
},
{
title: '已发货批次',
......
......@@ -7,7 +7,6 @@ import PreLoading from '@/components/PreLoading';
import { useOrderDetail } from '../../../_public/order/effects/useOrderDetail';
import OrderHandDeleved from '../../../components/orderHandDeleved';
import OrderDetailSection from '../../../components/orderDetailSection';
import { SaleOrderInsideWorkState, DeliverySideState } from '@/constants/order';
import { usePageStatus } from '@/hooks/usePageStatus';
const ReadyConfirmDelevedOrderDetail: React.FC = () => {
......
import React, { useRef } from 'react'
import { history, Link } from 'umi'
import { history } from 'umi'
import { Button } from 'antd'
import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
......@@ -47,7 +47,7 @@ export const useSelfTable = () => {
align: 'center',
dataIndex: 'amount',
key: 'amount',
render: (t, r) => (r.orderType === 7 || r.orderType === 8) ? t : '¥' + t
render: (t, r) => '¥' + t
},
{
title: '已发货批次',
......
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