Commit f64a1b8c authored by GuanHua's avatar GuanHua
parents c7f78b75 a63820dd
...@@ -978,6 +978,7 @@ export enum DeliverySideState { ...@@ -978,6 +978,7 @@ export enum DeliverySideState {
// 订单外部显示文案 // 订单外部显示文案
export const PurchaseOrderOutWorkStateTexts = { export const PurchaseOrderOutWorkStateTexts = {
"-1": "取消订单", "-1": "取消订单",
0: '订单完成',
1: '待提交订单', 1: '待提交订单',
2: '待确认订单', 2: '待确认订单',
3: '待确认电子合同', 3: '待确认电子合同',
...@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = { ...@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = {
// 订单流转记录外部状态 // 订单流转记录外部状态
export const OrderTransformOutWorkStateTexts = { export const OrderTransformOutWorkStateTexts = {
"-1": '取消订单', "-1": '取消订单',
0: '订单完成',
1: '待确认', 1: '待确认',
2: '待确认电子合同', 2: '待确认电子合同',
3: '待支付', 3: '待支付',
...@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = { ...@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = {
// 采购订单流转记录内部状态 // 采购订单流转记录内部状态
export const PurchaseOrderTransformInsideWorkStateTexts = { export const PurchaseOrderTransformInsideWorkStateTexts = {
"-1": '取消订单', "-1": '取消订单',
0: '订单完成',
1: '待提交审核', 1: '待提交审核',
2: '提交审核通过', 2: '提交审核通过',
3: '审核通过', 3: '审核通过',
......
...@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
let minOrder = Number(minOrderNumber)
let precision;
if(Number.isInteger(minOrder)) { // 整数取1
precision = 1
} else { // 小数取最小精度(最多三位)
switch(minOrderNumber.toString().split(".")[1].length) {
case 1:
precision = 0.1
break;
case 2:
precision = 0.01
break;
case 3:
precision = 0.001
break;
default:
precision = 1
}
}
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
return Object.values(item.numberRange) return Object.values(item.numberRange)
}).reduce( }).reduce(
function(a, b) { function(a, b) {
// 判断首位数是否满足精度
if(a.length && b.length) {
if((Number(b[0])*1000 - Number(a[a.length-1])*1000)/1000 !== precision) {
throw new Error('请正确输入阶梯数量范围');
}
}
return a.concat(b); return a.concat(b);
}, },
[] []
......
...@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
let minOrder = Number(currentRow.minOrder)
let precision;
if(Number.isInteger(minOrder)) { // 整数取1
precision = 1
} else { // 小数取最小精度(最多三位)
switch(minOrder.toString().split(".")[1].length) {
case 1:
precision = 0.1
break;
case 2:
precision = 0.01
break;
case 3:
precision = 0.001
break;
default:
precision = 1
}
}
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => {
return Object.values(item.numberRange) return Object.values(item.numberRange)
}).reduce( }).reduce(
function(a, b) { function(a, b) {
// 判断首位数是否满足精度
if(a.length && b.length) {
if((Number(b[0])*1000 - Number(a[1])*1000)/1000 !== precision) {
throw new Error('请正确输入阶梯数量范围');
}
}
return a.concat(b); return a.concat(b);
}, },
[] []
......
...@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={6}> <Col span={6}>
<p> <p>
{ {
productDetail?.isMemberPrice && '允许使用会员折扣购买' productDetail?.isMemberPrice ? '允许使用会员折扣购买' : '无'
} }
</p> </p>
</Col> </Col>
......
...@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}).then(res => { }).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
setBalanceInfo(res.data) setBalanceInfo(res.data)
} else {
message.error(res.message)
} }
setIsSpin(false) setIsSpin(false)
}) })
......
...@@ -100,13 +100,14 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor ...@@ -100,13 +100,14 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
if (value && value.length > 0){ if (value && value.length > 0){
// 请求一次并复制给支付信息 // 请求一次并复制给支付信息
const productItem = value[0] const productItem = value[0]
console.log(productItem, 'pp')
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现 if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数 } else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
fetchOrderApi.getPayInfoList({ fetchOrderApi.getPayInfoList({
productId: productItem?.commodityId ? productItem.id : productItem.productId, productId: productItem?.commodityId ? productItem.id : productItem.productId,
memberId: productItem.memberId, memberId: productItem?.memberId || ctx.getFieldValue('supplyMembersId'),
memberRoleId: productItem.memberRoleId, memberRoleId: productItem?.memberRoleId || ctx.getFieldValue('supplyMembersRoleId'),
orderModel: ctx.getFieldValue('orderModel'), orderModel: ctx.getFieldValue('orderModel'),
}).then(data => { }).then(data => {
ctx.setFieldValue('paymentInformationResponses', data) ctx.setFieldValue('paymentInformationResponses', data)
...@@ -167,6 +168,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn ...@@ -167,6 +168,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
if (initValue) { if (initValue) {
const fn = async (initValue) => { const fn = async (initValue) => {
const productInfo = initValue.orderList[0].orderList const productInfo = initValue.orderList[0].orderList
ctx.setFieldValue('shopId', initValue.shopId)
ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId) ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId)
ctx.setFieldValue('supplyMembersRoleId', initValue.supplyMembersRoleId) ctx.setFieldValue('supplyMembersRoleId', initValue.supplyMembersRoleId)
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName) ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName)
......
...@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => { ...@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
orderProductList: logsiticsDataMaps.map(v => ({ orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId, templateId: v.logistics.templateId,
weight: v.logistics.weight, weight: v.logistics.weight,
count: v?.purchaseCount || null count: v?.purchaseCount || 0
})), })),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => { }, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......
...@@ -9,7 +9,7 @@ import { message } from 'antd' ...@@ -9,7 +9,7 @@ import { message } from 'antd'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => { export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => {
const paywayData = useRef<any>({}) const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns) const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const { productSumPrice } = useContext(ReadyAddOrderDetailContext) // const { schemaActions, detailData } = useContext(ReadyAddOrderDetailContext)
const components = { const components = {
body: { body: {
row: EditableRow, row: EditableRow,
...@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
// }) // })
// }, []) // }, [])
useEffect(() => { useEffect(() => {
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api // 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if(memberId) { if(memberId) {
...@@ -75,42 +76,83 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -75,42 +76,83 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
} }
}, [memberId]) }, [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
// }
// }
// // 多次支付也要禁用到付
// if(ctx.getFieldValue('paymentInformationResponses').length > 1) {
// 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])
useEffect(() => { useEffect(() => {
// 当有商品数据传入的时 判断商品只有是物流的才能使用到付
if(orderProducts?.length) { if(orderProducts?.length) {
restrictArrivalPay(columns, orderProducts)
}
}, [orderProducts])
const getPayLists = (memberId, memberRoleId) => {
PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => {
const { code, data } = res
if (code === 1000) {
const newColumns = [...columns] const newColumns = [...columns]
newColumns[5].formItemProps.options = initPayWayList(data)
paywayData.current = data
restrictArrivalPay(newColumns, orderProducts)
setColumns(newColumns)
} else {
message.error(res.message)
}
})
}
// 限制使用到付(多次支付和商品仅有物流)
const restrictArrivalPay = (cols, pros) => {
if(pros?.length) {
// const newColumns = [...columns]
const newColumns = [...cols]
let options = newColumns[5].formItemProps.options let options = newColumns[5].formItemProps.options
if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) { if(pros.filter(item => item.deliveryType === 1).length !== pros.length) {
if(options.filter(_item => _item.payType === 4).length) if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = true options.filter(_item => _item.payType === 4)[0].disabled = true
}
} else { } else {
if(options.filter(_item => _item.payType === 4).length) if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = false options.filter(_item => _item.payType === 4)[0].disabled = false
} }
}
setTimeout(() => {
let payment = ctx.getFieldValue('paymentInformationResponses')
// 多次支付也要禁用到付 // 多次支付也要禁用到付
if(ctx.getFieldValue('paymentInformationResponses').length > 1) { if(payment?.length > 1) {
if(options.filter(_item => _item.payType === 4).length) if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true options.filter(_item => _item.payType === 4)[0].disabled = true
} else { }
else {
if(options.filter(_item => _item.payType === 4).length) if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false options.filter(_item => _item.payType === 4)[0].disabled = false
} }
} } , 1000)
}, [orderProducts, columns])
const getPayLists = (memberId, memberRoleId) => {
PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => {
const { code, data } = res
if (code === 1000) {
const newColumns = [...columns]
newColumns[5].formItemProps.options = initPayWayList(data)
paywayData.current = data
setColumns(newColumns) setColumns(newColumns)
} else {
message.error(res.message)
} }
})
} }
const handleSave = row => { const handleSave = row => {
......
...@@ -391,7 +391,13 @@ const ortherInfo: ISchema = { ...@@ -391,7 +391,13 @@ const ortherInfo: ISchema = {
maxByte: 100 maxByte: 100
} }
] ]
} },
// 仅进货单下单传入接口使用
shopId: {
type: 'string',
title: '店铺ID',
visible: false
},
} }
} }
} }
......
...@@ -95,6 +95,9 @@ export const useSelfTable = () => { ...@@ -95,6 +95,9 @@ export const useSelfTable = () => {
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.DELIVERY_APPROVED_SUCCESS && { record.purchaseOrderInteriorState === SaleOrderInsideWorkState.DELIVERY_APPROVED_SUCCESS &&
<Button type='link' onClick={() => handlePreview(record)}>查看物流单</Button> <Button type='link' onClick={() => handlePreview(record)}>查看物流单</Button>
} }
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.NOT_ACCEPTED_DELIVERY &&
<Button type='link' onClick={() => handleModify(record)}>修改物流单</Button>
}
</> </>
} }
] ]
...@@ -115,6 +118,11 @@ export const useSelfTable = () => { ...@@ -115,6 +118,11 @@ export const useSelfTable = () => {
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=${logisticsId}&invoicesTypeId=2`) history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=${logisticsId}&invoicesTypeId=2`)
} }
const handleModify = async (record) => {
const logisticsId = record.logisticsId
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit?id=${logisticsId}`)
}
return { return {
columns: customOrderColumns columns: customOrderColumns
} }
......
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