Commit 3059209c authored by 前端-李俊鑫's avatar 前端-李俊鑫
parents e05b6574 31b4865d
......@@ -5,7 +5,7 @@ import { FormEffectHooks } from '@formily/antd'
import { StandardTable } from 'god';
import { LAYOUT_TYPE } from '@/constants'
import { PublicApi } from '@/services/api';
import { formatTimeString } from '@/utils'
import moment from 'moment'
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import Search from '@/components/NiceForm/components/Search';
......@@ -57,19 +57,20 @@ const CommodityDrawer: React.FC<CommodityDrawerProps> = (props: CommodityDrawerP
<>
{record?.activityList?.map((item, index) => {
return (
<div key={index} style={{ marginBottom: 8 }}>
<a key={index} style={{ marginBottom: 8 }} href={`/memberCenter/marketingAbility/selfManagement/search/preview?id=${item.id}`} target={"_blank"}>
<Space direction='horizontal'>
<img src={ActivityImage} style={{ width: 24, height: 24, borderRadius: 4 }} />
<span>{item?.name}</span>
<div className={styles['defaultTag']}>{item?.type}</div>
<StatusTag title={item?.belongType === 1 ? '平台活动' : '商家活动'} type={item?.belongType === 1 ? 'primary' : 'success'} />
<div style={{color: '#301333'}}>有效期:{item.startTime && moment(item.startTime).format('YYYY-MM-DD HH:mm:ss')}{item.endTime && moment(item.endTime).format('YYYY-MM-DD HH:mm:ss')} </div>
</Space>
</div>
)
</a>
);
})}
</>
);
}
};
const columns = [
{
......
......@@ -205,7 +205,7 @@ const BannerClient: React.FC<BannerClientProps> = (props: BannerClientProps) =>
<Tooltip title={record?.name}>
<div className={styles['banner-record-integral-right-top']}>{record?.name}</div>
</Tooltip>
<div className={styles['banner-record-integral-right-bottom']}>{priceFormat(record?.unitPrice?.['0-0'])} 积分</div>
<div className={styles['banner-record-integral-right-bottom']}>{priceFormat(record?.min)} 积分</div>
</div>
</div>
)
......
......@@ -54,15 +54,15 @@ const TyleList_Own = [
label: '积分兑换',
},
{
value: 2,
label: '公司介绍',
value: 4,
label: '行情资讯',
},
{
value: 3,
label: '成为会员',
},
{
value: 4,
value: 2,
label: '公司介绍',
},
]
......@@ -190,7 +190,7 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
let getFn
if (layoutType === LAYOUT_TYPE.channel) {
getFn = PublicApi.getSearchChannelCommodityTemplateGetFirstCategoryListByMemberId
} else if (layoutType === LAYOUT_TYPE.shop) {
} else {
params.memberRoleId = memberRoleId
getFn = PublicApi.getSearchCommodityTemplateGetFirstCategoryListByMemberId
}
......@@ -318,12 +318,13 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
const handleSumit = (values) => {
const newProps: any = {
...values,
icon: values.icon[0].url
icon: values.icon[0].url,
empty: false
}
if (values.channel && values.type === 3) {
newProps.id = values.channel
} else if (values.type === 2 || values.type === 5) {
newProps.id = record.id
newProps.id = record ? record?.id : undefined
}
changeProps({
......
import React, { useEffect, useState } from 'react';
import { updatePageConfig } from '@lingxi-disign/core';
import { updatePageConfig } from '@lingxi-disign/react';
import { cloneDeep } from 'lodash';
import pageConfig from '../schema/pageConfig';
import { PublicApi } from '@/services/api';
......@@ -123,7 +123,6 @@ function useGetLayout() {
...config
};
setDataSourceFromRequest(dataFromRequest);
console.log("newConfig", newConfig);
updatePageConfig(newConfig);
}, [info]);
......
......@@ -17,6 +17,8 @@ import Submit from '@/components/NiceForm/components/Submit';
import StatusTag from '@/components/StatusTag';
import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearch';
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch';
import defaultActivityImage from '@/assets/activity/ActivityImage.svg';
import moment from 'moment';
// import { serviceAdvertConfig } from '@/pages/editor/channelEdit/defaultData';
interface CommodityDrawerProps {
......@@ -28,6 +30,8 @@ interface CommodityDrawerProps {
selectType?: 'radio' | 'checkbox',
service?: ((data: any) => Promise<any>) | null,
formEffects?: (context: any, formAction: any) => void,
/** 格式化s搜索参数 */
formatedFilterParams?: (params: any) => any
}
const _returnCategoryList = (list: any, obj: any) => {
......@@ -38,7 +42,7 @@ const _returnCategoryList = (list: any, obj: any) => {
};
const CommodityDrawer: React.FC<CommodityDrawerProps> = (props: CommodityDrawerProps) => {
const { visible, onClose, onConfirm, selectId, filterParam, selectType = 'radio', service = null, formEffects } = props;
const { visible, onClose, onConfirm, selectId, filterParam, selectType = 'radio', service = null, formEffects, formatedFilterParams = () => {} } = props;
const { query: { shopId } }: any = history.location;
const [selectedRowKeys, setSelectedRowKeys] = useState<any>(selectId ? [selectId] : []);
const [selectedRows, setSelectedRows] = useState<any>([]);
......@@ -54,14 +58,15 @@ const CommodityDrawer: React.FC<CommodityDrawerProps> = (props: CommodityDrawerP
<>
{record?.activityList?.map((item, index) => {
return (
<div key={index} style={{ marginBottom: 8 }}>
<a key={index} style={{ marginBottom: 8 }} href={`/memberCenter/marketingAbility/selfManagement/search/preview?id=${item.id}`} target={"_blank"}>
<Space direction='horizontal'>
<img src={''} style={{ width: 24, height: 24, borderRadius: 4 }} />
<img src={defaultActivityImage} style={{ width: 24, height: 24, borderRadius: 4 }} />
<span>{item?.name}</span>
<div className={styles['defaultTag']}>{item?.type}</div>
<StatusTag title={item?.belongType === 1 ? '平台活动' : '商家活动'} type={item?.belongType === 1 ? 'primary' : 'success'} />
<div style={{color: '#301333'}}>有效期:{item.startTime && moment(item.startTime).format('YYYY-MM-DD HH:mm:ss')}{item.endTime && moment(item.endTime).format('YYYY-MM-DD HH:mm:ss')} </div>
</Space>
</div>
</a>
);
})}
</>
......@@ -132,11 +137,12 @@ const CommodityDrawer: React.FC<CommodityDrawerProps> = (props: CommodityDrawerP
};
const fetchTableData = async (params: any) => {
const formated = formatedFilterParams?.(params) || filterParam || {}
const _params = {
...params,
// ...params,
shopId,
idNotInList: Array.isArray(selectId) ? selectId : [selectId],
...filterParam
...formated
};
const fetchService = service || PublicApi.getMarketingAdornChannelGoodsListAdorn;
const { data } = await fetchService(_params);
......
......@@ -30,7 +30,7 @@ type SettingPanelType = {
}
const ComponentSchema = {
tabItem: tabTitleSchema,
// tabItem: tabTitleSchema,
secondaryItem: secondaryTabSchema,
flashSale: blockSchema,
flashSaleItem: flashSaleSchema,
......@@ -62,7 +62,7 @@ const EditPanel = () => {
* 但当一级类型没有被选择的时候,那么必须选择一级导航类型
*/
useEffect(() => {
if (activeKey === null || previousActiveKey !== activeKey) {
if (activeKey === null && previousActiveKey !== activeKey) {
if(activeKey === null) {
message.info("请先选择一级导航类型");
}
......@@ -115,8 +115,8 @@ const EditPanel = () => {
},
},
suggestProduct: {
type: selectedInfo.props.type || 1,
num: selectedInfo.props.num || 50,
type: selectedInfo?.props?.type || 1,
num: selectedInfo?.props?.num || 50,
title: selectedInfo.props.title,
},
suggestProductItem: {
......@@ -137,7 +137,6 @@ const EditPanel = () => {
message.info("当前商品展示类型为自动排序,不能进行单个商品设置");
return;
}
setFormValue(tempFormValue[componentType]);
setSchema(targetSchema);
setVisible(true);
......@@ -184,7 +183,6 @@ const EditPanel = () => {
const key = activeKey === null ? domKey : selectedInfo?.selectedKey || domKey;
const componentType: keyof typeof ComponentSchema = activeKey === null ? 'tabItem' : (selectedInfo as any)?.otherProps?.type;
console.log(values);
const formValueToProps = {
tabItem: {
name: values.title,
......@@ -223,7 +221,7 @@ const EditPanel = () => {
};
const currentProps = type === 0 && componentType.includes('suggestProduct') ? formValueToProps['suggestProduct'] : formValueToProps[componentType];
if(componentType === 'suggestProduct' || type === 0) {
if(componentType.includes('suggestProduct') && type === 0) {
setType(values.type);
}
changeProps({
......@@ -348,7 +346,7 @@ const EditPanel = () => {
</div>
<div className={styles.footer}>
<Space>
<Button onClick={() => setVisible(false)}>取消</Button>
<Button onClick={handleOnClose}>取消</Button>
<Button type="primary" onClick={() => formActions.submit()}>确认</Button>
</Space>
</div>
......
......@@ -15,6 +15,12 @@ export const tabTitleSchema: ISchema = {
type: 'string',
title: '类型',
enum: [],
"x-rules": [
{
required: true,
message: '请选择一级品类'
}
]
},
title: {
type: 'string',
......@@ -40,6 +46,12 @@ export const secondaryTabSchema: ISchema = {
type: 'string',
title: '类型',
enum: [],
"x-rules": [
{
required: true,
message: '请选择二级类型'
}
]
},
title: {
type: 'string',
......@@ -56,6 +68,12 @@ export const secondaryTabSchema: ISchema = {
children: null,
maxCount: 1,
},
"x-rules": [
{
required: true,
message: '请上传图片'
}
]
}
}
}
......@@ -77,8 +95,13 @@ export const blockSchema: ISchema = {
blockTitle: {
type: 'string',
title: '标题',
'x-rules': [
{
required: true,
message: '请填写标题'
}
]
},
}
}
}
......@@ -124,10 +147,19 @@ export const saleRankSchema: ISchema = {
rankProduct: {
type: 'object',
"x-component": 'FormilyCommodity',
"x-component-props": {
commodityKey: 'saleRanking'
}
},
sale: {
type: 'string',
title: '销量',
"x-rules": [
{
required: true,
message: '请填写销量',
}
]
}
}
......@@ -147,7 +179,6 @@ export const branchSchema: ISchema = {
labelAlign: "top"
},
properties: {
brand: {
type: 'object',
// title: '',
......@@ -209,7 +240,7 @@ export const productListSchema: ISchema = {
}
};
/** 销量排行schema */
/** 精选商品schema */
export const commoditySchema: ISchema = {
type: 'Object',
properties: {
......@@ -225,10 +256,9 @@ export const commoditySchema: ISchema = {
"x-component": 'FormilyCommodity',
'x-component-props': {
isWithLabels: true,
commodityKey: 'suggestProduct'
}
},
}
}
}
......
......@@ -9,6 +9,13 @@ import { useFilterSameOption } from '../../common/hooks/useFilterSameOption';
import { PublicApi } from '@/services/api';
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effect';
type ComponentTypeProps = {
activityType: number,
commodityKey: 'saleRanking' | 'suggestProduct',
isWithLabels?: boolean
} & {
[key: string]: any
}
interface Iprops {
value: {
id: number,
......@@ -21,11 +28,7 @@ interface Iprops {
label: string[],
},
props: {
['x-component-props']: {
activityType: number,
} & {
[key: string]: any
},
['x-component-props']: ComponentTypeProps,
},
mutators: {
change: (params: any) => void
......@@ -43,9 +46,9 @@ const FormilyCommodity: React.FC<Iprops> & { isFieldComponent: boolean } = (prop
const isSelfMall = useMemo(() => fixtureContext.isSelfMall, [fixtureContext.isSelfMall]);
/** 获取已经选择的id */
const sameKeyState = useFilterSameOption();
const disabledSaleRankingKeys = useMemo(() => sameKeyState[`tabItem_${activeKey}_saleRanking`], [sameKeyState, activeKey]);
const componentProps = props.props?.['x-component-props'] || {} as ComponentTypeProps;
const disabledSaleRankingKeys = useMemo(() => sameKeyState[`tabItem_${activeKey}_${componentProps.commodityKey}`], [sameKeyState, activeKey]);
console.log(sameKeyState, disabledSaleRankingKeys );
const componentProps = props.props?.['x-component-props'] || {} as { isWithLabels?: boolean };
const { state: productVisible, toggle: setProductVisible } = useToggle();
const productProps = useMemo(() => ({
......@@ -72,15 +75,22 @@ const FormilyCommodity: React.FC<Iprops> & { isFieldComponent: boolean } = (prop
setProductVisible(false);
};
const filterParam = useMemo(() => {
return {
const formatSearchParams = (params) => {
const idInList = typeof params.id !== 'undefined' && params.id ? { idInList: [params.id] } : {}
const { id, ...rest } = params;
const idNotInList = Array.from(new Set([productProps?.id].concat(disabledSaleRankingKeys).filter(Boolean)));
const common = {
shopId: fixtureContext?.shopId.toString(),
customerCategoryId: activeKey,
memberId: userAuth.memberId,
memberRoleId: userAuth.memberRoleId,
idNotInList: [productProps?.id].concat(disabledSaleRankingKeys).filter(Boolean)
};
}, [fixtureContext?.shopId.toString(), activeKey, disabledSaleRankingKeys, isSelfMall]);
idNotInList: idNotInList,
...rest,
...idInList,
}
return common
}
const restProps = useMemo(() => {
const data = {
......@@ -116,13 +126,13 @@ const FormilyCommodity: React.FC<Iprops> & { isFieldComponent: boolean } = (prop
return (
<div>
<Product activityImage={''} onEdit={onEdit} {...productProps} isWithLabels={componentProps.isWithLabels || false} onLabelChange={onLabelChange} />
<Product onEdit={onEdit} {...productProps} isWithLabels={componentProps.isWithLabels || false} onLabelChange={onLabelChange} />
<CommodityDrawer
{...restProps}
visible={productVisible}
onClose={onClose}
onConfirm={onOk}
filterParam={filterParam}
formatedFilterParams={formatSearchParams}
selectId={productProps?.id?.toString()}
/>
</div>
......
......@@ -37,10 +37,11 @@ const FormilyActivityProduct: React.FC<Iprops> & { isFieldComponent: boolean } =
/** 1 级分类 id */
const { activeKey } = useSelector<any, "activeKey" >(['activeKey']);
const fixtureContext = useContext(context);
/** 是否是自营商城 */
const isSelfMall = useMemo(() => fixtureContext.isSelfMall, [fixtureContext.isSelfMall]);
const ignoresFilters = ['activityType'];
const componentProps = props.props?.['x-component-props'] || {} as { activityType?: number, isWithLabels: boolean };
const activityImage = "logo.png";
const { state: productVisible, toggle: setProductVisible } = useToggle();
/** @tofixed activityId */
const cacheProductList = useMemo(() => [{ ...value }], [value]);
......@@ -66,10 +67,12 @@ const FormilyActivityProduct: React.FC<Iprops> & { isFieldComponent: boolean } =
const fetchData = async (params: GetMarketingAdornMerchantActivityListAdornRequest) => {
const withActivityType = componentProps?.activityType ? { activityType: componentProps?.activityType } : {};
/** 自营商城,b端,c端需要带一级品类,不明白为啥要这么设计 */
const withCategoryId = isSelfMall ? { categoryId: activeKey } : {};
const common = {
...params,
shopId: fixtureContext?.shopId.toString(),
// categoryId: activeKey,
...withCategoryId,
...withActivityType
};
const isWithActivityType = common;
......@@ -78,7 +81,7 @@ const FormilyActivityProduct: React.FC<Iprops> & { isFieldComponent: boolean } =
return (
<div style={{ position: 'relative' }}>
<Product activityImage={''} onEdit={onEdit} {...productProps} isWithLabels={componentProps.isWithLabels || false} />
<Product onEdit={onEdit} {...productProps} isWithLabels={componentProps.isWithLabels || false} />
<ActivityProductDrawer
ignoresFilters={ignoresFilters}
activityImage={activityImage}
......
......@@ -274,7 +274,6 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
...cloneDeepPageConfig,
...finalData,
};
console.log("fuckNewConfig", newConfigData);
createActions({ type: 'onChangeTabKey', payload: { activeKey: matches?.[1] === 'undefined' ? null : matches?.[1] , domKey: matches?.[2], pageConfig: newConfigData, hasRequestTabKey: concatActiveKey } });
setActiveKey(activeKey);
};
......
......@@ -77,7 +77,7 @@ const CategoryNavigation = () => {
}, [info]);
const onSave = async (pageConfig, rest) => {
const hasRequestTabKey = rest.hasRequestTabKey.map((_item: string) => _item.match(/id_(.*)\/\.\$(\d+)/)?.[1]) || [];
const hasRequestTabKey = rest.hasRequestTabKey?.map((_item: string) => _item.match(/id_(.*)\/\.\$(\d+)/)?.[1]) || [];
/** domKey 从7开始都是tab 的值 */
const tabChildren = pageConfig[4].childNodes.slice(1);
......@@ -120,6 +120,7 @@ const CategoryNavigation = () => {
return tabProps;
});
const postData = { style: 0, category: result.filter(Boolean) };
console.log(result, postData);
const service = isSelfMall ? PublicApi.postTemplateAdornAppSelfSave : PublicApi.postTemplateAdornAppChannelSave;
const { data, code } = await service({
templateId: Number(id),
......
......@@ -94,7 +94,9 @@ export const useOrderDetail = (options: OrderDetailHookProps) => {
reloadPayList(id)
}
if(data.payments.length > 0){
setCurrentPayInfoId(data.payments[0].paymentId)
// 过滤出未支付的 第一个
const payObj = data.payments.filter(item => item.showPayment)[0]
setCurrentPayInfoId(payObj.paymentId)
}
} else {
message.error(msg)
......
......@@ -94,7 +94,7 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
}
const getMemberInfo = (value) => {
form.setFieldsValue({ "memberName": value.name });
form.setFieldsValue({ "memberName": value.name, "shopId": undefined });
setMenberInfo(value)
setInquiryProduct([])
form.setFieldsValue({
......
......@@ -54,13 +54,6 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
}
]
useEffect(() => {
let shopList = GlobalConfig.web.shopInfo.filter(v => (v.type == 1 && v.environment == 1)).map(
v => v
)
setStoreList(shopList)
}, [])
const handleFetchData = useCallback((params: any) => {
return new Promise(resolve => {
PublicApi.getMemberManagePlatformProviderPage({ ...params }).then(res => {
......@@ -78,8 +71,24 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
setVisible(flag)
}
const getShopListFn = (memberId: number, roleId: number) => {
PublicApi.postManageWebShopWebAll({
siteId: GlobalConfig.global.siteInfo.id,
environment: 1,
hasMemberType: 1,
memberId,
roleId,
}, {ctlType: 'none'}).then(res => {
if (res.code !== 1000) {
return
}
setStoreList(res.data)
})
}
const handleLogisticOnOk = (selectRowKeys: string[] | number[], selectRowRecord: any) => {
const target = selectRowRecord[0];
getShopListFn(target.memberId, target.roleId);
getMemberInfo(target)
setMember(target)
toggle(false)
......
import React, { useEffect, useState } from 'react';
import omit from 'lodash/omit';
import { updatePageConfig } from '@lingxi-disign/core';
import { updatePageConfig } from '@lingxi-disign/react';
import DEFAULT_DATA from '../mock/index.json';
import { GetTemplateWebActivityPageGetResponse } from '@/services/Template2Api';
import { usePageStatus } from '@/hooks/usePageStatus';
......
......@@ -82,6 +82,7 @@
align-items: center;
width: 100%;
margin-bottom: 8px;
color: #303133;
.activityImg {
width: 24px;
......
......@@ -6,7 +6,8 @@ import { Input, Tag, Space } from 'antd';
import { unstable_batchedUpdates } from 'react-dom';
import { priceFormat } from '@/utils/numberFomat';
import styles from './product.less';
import defaultActivityImage from '@/assets/activity/ActivityImage.svg'
// import { } from 'umi'
interface Iprops {
onEdit?: ((data: { id: number, activityId: number}) => void) | null,
......@@ -23,13 +24,13 @@ interface Iprops {
}[],
/** 是否有标签 */
isWithLabels: boolean,
activityImage: string,
activityImage?: string,
label: string[],
onLabelChange?: ((data: { id: number, activityId: number, label: string[] }) => void) | null
}
const Product: React.FC<Iprops> = (props: Iprops) => {
const { onEdit, onRemove, productName, productImgUrl, id, activityId, price, activityList, isWithLabels, activityImage, label, onLabelChange = null } = props;
const { onEdit, onRemove, productName, productImgUrl, id, activityId, price, activityList, isWithLabels, activityImage = defaultActivityImage, label, onLabelChange = null } = props;
const [inputVisible, setInputVisible] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>("");
const inputRef = useRef<(Input) | null>(null);
......@@ -163,11 +164,11 @@ const Product: React.FC<Iprops> = (props: Iprops) => {
{
activityList?.map((_item) => {
return (
<div className={styles.activityItem} key={_item.id}>
<a className={styles.activityItem} key={_item.id} href={`/memberCenter/marketingAbility/selfManagement/search/preview?id=${_item.id}`} target={"_blank"}>
<img className={styles.activityImg} src={activityImage} />
<span className={styles.activityName}>{_item.name}</span>
<StatusTag type="danger" title={_item.type}></StatusTag>
</div>
</a>
);
})
}
......
......@@ -228,12 +228,13 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
const { code, data: _data } = await PublicApi.getOrderBuyerGetDeliveryTime({ shopId: record.shopId, orderId: record.orderId })
if(code === 1000) {
// const _data = {
// isAppointmentDay: true,
// appointmentDay: true,
// days: 3,
// deliverDate: "2021-10-19T19:39:42.799",
// isDeliveryTime: true,
// deliverDate: "2021-10-20 20:00",
// deliverPeriod: '12:00-13:00',
// deliveryTime: true,
// paramList: [{ startTime: '02:12', endTime: '03:45' }, { startTime: '05:45', endTime: '07:00' }],
// reason: 888888,
// reason: 66666666666,
// }
adjustActions.setFieldValue('orderId', record.orderId)
adjustActions.setFieldValue('reason', _data.reason)
......@@ -243,21 +244,31 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
adjustActions.setFieldState('deliverDate', state => {
state.props['x-component-props'].disabledDate = (current) => {
// 有预约天数
if(_data.isAppointmentDay && _data?.days) {
if(_data.appointmentDay && _data?.days) {
return current && (current < moment().startOf('day') || current > moment().add(_data.days, 'days'))
} else {
return current && current < moment().startOf('day')
}
}
if(!_data.deliveryTime) { // 有时间段 时间控件不显示时分
state.props['x-component-props'].showTime = true
state.props['x-component-props'].format = 'YYYY-MM-DD HH:mm'
} else {
state.props['x-component-props'].showTime = false
state.props['x-component-props'].format = 'YYYY-MM-DD'
}
})
adjustActions.setFieldState('timeLine', prevState => {
prevState.visible = _data.isDeliveryTime
prevState.visible = _data.deliveryTime
if(_data.paramList?.length) {
prevState.props.enum = _data.paramList.map(item => ({label: `${item.startTime}-${item.endTime}`, value: `${item.startTime}-${item.endTime}`}))
} else {
prevState.visible = false
}
})
if(_data.deliveryTime && _data.deliverPeriod) {
adjustActions.setFieldValue('timeLine', _data.deliverPeriod)
}
}
}
......@@ -420,8 +431,8 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
// disabledDate: current => {
// return current && current < moment().startOf('day')
// },
showTime: true,
format: 'YYYY-MM-DD HH:mm',
// showTime: true,
// format: 'YYYY-MM-DD HH:mm',
style: { width: '100%' }
}
},
......
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
......@@ -28,6 +28,7 @@ import { getAuth } from '@/utils/auth';
import { fectchShopListsSource } from '@/utils/type'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { fetchOrderApi } from './apis'
import MemberModalTable from './components/memberModalTable'
export interface AgentOrderDetailProps {}
......@@ -317,9 +318,6 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
// 选择会员弹窗
const handleOrderMember = () => {
if(!addSchemaAction.getFieldValue('shopId')) {
return message.error('请先选择适应商城')
}
memberRef.current.setVisible(true)
}
......@@ -393,9 +391,6 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
effects={($, ctx) => {
useAsyncSelect('shopId', fetchShopLists, ['name', 'id'])
$('onFormMount').subscribe(() => {
ctx.setFieldValue('vendorMemberName', name)
ctx.setFieldValue('vendorMemberId', memberId)
ctx.setFieldValue('vendorRoleId', memberRoleId)
// if (id || modelType) {
// ctx.setFieldState('orderMode', state => {
// state.editable = false
......@@ -456,6 +451,7 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
/>
</Card>
<ProductModalTable currentRef={productRef} schemaAction={addSchemaAction} sectionProps={sectionProps} forceRender/>
<MemberModalTable currentRef={memberRef} productRef={productRef} schemaAction={addSchemaAction}/>
</ReadyAddOrderDetailContext.Provider>
</PageHeaderWrapper>
......
......@@ -32,6 +32,23 @@ const basicInfo: ISchema = {
visible: false,
title: '下单模式值',
},
vendorMemberName: {
type: 'string',
title: '供应会员',
"x-component-props": {
disabled: true,
addonAfter: "{{orderMember}}"
},
required: true,
},
vendorMemberId: {
type: 'string',
display: false
},
vendorRoleId: {
type: 'string',
display: false
},
shopId: {
type: 'number',
enum: [],
......@@ -60,23 +77,6 @@ const basicInfo: ISchema = {
type: 'string',
display: false
},
vendorMemberName: {
type: 'string',
title: '供应会员',
"x-component-props": {
disabled: true,
addonAfter: "{{orderMember}}"
},
required: true,
},
vendorMemberId: {
type: 'string',
display: false
},
vendorRoleId: {
type: 'string',
display: false
},
idList: {
type: 'array',
display: false
......
......@@ -5,6 +5,7 @@ import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
import StatusColors from '@/pages/transaction/components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons'
import { ORDER_TYPE_CHANNEL_POINTS, ORDER_TYPE_POINTS } from '@/constants/order'
// 业务hooks
export const useSelfTable = () => {
......@@ -46,7 +47,7 @@ export const useSelfTable = () => {
align: 'center',
dataIndex: 'amount',
key: 'amount',
render: (t) => '¥' + t
render: (t, r) => (r.orderType === ORDER_TYPE_POINTS || r.orderType === ORDER_TYPE_CHANNEL_POINTS) ? t : `¥${t}`
},
{
title: '已发货批次',
......
......@@ -116,7 +116,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
/** 销售订单 代理下单 */
const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
const shopDataRef = useRef<any>({})
const { name, memberId, memberRoleId } = getAuth() || {}
const { company, memberId, memberRoleId } = getAuth() || {}
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
......@@ -367,7 +367,7 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
state.props.enum = data.map(item => ({
...item,
label: `${item.name}/${item.memberTypeName}/${item.roleName}`,
value: item.id,
value: item.memberId,
}))
})
})
......@@ -402,7 +402,7 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
effects={($, ctx) => {
useAsyncSelect('shopId', fetchShopLists, ['name', 'id'])
$('onFormMount').subscribe(() => {
ctx.setFieldValue('vendorMemberName', name)
ctx.setFieldValue('vendorMemberName', company)
ctx.setFieldValue('vendorMemberId', memberId)
ctx.setFieldValue('vendorRoleId', memberRoleId)
// if (id || modelType) {
......
......@@ -5,6 +5,7 @@ import EyePreview from '@/components/EyePreview'
import { formatTimeString } from '@/utils'
import StatusColors from '@/pages/transaction/components/statusColors'
import { FieldTimeOutlined } from '@ant-design/icons'
import { ORDER_TYPE_CHANNEL_POINTS, ORDER_TYPE_POINTS } from '@/constants/order'
// 业务hooks, 待支付订单
export const useSelfTable = () => {
......@@ -47,7 +48,7 @@ export const useSelfTable = () => {
align: 'center',
dataIndex: 'amount',
key: 'amount',
render: (t, r) => '¥' + t
render: (t, r) => (r.orderType === ORDER_TYPE_POINTS || r.orderType === ORDER_TYPE_CHANNEL_POINTS) ? t : `¥${t}`
},
{
title: '已发货批次',
......
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