Commit 6d86ab1b authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 初步对接代客下单,对接商品添加副单位,商品价格弹框添加副单位价格和扶单位换算率,处理跳转积分支付参数异常问题

parent 0448815e
...@@ -147,6 +147,20 @@ export const ORDER_TYPE = ['', ...@@ -147,6 +147,20 @@ export const ORDER_TYPE = ['',
// 下单模式 *NEW // 下单模式 *NEW
export enum OrderModalType { export enum OrderModalType {
/**
* 进货单下单
*/
PURCHASE_ORDER = 1,
/**
* 渠道直采进货单下单
*/
CHANNEL_DIRECT_PURCHASE_ORDER = 6,
/**
* 渠道现货进货单下单
*/
CHANNEL_EXISTING_PURCHASE_ORDER = 8,
/** /**
* 询价报价下单 * 询价报价下单
...@@ -169,7 +183,7 @@ export enum OrderModalType { ...@@ -169,7 +183,7 @@ export enum OrderModalType {
PURCHASE_TENDER_CONTRACT_ORDER = 14, PURCHASE_TENDER_CONTRACT_ORDER = 14,
} }
// 订单种类 *NEW // 订单种类 *NEW @可能还需要补充 现货采购 渠道直采 渠道现货
export enum OrderKindType { export enum OrderKindType {
/** /**
......
...@@ -14,6 +14,8 @@ export interface IBasicFormParam { ...@@ -14,6 +14,8 @@ export interface IBasicFormParam {
export interface IPriceAttributeParam { export interface IPriceAttributeParam {
unitId: number; unitId: number;
unitName: string; unitName: string;
subUnitId: number;
subUnitName: string;
minOrder: number; minOrder: number;
isMemberPrice: boolean; isMemberPrice: boolean;
priceType: number; priceType: number;
......
...@@ -75,6 +75,8 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -75,6 +75,8 @@ const AddProducts: React.FC<{}> = (props) => {
isUpdateAttribute: data.isUpdateAttribute, isUpdateAttribute: data.isUpdateAttribute,
unitId: data.unitId, unitId: data.unitId,
unitName: data.unitName, unitName: data.unitName,
subUnitId: data.subUnitId,
subUnitName: data.subUnitName,
minOrder: data.minOrder, minOrder: data.minOrder,
isMemberPrice: data.isMemberPrice, isMemberPrice: data.isMemberPrice,
priceType: data.priceType, priceType: data.priceType,
......
...@@ -102,3 +102,17 @@ ...@@ -102,3 +102,17 @@
} }
} }
} }
.label {
color: #91959B;
height: 28px;
line-height: 28px;
.redStar {
color: #ff4d4f;
}
}
.assistLadderPriceText {
height: 32px;
line-height: 32px;
}
...@@ -452,6 +452,16 @@ const viewProducts: React.FC<{}> = () => { ...@@ -452,6 +452,16 @@ const viewProducts: React.FC<{}> = () => {
<p>{productDetail?.unitName}</p> <p>{productDetail?.unitName}</p>
</Col> </Col>
</Row> </Row>
{
productDetail?.subUnitName ? <Row>
<Col span={2}>
<p>计量副单位:</p>
</Col>
<Col span={22}>
<p>{productDetail?.subUnitName}</p>
</Col>
</Row> : null
}
<Row> <Row>
<Col span={2}> <Col span={2}>
<p>最小起订:</p> <p>最小起订:</p>
......
import React from 'react';
import auto_receive from '@/assets/imgs/auto_receive.png'
import express_time from '@/assets/imgs/express_time.png';
import forcast_time from '@/assets/imgs/forcast_time.png'
import price_line from '@/assets/imgs/price_line.png';
export interface IConfigSource {
id: number,
title: string,
description: string,
icon: string,
type: string,
isSettting: boolean,
}
export const configSourceData: IConfigSource[] = [
{
id: 1,
title: '商品价格曲线',
description: '启用显示商品价格曲线。鼠标移到价格一栏时,显示当前规格商品的历史价格变化。',
icon: price_line,
type: 'commodity',
isSettting: false
},
{
id: 2,
title: '自动确认收货',
description: '启用自动确认收货。当发货后超过收货天数后未确认收货,系统默认收货。',
icon: auto_receive,
type: 'order',
isSettting: false
},
{
id: 3,
title: '送货预约时长',
description: '启用送货预约时长。可预约下单时间后可预约时长(天数)内送货。',
icon: forcast_time,
type: 'order',
isSettting: false
},
{
id: 4,
title: '配送时间段',
description: '启用配送时间段。可选择配送时间段内的时间。',
icon: express_time,
type: 'order',
isSettting: false
},
]
...@@ -47,8 +47,6 @@ ...@@ -47,8 +47,6 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 16px;
border-bottom: 1px solid #F5F6F7;
p { p {
img { img {
width: 40px; width: 40px;
...@@ -62,6 +60,10 @@ ...@@ -62,6 +60,10 @@
} }
} }
} }
.cardBodyMain {
border-bottom: 1px solid #F5F6F7;
margin-bottom: 16px;
}
.receiveDay { .receiveDay {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
......
...@@ -89,7 +89,6 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => { ...@@ -89,7 +89,6 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
if(orderType === ORDER_TYPE_POINTS) { if(orderType === ORDER_TYPE_POINTS) {
setShowDataSource(() => [ setShowDataSource(() => [
{ id: 1, name: "换货"}, { id: 1, name: "换货"},
{ id: 3, name: "维修"}
]) ])
} else { } else {
setShowDataSource(() => [ setShowDataSource(() => [
......
...@@ -8,8 +8,7 @@ import PreLoading from '@/components/PreLoading'; ...@@ -8,8 +8,7 @@ import PreLoading from '@/components/PreLoading';
import { useOrderDetail } from '../../../_public/order/effects/useOrderDetail'; import { useOrderDetail } from '../../../_public/order/effects/useOrderDetail';
import OrderDetailSection from '../../../components/orderDetailSection'; import OrderDetailSection from '../../../components/orderDetailSection';
import OrderPayModal from '@/pages/transaction/components/orderPayModal'; import OrderPayModal from '@/pages/transaction/components/orderPayModal';
import { ENTERPRISE_CENTER_URL, REQUEST_HEADER, TOP_DOMAIN } from '@/constants'; import { ENTERPRISE_CENTER_URL } from '@/constants';
import { GlobalConfig } from '@/global/config';
const ReadyConfirmContract: React.FC = () => { const ReadyConfirmContract: React.FC = () => {
const { formContext, id, detailList } = useOrderDetail({type: 'p_readyPayOrder'}) const { formContext, id, detailList } = useOrderDetail({type: 'p_readyPayOrder'})
...@@ -24,7 +23,7 @@ const ReadyConfirmContract: React.FC = () => { ...@@ -24,7 +23,7 @@ const ReadyConfirmContract: React.FC = () => {
console.log(obj, currentPayInfoId) console.log(obj, currentPayInfoId)
if(obj.payChannel === 10) { if(obj.payChannel === 10) {
const spam: any = { const spam: any = {
orderId: data.orderId, orderIds: [data.orderId],
memberId: data.vendorMemberId, memberId: data.vendorMemberId,
memberRoleId: data.vendorRoleId, memberRoleId: data.vendorRoleId,
batchNo: obj.batchNo, batchNo: obj.batchNo,
......
...@@ -3,7 +3,6 @@ import { history, Link } from 'umi' ...@@ -3,7 +3,6 @@ import { history, Link } from 'umi'
import { Button } from 'antd' import { Button } from 'antd'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import { ORDER_TYPE, PurchaseOrderInsideWorkState } from '@/constants/order'
import StatusColors from '@/pages/transaction/components/statusColors' import StatusColors from '@/pages/transaction/components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons' import { FieldTimeOutlined } from '@ant-design/icons'
......
...@@ -4,7 +4,6 @@ import { Button, Modal } from 'antd' ...@@ -4,7 +4,6 @@ import { Button, Modal } from 'antd'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import { ORDER_TYPE, SaleOrderInsideWorkState } from '@/constants/order'
import StatusColors from '@/pages/transaction/components/statusColors' import StatusColors from '@/pages/transaction/components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons' import { FieldTimeOutlined } from '@ant-design/icons'
import { DOC_TYPE_SALES_INVOICE } from '@/constants/commodity' import { DOC_TYPE_SALES_INVOICE } from '@/constants/commodity'
......
...@@ -37,7 +37,7 @@ export const fetchOrderApi = { ...@@ -37,7 +37,7 @@ export const fetchOrderApi = {
}, },
/** 获取支付信息列表 */ /** 获取支付信息列表 */
async getPayInfoList(params) { async getPayInfoList(params) {
const { data } = await PublicApi.postOrderBuyerCreateB2bPaymentFind(params, { ctlType: 'none' }) const { data } = await PublicApi.postOrderVendorCreateAgentPaymentFind(params, { ctlType: 'none' })
return data return data
}, },
...@@ -47,4 +47,16 @@ export const fetchOrderApi = { ...@@ -47,4 +47,16 @@ export const fetchOrderApi = {
return data return data
}, },
/** 查看状态正常的会员服务消费者列表 */
async getMemberConsumeLists(params) {
const { data } = await PublicApi.getMemberManageLowerConsumerMemberPage(params)
return data
},
/** 根据商城类型 获取下单模式和类型 */
async getOrderModeOrderType(params) {
const { data } = await PublicApi.getOrderVendorGetOrderMode(params)
return data
}
} }
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis'
import { useModalTable } from '../../model/useModalTable'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { memberColumns } from '../../constant'
export interface MemberModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
confirmModal?(),
productRef?: any,
}
const MemberModalTable:React.FC<MemberModalTableProps> = (props) => {
const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type, customKey: 'id'})
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
const handleConfirm = () => {
const rowItem = rowSelectionCtl.selectRow[0]
if (rowItem) {
schemaAction.setFieldValue('supplyMembersName', rowItem.name)
schemaAction.setFieldValue('supplyMembersId', rowItem.memberId)
schemaAction.setFieldValue('supplyMembersRoleId', rowItem.roleId)
}
confirmModal && confirmModal()
setVisible(false)
// 清空之前可能存在的商品支付信息数据
schemaAction.setFieldValue('orderProductRequests', [])
schemaAction.setFieldValue('paymentInformationResponses', [])
if(props?.productRef) {
props.productRef.current.rowSelectionCtl.setSelectRow([])
props.productRef.current.rowSelectionCtl.setSelectedRowKeys([])
}
}
return (
<ModalTable
modalTitle='选择采购会员'
columns={memberColumns}
visible={visible}
confirm={handleConfirm}
cancel={() => setVisible(false)}
fetchTableData={(params) => fetchOrderApi.getMemberListByModelType({...params, orderType: schemaAction.getFieldValue('orderModel')})}
rowSelection={rowSelection}
modalType='memberByDefault'
tableProps={{
rowKey: 'id'
}}
{...restProps}
/>
)
}
MemberModalTable.defaultProps = {}
export default MemberModalTable
...@@ -4,8 +4,6 @@ import { fetchOrderApi } from '../../apis' ...@@ -4,8 +4,6 @@ import { fetchOrderApi } from '../../apis'
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd' import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { DELIVERY_TYPE, OrderModalType } from '@/constants/order' import { DELIVERY_TYPE, OrderModalType } from '@/constants/order'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { EnvironmentOutlined } from '@ant-design/icons'
import { Popover, Space, Row, message } from 'antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { addOrderModalSchema } from '@/components/ModalTable/schema' import { addOrderModalSchema } from '@/components/ModalTable/schema'
...@@ -13,7 +11,6 @@ import Search from '@/components/NiceForm/components/Search' ...@@ -13,7 +11,6 @@ import Search from '@/components/NiceForm/components/Search'
import SearchSelect from '@/components/NiceForm/components/SearchSelect'; import SearchSelect from '@/components/NiceForm/components/SearchSelect';
import Submit from '@/components/NiceForm/components/Submit'; import Submit from '@/components/NiceForm/components/Submit';
import DateSelect from '@/components/NiceForm/components/DateSelect'; import DateSelect from '@/components/NiceForm/components/DateSelect';
import { action } from 'mobx'
import { searchCustomerCategoryOptionEffect } from '../../effects' import { searchCustomerCategoryOptionEffect } from '../../effects'
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch' import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch'
...@@ -66,10 +63,9 @@ export const productColumns: any[] = [ ...@@ -66,10 +63,9 @@ export const productColumns: any[] = [
// 下单类型->商城类型映射 // 下单类型->商城类型映射
const orderProductShopTypeMaps = { const orderProductShopTypeMaps = {
[OrderModalType.HAND_ORDER]: 1, [OrderModalType.PURCHASE_ORDER]: 1,
[OrderModalType.CONSOLIDATED_ORDER]: 1, [OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER]: 3,
[OrderModalType.CHANNEL_DIRECT_MINING_ORDER]: 3, [OrderModalType.CHANNEL_EXISTING_PURCHASE_ORDER]: 4
[OrderModalType.CHANNEL_SPOT_MANUAL_ORDER]: 4
} }
export const filterProductDataById = (data, targetData) => { export const filterProductDataById = (data, targetData) => {
...@@ -113,6 +109,7 @@ export const filterProductDataById = (data, targetData) => { ...@@ -113,6 +109,7 @@ export const filterProductDataById = (data, targetData) => {
return prev return prev
}, []) }, [])
} }
const ProductModalTable:React.FC<ProductModalTableProps> = (props) => { const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
const { type = 'checkbox', schemaAction, confirmModal, currentRef, sectionProps, ...restProps } = props const { type = 'checkbox', schemaAction, confirmModal, currentRef, sectionProps, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = sectionProps const { visible, setVisible, rowSelection, rowSelectionCtl } = sectionProps
...@@ -128,36 +125,26 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => { ...@@ -128,36 +125,26 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
}, []) }, [])
const handleConfirmProduct = async () => { const handleConfirmProduct = async () => {
// 判断所选择的商品是否属于同一个工作流 const newData = rowSelectionCtl.selectRow.map(v => {
// @ts-ignore v.orderMode = schemaAction.getFieldValue('orderMode')
const res = await PublicApi.postOrderIsWorkFlow({ v.shopId = schemaAction.getFieldValue('shopId')
memberId: rowSelectionCtl.selectRow[0].memberId, return v
memberRoleId: rowSelectionCtl.selectRow[0].memberRoleId, })
productIds: rowSelectionCtl.selectedRowKeys, console.log(newData, 'nnn')
orderMode: schemaAction.getFieldValue('orderMode') schemaAction.setFieldValue('products', await filterProductDataById([], newData))
}, { ctlType: 'none' })
if (res.code === 1000) {
const productData = schemaAction.getFieldValue('orderProductRequests')
schemaAction.setFieldValue('orderProductRequests', await filterProductDataById(productData, rowSelectionCtl.selectRow))
confirmModal && confirmModal() confirmModal && confirmModal()
setVisible(false) setVisible(false)
} }
// else {
// message.error(res.message)
// }
}
const fetchProductList = (values) => { const fetchProductList = (values) => {
const modelType = schemaAction.getFieldValue('orderMode') const modelType = schemaAction.getFieldValue('orderMode')
const supplyMembersId = schemaAction.getFieldValue('supplyMembersId') const supplyMembersId = schemaAction.getFieldValue('vendorMemberId')
const params = { const params = {
...values, ...values,
shopType: orderProductShopTypeMaps[modelType], shopType: orderProductShopTypeMaps[modelType],
environment: 1, environment: 1,
memberId: supplyMembersId, memberId: supplyMembersId,
// 手工下单/合并订单下单时,查询现货价格商品 priceTypeList: [1],
priceTypeList: (modelType === OrderModalType.CONSOLIDATED_ORDER || modelType === OrderModalType.HAND_ORDER) ? [1] : undefined,
shopId: schemaAction.getFieldValue('shopId') shopId: schemaAction.getFieldValue('shopId')
} }
return fetchOrderApi.getProductList(params) return fetchOrderApi.getProductList(params)
......
...@@ -82,20 +82,21 @@ export const procurementRenderField = (data) => { ...@@ -82,20 +82,21 @@ export const procurementRenderField = (data) => {
}) })
} }
/** B2B询价报价下单 字段转换 */ /** 代客下单提交 字段转换 */
export const procurementProcessField = (value) => { export const procurementProcessField = (value) => {
value.products = value.products.map(item => { value.products = value.products.map(item => {
return { return {
...item, ...item,
productId: item.commodityId, productId: item.commodityId,
skuId: item.productId, skuId: item.id,
name: item.productName, logo: item.mainPic,
logo: item.imgUrl,
quantity: item.purchaseCount, quantity: item.purchaseCount,
logisticsTemplateId: item.logistics.templateId, logisticsTemplateId: item.logistics.templateId,
weight: item.logistics.weight, weight: item.logistics.weight,
stockId: item.upperCommoditySkuId,
stock: item.stockCount, stock: item.stockCount,
vendorMemberId: item.memberId,
vendorRoleId: item.memberRoleId,
vendorMemberName: item.memberName,
// 上游字段 // 上游字段
supplyMemberId: item.upperMemberId, supplyMemberId: item.upperMemberId,
supplyRoleId: item.upperMemberRoleId, supplyRoleId: item.upperMemberRoleId,
...@@ -333,11 +334,17 @@ export const productInfoColumns: any[] = [ ...@@ -333,11 +334,17 @@ export const productInfoColumns: any[] = [
key: 'unitPrice', key: 'unitPrice',
}, },
{ {
title: '库存', title: '会员折扣',
dataIndex: 'stockCount', dataIndex: 'memberPrice',
align: 'center', key: 'memberPrice',
key: 'stockCount', render: (text, record) => record.isMemberPrice && text ? text * 100 + '%' : null
}, },
// {
// title: '库存',
// dataIndex: 'stockCount',
// align: 'center',
// key: 'stockCount',
// },
{ {
title: '采购数量', title: '采购数量',
dataIndex: 'purchaseCount', dataIndex: 'purchaseCount',
......
...@@ -9,7 +9,7 @@ import { PublicApi } from '@/services/api'; ...@@ -9,7 +9,7 @@ import { PublicApi } from '@/services/api';
const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => { const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => {
const productData = productValue.value const productData = productValue.value
const loading = productValue.loading const loading = productValue.loading
console.log(productData, 'discount')
if (productData.length === 0 || loading) { if (productData.length === 0 || loading) {
return false return false
} }
...@@ -18,24 +18,31 @@ const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsync ...@@ -18,24 +18,31 @@ const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsync
state.loading = true 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) => { const newData = productData.map((v, i) => {
//@ b2b订单不考虑会员折扣 字段固定100 if (!v.memberPrice) {
v.discount = 100 v.memberPrice = asyncPriceRequests.find(j => j.id === v.id)?.value || ''
}
return v return v
}) })
ctx.setFieldValue('products', newData) ctx.setFieldValue('products', newData)
}
ctx.setFieldState(productValue.path, state => { ctx.setFieldState(productValue.path, state => {
state.loading = false state.loading = false
}) })
} }
export const useModelTypeChange = (callback) => {
// 下单模式发生改变时
FormEffectHooks.onFieldValueChange$('orderMode').subscribe(state => {
callback(state)
})
}
export const useEditHideField = () => { export const useEditHideField = () => {
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
...@@ -59,14 +66,12 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor ...@@ -59,14 +66,12 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
const { value } = state const { value } = state
// 强制渲染一次, 用于触发金额总数 // 强制渲染一次, 用于触发金额总数
update() update()
const orderMode = ctx.getFieldValue('orderMode')
if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用 if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用
// 请求一次并复制给支付信息 // 请求一次并复制给支付信息
const productItem = value[0]
if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数 if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
ctx.setFieldValue('payments', []) // 变动后先 清空支付信息 ctx.setFieldValue('payments', []) // 变动后先 清空支付信息
const shopId = ctx.getFieldValue('shopId') const shopId = ctx.getFieldValue('shopId')
const products = value.map(item => ({ productId: item.commodityId, skuId: item.productId })) const products = value.map(item => ({ productId: item.commodityId, skuId: item.id }))
if(shopId && products?.length) { if(shopId && products?.length) {
// 判断不存在物流 隐藏交付地址 // 判断不存在物流 隐藏交付地址
if(!value.some(item => item.logistics.deliveryType === 1)) { if(!value.some(item => item.logistics.deliveryType === 1)) {
...@@ -76,9 +81,6 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor ...@@ -76,9 +81,6 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
} }
fetchOrderApi.getPayInfoList({ fetchOrderApi.getPayInfoList({
products: products, products: products,
memberId: productItem?.memberId,
roleId: productItem?.memberRoleId,
orderMode: orderMode,
shopId: shopId shopId: shopId
}).then(data => { }).then(data => {
ctx.setFieldValue('payments', data.map(item => ({ ctx.setFieldValue('payments', data.map(item => ({
......
...@@ -26,7 +26,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -26,7 +26,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
const initPayWayList = (memberId, memberRoleId) => { const initPayWayList = (memberId, memberRoleId) => {
let result = [] let result = []
PublicApi.getOrderBuyerCreateB2bPayTypes({vendorMemberId: memberId, vendorRoleId: memberRoleId}).then(res => { PublicApi.getOrderVendorCreateAgentPayTypes({vendorMemberId: memberId, vendorRoleId: memberRoleId}).then(res => {
const { data = [], code } = res const { data = [], code } = res
for (let item of data) { for (let item of data) {
result.push({ result.push({
...@@ -40,21 +40,12 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -40,21 +40,12 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
} }
const getPayLists = (memberId, memberRoleId) => { const getPayLists = (memberId, memberRoleId) => {
PublicApi.postOrderBuyerCreateB2bPaymentFind({ PublicApi.postOrderVendorCreateAgentPaymentFind({
memberId,
roleId: memberRoleId,
shopId: products[0]['shopId'], shopId: products[0]['shopId'],
orderMode: products[0]['orderMode'], products: products.map(item => ({ productId: item.commodityId, skuId: item.id }))
products: products.map(item => ({ productId: item.commodityId, skuId: item.productId }))
}, { ctlType: 'none' }).then(res => { }, { ctlType: 'none' }).then(res => {
const { code, data } = res const { code, data } = res
// const sumPrice = ctx.getFieldValue('sumPrice')
if (code === 1000) { if (code === 1000) {
// // 设置支付信息
// ctx.setFieldValue('payments', data.map(item => ({
// ...item,
// payPrice: (sumPrice * Number(item.payRate) / 100).toFixed(2)
// })))
// 设置支付方式 // 设置支付方式
const newColumns = [...columns] const newColumns = [...columns]
newColumns[5].formItemProps.options = initPayWayList(memberId, memberRoleId) newColumns[5].formItemProps.options = initPayWayList(memberId, memberRoleId)
......
...@@ -23,7 +23,46 @@ export const sortByKey = (params) => { ...@@ -23,7 +23,46 @@ export const sortByKey = (params) => {
export const getUnitPriceTotal = (record) => { export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['purchaseCount']) || 0 const purchaseCount = Number(record['purchaseCount']) || 0
return Number((record.price * purchaseCount).toFixed(2)) // fix 当没有传递unitPrice字段时 自动容错, 单价显示为0
// fix 编辑订单取price
record.unitPrice = pageStatus === PageStatus.EDIT ? record.price : record.unitPrice || record.price || 0
if (typeof record.unitPrice === 'number') {
return record.isMemberPrice ?
Number((record.unitPrice * purchaseCount * record.memberPrice).toFixed(2))
:
Number((record.unitPrice * purchaseCount).toFixed(2))
}
if(record.unitPrice) {
record.unitPrice = sortByKey(record.unitPrice)
}
// fix 当没有传递unitPrice字段时 但有price字段时 补全unitPrice字段
if(record.price && JSON.stringify(record.unitPrice) === "{}") {
record.unitPrice = {'0-0': record.price}
}
// fix 当有unitPrice字段时 没有price字段时 补全price字段
if(!record?.price && JSON.stringify(record.unitPrice) !== "{}") {
if(Object.keys(record.unitPrice)[0] === '0-0') record.price = record.unitPrice['0-0']
}
let unitPrice = 0
Object.entries(record.unitPrice).forEach(([key, value]) => {
const [min, max] = key.split('-').map(v => Number(v))
if (min === 0 && max === 0) {
unitPrice = Number(value)
return false
}
if ((purchaseCount >= min && purchaseCount <= max) || (purchaseCount > max)) {
// 处于该区间或者大于该区间
unitPrice = Number(value)
return false
}
})
// 考虑会员折扣
let memberPrice = record.memberPrice
if(record.isMemberPrice) {
return Number((unitPrice * purchaseCount * memberPrice).toFixed(2))
} else {
return Number((unitPrice * purchaseCount).toFixed(2))
}
} }
/** /**
...@@ -48,7 +87,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -48,7 +87,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
// 商品行数变动 清空之前的支付信息 // 商品行数变动 清空之前的支付信息
if (pageStatus === PageStatus.ADD) { if (pageStatus === PageStatus.ADD) {
ctx.setFieldValue('paymentInformationResponses', []) ctx.setFieldValue('payments', [])
} }
} }
...@@ -87,7 +126,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -87,7 +126,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
return productInfoColumns return productInfoColumns
}) })
const handleShowProduct = () => { const handleShowProduct = () => {
const supplyMembersId = ctx.getFieldValue('supplyMembersId') const supplyMembersId = ctx.getFieldValue('vendorMemberName')
if (supplyMembersId) { if (supplyMembersId) {
productRef.current.setVisible(true) productRef.current.setVisible(true)
} else { } else {
...@@ -107,15 +146,15 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction ...@@ -107,15 +146,15 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
// 商品采购数量变动 清空之前的支付信息 // 商品采购数量变动 清空之前的支付信息
if (pageStatus === PageStatus.ADD) { if (pageStatus === PageStatus.ADD) {
ctx.setFieldValue('paymentInformationResponses', []) ctx.setFieldValue('payments', [])
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')]; const newData = [...ctx.getFieldValue('products')];
console.log(newData, row) console.log(newData, row)
const index = newData.findIndex(item => row.productId === item.productId); const index = newData.findIndex(item => row.commodityId === item.commodityId);
const item = newData[index]; const item = newData[index];
row['money'] = getUnitPriceTotal(row) row['money'] = getUnitPriceTotal(row)
row['productId'] = row.productId row['productId'] = row.commodityId
newData.splice(index, 1, { newData.splice(index, 1, {
...item, ...item,
...row, ...row,
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { GlobalConfig } from '@/global/config';
import moment from 'moment' import moment from 'moment'
// 将获取的商城转化为可用类型
const getShopTypeMap = (() => {
return GlobalConfig.web.shopInfo.filter(item => (item.type === 1) && (item.environment === 1)).map(item => ({
label: item.name,
value: item.id,
type: item.type,
environment: item.environment,
}))
})()
// 基本信息 // 基本信息
const basicInfo: ISchema = { const basicInfo: ISchema = {
"x-index": 0, "x-index": 0,
...@@ -31,20 +20,20 @@ const basicInfo: ISchema = { ...@@ -31,20 +20,20 @@ const basicInfo: ISchema = {
wrapperCol: 10 wrapperCol: 10
}, },
properties: { properties: {
orderModeName: {
type: 'string',
title: '下单模式',
"x-component": 'text',
},
orderMode: { orderMode: {
type: 'number', type: 'number',
required: true, required: true,
default: 5, visible: false,
enum: [{ title: '下单模式值',
label: '进货单下单',
value: 5
}],
title: '下单模式',
readOnly: true,
}, },
shopId: { shopId: {
type: 'number', type: 'number',
enum: getShopTypeMap, enum: [],
title: '适应商城', title: '适应商城',
required: true, required: true,
}, },
...@@ -62,16 +51,29 @@ const basicInfo: ISchema = { ...@@ -62,16 +51,29 @@ const basicInfo: ISchema = {
} }
] ]
}, },
supplyMembersName: { buyerMemberId : {
type: 'string', type: 'string',
title: '采购会员', title: '采购会员',
enum: [],
"x-component-props": { "x-component-props": {
disabled: true, placeholder: "请输入搜索采购会员",
addonAfter: "{{orderMember}}" showSearch: true,
showArrow: true,
allowClear: true,
defaultActiveFirstOption: false,
filterOption: false,
onSearch: "{{handleMemberSearch}}"
}, },
required: true, required: true,
}, },
buyerMemberName: {
type: 'string',
display: false
},
buyerRoleId: {
type: 'string',
display: false
},
vendorMemberName: { vendorMemberName: {
type: 'string', type: 'string',
title: '供应会员', title: '供应会员',
...@@ -154,6 +156,7 @@ export const orderProduct: ISchema = { ...@@ -154,6 +156,7 @@ export const orderProduct: ISchema = {
rowKey: 'id', rowKey: 'id',
columns: "{{productColumns}}", columns: "{{productColumns}}",
components: "{{productComponents}}", components: "{{productComponents}}",
prefix: "{{productAddButton}}",
}, },
}, },
NO_SUBMIT_SPY: { NO_SUBMIT_SPY: {
...@@ -197,7 +200,7 @@ const submitInfo: ISchema = { ...@@ -197,7 +200,7 @@ const submitInfo: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: '交付信息' tab: '送货信息'
}, },
properties: { properties: {
NO_SUBMIT_LAYOUT_2: { NO_SUBMIT_LAYOUT_2: {
...@@ -218,7 +221,7 @@ const submitInfo: ISchema = { ...@@ -218,7 +221,7 @@ const submitInfo: ISchema = {
deliverDate: { deliverDate: {
type: 'string', type: 'string',
"x-component": 'date', "x-component": 'date',
title: '交付日期', title: '送货时间',
required: true, required: true,
"x-component-props": { "x-component-props": {
disabledDate: current => { disabledDate: current => {
...@@ -244,10 +247,10 @@ const submitInfo: ISchema = { ...@@ -244,10 +247,10 @@ const submitInfo: ISchema = {
"x-rules": [ "x-rules": [
{ {
required: true, required: true,
message: '请选择收货方式' message: '请选择送货地址'
} }
], ],
title: '收货方式' title: '送货地址'
} }
} }
} }
......
...@@ -7,3 +7,10 @@ ...@@ -7,3 +7,10 @@
margin-top: 24px !important; margin-top: 24px !important;
} }
} }
.adjustFormItem {
:global {
.ant-radio-button-wrapper {
margin-right: 16px !important;
}
}
}
...@@ -17,6 +17,8 @@ import { useHttpRequest } from '@/hooks/useHttpRequest' ...@@ -17,6 +17,8 @@ import { useHttpRequest } from '@/hooks/useHttpRequest'
import TableOperation from '@/components/TableOperation' import TableOperation from '@/components/TableOperation'
import { getAuth } from '@/utils/auth' import { getAuth } from '@/utils/auth'
import { MEMBER_ROLE_TYPE_SERVICE_CONSUMER } from '@/constants/member' import { MEMBER_ROLE_TYPE_SERVICE_CONSUMER } from '@/constants/member'
import moment from 'moment'
import styles from './index.less'
// 销售订单查询 // 销售订单查询
...@@ -31,16 +33,17 @@ const formActions = createFormActions(); ...@@ -31,16 +33,17 @@ const formActions = createFormActions();
const destroyActions = createFormActions(); const destroyActions = createFormActions();
const pauseActions = createFormActions(); const pauseActions = createFormActions();
const transformActions = createFormActions(); const transformActions = createFormActions();
const adjustActions = createFormActions();
const SaleOrder: React.FC<SaleOrderProps> = () => { const SaleOrder: React.FC<SaleOrderProps> = () => {
const ref = useRef<any>({}) const ref = useRef<any>({})
const destoryRef = useRef<any>({}) const destoryRef = useRef<any>({})
const pauseRef = useRef<any>({}) const pauseRef = useRef<any>({})
const orderIds = useRef<number[]>([]) const orderIds = useRef<number[]>([])
const adjustRef = useRef<any>({})
const { run, loading } = useHttpRequest(PublicApi.postOrderVendorCancel) const { run, loading } = useHttpRequest(PublicApi.postOrderVendorCancel)
const { run: runPause, loading: loadingEnd } = useHttpRequest(PublicApi.postOrderVendorTerminate) const { run: runPause, loading: loadingEnd } = useHttpRequest(PublicApi.postOrderVendorTerminate)
const { transformRef, orderColumns } = useTransformOrderTable(transformActions) const { transformRef, orderColumns } = useTransformOrderTable(transformActions)
// const [transformLoading, setTransformLoading] = useState<boolean>(false)
const { roles } = getAuth() || {} const { roles } = getAuth() || {}
const serversRoles = roles.filter(item => item['roleType'] === MEMBER_ROLE_TYPE_SERVICE_CONSUMER) const serversRoles = roles.filter(item => item['roleType'] === MEMBER_ROLE_TYPE_SERVICE_CONSUMER)
...@@ -170,15 +173,24 @@ const SaleOrder: React.FC<SaleOrderProps> = () => { ...@@ -170,15 +173,24 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
}) })
} }
const handleSubmitAdjust = () => {
}
const resetAdjustSelect = () => {
}
/** 参照后台数据生成 */ /** 参照后台数据生成 */
const renderOptionButton = (record) => { const renderOptionButton = (record) => {
const buttonGroup = { '取消订单': record.showCancel, '中止': record.showTerminate, '评价': record.showComment, '转单': record.showTransfer } const buttonGroup = { '取消订单': record.showCancel, '中止': record.showTerminate, '评价': record.showComment, '转单': record.showTransfer, '调整送货时间': true }
const operationHandler = { const operationHandler = {
'取消订单': () => handleCancel(record), '取消订单': () => handleCancel(record),
'中止': () => handleSuspend(record), '中止': () => handleSuspend(record),
'评价': () => handleEvaluate(record.orderId), '评价': () => handleEvaluate(record.orderId),
'转单': () => onlyTransform(record.orderId), '转单': () => onlyTransform(record.orderId),
'调整送货时间': () => adjustRef.current.setVisible(true)
} }
return ( return (
...@@ -347,7 +359,6 @@ const SaleOrder: React.FC<SaleOrderProps> = () => { ...@@ -347,7 +359,6 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
confirm={handleSubmitTransform} confirm={handleSubmitTransform}
cancel={resetRoleSelect} cancel={resetRoleSelect}
actions={transformActions} actions={transformActions}
// loading={transformLoading}
schema={{ schema={{
type: 'object', type: 'object',
properties: { properties: {
...@@ -410,9 +421,78 @@ const SaleOrder: React.FC<SaleOrderProps> = () => { ...@@ -410,9 +421,78 @@ const SaleOrder: React.FC<SaleOrderProps> = () => {
expressionScope={{ expressionScope={{
orderColumns, orderColumns,
}} }}
// components={{ />
// CustomTitle {/* 调整送货时间 */}
// }} <ModalForm
modalTitle='调整送货时间'
currentRef={adjustRef}
confirm={handleSubmitAdjust}
cancel={resetAdjustSelect}
actions={adjustActions}
// className={styles.adjustModal}
schema={{
type: 'object',
properties: {
NO_SUBMIT: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
labelAlign: 'top',
},
properties: {
deliverDate: {
type: 'string',
"x-component": 'date',
title: '送货时间',
required: true,
"x-component-props": {
disabledDate: current => {
return current && current < moment().startOf('day')
},
style: { width: '100%' }
}
},
timeLine: {
title: '时间段',
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
default: 1,
"x-component-props": {
disabled: false,
optionType: 'button',
// className: styles.adjustFormItem
},
},
adjustReason: {
type: 'textarea',
"x-component-props": {
rows: 4,
placeholder: '在此输入你的原因, 最多50个汉字'
},
title: '调整原因',
"x-rules": [
{
required: true,
message: '请输入调整原因'
},
{
limitByte: true,
maxByte: 100
}
]
}
}
}
}
}}
effects={($, actions) => {
$('onFormInit').subscribe(() => {
})
}}
/> />
</PageHeaderWrapper> </PageHeaderWrapper>
} }
......
import React, { useRef } from 'react' import React, { useRef } from 'react'
import { history, Link } from 'umi' import { history, Link } from 'umi'
import { Button } from 'antd'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import { ORDER_TYPE, SaleOrderInsideWorkState } from '@/constants/order'
import StatusColors from '@/pages/transaction/components/statusColors' import StatusColors from '@/pages/transaction/components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons' import { FieldTimeOutlined } from '@ant-design/icons'
import qs from 'querystring' import qs from 'querystring'
......
...@@ -3,7 +3,6 @@ import { history, Link } from 'umi' ...@@ -3,7 +3,6 @@ import { history, Link } from 'umi'
import { Button } from 'antd' import { Button } from 'antd'
import EyePreview from '@/components/EyePreview' import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils' import { formatTimeString } from '@/utils'
import { ORDER_TYPE, SaleOrderInsideWorkState } from '@/constants/order'
import StatusColors from '@/pages/transaction/components/statusColors' import StatusColors from '@/pages/transaction/components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons' import { FieldTimeOutlined } from '@ant-design/icons'
......
...@@ -82,6 +82,8 @@ class ProductStore implements IProductModule { ...@@ -82,6 +82,8 @@ class ProductStore implements IProductModule {
return { return {
unitId: this.productInfoByEdit?.unitId, unitId: this.productInfoByEdit?.unitId,
unitName: this.productInfoByEdit?.unitName, unitName: this.productInfoByEdit?.unitName,
subUnitId: this.productInfoByEdit?.subUnitId,
subUnitName: this.productInfoByEdit?.subUnitName,
minOrder: this.productInfoByEdit?.minOrder, minOrder: this.productInfoByEdit?.minOrder,
isMemberPrice: this.productInfoByEdit?.isMemberPrice, isMemberPrice: this.productInfoByEdit?.isMemberPrice,
priceType: this.productInfoByEdit?.priceType, priceType: this.productInfoByEdit?.priceType,
...@@ -165,6 +167,8 @@ class ProductStore implements IProductModule { ...@@ -165,6 +167,8 @@ class ProductStore implements IProductModule {
public clearPartData(data?: any[]) { public clearPartData(data?: any[]) {
this.productInfoByEdit.unitId = null; this.productInfoByEdit.unitId = null;
this.productInfoByEdit.unitName = null; this.productInfoByEdit.unitName = null;
this.productInfoByEdit.subUnitId = null;
this.productInfoByEdit.subUnitName = null;
this.productInfoByEdit.minOrder = null; this.productInfoByEdit.minOrder = null;
this.productInfoByEdit.isMemberPrice = false; this.productInfoByEdit.isMemberPrice = false;
this.productInfoByEdit.priceType = 1; this.productInfoByEdit.priceType = 1;
......
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