Commit da59818f authored by 卢均锐's avatar 卢均锐

Merge branch 'v2' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into v2

* 'v2' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform: fix: 修改pc 装修页tab样式以及商城域名链接 fix: 修复入库资料不显示的问题 fix: 对接新增物流单 feat: 添加适用商城溢出效果 fix: 修复指针不显示的问题 feat: 调整售后评价组件布局 fix: 处理新增请购单订单获取供应商配置时间段传会员参数异常
parents ab346ced 0b9a1ace
......@@ -4,14 +4,14 @@ import {
Coordinate,
Point,
Annotation,
registerShape,
} from 'bizcharts';
// import Point from 'bizcharts/lib/geometry/Point';
// import { Annotation } from 'bizcharts/lib';
import { registerShape } from '@antv/g2';
import React from 'react';
import autoHeight from '../autoHeight';
import { getIntl } from 'umi';
const intl = getIntl();
export interface GaugeProps {
title: React.ReactText;
color?: string;
......@@ -73,7 +73,7 @@ registerShape('point', 'pointer', {
attrs: {
x: center.x,
y: center.y,
r: 6,
r: 4,
stroke: cfg.color,
lineWidth: 3,
fill: '#fff',
......@@ -103,6 +103,7 @@ const Gauge: React.FC<GaugeProps> = (props) => {
nice: true,
},
};
const data = [{ value: percent / 10 }];
const textStyle: {
......
......@@ -178,45 +178,18 @@ export const addOrderModalSchema: ISchema = {
},
},
properties: {
customerCategoryId: {
category: {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'components.shangpinpinlei' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
brandId: {
brand: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: intl.formatMessage({ id: 'components.shangpinpinpai' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
},
},
// brandId: {
// type: 'string',
// "x-component": 'SearchSelect',
// "x-component-props": {
// placeholder: '请选择品牌',
// fetchSearch: getProductSelectGetMemberBrand,
// style: {
// width: 160
// },
// queryParams: {},
// }
// },
submit: {
"x-component": 'Submit',
"x-mega-props": {
......
......@@ -2,15 +2,17 @@
.evaluate {
.score {
position: absolute;
position: relative;
padding-right: 90px;
display: inline-block;
&-left {
padding-right: 90px;
display: inline-block;
}
&-right {
position: absolute;
top: -50%;
top: -76%;
right: 0;
width: 80px;
flex-shrink: 0;
......
......@@ -7,7 +7,7 @@
*/
import React from 'react';
import { useIntl } from 'umi';
import { Row, Col, Descriptions } from 'antd';
import { Row, Col, Form } from 'antd';
import MellowCard, { MellowCardProps } from '@/components/MellowCard';
import { Gauge } from '@/components/Charts';
import styles from './index.less';
......@@ -48,6 +48,11 @@ const Score: React.FC<ScoreProps> = ({
...rest
}) => {
const intl = useIntl();
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 18 },
};
return (
<MellowCard
......@@ -56,40 +61,40 @@ const Score: React.FC<ScoreProps> = ({
{...rest}
>
<Row gutter={40}>
<Col span={8}>
<div className={styles.score}>
<div className={styles['score-left']}>
<Descriptions column={1}>
<Descriptions.Item
label={intl.formatMessage({ id: 'afterService.components.Score.score' }, { default: '售后满意度' })}
>
<span className={styles['score-star']}>
{`${score}${intl.formatMessage({ id: 'afterService.components.Score.score.unit' }, { default: '分' })}`}
</span>
</Descriptions.Item>
</Descriptions>
</div>
<div className={styles['score-right']}>
<Gauge
title=""
height={90}
percent={+(score/FULL_SCORE * 100).toFixed(2)}
formatter={() => ''}
formatContent={() => ''}
color={COLOR_MAP[score]}
strokeWidth={5}
/>
<Col span={12}>
<Form.Item
label={intl.formatMessage({ id: 'afterService.components.Score.score' }, { default: '售后满意度' })}
labelAlign="left"
{...formItemLayout}
>
<div className={styles.score}>
<div className={styles['score-left']}>
<span className={styles['score-star']}>
{`${score}${intl.formatMessage({ id: 'afterService.components.Score.score.unit' }, { default: '分' })}`}
</span>
</div>
<div className={styles['score-right']}>
<Gauge
title=""
height={90}
percent={+(score/FULL_SCORE * 100).toFixed(2)}
formatter={() => ''}
formatContent={() => ''}
color={COLOR_MAP[score]}
strokeWidth={5}
/>
</div>
</div>
</div>
</Form.Item>
</Col>
<Col span={16}>
<Descriptions column={1}>
<Descriptions.Item
label={intl.formatMessage({ id: 'afterService.components.Score.content' }, { default: '售后评价' })}
>
{content}
</Descriptions.Item>
</Descriptions>
<Col span={12}>
<Form.Item
label={intl.formatMessage({ id: 'afterService.components.Score.content' }, { default: '售后评价' })}
labelAlign="left"
{...formItemLayout}
>
{content}
</Form.Item>
</Col>
</Row>
</MellowCard>
......
......@@ -145,9 +145,9 @@ const AddProducts: React.FC<{}> = (props) => {
// 切换模板
const renderTemplate = () => {
// if(currentTemplateName === 'science')
// return <ProductDescFormDefualt />
// return <ProductDescFormDefualt />
// else if(currentTemplateName === 'cloud')
// return <ProductDescFormCloud />
// return <ProductDescFormCloud />
return <ProductDescFormYang />
}
......
......@@ -318,7 +318,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 生成表格dataSource
let combineArray = SKUCombine(_attributeValueArr)
console.log(combineArray, 'combineArray')
// console.log(combineArray, 'combineArray')
setCombineAttributeArray(combineArray)
setAttributeObjArr(_temp_attributeObjArr)
setAttributeValObjArr(_temp_attributeValObjArr)
......@@ -412,7 +412,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
_tableDataSource.map(item => item[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })] = {})
}
}
console.log(_tableDataSource, '_tableDataSource')
// console.log(_tableDataSource, '_tableDataSource')
setTableDataSource(productName ? _tableDataSource : []) // 通过商品名称来判断是否显示表格数据
constructedPrarams()
......@@ -478,7 +478,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
id: _tableDataSource[0] && _tableDataSource[0][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.id' })],
}) /*带上货品id 带上单价*/ /* code1 end */
setPriceAttributeParams(_paramsArray)
console.log(_paramsArray, '_paramsArray')
// console.log(_paramsArray, '_paramsArray')
}
/**
......
......@@ -25,7 +25,10 @@ const ISalePlaceholder = [
getIntl().formatMessage({ id: 'commodity.products.addProductsItem.productDescFormCloud.ISalePlaceholder.5' }),
]
const ProductDescFormCloud: React.FC<{}> = (props) => {
/**
* YunXianCai式商品模板
*/
const ProductDescFormCloud: React.FC<{}> = () => {
const intl = useIntl();
const { token } = getAuth() || {}
// 初始商品特色4个input值和3*4个image值
......
......@@ -19,6 +19,9 @@ import { postContractContractSignSaleSignContractCreate } from '@/services/Contr
const schemaActions = createFormActions()
/**
* 商品 默认模板
*/
const ProductDescFormDefualt: React.FC<{}> = () => {
const intl = useIntl();
const [fileImageList, setFileImageList] = useState<any>([])
......
......@@ -22,7 +22,10 @@ const schemaActions = createFormActions()
const imagesTypeKeyValue = ['', 'descriptionImages', 'certificationImages', 'reportImages']
const ProductDescFormDefualt: React.FC<{}> = () => {
/**
* YangLian式商品模板
*/
const ProductDescFormYang: React.FC<{}> = () => {
const intl = useIntl();
const [fileImageList, setFileImageList] = useState<any>({
descriptionImages: [], // 商品描述
......@@ -430,4 +433,4 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
</div>)
}
export default observer(ProductDescFormDefualt)
export default observer(ProductDescFormYang)
......@@ -338,13 +338,16 @@ const MemberProfile: React.FC<IProps> = (props) => {
{/* 入库信息 */}
{(
dataSource?.depositDetailTexts?.length > 0
(
dataSource?.depositDetailTexts?.length
|| dataSource?.depositDetails?.length
) > 0
&& !editableDeposit
) ? (
<Col span={24}>
<AnchorPage.Item itemKey="incomingInfo">
<MemberDocIncomingInfo
dataSource={dataSource?.depositDetailTexts || []}
dataSource={dataSource?.depositDetailTexts || dataSource?.depositDetails || []}
showNew={showNew}
id="incomingInfo"
/>
......
......@@ -57,6 +57,10 @@
font-size: @font-size-sm * 2;
color: @error-color;
}
&-webs {
.textOverflow();
}
&-actions {
margin-top: @margin-xss;
......
......@@ -140,10 +140,12 @@ const CouponCard: React.FC<CouponCardProps> = (props: CouponCardProps) => {
券码:
{data.code}
</div>
<div className={styles['coupon-card-webs']}>
适用商城:
{data.shopList.map((item) => item.shopName).join('、')}
</div>
<Tooltip title={data.shopList.map((item) => item.shopName).join('、')}>
<div className={styles['coupon-card-webs']}>
适用商城:
{data.shopList.map((item) => item.shopName).join('、')}
</div>
</Tooltip>
</div>
<div className={styles['coupon-card-right']}>
<div className={styles['coupon-card-yuanWrap']}>
......
import { getOrderBuyerCreatePageItems, getOrderBuyerPageItems, GetOrderBuyerPageItemsResponse, getOrderBuyerTakePageItems, getOrderBuyerValidatePageItems, getOrderVendorPageItems, getOrderVendorTakePageItems, getOrderVendorValidatePageItems } from '@/services/OrderNewV2Api'
import {
getOrderBuyerCreatePageItems,
getOrderBuyerPageItems,
GetOrderBuyerPageItemsResponse,
getOrderBuyerTakePageItems,
getOrderBuyerValidatePageItems,
getOrderVendorPageItems,
getOrderVendorTakePageItems,
getOrderVendorValidatePageItems,
getOrderVendorOrderTypeAll,
getOrderBuyerOrderTypeAll
} from '@/services/OrderNewV2Api'
import { getProductSelectGetSelectCategory } from '@/services/ProductV2Api'
import { getPurchaseRequisitionFindInnerStatusEnum } from '@/services/PurchaseV2Api'
import { useEffect, useState } from 'react'
......@@ -151,3 +162,35 @@ export const getSaleOrderReadyDistributionPageSelectOption = () => {
return state
}
/** 销售订单 通用 订单类型下拉框列表 */
export const getSaleOrderPublicUsePageSelectOption = () => {
const [state, setstate] = useState<any>([])
useEffect(() => {
getOrderVendorOrderTypeAll({}).then(res => {
const { code, data } = res
if (code === 1000) {
setstate(data)
}
})
}, [])
return state
}
/** 采购订单 通用 订单类型下拉框列表 */
export const getPurchaseOrderPublicUsePageSelectOption = () => {
const [state, setstate] = useState<any>([])
useEffect(() => {
getOrderBuyerOrderTypeAll({}).then(res => {
const { code, data } = res
if (code === 1000) {
setstate(data)
}
})
}, [])
return state
}
......@@ -7,6 +7,8 @@ import styles from './index.less';
import { enumName, WEB } from '@/constants/environment';
import StatusTag from '@/components/StatusTag';
import fixture from '@/assets/activity/fixture.png'
import { REQUEST_HEADER, TOP_DOMAIN } from '@/constants';
// REQUEST_HEADER
const { Paragraph } = Typography;
interface Iprops {
......@@ -18,6 +20,8 @@ interface Iprops {
endTime: string,
statusName: string,
id: number,
/** 商城子域名 */
url: string,
/** 1.WEB 2.H5 3.小程序 4.APP */
environment: 1 | 2 | 3 | 4 | number,
onRemove?: ((id: number) => void )| null,
......@@ -54,7 +58,8 @@ const ActiveItem: React.FC<Iprops> = (props: Iprops) => {
onRemove,
status,
onChangeStatus,
environment
environment,
url,
} = props;
const handleRemove = () => {
......@@ -104,7 +109,7 @@ const ActiveItem: React.FC<Iprops> = (props: Iprops) => {
{
environment === WEB && status !== END && (
<div className={styles.copyLink}>
<Paragraph copyable={{ text: `http://b2b.lingxidev.com/activity/${id}` }} />
<Paragraph copyable={{ text: `${REQUEST_HEADER}${url}.${TOP_DOMAIN}/activity/${id}` }} />
</div>
)
}
......
......@@ -38,6 +38,27 @@
height: 100%;
overflow: auto;
:global {
.ant-tabs-nav {
margin-bottom: 0px;
}
.ant-tabs-nav-wrap {
flex: 1;
width: 100%;
padding: 0 16px;
}
.ant-tabs-nav-list {
width: 100%;
}
.ant-tabs-tab {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
}
.expand-icon {
position: absolute;
top: 35px;
......
......@@ -128,6 +128,7 @@ const ActivePage = () => {
endTime={_item.endTime as unknown as string}
environment={_item.environment}
status={_item.status}
url={_item.url}
onRemove={handleRemove}
onChangeStatus={onChangeStatus}
/>
......
......@@ -113,9 +113,18 @@ export interface JumpFormValueType {
}
// 异步处理发货 预约时间 时间段配置
export const useOrderDeliverTimeEffect = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, shopId, jumpFormValue?: JumpFormValueType) => {
export const useOrderDeliverTimeEffect = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, shopId, jumpFormValue: JumpFormValueType) => {
const { pageStatus } = usePageStatus()
if(shopId) {
const { vendorMemberId, vendorRoleId } = jumpFormValue
let vendorMemberId, vendorRoleId;
if(pageStatus === PageStatus.ADD) {
vendorMemberId = ctx.getFieldValue('vendorMemberId')
vendorRoleId = ctx.getFieldValue('vendorRoleId')
} else if(pageStatus === PageStatus.EDIT) {
vendorMemberId = jumpFormValue.vendorMemberId
vendorRoleId = jumpFormValue.vendorRoleId
}
console.log(vendorMemberId, vendorRoleId, 'jumpFormValue')
const { code, data } = await getOrderBuyerFindDeliveryDate({shopId, vendorMemberId, vendorRoleId})
if(code !== 1000) { return false; }
......
......@@ -432,7 +432,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = () => {
return (<div style={{margin: -24}}>
<FormDetailContext.Provider value={providerValue}>
<FormDetailHeader
title={id?intl.formatMessage({id: 'purchaseOrder.add'}):intl.formatMessage({id: 'purchaseOrder.edit'})}
title={id?intl.formatMessage({id: 'purchaseOrder.edit'}):intl.formatMessage({id: 'purchaseOrder.add'})}
schema={orderAddSchema}
extraRight={[
<Button key="1" onClick={() => addSchemaAction.submit()} loading={btnLoading} type="primary" icon={<SaveOutlined />}>
......
import { getProductCommodityCommonGetCommodityListByBuyer } from "@/services/ProductV2Api"
import { getOrderVendorLogisticsProductPage } from "@/services/OrderNewV2Api"
export const fetchOrderApi = {
/** 弹窗获取商品列表 */
/** 弹窗获取 发货单 商品明细 */
async getProductList(params) {
const { data } = await getProductCommodityCommonGetCommodityListByBuyer(params, { useCache: true, ttl: 10 * 1000 })
const { data } = await getOrderVendorLogisticsProductPage(params, { useCache: true, ttl: 10 * 1000 })
return data
},
......
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis'
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { DELIVERY_TYPE, OrderModalType } from '@/constants/order'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { addOrderModalSchema } from '@/components/ModalTable/schema'
......@@ -10,11 +9,9 @@ import Search from '@/components/NiceForm/components/Search'
import SearchSelect from '@/components/NiceForm/components/SearchSelect';
import Submit from '@/components/NiceForm/components/Submit';
import DateSelect from '@/components/NiceForm/components/DateSelect';
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from '../../effects'
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch'
import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearch'
import { getLogisticsShipperAddressGet } from '@/services/LogisticsV2Api'
import { getIntl } from 'umi'
import { getIntl, history } from 'umi'
export interface ProductModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
......@@ -27,9 +24,9 @@ export interface ProductModalTableProps extends ModalTableProps {
export const productColumns: any[] = [
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.id'}),
dataIndex: 'id',
dataIndex: 'productId',
align: 'center',
key: 'id',
key: 'productId',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.name'}),
......@@ -39,62 +36,33 @@ export const productColumns: any[] = [
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.customerCategoryName'}),
dataIndex: 'customerCategoryName',
dataIndex: 'category',
align: 'center',
key: 'customerCategoryName',
key: 'category',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.brandName'}),
dataIndex: 'brandName',
dataIndex: 'brand',
align: 'center',
key: 'brandName',
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.unitName'}),
dataIndex: 'unitName',
align: 'center',
key: 'unitName'
},
{
title: getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.stockCount'}),
dataIndex: 'stockCount',
align: 'center',
key: 'stockCount'
key: 'brand',
},
]
// 下单类型->商城类型映射
const orderProductShopTypeMaps = {
[OrderModalType.PURCHASE_ORDER]: 1,
[OrderModalType.CHANNEL_DIRECT_PURCHASE_ORDER]: 3,
[OrderModalType.CHANNEL_EXISTING_PURCHASE_ORDER]: 4
}
export const filterProductDataById = (data, targetData) => {
return targetData.reduce(async (prev: any[], next) => {
const { logistics } = next
// 由于自选商品和进货单商品字段不一致,需手动同步
// 由于自选发货单商品和物流单单商品字段不一致,需手动同步
next.id = next.id || next.productId
next.productId = next.id || next.productId
next.brand = next.brand || next.brandName
next.category = next.category || next.customerCategoryName
next.unit = next.unit || next.unitName
next.productName = next.productName || next.name
next.deliverType = next.logistics.sendAddress // 保证和详情编辑字段一致
if (logistics.deliveryType === 2 && logistics.sendAddress) {
const { code, data } = await getLogisticsShipperAddressGet({
id: logistics.sendAddress
}, { ttl: 60 * 1000, useCache: true })
logistics.render = {...data, deliveryType: logistics.deliveryType}
} else {
logistics.render = DELIVERY_TYPE[logistics.deliveryType]
}
// 配送方式外置, 用于接口字段冗余
next.deliveryType = logistics.deliveryType
next.amount = next.quantity || next.amount
next.weight = next.weight || null
// id 存在集合中, 采用target中的数据, 否则采用data中的数据
const findResult = data.find(v => v.id === next.id)
const findResult = data.find(v => v.productId === next.productId)
// 由于迭代时,会出现promise的 已完成状态, 需转换一下,实现异步转同步化
if (!Array.isArray(prev)) {
......@@ -126,29 +94,16 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
}, [])
const handleConfirmProduct = async () => {
const newData = rowSelectionCtl.selectRow.map(v => {
v.orderMode = schemaAction.getFieldValue('orderMode')
v.shopId = schemaAction.getFieldValue('shopId')
v.buyerMemberId = schemaAction.getFieldValue('buyerMemberId')
v.buyerRoleId = schemaAction.getFieldValue('buyerRoleId')
return v
})
schemaAction.setFieldValue('products', await filterProductDataById([], newData))
const newData = [...rowSelectionCtl.selectRow]
schemaAction.setFieldValue('detailList', await filterProductDataById([], newData))
confirmModal && confirmModal()
setVisible(false)
}
const fetchProductList = (values) => {
const modelType = schemaAction.getFieldValue('orderMode')
const buyerMembersId = schemaAction.getFieldValue('buyerMemberId')
const shopId = schemaAction.getFieldValue('shopId')
const params = {
...values,
shopType: orderProductShopTypeMaps[modelType],
environment: 1,
memberId: buyerMembersId,
priceTypeList: [1],
shopId: schemaAction.getFieldValue('shopId')
orderId: history.location.query.id
}
return fetchOrderApi.getProductList(params)
}
......@@ -156,7 +111,7 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
return (
<ModalTable
modalTitle={getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.title'})}
modalTitle={getIntl().formatMessage({id: 'purchaseOrder.orderCollect.productModalTable.title'})}
width={900}
columns={productColumns}
visible={visible}
......@@ -167,11 +122,11 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
resetModal={{destroyOnClose: true, forceRender: true}}
modalType='none'
tableProps={{
rowKey: 'id',
rowKey: 'productId',
onRow: (record) => ({
onClick: () => {
rowSelectionCtl.appendSelectRow(record);
rowSelectionCtl.appendSelectRowKeys(record.id);
rowSelectionCtl.appendSelectRowKeys(record.productId);
},
})
}}
......@@ -186,12 +141,6 @@ const ProductModalTable:React.FC<ProductModalTableProps> = (props) => {
'name',
FORM_FILTER_PATH,
);
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(() => {
searchCustomerCategoryOptionEffect(schemaAction, actions, 'customerCategoryId')
})
FormEffectHooks.onFieldChange$('brandId').subscribe(() => {
searchBrandOptionEffect(schemaAction, actions, 'brandId')
})
}
}
}}
......
......@@ -22,7 +22,8 @@ export const PriceComp = (props) => {
/**新增物流单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
shipmentOrderId: initValue.deliveryNo,
// shipmentOrderId: initValue.deliveryNo,
shipmentOrderCode: initValue.deliveryNo,
relevanceOrderId: initValue.orderId,
relevanceOrderCode: initValue.orderNo,
memberName: initValue.buyerMemberName,
......
import { FormEffectHooks, ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { getProductCustomerGetMemberCustomerCategoryTree, getProductSelectGetMemberBrand } from '@/services/ProductV2Api';
export const useMaterialTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('detailList').subscribe(state => {
export const useDetailTableChangeForAmount = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
FormEffectHooks.onFieldValueChange$('detailList').subscribe(() => {
// 强制渲染一次, 用于统计总数
update()
})
}
/**
* 高级筛选schema中用于获取供应商 商品品类Effect
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export const searchCustomerCategoryOptionEffect = (ctx: any, mctx: any, fieldName: string) => {
const params: any = {}
params['memberId'] = ctx.getFieldValue('vendorMemberId')
params['memberRoleId'] = ctx.getFieldValue('vendorRoleId')
mctx.getFieldState(fieldName, state => {
// params['name'] = state.props['x-component-props'].searchValue
getProductCustomerGetMemberCustomerCategoryTree(params).then(res => {
mctx.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
/**
* 高级筛选schema中用于获取供应商 商品品牌Effect
* @param ctx 外部表单action
* @param mctx 模态框表单action
* @param fieldName 字段名称
*/
export const searchBrandOptionEffect = (ctx: any, mctx: any, fieldName: string) => {
const params: any = {}
params['memberId'] = ctx.getFieldValue('vendorMemberId')
params['memberRoleId'] = ctx.getFieldValue('vendorRoleId')
mctx.getFieldState(fieldName, state => {
params['name'] = state.props['x-component-props'].searchValue
getProductSelectGetMemberBrand(params).then(res => {
mctx.setFieldState(fieldName, state => {
state.props['x-component-props'].dataoption = res.data
})
})
})
}
......@@ -6,8 +6,8 @@ import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd
import { SaveOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { increaseSchema } from './schema'
import { useMaterialTableChangeForAmount } from './effects'
import { procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { useDetailTableChangeForAmount } from './effects'
import { procurementProcessField, procurmentRenderInit } from './constant'
import { useUpdate } from '@umijs/hooks'
import { help } from '../../common'
import styled from 'styled-components'
......@@ -17,7 +17,7 @@ import { FormDetailContext } from '@/formSchema/context'
import { useProductTable } from './model/useProductTable'
import { useFormDetail } from '@/formSchema/effects/useFormDetail'
import ProductModalTable from './components/productModalTable'
import { getOrderVendorCreateLogisticsDetail, getOrderVendorSellDeliveryDetail } from '@/services/OrderNewV2Api'
import { getOrderVendorCreateLogisticsDetail } from '@/services/OrderNewV2Api'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { getLogisticsCompanyPage, getLogisticsShipperAddressPage,postLogisticsOrderWaitSubmitAdd } from '@/services/LogisticsV2Api'
import addressText from '../../components/addressText'
......@@ -42,7 +42,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
const intl = useIntl()
const { form } = useFormSpy({ selector: [['onFieldValueChange', 'detailList']], reducer: v => v })
const data = form.getFieldValue('detailList')
console.log(data, 'data')
const totalCarton = data.reduce((prev, next) => (prev*1000 + (next.carton || 0)*1000)/1000, 0)
const totalWeight = data.reduce((prev, next) => (prev*1000 + (next.weight || 0)*1000)/1000, 0)
const totalVolume = data.reduce((prev, next) => (prev*1000 + (next.volume || 0)*1000)/1000, 0)
......@@ -77,13 +77,9 @@ const AddLogisticsOrder:React.FC<{}> = () => {
useEffect(() => {
if (id) {
setFormLoading(true)
getOrderVendorCreateLogisticsDetail({ orderId: '5870' }).then(res => {
getOrderVendorCreateLogisticsDetail({ orderId: id }).then(res => {
const { data } = res
setInitFormValue(() => procurmentRenderInit(data))
// const _orderProductRequests = procurementRenderField(data)
// setTimeout(() => {
// addSchemaAction.setFieldValue('detailList', _orderProductRequests)
// }, 1000)
setFormLoading(false)
})
getSettleAccountsPlatformConfigGetSettlementWay({memberId: memberId + '', roleId: memberRoleId + ''}).then(res => {
......@@ -97,7 +93,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
const handleSubmit = async (value) => {
try {
// let fnResult = null
// 新增物流单/编辑物流单
const params = { ...value }
console.log(value)
......@@ -107,11 +102,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
setBtnLoading(true)
const _params = procurementProcessField(params)
// if(id) {
// fnResult = await postPurchaseRequisitionUpdate({..._params, id})
// } else {
// fnResult = await postPurchaseRequisitionCreate(_params)
// }
const fnResult = await postLogisticsOrderWaitSubmitAdd(_params)
if (fnResult.code === 1000) {
setTimeout(() => {
......@@ -145,10 +135,6 @@ const AddLogisticsOrder:React.FC<{}> = () => {
}
const renderTitle = () => {
// intl.formatMessage({ id: 'saleOrder.xiugaiwuliudan', defaultMessage: '修改物流单' })
// if(preview) {
// return intl.formatMessage({ id: 'saleOrder.chakanwuliudan', defaultMessage: '查看物流单' })
// }
return intl.formatMessage({ id: 'saleOrder.xinzengwuliudan', defaultMessage: '新增物流单' })
}
......@@ -176,7 +162,7 @@ const AddLogisticsOrder:React.FC<{}> = () => {
effects={($, ctx) => {
$('onFormMount').subscribe(() => { })
// 物流明细信息的改动 渲染总额
useMaterialTableChangeForAmount(ctx, update)
useDetailTableChangeForAmount(ctx, update)
// 注入表单完成进度
formContext.useAttachmentChangeForContext(ctx)
......
import { useRef, useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { Button, message } from 'antd';
import { Button } from 'antd';
import { PriceComp, productInfoColumns } from '../constant';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
import { useModalTable } from './useModalTable';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useIntl } from 'umi';
// 对象按key排序(运用于商城传过来的阶梯价格排序)
export const sortByKey = (params) => {
let keys = Object.keys(params).sort((x,y)=> parseInt(x) - parseInt(y));
let newParams = {};
keys.forEach((key) => {
newParams[key] = params[key];
});
return newParams;
}
export const getUnitPriceTotal = (record) => {
const { pageStatus } = usePageStatus()
const purchaseCount = Number(record['purchaseCount']) || 0
// 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))
}
}
/**
* @param ctx schemaAction
*/
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const { pageStatus, preview = null } = usePageStatus()
const productRef = useRef<any>({})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox', customKey: 'productId'})
const intl = useIntl()
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('detailList')]
// 删除formvalue
......@@ -82,47 +27,26 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
rowSelectionCtl.setSelectedRowKeys(newData.map(v => v.id))
ctx.setFieldValue('detailList', newData)
// 商品行数变动 清空之前的支付信息
if (pageStatus === PageStatus.ADD) {
ctx.setFieldValue('payments', [])
}
}
const [productColumns, setProductColumns] = useState(() => {
// if (pageStatus === PageStatus.ADD) {
// 渲染操作
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'saleOrder.delete'})}</Button>
// 渲染单价
productInfoColumns[5].render = (t, r) => {
return r.price ? <span style={{color: 'red'}}>{r.price}</span> : <PriceComp priceSection={r.unitPrice}/>
}
// 渲染商品ID
productInfoColumns[0].render = (t, r) => {
return r.id
}
// 渲染操作
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({id: 'saleOrder.delete'})}</Button>
// } else {
// // 渲染单价
// productInfoColumns[5].render = (t, r) => <span style={{color: 'red'}}>¥ {r.price}</span>
// // 渲染商品ID
// productInfoColumns[0].render = (t, r) => r.productId
// return [...productInfoColumns].slice(0, productInfoColumns.length - 1)
// }
// 渲染单价
productInfoColumns[5].render = (t, r) => {
return r.price ? <span style={{color: 'red'}}>{r.price}</span> : <PriceComp priceSection={r.unitPrice}/>
}
// 渲染商品ID
productInfoColumns[0].render = (t, r) => {
return r.id
}
return productInfoColumns
})
const handleShowProduct = () => {
const buyerMemberId = ctx.getFieldValue('buyerMemberId')
const shopId = ctx.getFieldValue('shopId')
if (buyerMemberId && shopId) {
productRef.current.setVisible(true)
} else {
message.error(intl.formatMessage({id: 'purchaseOrder.orderCollect.model.message'}))
}
productRef.current.setVisible(true)
}
const productAddButton = !preview && <Button onClick={handleShowProduct} block type='default' style={{margin: '24px auto'}}>{intl.formatMessage({ id: 'saleOrder.xuanzeshangpin', defaultMessage: '选择商品' })}</Button>
......@@ -144,8 +68,6 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
const newData = [...ctx.getFieldValue('detailList')];
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
row['money'] = getUnitPriceTotal(row)
row['productId'] = row.commodityId
newData.splice(index, 1, {
...item,
...row,
......
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { getSaleOrderReadyDistributionPageSelectOption } from '@/pages/transaction/effect';
import { getSaleOrderPublicUsePageSelectOption } from '@/pages/transaction/effect';
import { useIntl } from 'umi';
export const tableListSchema: any = () => {
const intl = useIntl()
const data = getSaleOrderReadyDistributionPageSelectOption()
const data = getSaleOrderPublicUsePageSelectOption()
if(data) {
return {
......
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