|
@@ -1,14 +1,24 @@
|
|
|
import { App, Button, Card, Form, Input, Modal, Select } from "antd";
|
|
|
import React from "react";
|
|
|
-import { LINKTYPE } from "./const";
|
|
|
+import { FANQIELINKTYPE, HUASHENGLINKTYPE, LINKTYPE, WENDINGLINKTYPE } from "./const";
|
|
|
import { PlusOutlined, MinusCircleOutlined } from "@ant-design/icons";
|
|
|
-import RechargeActivityLinkDTO from "./rechargeActivityLinkDTO";
|
|
|
-import BookPromoLinkCreateDTO from "./bookPromoLinkCreateDTO";
|
|
|
-import PagePromoLinkCreateDTO from "./pagePromoLinkCreateDTO";
|
|
|
-import ConsumeActivityLinkDTO from "./consumeActivityLinkDTO";
|
|
|
-import GiftActivityLinkDTO from "./giftActivityLinkDTO";
|
|
|
import { useAjax } from "@/Hook/useAjax";
|
|
|
import { addCorpAutoLinkApi } from "../../API/bookLink";
|
|
|
+import PagePromoLinkCreateDTO from "./components/yuewen/pagePromoLinkCreateDTO";
|
|
|
+import BookPromoLinkCreateDTO from "./components/yuewen/bookPromoLinkCreateDTO";
|
|
|
+import RechargeActivityLinkDTO from "./components/yuewen/rechargeActivityLinkDTO";
|
|
|
+import GiftActivityLinkDTO from "./components/yuewen/giftActivityLinkDTO";
|
|
|
+import ConsumeActivityLinkDTO from "./components/yuewen/consumeActivityLinkDTO";
|
|
|
+import PagePromoLinkCreateDTOFanQie from "./components/fanqie/pagePromoLinkCreateDTO";
|
|
|
+import BookPromoLinkCreateDTOFanqie from "./components/fanqie/bookPromoLinkCreateDTO";
|
|
|
+import RechargeActivityLinkDTOFanqie from "./components/fanqie/rechargeActivityLinkDTO";
|
|
|
+import GiftActivityLinkDTOFanQie from "./components/fanqie/giftActivityLinkDTO";
|
|
|
+import ConsumeActivityLinkDTOFanQie from "./components/fanqie/consumeActivityLinkDTO";
|
|
|
+import BookPromoLinkCreateDTOHuaSheng from './components/huasheng/bookPromoLinkCreateDTO'
|
|
|
+import RechargeActivityLinkDTOHuaSheng from './components/huasheng/rechargeActivityLinkDTO'
|
|
|
+import GiftActivityLinkDTOHuaSheng from './components/huasheng/giftActivityLinkDTO'
|
|
|
+import BookPromoLinkCreateDTOWenDing from './components/wending/bookPromoLinkCreateDTO'
|
|
|
+import RechargeActivityLinkDTOWenDing from './components/wending/rechargeActivityLinkDTO'
|
|
|
import dayJs from "dayjs";
|
|
|
|
|
|
interface Props {
|
|
@@ -33,6 +43,9 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
const { message } = App.useApp()
|
|
|
const [form] = Form.useForm();
|
|
|
const yueWenCreateLinkDTOList = Form.useWatch('yueWenCreateLinkDTOList', form)
|
|
|
+ const fanQieCreateLinkDTOList = Form.useWatch('fanQieCreateLinkDTOList', form)
|
|
|
+ const huaShengCreateLinkDTOList = Form.useWatch('huaShengCreateLinkDTOList', form)
|
|
|
+ const wenDingCreateLinkDTOList = Form.useWatch('wenDingCreateLinkDTOList', form)
|
|
|
const platform = Form.useWatch('platform', form)
|
|
|
const mpAccountIds = Form.useWatch('mpAccountIds', form)
|
|
|
|
|
@@ -42,26 +55,85 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
const handleOk = () => {
|
|
|
form.validateFields().then((values) => {
|
|
|
console.log(values)
|
|
|
- const params = {
|
|
|
- mpAccountIds: values.mpAccountIds,
|
|
|
- platform: values.platform,
|
|
|
- yueWenCreateLinkDTOList: values.yueWenCreateLinkDTOList.map(item => {
|
|
|
- const { linkType, pagePromoLinkCreateDTO, bookPromoLinkCreateDTO, rechargeActivityLinkDTO, consumeActivityLinkDTO, giftActivityLinkDTO, ...rest } = item
|
|
|
- if (linkType === '1') {
|
|
|
- return { ...rest, pagePromoLinkCreateDTO, linkType }
|
|
|
- } else if (linkType === '2') {
|
|
|
- return { ...rest, bookPromoLinkCreateDTO, linkType }
|
|
|
- } else if (linkType === '3') {
|
|
|
- const { activityTime, display, isDayRepeat, rechargeCount, ...ralDto } = rechargeActivityLinkDTO
|
|
|
- return { ...rest, rechargeActivityLinkDTO: { ...ralDto, rechargeCount, isDayRepeat: rechargeCount == 1 ? isDayRepeat : false, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
- } else if (linkType === '4') {
|
|
|
- const { activityTime, display, ...calDto } = giftActivityLinkDTO
|
|
|
- return { ...rest, giftActivityLinkDTO: { ...calDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
- } else if (linkType === '5') {
|
|
|
- const { activityTime, display, ...galDto } = consumeActivityLinkDTO
|
|
|
- return { ...rest, consumeActivityLinkDTO: { ...galDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
- }
|
|
|
- })
|
|
|
+ let params: { [x: string]: any } = {}
|
|
|
+ if (values?.platform === 'YUE_WEN') {
|
|
|
+ params = {
|
|
|
+ mpAccountIds: values.mpAccountIds,
|
|
|
+ platform: values.platform,
|
|
|
+ yueWenCreateLinkDTOList: values.yueWenCreateLinkDTOList.map(item => {
|
|
|
+ const { linkType, pagePromoLinkCreateDTO, bookPromoLinkCreateDTO, rechargeActivityLinkDTO, consumeActivityLinkDTO, giftActivityLinkDTO, ...rest } = item
|
|
|
+ if (linkType === '1') {
|
|
|
+ return { ...rest, pagePromoLinkCreateDTO, linkType }
|
|
|
+ } else if (linkType === '2') {
|
|
|
+ return { ...rest, bookPromoLinkCreateDTO, linkType }
|
|
|
+ } else if (linkType === '3') {
|
|
|
+ const { activityTime, display, isDayRepeat, rechargeCount, ...ralDto } = rechargeActivityLinkDTO
|
|
|
+ return { ...rest, rechargeActivityLinkDTO: { ...ralDto, rechargeCount, isDayRepeat: rechargeCount == 1 ? isDayRepeat : false, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
+ } else if (linkType === '4') {
|
|
|
+ const { activityTime, display, ...calDto } = giftActivityLinkDTO
|
|
|
+ return { ...rest, giftActivityLinkDTO: { ...calDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
+ } else if (linkType === '5') {
|
|
|
+ const { activityTime, display, ...galDto } = consumeActivityLinkDTO
|
|
|
+ return { ...rest, consumeActivityLinkDTO: { ...galDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else if (values?.platform === 'FAN_QIE') {
|
|
|
+ params = {
|
|
|
+ mpAccountIds: values.mpAccountIds,
|
|
|
+ platform: values.platform,
|
|
|
+ fanQieCreateLinkDTOList: values.fanQieCreateLinkDTOList.map(item => {
|
|
|
+ const { linkType, pagePromoLinkCreateDTO, bookPromoLinkCreateDTO, rechargeActivityLinkDTO, consumeActivityLinkDTO, giftActivityLinkDTO, ...rest } = item
|
|
|
+ if (linkType === '1') {
|
|
|
+ return { ...rest, pagePromoLinkCreateDTO, linkType }
|
|
|
+ } else if (linkType === '2') {
|
|
|
+ return { ...rest, bookPromoLinkCreateDTO, linkType }
|
|
|
+ } else if (linkType === '3') {
|
|
|
+ const { activityTime, ...ralDto } = rechargeActivityLinkDTO
|
|
|
+ return { ...rest, rechargeActivityLinkDTO: { ...ralDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD') }, linkType }
|
|
|
+ } else if (linkType === '4') {
|
|
|
+ const { activityTime, ...calDto } = giftActivityLinkDTO
|
|
|
+ return { ...rest, giftActivityLinkDTO: { ...calDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD') }, linkType }
|
|
|
+ } else if (linkType === '5') {
|
|
|
+ const { activityTime, ...galDto } = consumeActivityLinkDTO
|
|
|
+ return { ...rest, consumeActivityLinkDTO: { ...galDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD') }, linkType }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else if (values?.platform === 'HUA_SHENG') {
|
|
|
+ params = {
|
|
|
+ mpAccountIds: values.mpAccountIds,
|
|
|
+ platform: values.platform,
|
|
|
+ huaShengCreateLinkDTOList: values.huaShengCreateLinkDTOList.map(item => {
|
|
|
+ const { linkType, bookPromoLinkCreateDTO, rechargeActivityLinkDTO, giftActivityLinkDTO, ...rest } = item
|
|
|
+ if (linkType === '1') {
|
|
|
+ return { ...rest, bookPromoLinkCreateDTO, linkType }
|
|
|
+ } else if (linkType === '2') {
|
|
|
+ const { activityTime, display, rechargeAmount, giftAmount, ...ralDto } = rechargeActivityLinkDTO
|
|
|
+ return { ...rest, rechargeActivityLinkDTO: { ...ralDto, productName: rechargeAmount + '-' + giftAmount, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
+ } else if (linkType === '3') {
|
|
|
+ const { activityTime, display, rechargeAmount, giftAmount, ...ralDto } = giftActivityLinkDTO
|
|
|
+ return { ...rest, giftActivityLinkDTO: { ...ralDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else if (values?.platform === 'WEN_DING') {
|
|
|
+ params = {
|
|
|
+ mpAccountIds: values.mpAccountIds,
|
|
|
+ platform: values.platform,
|
|
|
+ wenDingCreateLinkDTOList: values.wenDingCreateLinkDTOList.map(item => {
|
|
|
+ const { linkType, bookPromoLinkCreateDTO, rechargeActivityLinkDTO, giftActivityLinkDTO, ...rest } = item
|
|
|
+ if (linkType === '1') {
|
|
|
+ return { ...rest, bookPromoLinkCreateDTO, linkType }
|
|
|
+ } else if (linkType === '2') {
|
|
|
+ const { activityTime, ...ralDto } = rechargeActivityLinkDTO
|
|
|
+ return { ...rest, rechargeActivityLinkDTO: { ...ralDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD') }, linkType }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ message.error('当前书城占不支持')
|
|
|
+ return
|
|
|
}
|
|
|
addCorpAutoLink.run(params).then(res => {
|
|
|
if (res?.data) {
|
|
@@ -108,6 +180,17 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
}
|
|
|
allowClear
|
|
|
options={bookPlatForm.map(item => ({ value: item.platformKey, label: item.platformName }))}
|
|
|
+ onChange={(e) => {
|
|
|
+ if (e === 'YUE_WEN') {
|
|
|
+ form.setFieldsValue({ yueWenCreateLinkDTOList: [{}] })
|
|
|
+ } else if (e === 'FAN_QIE') {
|
|
|
+ form.setFieldsValue({ fanQieCreateLinkDTOList: [{}] })
|
|
|
+ } else if (e === 'HUA_SHENG') {
|
|
|
+ form.setFieldsValue({ huaShengCreateLinkDTOList: [{}] })
|
|
|
+ } else if (e === 'WEN_DING') {
|
|
|
+ form.setFieldsValue({ wenDingCreateLinkDTOList: [{}] })
|
|
|
+ }
|
|
|
+ }}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
<Form.Item label={<strong>公众号</strong>} name="mpAccountIds" rules={[{ required: true, message: '请选择公众号!' }]}>
|
|
@@ -124,7 +207,7 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
</Form.Item>
|
|
|
</Card>
|
|
|
<DispatchBookLink.Provider value={{ form }}>
|
|
|
- <Form.List name="yueWenCreateLinkDTOList">
|
|
|
+ {platform === 'YUE_WEN' ? <Form.List name="yueWenCreateLinkDTOList">
|
|
|
{(fields, { add, remove }) => (
|
|
|
<>
|
|
|
{fields.map(({ key, name, ...restField }, index) => {
|
|
@@ -257,7 +340,320 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
</Form.Item>
|
|
|
</>
|
|
|
)}
|
|
|
- </Form.List>
|
|
|
+ </Form.List> : platform === "FAN_QIE" ? <Form.List name="fanQieCreateLinkDTOList">
|
|
|
+ {(fields, { add, remove }) => (
|
|
|
+ <>
|
|
|
+ {fields.map(({ key, name, ...restField }, index) => {
|
|
|
+ const fanQieCreateLinkDTO = fanQieCreateLinkDTOList?.[index]
|
|
|
+ return <Card
|
|
|
+ title={<strong>链接信息配置{index + 1}</strong>}
|
|
|
+ style={{ background: '#fff', marginBottom: 10 }}
|
|
|
+ key={key}
|
|
|
+ extra={fanQieCreateLinkDTOList?.length > 1 ? <div style={{ color: 'red' }} onClick={() => remove(name)}>
|
|
|
+ <MinusCircleOutlined />
|
|
|
+ </div> : undefined}
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'linkType']}
|
|
|
+ label={<strong>链接类型</strong>}
|
|
|
+ rules={[{ required: true, message: '请选择链接类型!' }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ placeholder="链接类型"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ allowClear
|
|
|
+ options={Object.keys(FANQIELINKTYPE).map(key => ({ label: FANQIELINKTYPE[key], value: key }))}
|
|
|
+ onChange={(e) => {
|
|
|
+ if (e === '1') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ fanQieCreateLinkDTOList: fanQieCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName } = item
|
|
|
+ return { channelName, linkType: '1', pagePromoLinkCreateDTO: {} }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '2') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ fanQieCreateLinkDTOList: fanQieCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName } = item
|
|
|
+ return { channelName, linkType: '2', bookPromoLinkCreateDTO: {} }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '3') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ fanQieCreateLinkDTOList: fanQieCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName } = item
|
|
|
+ return { channelName, linkType: '3', rechargeActivityLinkDTO: { rechargeCount: -1 } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '4') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ fanQieCreateLinkDTOList: fanQieCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName } = item
|
|
|
+ return { channelName, linkType: '4', giftActivityLinkDTO: { rechargeCount: 1 } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '5') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ fanQieCreateLinkDTOList: fanQieCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName } = item
|
|
|
+ return { channelName, linkType: '5', consumeActivityLinkDTO: { rechargeCount: 1, activityFrequencies: 2 } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'channelName']}
|
|
|
+ label={<strong>渠道名称</strong>}
|
|
|
+ rules={[{ required: true, message: '请输入渠道名称!' }]}
|
|
|
+ >
|
|
|
+ <Input placeholder="请输入渠道名称" allowClear />
|
|
|
+ </Form.Item>
|
|
|
+ {fanQieCreateLinkDTO?.linkType === '1' ? <PagePromoLinkCreateDTOFanQie restField={restField} name={name} /> :
|
|
|
+ fanQieCreateLinkDTO?.linkType === '2' ? <BookPromoLinkCreateDTOFanqie restField={restField} name={name} platform={platform} /> :
|
|
|
+ fanQieCreateLinkDTO?.linkType === '3' ? <RechargeActivityLinkDTOFanqie restField={restField} name={name} /> :
|
|
|
+ fanQieCreateLinkDTO?.linkType === '4' ? <GiftActivityLinkDTOFanQie restField={restField} name={name} vipDuration={fanQieCreateLinkDTO?.giftActivityLinkDTO?.vipDuration} /> :
|
|
|
+ fanQieCreateLinkDTO?.linkType === '5' ? <ConsumeActivityLinkDTOFanQie restField={restField} name={name} /> :
|
|
|
+ undefined}
|
|
|
+ </Card>
|
|
|
+ })}
|
|
|
+ <Form.Item>
|
|
|
+ <Button type="dashed" onClick={() => add({})} block icon={<PlusOutlined />}>
|
|
|
+ 新增链接信息配置
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Form.List> : platform === 'HUA_SHENG' ? <Form.List name="huaShengCreateLinkDTOList">
|
|
|
+ {(fields, { add, remove }) => (
|
|
|
+ <>
|
|
|
+ {fields.map(({ key, name, ...restField }, index) => {
|
|
|
+ const huaShengCreateLinkDTO = huaShengCreateLinkDTOList?.[index]
|
|
|
+ return <Card
|
|
|
+ title={<strong>链接信息配置{index + 1}</strong>}
|
|
|
+ style={{ background: '#fff', marginBottom: 10 }}
|
|
|
+ key={key}
|
|
|
+ extra={huaShengCreateLinkDTOList?.length > 1 ? <div style={{ color: 'red' }} onClick={() => remove(name)}>
|
|
|
+ <MinusCircleOutlined />
|
|
|
+ </div> : undefined}
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'linkType']}
|
|
|
+ label={<strong>链接类型</strong>}
|
|
|
+ rules={[{ required: true, message: '请选择链接类型!' }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ placeholder="链接类型"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ allowClear
|
|
|
+ options={Object.keys(HUASHENGLINKTYPE).map(key => ({ label: HUASHENGLINKTYPE[key], value: key }))}
|
|
|
+ onChange={(e) => {
|
|
|
+ if (e === '1') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ huaShengCreateLinkDTOList: huaShengCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName, channelType } = item
|
|
|
+ return { channelName, channelType, linkType: '1', bookPromoLinkCreateDTO: { cost: 0 } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '2') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ huaShengCreateLinkDTOList: huaShengCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName, channelType } = item
|
|
|
+ return { channelName, channelType, linkType: '2', rechargeActivityLinkDTO: { status: 'normal', chargeType: 0, userType: 1, charge: 0, commonType: 0, display: ['stack', 'read_footer_text'] } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '3') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ huaShengCreateLinkDTOList: huaShengCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName } = item
|
|
|
+ return { channelName, linkType: '3', giftActivityLinkDTO: { status: 'normal', freeAmount: 50, userType: 1, charge: 0, commonType: 0, display: ['stack', 'read_footer_text'] } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'channelName']}
|
|
|
+ label={<strong>渠道名称</strong>}
|
|
|
+ rules={[{ required: true, message: '请输入渠道名称!' }]}
|
|
|
+ >
|
|
|
+ <Input placeholder="请输入渠道名称" allowClear />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'channelType']}
|
|
|
+ label={<strong>推广类型</strong>}
|
|
|
+ rules={[{ required: huaShengCreateLinkDTO?.linkType == 1 ? true : false, message: '请选择推广类型!' }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ placeholder="推广类型"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ allowClear
|
|
|
+ options={[{ label: '外部', value: '1' }, { label: '内部', value: '2' }]}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ {huaShengCreateLinkDTO?.linkType === '1' ? <BookPromoLinkCreateDTOHuaSheng restField={restField} name={name} platform={platform} mpAccountIds={mpAccountIds} huaShengCreateLinkDTO={huaShengCreateLinkDTO} /> :
|
|
|
+ huaShengCreateLinkDTO?.linkType === '2' ? <RechargeActivityLinkDTOHuaSheng restField={restField} name={name} itemData={huaShengCreateLinkDTO} /> :
|
|
|
+ huaShengCreateLinkDTO?.linkType === '3' ? <GiftActivityLinkDTOHuaSheng restField={restField} name={name} itemData={huaShengCreateLinkDTO} /> :
|
|
|
+ undefined}
|
|
|
+ </Card>
|
|
|
+ })}
|
|
|
+ <Form.Item>
|
|
|
+ <Button type="dashed" onClick={() => add({})} block icon={<PlusOutlined />}>
|
|
|
+ 新增链接信息配置
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Form.List> : platform === 'WEN_DING' ? <Form.List name="wenDingCreateLinkDTOList">
|
|
|
+ {(fields, { add, remove }) => (
|
|
|
+ <>
|
|
|
+ {fields.map(({ key, name, ...restField }, index) => {
|
|
|
+ const wenDingCreateLinkDTO = wenDingCreateLinkDTOList?.[index]
|
|
|
+ return <Card
|
|
|
+ title={<strong>链接信息配置{index + 1}</strong>}
|
|
|
+ style={{ background: '#fff', marginBottom: 10 }}
|
|
|
+ key={key}
|
|
|
+ extra={wenDingCreateLinkDTOList?.length > 1 ? <div style={{ color: 'red' }} onClick={() => remove(name)}>
|
|
|
+ <MinusCircleOutlined />
|
|
|
+ </div> : undefined}
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'linkType']}
|
|
|
+ label={<strong>链接类型</strong>}
|
|
|
+ rules={[{ required: true, message: '请选择链接类型!' }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ placeholder="链接类型"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ allowClear
|
|
|
+ options={Object.keys(WENDINGLINKTYPE).map(key => ({ label: WENDINGLINKTYPE[key], value: key }))}
|
|
|
+ onChange={(e) => {
|
|
|
+ if (e === '1') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ wenDingCreateLinkDTOList: wenDingCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName, channelType } = item
|
|
|
+ return { channelName, channelType, linkType: '1', bookPromoLinkCreateDTO: { qrcodeOpenStatus: 0, linkClassify: '3' } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ } else if (e === '2') {
|
|
|
+ setTimeout(() => {
|
|
|
+ form.setFieldsValue({
|
|
|
+ wenDingCreateLinkDTOList: wenDingCreateLinkDTOList.map((item, i) => {
|
|
|
+ if (index === i) {
|
|
|
+ const { channelName, channelType } = item
|
|
|
+ return { channelName, channelType, linkType: '2', rechargeActivityLinkDTO: { userGroup: 0, hideCountDown: 0 } }
|
|
|
+ }
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'channelName']}
|
|
|
+ label={<strong>渠道名称</strong>}
|
|
|
+ rules={[{ required: true, message: '请输入渠道名称!' }]}
|
|
|
+ >
|
|
|
+ <Input placeholder="请输入渠道名称" allowClear />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ {...restField}
|
|
|
+ name={[name, 'channelType']}
|
|
|
+ label={<strong>推广类型</strong>}
|
|
|
+ rules={[{ required: true, message: '请选择推广类型!' }]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ placeholder="推广类型"
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ allowClear
|
|
|
+ options={[{ label: '内推', value: 0 }, { label: '派单', value: 1 }]}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ {wenDingCreateLinkDTO?.linkType === '1' ? <BookPromoLinkCreateDTOWenDing restField={restField} name={name} platform={platform} mpAccountIds={mpAccountIds} wenDingCreateLinkDTO={wenDingCreateLinkDTO} /> :
|
|
|
+ wenDingCreateLinkDTO?.linkType === '2' ? <RechargeActivityLinkDTOWenDing restField={restField} name={name} /> :
|
|
|
+ undefined}
|
|
|
+ </Card>
|
|
|
+ })}
|
|
|
+ <Form.Item>
|
|
|
+ <Button type="dashed" onClick={() => add({})} block icon={<PlusOutlined />}>
|
|
|
+ 新增链接信息配置
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Form.List> : undefined}
|
|
|
+
|
|
|
</DispatchBookLink.Provider>
|
|
|
</Form>
|
|
|
</Modal>
|