Commit c829c70e authored by Bill's avatar Bill

Merge branch 'fix418' into 'v2-220418'

处理批量新增仓位报方式异常问题 See merge request linkseeks-design/pro-platform!127
parents 30a4c554 12ba6d06
......@@ -2,7 +2,9 @@ export default {
'priceManage.constant.columnsSetMember.name':'Member Name',
'priceManage.constant.columnsSetMember.memberTypeName':'Member Type',
'priceManage.constant.columnsSetMember.roleName':'Member Role',
'priceManage.constant.columnsSetMember.levelTag':'Membership level',
'priceManage.constant.columnsSetMember.levelTag': 'Membership grade label',
'priceManage.constant.columnsSetMember.level': 'Level of membership',
'priceManage.constant.columnsSetMember.levelTypeName': 'Type of Membership',
'priceManage.constant.columnsSetProduct.code':'Product ID',
'priceManage.constant.columnsSetProduct.name':'Product name',
'priceManage.constant.columnsSetProduct.customerCategory':'Category',
......@@ -81,6 +83,7 @@ export default {
'priceManage.priceStrategy.priceSetting.delete':'Delete',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton':'Member Name',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button':'Select the specified member',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button1': 'Select the specified membership level',
'priceManage.priceStrategy.priceSetting.batchPriceButton.button':'Batch price setting',
'priceManage.priceStrategy.priceSetting.connectProduct.button':'Select',
'priceManage.priceStrategy.priceSetting.questionNameLabel':'Price strategy name',
......@@ -109,6 +112,7 @@ export default {
'priceManage.schema.setPriceSchema.tab-2':'Price Settings',
'priceManage.schema.setPriceSchema.tab-3':'Applicable Member',
'priceManage.schema.formSearch.name':'Please enter the member name',
'priceManage.schema.formSearch.levelTag': 'Please enter the membership level TAB',
'priceManage.schema.formSearch.submit':'Query',
'priceManage.schema.formProduct.name':'Please enter the product number/name',
'priceManage.schema.formProduct.customerCategoryId':'Product category',
......
......@@ -2,7 +2,9 @@ export default {
'priceManage.constant.columnsSetMember.name' : '회원명',
'priceManage.constant.columnsSetMember.memberTypeName' : '회원 유형',
'priceManage.constant.columnsSetMember.roleName' : '회원 역할',
'priceManage.constant.columnsSetMember.levelTag' : '회원 등급',
'priceManage.constant.columnsSetMember.levelTag': '회원 등급 태그',
'priceManage.constant.columnsSetMember.level': '회원 등급',
'priceManage.constant.columnsSetMember.levelTypeName': '회원 등급 유형',
'priceManage.constant.columnsSetProduct.code' : '상품 번호',
'priceManage.constant.columnsSetProduct.name' : '상품명',
'priceManage.constant.columnsSetProduct.customerCategory' : '종류',
......@@ -81,6 +83,7 @@ export default {
'priceManage.priceStrategy.priceSetting.delete' : '삭제',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton' : '회원명',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button' : '지정 회원 선택',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button1': '지정한 회원 등급을 선택하십시오',
'priceManage.priceStrategy.priceSetting.batchPriceButton.button' : '대량 설정 가격',
'priceManage.priceStrategy.priceSetting.connectProduct.button' : '선택 항목',
'priceManage.priceStrategy.priceSetting.questionNameLabel' : '가격 정책 이름',
......@@ -109,6 +112,7 @@ export default {
'priceManage.schema.setPriceSchema.tab-2' : '가격 설정',
'priceManage.schema.setPriceSchema.tab-3' : '적용 회원',
'priceManage.schema.formSearch.name' : '회원 이름을 입력하세요',
'priceManage.schema.formSearch.levelTag': '회원 등급 탭을 입력해주세요',
'priceManage.schema.formSearch.submit' : '조회',
'priceManage.schema.formProduct.name' : '상품 번호/명칭을 입력하세요',
'priceManage.schema.formProduct.customerCategoryId' : '상품류',
......
......@@ -2,7 +2,9 @@ export default {
'priceManage.constant.columnsSetMember.name': '会员名称',
'priceManage.constant.columnsSetMember.memberTypeName': '会员类型',
'priceManage.constant.columnsSetMember.roleName': '会员角色',
'priceManage.constant.columnsSetMember.levelTag': '会员等级',
'priceManage.constant.columnsSetMember.levelTag': '会员等级标签',
'priceManage.constant.columnsSetMember.level': '会员等级',
'priceManage.constant.columnsSetMember.levelTypeName': '会员等级类型',
'priceManage.constant.columnsSetProduct.code': '商品编号',
'priceManage.constant.columnsSetProduct.name': '商品名称',
'priceManage.constant.columnsSetProduct.customerCategory': '品类',
......@@ -51,6 +53,7 @@ export default {
'priceManage.priceStrategy.setStrategy.title3': '编辑商品价格策略',
'priceManage.priceStrategy.setStrategy.extra': '保存',
'priceManage.priceStrategy.memberModal.modalTitle': '选择会员',
'priceManage.priceStrategy.memberModal.modalTitle1': '选择会员等级',
'priceManage.priceStrategy.priceModal.unitPrice': '单价',
'priceManage.priceStrategy.priceModal.index': '索引',
'priceManage.priceStrategy.priceModal.error.1': '请正确输入阶梯数量范围',
......@@ -81,6 +84,7 @@ export default {
'priceManage.priceStrategy.priceSetting.delete': '删除',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton': '会员名称',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button': '选择指定会员',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button1': '选择指定会员等级',
'priceManage.priceStrategy.priceSetting.batchPriceButton.button': '批量设置价格',
'priceManage.priceStrategy.priceSetting.connectProduct.button': '选择',
'priceManage.priceStrategy.priceSetting.questionNameLabel': '价格策略名称',
......@@ -110,6 +114,7 @@ export default {
'priceManage.schema.setPriceSchema.tab-2': '价格设置',
'priceManage.schema.setPriceSchema.tab-3': '适用会员',
'priceManage.schema.formSearch.name': '请输入会员名字',
'priceManage.schema.formSearch.levelTag': '请输入会员等级标签',
'priceManage.schema.formSearch.submit': '查询',
'priceManage.schema.formProduct.name': '请输入商品编号/名称',
'priceManage.schema.formProduct.customerCategoryId': '商品品类',
......
// 选择商品和会员弹框的列
// 会员弹框的列
import { getIntl } from 'umi';
export const columnsSetMember: any[] = [
{
......@@ -33,6 +33,47 @@ export const columnsSetMember: any[] = [
}
]
// 会员等级弹框的列
export const columnsSetMemberLevel: any[] = [
{
title: 'ID',
dataIndex: 'levelId',
align: 'center',
key: 'levelId',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.memberTypeName' }),
dataIndex: 'memberTypeName',
align: 'center',
key: 'memberTypeName',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.roleName' }),
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.levelTypeName' }),
dataIndex: 'levelTypeName',
align: 'center',
key: 'levelTypeName',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.level' }),
dataIndex: 'level',
align: 'center',
key: 'level',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.levelTag' }),
dataIndex: 'levelTag',
align: 'center',
key: 'levelTag',
}
]
// 选择商品列
export const columnsSetProduct: any[] = [
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.code' }),
......@@ -147,14 +188,44 @@ export const memberColumns: any[] = [
title: getIntl().formatMessage({ id: 'priceManage.constant.memberColumns.roleName' }),
align: 'center'
},
// {
// dataIndex: 'levelTag',
// title: '等级',
// align: 'center'
// },
{
dataIndex: 'ctl',
title: getIntl().formatMessage({ id: 'priceManage.constant.memberColumns.ctl' }),
align: 'center',
}
]
// 适用会员等级的列
export const memberLevelColumns: any[] = [
{
dataIndex: 'levelId',
title: 'ID',
align: 'center'
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.memberTypeName' }),
dataIndex: 'memberTypeName',
align: 'center',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.roleName' }),
dataIndex: 'roleName',
align: 'center',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.levelTypeName' }),
dataIndex: 'levelTypeName',
align: 'center',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.level' }),
dataIndex: 'level',
align: 'center',
},
{
title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.levelTag' }),
dataIndex: 'levelTag',
align: 'center',
}
]
import { getIntl } from 'umi';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { columnsUnitProduct } from '../constant';
import { GlobalConfig } from '@/global/config';
import { PageStatus } from '@/hooks/usePageStatus'
import { orderlyLadderPrice } from '@/pages/commodity/products/constant';
import { getProductCustomerGetCustomerCategoryTree, getProductSelectGetSelectBrand } from '@/services/ProductV2Api';
......@@ -98,6 +97,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
let _params: any = {}
_params["name"] = data.name
_params["priceType"] = data.priceType
_params["applyType"] = data.applyType
let shopInfo = data?.shopId ? { id: data.shopId } : ctx.getFieldState("shopId")['values'][1]
_params["shopId"] = shopInfo["id"]
......@@ -113,6 +113,13 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
memberRoleName: item.roleName,
}))
}
if (data?.commodityMemberLevelList) {
_params["commodityMemberLevelList"] = data.commodityMemberLevelList.map(item => ({
memberRoleId: item.roleId,
memberRoleName: item.roleName,
...item,
}))
}
_params["memberUnitPriceList"] = data.memberUnitPriceList.map(item => ({
commodityUnitPrice: { id: item.id },
unitPrice: item[intl.formatMessage({ id: 'priceManage.effect.unitPrice' })]
......@@ -128,6 +135,7 @@ export const transformDataForNiceForm = (value: any, ctx: ISchemaFormActions | I
if (value && JSON.stringify(value) !== '{}') {
let initValue: any = {};
initValue["name"] = value.name
initValue["applyType"] = value.applyType
initValue["priceType"] = value.priceType
initValue["productId"] = value.commodity.id
initValue["productName"] = value.commodity.name
......@@ -139,6 +147,11 @@ export const transformDataForNiceForm = (value: any, ctx: ISchemaFormActions | I
roleId: item.memberRoleId,
roleName: item.memberRoleName,
}))
initValue["commodityMemberLevelList"] = value.commodityMemberLevelList.map(item => ({
roleId: item.memberRoleId,
roleName: item.memberRoleName,
...item,
}))
initValue["shopId"] = value["shopId"]
// Edit使用
......
import React, { useEffect } from 'react'
import { useIntl } from 'umi';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useModalTable } from '../../model/useModalTable'
import ModalTable from '@/components/ModalTable'
import { columnsSetMemberLevel } from '../../constant'
import { formSearch, formSearchMemberLevel } from '../../schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import ModalSearch from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus'
import { clearModalParams } from '@/utils'
import { getMemberAbilityLevelConsumerPage } from '@/services/MemberV2Api';
export interface MemberLevelModalProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
}
const MemberLevelModal: React.FC<MemberLevelModalProps> = (props) => {
const { type = "checkbox", schemaAction, currentRef, ...restProps } = props
const intl = useIntl();
const {
visible,
setVisible,
rowSelection,
rowSelectionCtl,
} = useModalTable({ type, customKey: "levelId" })
const {
id,
preview,
pageStatus
} = usePageStatus()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
// 添加会员等级
const handleOkAddMemberLevel = () => {
setVisible(false)
if (pageStatus === PageStatus.EDIT) {
schemaAction.setFieldState('commodityMemberLevelList', state => {
state.isDelete = true
})
let hasMember: any = schemaAction.getFieldValue('commodityMemberLevelList') || []
schemaAction.setFieldValue('commodityMemberLevelList', hasMember.concat(rowSelectionCtl.selectRow))
rowSelectionCtl.setSelectedRowKeys([])
rowSelectionCtl.setSelectRow([])
} else {
schemaAction.setFieldValue('commodityMemberLevelList', rowSelectionCtl.selectRow)
schemaAction.setFieldState('commodityMemberLevelList', state => {
state.dataSource = rowSelectionCtl.selectRow
})
}
clearModalParams()
}
const handleCancelAddMemberLevel = () => {
setVisible(false)
clearModalParams()
}
const fetchMemberLevelList = async (params) => {
const res = await getMemberAbilityLevelConsumerPage(params, { ctlType: 'none' });
return res.data
}
return (
<ModalTable
modalTitle={intl.formatMessage({ id: 'priceManage.priceStrategy.memberModal.modalTitle1' })}
confirm={handleOkAddMemberLevel}
cancel={handleCancelAddMemberLevel}
visible={visible}
columns={columnsSetMemberLevel}
rowSelection={rowSelection}
fetchTableData={params => fetchMemberLevelList(params)}
formilyProps={
{
ctx: {
schema: formSearchMemberLevel,
components: {
ModalSearch,
Submit,
},
effects: ($, actions) => {
actions.reset()
useStateFilterSearchLinkageEffect(
$,
actions,
'levelTag',
FORM_FILTER_PATH,
);
},
}
}
}
resetModal={{
destroyOnClose: true
}}
tableProps={{
rowKey: 'levelId'
}}
/>
)
}
MemberLevelModal.defaultProps = {}
export default MemberLevelModal
......@@ -2,7 +2,6 @@ import React, { useState, useEffect, useRef } from 'react'
import { useIntl } from 'umi';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { ISchemaFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import {
PlusOutlined,
LinkOutlined,
......@@ -11,7 +10,7 @@ import {
} from '@ant-design/icons'
import { Button, message, Tooltip, Input } from 'antd'
import NiceForm from '@/components/NiceForm'
import { columnsUnitProduct, memberColumns } from '../../constant'
import { columnsUnitProduct, memberColumns, memberLevelColumns } from '../../constant'
import { constructTableData, transformDataForNiceForm } from '../../effect'
import PriceModal from './priceModal'
import ProductModal from './productModal'
......@@ -19,12 +18,13 @@ import MemberModal from './memberModal'
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'
import { fectchShopListsSource } from '@/utils/type'
import { getProductCommodityGetCommodityUnitPrice, getProductCommodityGetUnitPriceStrategy } from '@/services/ProductV2Api'
import MemberLevelModal from './memberLevelModal';
import { setPriceSchema } from '../../schema';
const { Search } = Input
export interface PriceSettingProps {
addSchemaAction: ISchemaFormActions,
schema: ISchema,
onFieldChange?(),
formSubmit?(values),
}
......@@ -35,18 +35,17 @@ const fetchShopLists = async () => {
const PriceSetting: React.FC<PriceSettingProps> = (props) => {
const intl = useIntl();
const { addSchemaAction, schema, formSubmit, onFieldChange = () => { } } = props
const { addSchemaAction, formSubmit, onFieldChange = () => { } } = props
const priceRef = useRef<any>({})
const productRef = useRef<any>({})
const memberRef = useRef<any>({})
const memberLevelRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [schema, setSchmea] = useState<ISchema>(setPriceSchema)
const [visibleMember, setVisibleMember] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId' })
const [initFormValue, setInitialFormValue] = useState({});
const dataRef = useRef({})
const [priceType, setPriceType] = useState(1)
const [membersLength, setMembersLength] = useState(0);
const {
id,
......@@ -82,6 +81,20 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
}
}
// 删除会员等级
const handleDeleteMemberLevelTable = (reocrd) => {
const value = addSchemaAction.getFieldValue('commodityMemberLevelList')
const res = value.filter(item => item.levelId != reocrd.levelId);
addSchemaAction.setFieldValue('commodityMemberLevelList', res)
addSchemaAction.setFieldState('commodityMemberLevelList', state => {
state.isDelete = true
})
if (pageStatus === PageStatus.EDIT) {
let hasMember = memberRef.current.rowSelectionCtl.selectRow
memberRef.current.rowSelectionCtl.setSelectRow(hasMember.filter(item => item.levelId != reocrd.levelId))
}
}
const handleAddMemberBtn = () => {
const shopId = addSchemaAction.getFieldValue('shopId');
const productId = addSchemaAction.getFieldValue('productId');
......@@ -89,16 +102,19 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
message.error(intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.error.1' }));
return;
}
// const checkBoxs = addSchemaAction.getFieldValue('commodityMemberList')
// if(checkBoxs?.length) {
// memberRowCtl.setSelectedRowKeys(checkBoxs.map(v => v.memberId))
// memberRowCtl.setSelectRow(checkBoxs)
// }
memberRef.current.setVisible(true)
}
const handleAddMemberLevelBtn = () => {
const shopId = addSchemaAction.getFieldValue('shopId');
const productId = addSchemaAction.getFieldValue('productId');
if (!shopId || !productId) {
message.error(intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.error.1' }));
return;
}
memberLevelRef.current.setVisible(true)
}
const handleSetProductPrice = (record: any) => {
console.log(record, 'record')
if (record?.id) {
......@@ -177,6 +193,14 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
}
state.props["x-component-props"].columns = memberColumns
})
// 填充会员等级table
ctx.setFieldState("commodityMemberLevelList", state => {
memberLevelColumns[memberLevelColumns.length - 1].render = (text, record) => {
return <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleDeleteMemberLevelTable(record)}>{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.delete' })}</Button>
}
state.props["x-component-props"].columns = memberLevelColumns
})
}
// 新增会员
......@@ -191,6 +215,11 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
<Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={handleAddMemberBtn} type='dashed'>{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button' })}</Button>
</>
// 新增会员等级
const tableAddMemberLevelButton = pageStatus !== PageStatus.PREVIEW && <>
<Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={handleAddMemberLevelBtn} type='dashed'>{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button1' })}</Button>
</>
// 批量设置价格按钮
const batchPriceButton = pageStatus !== PageStatus.PREVIEW && priceType !== 2 && <Button type="text" onClick={clickBatchSetPrice} style={{ marginBottom: 12, float: "right" }}><SettingOutlined /> {intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.batchPriceButton.button' })}</Button>
......@@ -226,8 +255,8 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
columnsUnitProduct,
memberColumns,
tableAddMemberButton,
// paginationChange,
// membersLength
memberLevelColumns,
tableAddMemberLevelButton,
}}
effects={($, ctx) => {
FormEffectHooks.onFormInputChange$().subscribe(() => {
......@@ -237,11 +266,6 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
$('onFieldValueChange', 'shopId').subscribe(parentState => {
if (parentState.value) {
ctx.setFieldState('shopId', state => {
// state.dataSource = pageStatus === PageStatus.PREVIEW ?
// GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id))
// :
// state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
if (pageStatus === PageStatus.EDIT) {
state.props['x-component-props'].disabled = true;
}
......@@ -268,6 +292,22 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
setPriceType(parentState.value)
})
// 会员 会员等级动态表单
$("onFieldValueChange", "applyType").subscribe(parentState => {
const _schema = {...schema}
if (parentState.value === 1) {
// 采用会员
ctx.setFieldState('commodityMemberList', state => state.visible = true)
ctx.setFieldState('commodityMemberLevelList', state => state.visible = false)
} else if(parentState.value === 2) {
// 采用会员等级
ctx.setFieldState('commodityMemberLevelList', state => state.visible = true)
ctx.setFieldState('commodityMemberList', state => state.visible = false)
}
setSchmea({..._schema})
})
}}
onSubmit={handleSubmit}
actions={addSchemaAction}
......@@ -286,6 +326,12 @@ const PriceSetting: React.FC<PriceSettingProps> = (props) => {
schemaAction={addSchemaAction}
/>
{/* 选择会员等级 */}
<MemberLevelModal
currentRef={memberLevelRef}
schemaAction={addSchemaAction}
/>
{/* 价格设置 Modal */}
<PriceModal
currentRef={priceRef}
......
......@@ -34,7 +34,7 @@ const PriceManage: React.FC<{}> = () => {
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) =>
render: (text, record) =>
<EyePreview
url={`/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/detail?id=${record.id}&preview=1`}
......@@ -90,7 +90,7 @@ const PriceManage: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.min' }),
dataIndex: 'min',
key: 'min',
render: (text: any, reocrd: any) => {
render: (text, reocrd) => {
if (reocrd.priceType === 1) {
if (reocrd.max === reocrd.min)
return <>{intl.formatMessage({ id: 'priceManage.priceStrategy.columns.currency' })}{reocrd.min}</>
......@@ -111,7 +111,7 @@ const PriceManage: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.isEnable' }),
dataIndex: 'isEnable',
key: 'isEnable',
render: (text: any, record: any) => (
render: (text, record) => (
<AuthButton btnCode='priceManage.state' >
<StatusSwitch
handleConfirm={() => handleUpdateState(record)}
......@@ -138,7 +138,7 @@ const PriceManage: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.option' }),
dataIndex: 'option',
width: 128,
render: (text: any, record: any) => {
render: (text, record) => {
return (
<>
<AuthButton btnCode='priceManage.edit' >
......@@ -155,7 +155,7 @@ const PriceManage: React.FC<{}> = () => {
}
];
const fetchData = (params: any) => {
const fetchData = (params) => {
return new Promise((resolve, reject) => {
getProductCommodityGetUnitPriceStrategyList(params).then(res => {
const { data } = res
......@@ -164,7 +164,7 @@ const PriceManage: React.FC<{}> = () => {
})
}
const handleUpdateState = (record: any) => {
const handleUpdateState = (record) => {
postProductCommodityUpdateUnitPriceStrategyStatus({ id: record.id, isEnable: !record.isEnable }).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......@@ -174,11 +174,11 @@ const PriceManage: React.FC<{}> = () => {
})
}
const handleModify = (record: any) => {
const handleModify = (record) => {
history.push(`${history.location.pathname}/edit?id=${record.id}`)
}
const handleDelete = (record: any) => {
const handleDelete = (record) => {
postProductCommodityDeleteUnitPriceStrategy({ id: record.id }).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......@@ -208,7 +208,7 @@ const PriceManage: React.FC<{}> = () => {
columns={columns}
currentRef={ref}
tableProps={{ rowKey: 'id' }}
fetchTableData={(params: any) => fetchData(params)}
fetchTableData={(params) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
......
......@@ -5,12 +5,11 @@ import { history, useIntl } from "umi"
import ReutrnEle from '@/components/ReturnEle'
import { SaveOutlined } from '@ant-design/icons'
import { createFormActions } from '@formily/antd'
import { setPriceSchema } from '../schema'
import PriceSetting from './component/priceSetting'
import './index.less'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { transformParamsForApi } from '../effect'
import { postProductCommoditySaveOrUpdateUnitPriceStrategy } from '@/services/ProductV2Api'
import './index.less'
const addSchemaAction = createFormActions()
......@@ -65,7 +64,7 @@ const SetStrategy: React.FC<{}> = () => {
)}
>
<Card>
<PriceSetting addSchemaAction={addSchemaAction} schema={setPriceSchema} formSubmit={formSubmit} />
<PriceSetting addSchemaAction={addSchemaAction} formSubmit={formSubmit} />
</Card>
</PageHeaderWrapper>
)
......
......@@ -334,17 +334,35 @@ export const setPriceSchema: ISchema = {
labelAlign: 'left',
},
properties: {
applyType: {
title: '适用类型',
'x-component': 'RadioGroup',
enum: [
{ label: '会员', value: 1 },
{ label: '会员等级', value: 2 },
],
default: 1
},
// 选择会员数据字段
commodityMemberList: {
type: 'array:number',
visible: false,
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'memberId',
columns: '{{memberColumns}}',
prefix: '{{tableAddMemberButton}}',
// pagination: {
// "onChange": "{{paginationChange}}",
// "total": "{{membersLength}}"
// }
},
},
// 选择会员等级数据字段
commodityMemberLevelList: {
type: 'array:number',
visible: false,
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'levelId',
columns: '{{memberLevelColumns}}',
prefix: '{{tableAddMemberLevelButton}}',
},
},
},
......@@ -357,6 +375,50 @@ export const setPriceSchema: ISchema = {
};
// 选择商品和会员高级筛选
export const formSearchMemberLevel: ISchema = {
type: 'object',
properties: {
levelTag: {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: getIntl().formatMessage({
id: 'priceManage.schema.formSearch.levelTag',
}),
align: 'flex-left',
advanced: false,
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0,
},
},
colStyle: {
marginTop: 20,
},
},
properties: {
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: getIntl().formatMessage({
id: 'priceManage.schema.formSearch.submit',
}),
},
},
},
},
},
};
export const formSearch: ISchema = {
type: 'object',
properties: {
......
......@@ -87,7 +87,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
rules={[
{
required: true,
message: `${title}${intl.formatMessage({ id: 'table.purchase.bixutianxie' })}}`,
message: `${title}${intl.formatMessage({ id: 'table.purchase.bixutianxie' })}`,
},
dataIndex === 'price' ? {
pattern: /^\d+(\.\d{1,4})?$/,
......
......@@ -55,6 +55,7 @@ const BatchAddRepository: React.FC<{}> = () => {
addSchemaAction.getFieldState('shopIds', state => {
params['shopIds'] = state.value.map(item => state.props['x-component-props'].dataSource.filter(_ => _.id === item)[0])
})
params['inventoryDeductWay'] = 1
let res = await postProductFreightSpaceAddBatch(params)
if (res.code === 1000) {
setTimeout(() => {
......
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