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

fix:处理编辑交易规则商品无分页问题,处理销售订单商品区块修改价格后乱序问题,处理商城跳转过来的订单会员折扣传参异常

parent 3e251647
......@@ -363,7 +363,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
})
ctl.setData({
...data,
orderProductRequests: newData
orderProductRequests: newData.sort((a, b) => a.id - b.id)
})
};
......@@ -479,7 +479,7 @@ const SaleOrderProductTable:React.FC<OrderProductTableProps> = (props) => {
<MellowCard title='订单商品' style={{marginTop: 24}} bordered={false}>
<Table
columns={columns}
dataSource={orderProductRequests}
dataSource={orderProductRequests.sort((a, b) => a.id - b.id)}
components={productComponents}
rowKey='id'
pagination={false}
......
......@@ -4,7 +4,6 @@ import { Row, Space, Popover } from 'antd'
import { DELIVERY_TYPE, OrderModalType, PurchaseOrderOutWorkStateTexts } from '@/constants'
import { EnvironmentOutlined } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { toPercent } from '@/utils/type'
// 简单控制价格区间的组件
// @todo 后续需要优化, 样式,目录文件等。
......@@ -71,7 +70,7 @@ export const orderCombination = {
]
}
export const orderTypeLabel = ['',
export const orderTypeLabel = ['',
'现货采购',
'现货采购',
'询价采购',
......@@ -295,7 +294,7 @@ export const productInfoColumns: any[] = [
dataIndex: 'memberPrice',
align: 'center',
key: 'memberPrice',
render: (text, record) => record.isMemberPrice ? toPercent(text) : null
render: (text, record) => record.isMemberPrice && text ? text * 100 + '%' : null
},
{
title: '采购数量',
......@@ -328,7 +327,7 @@ export const productInfoColumns: any[] = [
render: (t, r) => {
if(r.logistics?.deliveryType === 1)
return "物流(默认)"
else if(r.logistics?.deliveryType === 2)
else if(r.logistics?.deliveryType === 2)
return "自提"
else if(r.logistics?.deliveryType === 3)
return "无需配送"
......@@ -379,4 +378,4 @@ export const mergeOrderColumns: any[] = [
align: 'center',
key: 'none',
}
]
\ No newline at end of file
]
......@@ -89,7 +89,6 @@ export const useEditHideField = () => {
export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
const { value } = state
console.log(value, 'vlaue')
const payInfoData = ctx.getFieldValue('paymentInformationResponses')
// 强制渲染一次, 用于触发金额总数
update()
......@@ -183,7 +182,8 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
commodityId: v.id, // 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他)
memberPrice: v.memberDiscount !== 1 ? v.memberDiscount : 1, // 添加会员折扣
}
})))
})
))
}
// 回显的数据保存在表单中, 当切换下单模式时,可以再次回显
......
......@@ -55,7 +55,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
const receiverAddressId = form.getFieldValue('deliveryAddresId')
const sum = data.reduce((prev, next) => prev + (next.money || 0), 0)
const [freePrice, setFreePrice] = useState<number>(0)
useEffect(() => {
if (sum + freePrice) {
form.notify('sumPrice', sum + freePrice)
......@@ -72,7 +72,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId,
weight: v.logistics.weight,
count: v?.purchaseCount || 0
count: v?.purchaseCount || null
})),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......@@ -84,7 +84,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
}
}, [data])
return <RowStyle>
<Col span={2}>
<div>合计金额</div>
......@@ -161,7 +161,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
shopDataRef.current = Object.assign({}, shopDataRef.current, item)
}
}
}, [])
const handleSubmit = async (value) => {
try {
......@@ -274,7 +274,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// @todo 未实现金额合计
const couponAddButton = <Button onClick={() => productRef.current.setVisible(true)} block type='default' style={{margin: '24px auto'}}>选择优惠券</Button>
// 新增收货地址
const addNewAddress = <Button block icon={<PlusOutlined/>}>新增收货地址</Button>
......@@ -326,25 +326,25 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
]}
>
<ReadyAddOrderDetailContext.Provider value={providerValue}>
{ pageStatus !== PageStatus.ADD && initFormValue && initFormValue.externalWorkflowFlowRecordLogResponses && <AuditProcess
{ pageStatus !== PageStatus.ADD && initFormValue && initFormValue.externalWorkflowFlowRecordLogResponses && <AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)}
outerVerifyCurrent={findLastIndexFlowState(initFormValue.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(initFormValue.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
initFormValue.externalWorkflowFlowRecordLogResponses ?
initFormValue.externalWorkflowFlowRecordLogResponses ?
initFormValue.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
}
innerVerifySteps={
initFormValue.interiorWorkflowFlowRecordLogResponses ?
initFormValue.interiorWorkflowFlowRecordLogResponses ?
initFormValue.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess> }
......@@ -416,12 +416,12 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const { value, editable } = state
// 报价单的值 等同于是否填写过报价单
const quotationOrderValue = ctx.getFieldValue('quotationNo')
// 当选择了手工下单、渠道直采手工下单、渠道现货手工下单、或者选择了合并订单下单并未选择报价单则需要显示商品列表添加接口
if (
value === OrderModalType.HAND_ORDER ||
value === OrderModalType.CHANNEL_DIRECT_MINING_ORDER ||
value === OrderModalType.CHANNEL_SPOT_MANUAL_ORDER ||
value === OrderModalType.CHANNEL_SPOT_MANUAL_ORDER ||
(value === OrderModalType.CONSOLIDATED_ORDER && quotationOrderValue)
) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
......@@ -476,4 +476,4 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
PurchaseOrderDetail.defaultProps = {}
export default PurchaseOrderDetail
\ No newline at end of file
export default PurchaseOrderDetail
......@@ -48,9 +48,9 @@ export const getUnitPriceTotal = (record) => {
// let memberPrice = record.memberPrice !== 1 ? toPoint(record.memberPrice) : 1
let memberPrice = record.memberPrice
if(record.isMemberPrice) {
return unitPrice * purchaseCount * memberPrice
return Number((unitPrice * purchaseCount * memberPrice).toFixed(2))
} else {
return unitPrice * purchaseCount
return Number((unitPrice * purchaseCount).toFixed(2))
}
}
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
......@@ -79,7 +79,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
} else {
return [...productInfoColumns].slice(0, productInfoColumns.length - 1)
}
return productInfoColumns
})
const handleShowProduct = () => {
......@@ -105,7 +105,6 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const newData = [...ctx.getFieldValue('orderProductRequests')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
console.log(getUnitPriceTotal(row), 'row')
row['money'] = getUnitPriceTotal(row)
// 新增的时候接口字段id,commodityId 编辑的时候id,productId
row['productId'] = row?.commodityId ? row.id : row.productId
......@@ -146,4 +145,4 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
rowSelection,
rowSelectionCtl
}
}
\ No newline at end of file
}
......@@ -184,7 +184,7 @@ const basicInfo: ISchema = {
type: 'number',
display: false
},
orderNo: {
type: 'string',
title: '订单编号',
......@@ -213,7 +213,7 @@ const basicInfo: ISchema = {
},
}
},
}
}
// 订单商品
......@@ -449,7 +449,7 @@ const auditRecord: ISchema = {
}
}
}
}
}
......@@ -485,7 +485,7 @@ const electronicResult: ISchema = {
}
}
}
}
}
// 流转记录
......@@ -597,4 +597,4 @@ export const mergeAllSchemas = {
4: orderElectronicSchema,
// 订单支付
5: orderDetailSchema
}
\ No newline at end of file
}
......@@ -4,7 +4,7 @@ import { Button, Row, Col, Progress, Popconfirm } from 'antd'
import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderOutWorkState } from '@/constants'
import { ORDER_TYPE, PurchaseOrderInsideWorkState, PurchaseOrderOutWorkState } from '@/constants'
import StatusColors from '../../components/StatusColors'
import { FieldTimeOutlined } from '@ant-design/icons'
import {
......@@ -136,8 +136,8 @@ export const useSelfTable = (props) => {
<Col>{record.currentPayments} / {record.sum}</Col>
{/* <Col>
{
record.currentPayments !== record.sum &&
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
record.currentPayments !== record.sum &&
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
<Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link>
}
</Col> */}
......@@ -152,17 +152,22 @@ export const useSelfTable = (props) => {
key: 'ctl',
render: (text, record) => <>
{
record.currentPayments !== record.sum &&
record.currentPayments !== record.sum &&
(
record.externalState === PurchaseOrderOutWorkState.PAY_ORDER ||
record.externalState === PurchaseOrderOutWorkState.PAY_ORDER ||
record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT ||
record.externalState === PurchaseOrderOutWorkState.NOT_PAYMENT_FINAL ||
record.externalState === PurchaseOrderOutWorkState.CONFIRM_WITHOUT_ARRIVED_ACCOUNT
) &&
) &&
<Link to={`/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder/detail?id=${record.id}`}>去支付</Link>
}
{
(record.externalState === PurchaseOrderOutWorkState.PAY_ORDER && !record.signatureLogId || record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT) &&
(
record.externalState === PurchaseOrderOutWorkState.PAY_ORDER &&
!record.signatureLogId ||
record.externalState === PurchaseOrderOutWorkState.CONFIRM_NOT_ARRIVED_ACCOUNT &&
record.interiorState !== PurchaseOrderInsideWorkState.PAY_SUCCESS
) &&
<Popconfirm
title="是否要取消该订单?"
onConfirm={() => handleCancel(record.id)}
......
......@@ -60,7 +60,7 @@ export const useSelfTable = () => {
align: 'center',
dataIndex: 'sumPrice',
key: 'sumPrice',
render: text => '¥' + text
render: (t, r) => (r.type === 7 || r.type === 8) ? t : '¥' + t
},
{ title: '发货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 发货单号跳转
......@@ -93,7 +93,7 @@ export const useSelfTable = () => {
key: 'ctl',
render: (text, record) => <>
{/* 支付结果确认到账= 待审核状态 */}
{ (record.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER || record.purchaseOrderInteriorState === SaleOrderInsideWorkState.HAND_DELEVED_ORDER) &&
{ (record.purchaseOrderInteriorState === SaleOrderInsideWorkState.CONFIRM_DELIVERY_ORDER || record.purchaseOrderInteriorState === SaleOrderInsideWorkState.HAND_DELEVED_ORDER) &&
<Button type='link' onClick={() => handleConfirm(record)}>确认发货</Button>
}
</>
......
......@@ -78,29 +78,29 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const tableAddButton = <Button style={{marginBottom: 16}} block icon={<PlusOutlined/>} disabled={pageStatus === PageStatus.PREVIEW} onClick={handleAddProductBtn} type='dashed'>选择指定商品</Button>
const tableColumns = [
{
{
dataIndex: 'id',
title: 'ID',
key: 'id'
},
{
dataIndex: 'name',
title: '商品名称',
{
dataIndex: 'name',
title: '商品名称',
key: 'name',
render: (_, record) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/detail?id=${record.commodityId}`}>{_}</EyePreview>
render: (_, record) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/detail?id=${record.commodityId}`}>{_}</EyePreview>
},
{
dataIndex: 'customerCategoryName',
title: '品类',
title: '品类',
key: 'customerCategoryName'
},
{
dataIndex: 'brandName',
{
dataIndex: 'brandName',
title: '品牌',
key: 'brandName'
},
{
dataIndex: 'priceType',
{
dataIndex: 'priceType',
title: '商品定价',
key: 'priceType',
render: (text:any, reocrd:any)=>{
......@@ -112,10 +112,10 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
return '积分兑换商品'
},
},
{
dataIndex: 'ctl',
title: '操作',
render: (_, record) => <Button type='link' disabled={pageStatus === PageStatus.PREVIEW} onClick={() => handleDeleteTable(record.id)}>删除</Button>
{
dataIndex: 'ctl',
title: '操作',
render: (_, record) => <Button type='link' disabled={pageStatus === PageStatus.PREVIEW} onClick={() => handleDeleteTable(record.id)}>删除</Button>
}
]
......@@ -136,28 +136,28 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
const columnsSetProduct: any[] = [
{
{
dataIndex: 'id',
title: 'ID',
key: 'id'
},
{
dataIndex: 'name',
title: '商品名称',
{
dataIndex: 'name',
title: '商品名称',
key: 'name'
},
{
dataIndex: 'customerCategoryName',
{
dataIndex: 'customerCategoryName',
title: '品类',
key: 'customerCategoryName'
},
{
dataIndex: 'brandName',
title: '品牌',
{
dataIndex: 'brandName',
title: '品牌',
key: 'brandName'
},
{
dataIndex: 'priceType',
{
dataIndex: 'priceType',
title: '商品定价',
key: 'priceType',
render: (text:any, reocrd:any)=>{
......@@ -203,7 +203,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
"x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down',
className: 'fixed-ant-selected-down',
fetchSearch: PublicApi.getProductSelectGetSelectCustomerCategory,
style: {
width: 160
......@@ -239,7 +239,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
async function getInitValue() {
const { data } = await PublicApi.getOrderTradingRulesDetails({id: id})
if(data.isTacitlyApprove === 2) {
const res = await getBindingProducts({id: id.toString(), current: '1', pageSize: '10'})
const res = await getBindingProducts({id: id.toString(), current: '1', pageSize: '1000'})
addSchemaAction.setFieldState('products', state => {
state.value = res.data
})
......@@ -289,7 +289,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
productsLength
}}
components={{
SelectProcesss,
SelectProcesss,
}}
effects={($, { setFieldState }) => {
FormEffectHooks.onFormInputChange$().subscribe(() => {
......@@ -324,9 +324,9 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
fetchTableData={params => fetchProductList(params)}
formilyProps={
{
ctx: {
schema: formProduct,
components: {
ctx: {
schema: formProduct,
components: {
ModalSearch: Search,
SearchSelect, Submit,
} ,
......@@ -347,10 +347,10 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
/>
</>
)
}
RuleSetting.defaultProps = {}
export default RuleSetting
\ No newline at end of file
export default RuleSetting
......@@ -176,7 +176,6 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
rowKey: 'id',
columns: "{{tableColumns}}",
prefix: "{{tableAddButton}}",
idNotList: []
}
}
}
......
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