Commit 5998174e authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

fix: 修改营销活动bug

parent 3de74a52
......@@ -38,6 +38,8 @@ interface Iprops {
useStateEffects?: () => void,
/** rowKey */
rowKey?: string,
/** 选择的keyId */
activeKey?: string,
/** 禁用 */
getCheckboxProps?: (record: any) => void,
}
......@@ -56,11 +58,12 @@ const Table: React.FC<Iprops> = (props: any) => {
interiorStatusFetch,
useStateEffects,
rowKey,
activeKey,
getCheckboxProps
} = props;
const tableRef = useRef<any>({});
const [selectRow, selectRowFns] = useRowSelectionTable({
customKey: rowKey || 'id',
customKey: activeKey || 'id',
extendsSelection: {
getCheckboxProps: (record) => getCheckboxProps && getCheckboxProps(record)
}
......
......@@ -34,10 +34,12 @@ interface ProductListProps {
getActivityDefinedBO?: any,
/** 过滤的filterSkuId */
filterSkuId?: number[],
/** 是否商家自建营销活动 */
itrue?: boolean,
}
const ProductListLayout: React.FC<ProductListProps> = (props: any) => {
const { activityId, form, focus$, shopIdList, fieldApi, getActivityDefinedBO, filterSkuId } = props;
const { activityId, form, focus$, shopIdList, fieldApi, getActivityDefinedBO, filterSkuId, itrue } = props;
const [value, setValue] = useState<number>(1);
const [productVisible, setProductVisible] = useState<boolean>(false);
const [listModalVisible, setListModalVisible] = useState<boolean>(false);
......@@ -128,7 +130,27 @@ const ProductListLayout: React.FC<ProductListProps> = (props: any) => {
if (value === 15) {
setRemind(remindLayout(value));
}
setProductVisible(flag)
if (itrue && flag) {
if (form.getFieldValue('activityDefined') && form.getFieldValue('startTime') && form.getFieldValue('endTime') && form.getFieldValue('activityType')) {
const param = {
activityType: form.getFieldValue('activityType'),
activityDefined: form.getFieldValue('activityDefined'),
startTime: Number(form.getFieldValue('startTime').format('x')),
endTime: Number(form.getFieldValue('endTime').format('x'))
}
PublicApi.postMarketingMerchantActivityGetFilterSkuId(param, { ctlType: 'none' }).then(res => {
if (res.code !== 1000) {
return
}
setIdNotInList([...res.data.filterSkuId, ...idNots]);
setProductVisible(flag)
})
} else {
message.warn('请先完善活动时间和活动规则!')
}
} else {
setProductVisible(flag)
}
}
const handleSelectActiveProducts = (params) => {
......
......@@ -131,7 +131,7 @@ const ReadyExamineOne = () => {
fetchRowkeys={(e) => setRowKeys(e)}
columns={columns}
effects="id"
rowKey="activityId"
// rowKey="activityId"
fetch={PublicApi.getMarketingPlatformActivitySignupPageTobeExamineStep1}
controllerBtns={controllerBtns}
schema={{
......
......@@ -131,7 +131,7 @@ const ReadyExamineTwo = () => {
fetchRowkeys={(e) => setRowKeys(e)}
columns={columns}
effects="id"
rowKey="activityId"
// rowKey="activityId"
fetch={PublicApi.getMarketingPlatformActivitySignupPageTobeExamineStep2}
controllerBtns={controllerBtns}
schema={{
......
......@@ -123,7 +123,7 @@ const ReadySubmit = () => {
reload={ref}
columns={columns}
effects="id"
rowKey="activityId"
// rowKey="activityId"
fetch={PublicApi.getMarketingPlatformActivitySignupPageTobeSubmitSignUp}
selectedRow={true}
fetchRowkeys={(e) => setRowKeys(e)}
......
......@@ -145,11 +145,16 @@ const ReadySubmitExamine = () => {
})
}
const getCheckboxProps = (record) => {
return { disabled: !record.id }
}
return (
<TableLayout
reload={ref}
selectedRow
fetchRowkeys={(e) => setRowKeys(e)}
getCheckboxProps={getCheckboxProps}
columns={columns}
effects="id"
rowKey="activityId"
......
......@@ -291,7 +291,7 @@ const AddedMarketing = () => {
<BasicInfoLayout form={form} focus$={focus$} isEdit={path === 'edit' ? true : false} />
<ShopLayout onGetShopList={handleGetShopList} onSetShopList={shopList} />
<RulesLayout form={form} focus$={focus$} />
{value !== 10 && (<ProductListLayout activityId={activityId && { activityId: activityId }} form={form} focus$={value} shopIdList={shopIdList} filterSkuId={filterSkuId} fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsPage} />)}
{value !== 10 && (<ProductListLayout itrue activityId={activityId && { activityId: activityId }} form={form} focus$={value} shopIdList={shopIdList} fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsPage} />)}
{value === 10 && (<PrizeListLayout form={form} prizeList={prizeList} focus$={value} />)}
<PartakeUserLayout onGetLevel={handleGetLevel} onSetLevel={memberLevelList} setMemberType={memberType} />
</Form>
......
......@@ -98,35 +98,35 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
)
}
}
/** 超限规则 */
const exceedRule = (int = 1) => {
switch (int) {
case 1:
case 2:
case 3:
case 8:
case 4:
case 5:
case 6:
case 7:
case 12:
case 13:
return (
<Form.Item
name={['activityDefined', 'exceedRule']}
tooltip="超限规则表示超过个人限购数量时,超出部分可以设定为原价购买,也可以设定为不可购买"
label="超限规则"
rules={[{ required: true, message: '请选择超限规则' }]}
>
<Radio.Group>
{OVERRUNRULETYPE(int)?.map(item => (
<Radio key={item.value} value={item.value}>{item.label}</Radio>
))}
</Radio.Group>
</Form.Item>
)
}
}
// /** 超限规则 */
// const exceedRule = (int = 1) => {
// switch (int) {
// case 1:
// case 2:
// case 3:
// case 8:
// case 4:
// case 5:
// case 6:
// case 7:
// case 12:
// case 13:
// return (
// <Form.Item
// name={['activityDefined', 'exceedRule']}
// tooltip="超限规则表示超过个人限购数量时,超出部分可以设定为原价购买,也可以设定为不可购买"
// label="超限规则"
// rules={[{ required: true, message: '请选择超限规则' }]}
// >
// <Radio.Group>
// {OVERRUNRULETYPE(int)?.map(item => (
// <Radio key={item.value} value={item.value}>{item.label}</Radio>
// ))}
// </Radio.Group>
// </Form.Item>
// )
// }
// }
/** 满量/满额/赠送促销类型 */
const type = (int = 1) => {
switch (int) {
......@@ -1018,7 +1018,7 @@ const RulesLayout: React.FC<RulesLayoutProps> = (props: any) => {
{allowActivity(option?.value)}
{allowCoupon(option?.value)}
{grouPing(option?.value)}
{exceedRule(option?.value)}
{/* {exceedRule(option?.value)} */}
{probation(option?.value)}
{lottery(option?.value)}
{advanceSale(option?.value)}
......
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