Commit 46372949 authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-paltform into dev

parents e85d3cab 93d8fd62
......@@ -60,7 +60,7 @@ export const tableListSchema: ISchema = {
placeholder: '请输入订单摘要',
}
},
"supplyMembersName": {
"memberName": {
type: 'string',
"x-component-props": {
placeholder: '请输入采购会员名称'
......
......@@ -98,29 +98,24 @@ export const MoneyTotalBox = ({ dataSource, isEditData }) => {
}
const [amountMoney, setAmountMoney] = useState<number>(sumPrice || sum + freePrice)
const [changeTotal, setChangeTotal] = useState<boolean>(false) // 是否改变总价
// 总计金额
useEffect(() => {
setAmountMoney(() => sumPrice || (sum*1000 + freePrice*1000)/1000)
// setAmountMoney(() => (sum*1000 + freePrice*1000)/1000)
}, [sum, freePrice])
useEffect(() => {
if(changeTotal){
const handleConfirm = () => {
let free = modalPriceActions.getFieldValue('freePrice')
setFreePrice(Number(free || 0))
// 执行修改订单运费
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: freePrice, type: 2}).then(res => {
PublicApi.postOrderProductPriceUpdate({orderId: dataSource.id, price: free, type: 2}).then(res => {
if(res.code === 1000) {
modelRef.current.setVisible(false)
reloadFormData()
}
})
}
}, [amountMoney])
const handleConfirm = () => {
setFreePrice(Number(modalPriceActions.getFieldValue('freePrice') || 0))
modelRef.current.setVisible(false)
setChangeTotal(true)
}
useEffect(() => {
// 存在商品 并且有选择收货地址,则开始计算运费
......
......@@ -53,7 +53,13 @@ export const useSelfTable = () => {
},
{ title: '发货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 发货单号跳转
{ title: '入库单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> },
{
title: '入库单号',
align: 'center',
dataIndex: 'invoiceNumber',
key: 'invoiceNumber',
render: (text, record) => <Link to={`/memberCenter/tranactionAbility/stockSellStorage/bills/detail?id=${record.orderDeliveryDetailsId}&preview=1`}>{text}</Link>
},
{
title: '订单类型',
align: 'center',
......
......@@ -28,7 +28,6 @@ const MemberModalTable:React.FC<MemberModalTableProps> = (props) => {
const handleConfirm = () => {
const rowItem = rowSelectionCtl.selectRow[0]
console.log(rowItem, '看会员item有没有member信息')
if (rowItem) {
schemaAction.setFieldValue('supplyMembersName', rowItem.name)
schemaAction.setFieldValue('supplyMembersId', rowItem.memberId)
......
......@@ -65,7 +65,6 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
}) => {
const formItemRef = useRef<any>();
const { form, childOptions, setChildOptions, originOptions } = useContext(EditableContext);
const save = async e => {
try {
const values = await form.validateFields();
......@@ -90,7 +89,7 @@ export const PayInfoCell:React.FC<PayInfoCellProps> = ({
// 支付方式
if (dataIndex === 'payWay') {
return <Select ref={formItemRef}
options={originOptions.map(v => ({label: v.payVal, value: v.payType}))}
options={originOptions.map(v => ({label: v.payVal, value: v.payType, disabled: v?.disabled}))} // ?? 仅限线下支付下面只有一种方式
onChange={e => {
const result = originOptions.find(v => e === v.payType)
setChildOptions(result.payList.map(v => ({label: v.way, value: v.id})))
......
......@@ -129,7 +129,11 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
return resultState
})
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(addSchemaAction, addSchemaAction.getFieldValue('supplyMembersId'))
const [paymentColumns, paymentComponents, paymentSave] = usePaymentInfo(
addSchemaAction,
addSchemaAction.getFieldValue('supplyMembersId'),
pageStatus === PageStatus.ADD ? addSchemaAction.getFieldValue('orderProductRequests') : initFormValue.orderProductRequests
)
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction)
// 页面进入时, 当前所处的下单模式
......@@ -240,10 +244,14 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
break;
}
}
console.log(fnResult, 'fnResult')
if (fnResult.code === 1000) {
// 跳转至待新增列表
window.sessionStorage.removeItem(spam_id)
history.replace('/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder')
setTimeout(() => {
history.goBack()
}, 1000)
// history.replace('/memberCenter/tranactionAbility/purchaseOrder/readyAddOrder')
}
setBtnLoading(false)
} catch (error) {
......
......@@ -6,7 +6,7 @@ import { PublicApi } from '@/services/api'
import { ReadyAddOrderDetailContext } from '../../context'
import { message } from 'antd'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any): any => {
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, orderProducts: any): any => {
const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const { productSumPrice } = useContext(ReadyAddOrderDetailContext)
......@@ -75,6 +75,21 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}
}, [memberId])
useEffect(() => {
// 当有商品数据传入的时 判断商品只有是物流的才能使用到付
if(orderProducts?.length) {
const newColumns = [...columns]
let options = newColumns[5].formItemProps.options
if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
} else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
}
}, [orderProducts, columns])
const getPayLists = (memberId) => {
PublicApi.getPayPayWayList({memberId}).then(res => {
const { code, data } = res
......
......@@ -100,7 +100,6 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
}
const handleSave = row => {
console.log(row, 'row')
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('orderProductRequests')];
const index = newData.findIndex(item => row.id === item.id);
......
......@@ -64,7 +64,13 @@ export const useSelfTable = () => {
},
{ title: '收货批次', align: 'center', dataIndex: 'shipmentBatch', key: 'shipmentBatch', render: text => text ? `第${text}次` : '' },
// @todo 收货单号跳转
{ title: '收货单号', align: 'center', dataIndex: 'invoiceNumber', key: 'invoiceNumber', render: text => <Link to={'/'}>{text}</Link> },
{
title: '入库单号',
align: 'center',
dataIndex: 'invoiceNumber',
key: 'invoiceNumber',
render: (t, r) => r.orderDeliveryDetailsId ? <Link to={`/memberCenter/tranactionAbility/stockSellStorage/bills/detail?id=${r.orderDeliveryDetailsId}&preview=1`}>{t}</Link> : <a href={`https://www.kuaidi100.com/chaxun?nu=${t}`} target="blank">{t}</a>
},
{
title: '订单类型',
align: 'center',
......
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