Browse Source

优化快速活动

tags/小炒逻辑变更前
yangwenhua 2 years ago
parent
commit
3294f6299e
8 changed files with 84 additions and 57 deletions
  1. +2
    -1
      src/pages/activity/activityStart/components/CouponDelivery/index.jsx
  2. +2
    -1
      src/pages/activity/activityStart/components/FreeCouponMoney/index.jsx
  3. +2
    -1
      src/pages/activity/activityStart/components/FreeGoodsMoney/index.jsx
  4. +2
    -1
      src/pages/activity/activityStart/components/FullDecrement/index.jsx
  5. +1
    -0
      src/pages/activity/activityStart/components/LadderExchange/index.jsx
  6. +2
    -1
      src/pages/activity/activityStart/components/PriceIncrease/index.jsx
  7. +2
    -1
      src/pages/activity/activityStart/components/SpecialOffer/index.jsx
  8. +71
    -51
      src/pages/activity/activityStart/index.jsx

+ 2
- 1
src/pages/activity/activityStart/components/CouponDelivery/index.jsx View File

@@ -50,7 +50,7 @@ const activityConfigArray = [
},
]

const CouponDelivery = () => {
const CouponDelivery = (props) => {
const [form] = Form.useForm();
const [couponInfo, SetCouponInfo] = useState([]);
const [couponForm] = Form.useForm();
@@ -282,6 +282,7 @@ const CouponDelivery = () => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
couponForm.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 2
- 1
src/pages/activity/activityStart/components/FreeCouponMoney/index.jsx View File

@@ -103,7 +103,7 @@ const tailFormItemLayout = {
* @returns
*/

const FreeCouponMoney = () => {
const FreeCouponMoney = (props) => {

const [couponInfo, SetCouponInfo] = useState([]);
/**
@@ -353,6 +353,7 @@ const FreeCouponMoney = () => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
couponForm.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 2
- 1
src/pages/activity/activityStart/components/FreeGoodsMoney/index.jsx View File

@@ -85,7 +85,7 @@ const activityConfigArray = [
* 买满赠送(商品)
* @returns
*/
const FreeGoodsMoney = () => {
const FreeGoodsMoney = (props) => {

/** 适用商品范围 */
const [applyGood, setApplyGood] = useState([]);
@@ -269,6 +269,7 @@ const FreeGoodsMoney = () => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
couponForm.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 2
- 1
src/pages/activity/activityStart/components/FullDecrement/index.jsx View File

@@ -85,7 +85,7 @@ const activityConfigArray = [
* 买满减现
* @returns
*/
const FullDecrement = () => {
const FullDecrement = (props) => {

const [form] = Form.useForm();
const [imgurl, setimgUrl] = useState(null);
@@ -249,6 +249,7 @@ const FullDecrement = () => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
form.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 1
- 0
src/pages/activity/activityStart/components/LadderExchange/index.jsx View File

@@ -350,6 +350,7 @@ const LadderExchange = (props) => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
couponForm.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 2
- 1
src/pages/activity/activityStart/components/PriceIncrease/index.jsx View File

@@ -86,7 +86,7 @@ const activityConfigArray = [
* @returns
*/

const PriceIncrease = () => {
const PriceIncrease = (props) => {

const [couponForm] = Form.useForm();
const [imgurl, setimgUrl] = useState(null);
@@ -271,6 +271,7 @@ const PriceIncrease = () => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
couponForm.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 2
- 1
src/pages/activity/activityStart/components/SpecialOffer/index.jsx View File

@@ -37,7 +37,7 @@ const activityConfigArray = [
* 特价商品
* @returns
*/
const SpecialOffer = () => {
const SpecialOffer = (props) => {

const [form] = Form.useForm();
const [imgurl, setimgUrl] = useState(null);
@@ -116,6 +116,7 @@ const SpecialOffer = () => {
if (response.statusCode === 200) {
message.success('新建活动成功!');
form.resetFields();
props.onSuccessCreate && props.onSuccessCreate();
} else {
message.error(response.errors || '创建失败 请重试!');
}


+ 71
- 51
src/pages/activity/activityStart/index.jsx View File

@@ -1,6 +1,6 @@
import React, { useState } from "react";
import { PageContainer } from '@ant-design/pro-layout';
import { Card, Form, Select } from 'antd';
import { Card, Form, Select, Result, Button } from 'antd';
import styles from "./index.less";
import CouponDelivery from "./components/CouponDelivery";
import FullDecrement from "./components/FullDecrement";
@@ -12,6 +12,7 @@ import PriceIncrease from "./components/PriceIncrease";

const { Option } = Select;


/**
* 活动快速开始
* @returns
@@ -20,60 +21,79 @@ const ActivityStart = () => {

const activityForm = Form.useForm();
const [currentActivityType, setCurrentActivityType] = useState(1);
const onSuccessCreate = () => {
setCurrentActivityType(0);
}

const SuccessResult = () => {
return <Result
status="success"
title="创建成功!"
subTitle="活动创建成功!"
extra={[
<Button type="primary" key="console" onClick={() => setCurrentActivityType(1)}>
再次创建
</Button>,
]}
/>
}

return <PageContainer>
<Card className={styles.activity_start_container}>
<div className={styles.head_row}>
<div className={styles.head_row_prev}>
活动类型:
{
currentActivityType > 0 && <div className={styles.head_row}>
<div className={styles.head_row_prev}>
活动类型:
</div>
<Select
showSearch
optionFilterProp="children"
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
placeholder="请选择活动类型"
style={{ width: '600px' }}
onChange={(value) => {
setCurrentActivityType(value);
}}
value={currentActivityType}
>
<Option key={1} value={1}>
{'送券'}
</Option>
<Option key={2} value={2}>
{'买满减现'}
</Option>
<Option key={3} value={3}>
{'特价商品'}
</Option>
<Option key={4} value={4}>
{'买满赠送(优惠券)'}
</Option>
<Option key={5} value={5}>
{'买满赠送(商品)'}
</Option>
<Option key={6} value={6}>
{'累计消费换购(阶梯)'}
</Option>
<Option key={7} value={7}>
{'累计消费换购(循环)'}
</Option >
<Option key={8} value={8}>
{'加价换购'}
</Option>
</Select>
</div>
<Select
showSearch
optionFilterProp="children"
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
placeholder="请选择活动类型"
style={{ width: '600px' }}
onChange={(value) => {
setCurrentActivityType(value);
}}
value={currentActivityType}
>
<Option key={1} value={1}>
{'送券'}
</Option>
<Option key={2} value={2}>
{'买满减现'}
</Option>
<Option key={3} value={3}>
{'特价商品'}
</Option>
<Option key={4} value={4}>
{'买满赠送(优惠券)'}
</Option>
<Option key={5} value={5}>
{'买满赠送(商品)'}
</Option>
<Option key={6} value={6}>
{'累计消费换购(阶梯)'}
</Option>
<Option key={7} value={7}>
{'累计消费换购(循环)'}
</Option >
<Option key={8} value={8}>
{'加价换购'}
</Option>
</Select>
</div>
{currentActivityType === 1 && <CouponDelivery></CouponDelivery>}
{currentActivityType === 2 && <FullDecrement></FullDecrement>}
{currentActivityType === 3 && <SpecialOffer></SpecialOffer>}
{currentActivityType === 4 && <FreeCouponMoney></FreeCouponMoney>}
{currentActivityType === 5 && <FreeGoodsMoney></FreeGoodsMoney>}
{currentActivityType === 6 && <LadderExchange currentActivityType={currentActivityType}></LadderExchange>}
{currentActivityType === 7 && <LadderExchange currentActivityType={currentActivityType}></LadderExchange>}
{currentActivityType === 8 && <PriceIncrease></PriceIncrease>}
}
{currentActivityType === 1 && <CouponDelivery onSuccessCreate={onSuccessCreate}></CouponDelivery>}
{currentActivityType === 2 && <FullDecrement onSuccessCreate={onSuccessCreate}></FullDecrement>}
{currentActivityType === 3 && <SpecialOffer onSuccessCreate={onSuccessCreate}></SpecialOffer>}
{currentActivityType === 4 && <FreeCouponMoney onSuccessCreate={onSuccessCreate}></FreeCouponMoney>}
{currentActivityType === 5 && <FreeGoodsMoney onSuccessCreate={onSuccessCreate}></FreeGoodsMoney>}
{currentActivityType === 6 && <LadderExchange onSuccessCreate={onSuccessCreate} currentActivityType={currentActivityType}></LadderExchange>}
{currentActivityType === 7 && <LadderExchange onSuccessCreate={onSuccessCreate} currentActivityType={currentActivityType}></LadderExchange>}
{currentActivityType === 8 && <PriceIncrease onSuccessCreate={onSuccessCreate}></PriceIncrease>}
{currentActivityType === 0 && <SuccessResult></SuccessResult>}
</Card>
</PageContainer >
}


Loading…
Cancel
Save