Commit 711c8033 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

feat(平台活动报名): 填写报名资料

parent afddf914
......@@ -78,7 +78,7 @@ const memberCenterRoute = {
// MemberRoute,
// HandlingRoute,
marketingRoute,
// ...asyncRoutes,
...asyncRoutes,
{
path: '/memberCenter/noAuth',
auth: false,
......
......@@ -59,7 +59,6 @@ const GlobalHeaderRight: React.FC<{ SiteStore?: any }> = (props) => {
// ws.current.onopen = (e) => {}
ws.current.onmessage = (e) => {
const data: WsMessage = JSON.parse(e.data);
console.log(data);
if (data.action === 'purchase_bidding_message_supplier') {
setPurchaseBiddingMessageSupplier(data)
} else if (data.action === 'purchase_bidding_message') {
......@@ -73,7 +72,7 @@ const GlobalHeaderRight: React.FC<{ SiteStore?: any }> = (props) => {
if (data.action === 'msg_no_read_message') {
setMessage(+data.data);
}
};
ws.current.onclose = (e) => {
console.log("关闭连接")
......
......@@ -35,6 +35,10 @@ interface Iprops {
interiorStatusFetch?: Promise<unknown>,
/** 状态选择接口 */
useStateEffects?: () => void,
/** rowKey */
rowKey?: string,
/** 禁用 */
getCheckboxProps?: (record: any) => void,
}
const formActions = createFormActions();
const Table: React.FC<Iprops> = (props: any) => {
......@@ -50,6 +54,8 @@ const Table: React.FC<Iprops> = (props: any) => {
externalStatusFetch,
interiorStatusFetch,
useStateEffects,
rowKey,
getCheckboxProps
} = props;
const tableRef = useRef<any>({});
......@@ -76,14 +82,10 @@ const Table: React.FC<Iprops> = (props: any) => {
const rowSelection: TableRowSelection<any> = {
selectedRowKeys: selectedRowKeys,
onChange: (rowKeys: any) => {
console.log(rowKeys, 98)
fetchRowkeys(rowKeys)
setSelectedRowKeys(rowKeys);
},
getCheckboxProps: (record: any) => {
console.log(record)
return {}
}
getCheckboxProps: (record) => getCheckboxProps && getCheckboxProps(record)
}
useImperativeHandle(reload, () => ({
......@@ -126,7 +128,7 @@ const Table: React.FC<Iprops> = (props: any) => {
<StandardTable
currentRef={tableRef}
columns={columns}
tableProps={{ rowKey: 'id' }}
tableProps={{ rowKey: rowKey ? rowKey : 'id' }}
rowSelection={selectedRow && rowSelection}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
......
......@@ -32,17 +32,17 @@ const GeneralLayout: React.FC<GeneraInfoProps> = (props: any) => {
{effect.length > count && effect.map((item, index) => (
<Col key={`effect_${index + 1}`} span={8}>
{item.col.map((it, idx) => (
<Fragment>
<Fragment key={`effect_col_${idx + 1}`}>
{visible ? <>
{it.extra && (
<div className={style.cell} key={`effect_col_${idx + 1}`}>
<div className={style.cell}>
<h5 className={style.label}>{it.label}: </h5>
<h5 className={style.content}>{it.extra}</h5>
</div>
)}
</>
:
<div className={style.cell} key={`effect_col_${idx + 1}`}>
<div className={style.cell}>
<h5 className={style.label}>{it.label}: </h5>
<h5 className={style.content}>{it.extra}</h5>
</div>
......
......@@ -3,6 +3,7 @@ import { Table } from 'antd';
import { StandardTable } from 'god';
import { ColumnType } from 'antd/lib/table/interface';
import Card from '../../../card';
import { isEmpty } from 'lodash';
export interface ListLayoutIProps {
/** 锚点 */
......@@ -19,16 +20,18 @@ export interface ListLayoutIProps {
done?: boolean,
/** 展示的数据 */
data?: [],
/** ids */
ids?: Object,
}
const ListLayout: React.FC<ListLayoutIProps> = (props: any) => {
const { anchor, id, title, columns, fetch, done, data } = props;
const { anchor, id, title, columns, fetch, done, data, ids } = props;
const currentRef = useRef({});
const fetchTableData = (params: any) => {
return new Promise(resolve => {
if (fetch) {
fetch({ id, ...params }).then((res: any) => {
if (fetch && (ids || id)) {
fetch({ id, ...ids, ...params }).then((res: any) => {
resolve(res.data)
})
} else {
......
......@@ -128,6 +128,10 @@ const WaitAddOffer = () => {
}
]
const getCheckboxProps = (record) => {
return { disabled: !record.isBatch }
}
return (
<Table
selectedRow
......@@ -139,6 +143,7 @@ const WaitAddOffer = () => {
externalStatusFetch={PublicApi.getTransactionProductInquiryExternalStateEnum({ type: '2' })}
interiorStatusFetch={PublicApi.getTransactionProductInquiryInteriorStateEnum({ type: '2' })}
fetchRowkeys={(e) => setRowKeys(e)}
getCheckboxProps={getCheckboxProps}
controllerBtns={
<Row>
<Col span={24}>
......
......@@ -26,7 +26,17 @@ const layout: any = {
const AddFormGoods: React.FC<AddFormGoodsProps> = (props: any) => {
const { currentRef, layoutId, layoutTitle, ruleType } = props;
const [form] = Form.useForm();
const [dataSource, setDataSource] = useState<any>([]);
const [dataSource, setDataSource] = useState<any>([{
goodsId: 1,
goodsName: '111',
category: '111',
brand: '111',
unit: '1111',
price: '20',
activityPrice: '',
selfCount: '',
total: '',
}]);
const [visible, setVisible] = useState<boolean>(false);
const [couponVisible, setCouponVisible] = useState<boolean>(false);
const [giveCouponVisible, setGiveCouponVisible] = useState<boolean>(false);
......@@ -44,6 +54,7 @@ const AddFormGoods: React.FC<AddFormGoodsProps> = (props: any) => {
setDataSource,
deleteRow: _deleteRow
}
console.log(TableModel[`type${ruleType}`]?.(_obj), 10086)
return TableModel[`type${ruleType}`]?.(_obj)
}, [ruleType, dataSource, setDataSource, _deleteRow])
......@@ -88,11 +99,11 @@ const AddFormGoods: React.FC<AddFormGoodsProps> = (props: any) => {
effects='name'
onClose={() => { setVisible(false) }}
/>
<AddCouponsDrawer
<AddCouponsDrawer
visible={couponVisible}
onClose={() => { setCouponVisible(false) }}
/>
<GiveCouponDrawer
<GiveCouponDrawer
visible={giveCouponVisible}
onClose={() => { setGiveCouponVisible(false) }}
/>
......
......@@ -376,63 +376,3 @@ export const GeneralEffect = (int, data) => {
}
}
/** 活动商品columns */
export const Columns = (int) => {
switch (Number(int)) {
case 1:
return [
{
title: '商品图片',
key: '',
dataIndex: '',
},
{
title: '商品ID',
key: 'productId',
dataIndex: 'productId',
},
{
title: '商品名称',
key: 'productName',
dataIndex: 'productName',
},
{
title: '品类',
key: 'category',
dataIndex: 'category',
},
{
title: '品牌',
key: 'brand',
dataIndex: 'brand',
},
{
title: '单位',
key: 'unit',
dataIndex: 'unit',
},
{
title: '商品价格',
key: 'price',
dataIndex: 'price',
},
{
title: <Tooltip placement="top" title="活动价格表示商城直接以该商品的活动价格进行销售">
活动价格 <QuestionCircleOutlined />
</Tooltip>,
key: 'activityPrice',
dataIndex: 'activityPrice',
},
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum',
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum',
},
]
}
}
import React, { Fragment, useCallback, useState } from 'react';
import { Space, Tooltip } from 'antd';
import { Tooltip } from 'antd';
import { history } from 'umi';
import { Context } from '@/pages/transaction/components/detailLayout/components/context';
import PeripheralLayout from '@/pages/transaction/components/detailLayout';
......@@ -11,7 +11,6 @@ import BasicLayout from '@/pages/transaction/components/detailLayout/components/
import moment from 'moment';
import { useEffect } from 'react';
import { ACTIVITYTYPENAME, GeneralEffect } from './constants';
import StatusTag from '@/components/StatusTag';
import ActivityUserLayout from '../../components/activityUserLayout';
import DemandLayout from '../../components/demandLayout';
import ListLayout from '@/pages/transaction/components/detailLayout/components/listLayout';
......@@ -19,6 +18,7 @@ import { ColumnType } from 'antd/lib/table/interface';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
import { stringify } from 'query-string';
const TABLINK = [
{ id: 'progressLayout', title: '流转进度' },
......@@ -31,7 +31,7 @@ const TABLINK = [
]
const DetialLayout = () => {
const { query: { activityId }, pathname } = history.location;
const { query: { activityId, signUpId }, pathname } = history.location;
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const [pathPci] = useState(pathname.split('/')[pathname.split('/').length - 2]);
const format = (text, fmt?: string) => {
......@@ -157,6 +157,7 @@ const DetialLayout = () => {
// handleGeneralEffect(_data);
}, [])
console.log(typeof JSON.parse(signUpId))
return (
<Context.Provider value={dataSource}>
<PeripheralLayout
......@@ -175,8 +176,9 @@ const DetialLayout = () => {
/>
<ListLayout
anchor="activityProductLayout"
id={1}
ids={signUpId !== 'null' && { signUpId }}
title="活动商品"
fetch={PublicApi.getMarketingPlatformActivitySignupDetailGoodsPage}
columns={columns}
/>
<ActivityUserLayout />
......
import React, { Fragment, useCallback, useState } from 'react';
import { Space, Tooltip } from 'antd';
import { history } from 'umi';
import { Button, message } from 'antd';
import { history, Prompt } from 'umi';
import { Context } from '@/pages/transaction/components/detailLayout/components/context';
import PeripheralLayout from '@/pages/transaction/components/detailLayout';
import ProgressLayout from '@/pages/transaction/components/detailLayout/components/progressLayout';
......@@ -10,15 +10,12 @@ import BasicLayout from '@/pages/transaction/components/detailLayout/components/
import moment from 'moment';
import { useEffect } from 'react';
import { ACTIVITYTYPENAME, GeneralEffect } from './constants';
import StatusTag from '@/components/StatusTag';
import ActivityUserLayout from '../../components/activityUserLayout';
import DemandLayout from '../../components/demandLayout';
import ListLayout from '@/pages/transaction/components/detailLayout/components/listLayout';
import { ColumnType } from 'antd/lib/table/interface';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api';
import { isEmpty } from 'lodash';
import ProductListLayout from './components/productListLayout';
import { SaveOutlined } from '@ant-design/icons';
const TABLINK = [
{ id: 'progressLayout', title: '流转进度' },
......@@ -31,9 +28,10 @@ const TABLINK = [
]
const DetialLayout = () => {
const { query: { activityId }, pathname } = history.location;
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const [pathPci] = useState(pathname.split('/')[pathname.split('/').length - 2]);
const { query: { activityId } } = history.location;
const [loading, setLoading] = useState<boolean>(false)
const [unsaved, setUnsaved] = useState<boolean>(false);
const [productList, setProductList] = useState<any[]>([]);
const format = (text, fmt?: string) => {
return <>{moment(text).format(fmt || "YYYY-MM-DD HH:mm:ss")}</>
}
......@@ -41,7 +39,6 @@ const DetialLayout = () => {
const [basicEffect, setBasicEffect] = useState<any>([]);
const [generalEffect, setGeneralEffect] = useState<any>([]);
const handleBasicEffect = (data: any) => {
setBasicEffect([
{
......@@ -74,61 +71,6 @@ const DetialLayout = () => {
}
}
const columns: ColumnType<any>[] = [
{
title: '商品图片',
key: '',
dataIndex: '',
},
{
title: '商品ID',
key: '',
dataIndex: '',
},
{
title: '商品名称',
key: '',
dataIndex: '',
},
{
title: '品类',
key: '',
dataIndex: '',
},
{
title: '品牌',
key: '',
dataIndex: '',
},
{
title: '单位',
key: '',
dataIndex: '',
},
{
title: '商品价格',
key: '',
dataIndex: '',
},
{
title: <Tooltip placement="top" title="活动价格表示商城直接以该商品的活动价格进行销售">
活动价格 <QuestionCircleOutlined />
</Tooltip>,
key: '',
dataIndex: '',
},
{
title: '个人限购数量',
key: '',
dataIndex: '',
},
{
title: '活动限购总数量',
key: '',
dataIndex: '',
},
]
const fetchDataSource = useCallback(async () => {
await PublicApi.getMarketingPlatformActivitySignupDetail({ activityId }).then((res: any) => {
if (res.code !== 1000) {
......@@ -157,12 +99,53 @@ const DetialLayout = () => {
// handleGeneralEffect(_data);
}, [])
const handleSubmit = useCallback(async () => {
const params = {
activityId,
productList,
}
if (!isEmpty(productList)) {
setLoading(true)
PublicApi.postMarketingPlatformActivitySignupSave({ ...params }).then(res => {
if (res.code !== 1000) {
setLoading(false)
return
}
setLoading(false)
setUnsaved(false)
history.goBack()
}).catch(_err => {
setLoading(false)
})
} else {
message.warn('请选择活动商品!')
}
}, [productList])
const handleGetDataSoure = (e) => {
if (!unsaved) {
setUnsaved(true)
}
setProductList([...e])
}
return (
<Context.Provider value={dataSource}>
<PeripheralLayout
no={dataSource.activityId}
detail={dataSource.activityName}
tabLink={TABLINK}
effect={
<Button
loading={loading}
icon={<SaveOutlined />}
type="primary"
onClick={handleSubmit}
>
提交
</Button>
}
components={
<Fragment>
<ProgressLayout />
......@@ -173,13 +156,14 @@ const DetialLayout = () => {
anchor="activityRuleLayout"
effect={generalEffect}
/>
<ProductListLayout data={dataSource} />
<ProductListLayout data={dataSource} getDataSource={handleGetDataSoure} />
<ActivityUserLayout />
<DemandLayout storeList={dataSource.shopList} />
<RecordLyout />
</Fragment>
}
/>
<Prompt when={unsaved} message="您还有未保存的内容,是否确定要离开?" />
</Context.Provider>
)
}
......
import React from 'react';
import { Form, Tooltip, Input } from 'antd';
import { Tooltip, Popconfirm } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
export const Columns = (int) => {
switch (Number(int)) {
......@@ -38,22 +39,28 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '活动价格',
title: <Tooltip placement="top" title="活动价格表示商城直接以该商品的活动价格进行销售">
活动价格 <QuestionCircleOutlined />
</Tooltip>,
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
editable: true,
},
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
......@@ -96,32 +103,40 @@ export const Columns = (int) => {
{
title: '商品价格',
key: 'price',
dataIndex: 'price'
dataIndex: 'price',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '直降价格',
title: <Tooltip placement="top" title="直降价格为商品价格的直降价格,如原价每件¥20.00的商品,每件降价¥2.00,则直降价格输入框中输入 ¥2.00">
直降价格 <QuestionCircleOutlined />
</Tooltip>,
key: 'plummetPrice',
dataIndex: 'plummetPrice'
dataIndex: 'plummetPrice',
editable: true,
},
{
title: '活动价格',
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
render: (text) => `¥${Number(text).toFixed(2)}`
},
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
key: '',
dataIndex: ''
key: 'operation',
dataIndex: 'operation',
operation: true,
},
]
case 3:
......@@ -162,7 +177,9 @@ export const Columns = (int) => {
dataIndex: 'price'
},
{
title: '折扣',
title: <Tooltip placement="top" title="折扣为商品价格的折扣,输入数字,如85折,输入85,9折输入90">
折扣 <QuestionCircleOutlined />
</Tooltip>,
key: 'discount',
dataIndex: 'discount'
},
......@@ -343,29 +360,38 @@ export const Columns = (int) => {
dataIndex: 'price'
},
{
title: '起始价格',
key: 'activityPrice',
dataIndex: 'activityPrice'
title: <Tooltip placement="top" title="第一个用户帮砍价时的起始价格">
起始价格 <QuestionCircleOutlined />
</Tooltip>,
key: 'plummetPrice',
dataIndex: 'plummetPrice',
editable: true,
},
{
title: '砍价底价',
title: <Tooltip placement="top" title="砍价过程中最后一次砍价不能超过砍价底价">
砍价底价 <QuestionCircleOutlined />
</Tooltip>,
key: 'activityPrice',
dataIndex: 'activityPrice'
dataIndex: 'activityPrice',
editable: true,
},
{
title: '个人限购数量',
key: 'restrictNum',
dataIndex: 'restrictNum'
dataIndex: 'restrictNum',
editable: true,
},
{
title: '活动限购总数量',
key: 'restrictTotalNum',
dataIndex: 'restrictTotalNum'
dataIndex: 'restrictTotalNum',
editable: true,
},
{
title: '操作',
key: '',
dataIndex: ''
key: 'operation',
dataIndex: 'operation',
operation: true,
},
]
case 12:
......@@ -406,7 +432,9 @@ export const Columns = (int) => {
dataIndex: 'price'
},
{
title: '秒杀价格',
title: <Tooltip placement="top" title="秒杀价格表示在秒杀时间段内商城直接以该商品的秒杀价格进行销售">
秒杀价格 <QuestionCircleOutlined />
</Tooltip>,
key: 'activityPrice',
dataIndex: 'activityPrice'
},
......
......@@ -24,7 +24,7 @@ const ReadySubmitExamine = () => {
title: '活动名称',
key: 'activityName',
dataIndex: 'activityName',
render: (text, record) => <EyePreview url={`/memberCenter/marketingAbility/paltformSign/readySubmitExamine/preview?activityId=${record.activityId}`}>{text}</EyePreview>
render: (text, record) => <EyePreview url={`/memberCenter/marketingAbility/paltformSign/readySubmitExamine/preview?activityId=${record.activityId}&signUpId=${record.id}`}>{text}</EyePreview>
},
{
title: '活动类型',
......@@ -112,40 +112,54 @@ const ReadySubmitExamine = () => {
<TableLayout
columns={columns}
effects="id"
rowKey="activityId"
fetch={PublicApi.getMarketingPlatformActivitySignupPageTobeSubmit}
selectedRow={true}
selectedRow
fetchRowkeys={fetchRowkeys}
controllerBtns={controllerBtns}
schema={{
type: 'object',
type: "object",
properties: {
mageLayout: {
type: 'object',
'x-component': 'Mega-Layout',
megalayout: {
type: "object",
"x-component": "mega-layout",
"x-component-props": {
grid: true
},
properties: {
topLayout: {
type: 'object',
'x-component': 'Mega-Layout',
ctl: {
type: "object",
"x-component": "controllerBtns",
},
id: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
grid: true,
},
properties: {
id: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '活动ID',
},
},
placeholder: '活动ID',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'Flex-Layout',
'x-component-props': {
colStyle: {
marginLeft: 20,
},
}
},
[FORM_FILTER_PATH]: {
type: "object",
"x-component": "flex-layout",
"x-component-props": {
rowStyle: {
flexWrap: "nowrap"
},
colStyle: {
marginLeft: 20
}
},
properties: {
PRO_LAYOUT: {
type: "object",
"x-component": "mega-layout",
"x-mega-props": {
span: 5
},
"x-component-props": {
inline: true
},
properties: {
activityName: {
......@@ -177,20 +191,20 @@ const ReadySubmitExamine = () => {
},
enum: [],
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
}
},
},
},
},
sumbit: {
"x-component": "Submit",
"x-mega-props": {
span: 1
},
"x-component-props": {
children: "查询"
}
}
}
}
}
}}
useStateEffects={useStateEffects}
/>
......
......@@ -15,8 +15,9 @@ export interface BidProps {
const Bidmodal: React.FC<BidProps> = (props: any) => {
const { bid, visible, cancel } = props;
const ref = useRef<any>({});
const ref = useRef<any>({});
const [confirmLoading, setConfirmLoading] = React.useState(false);
const handleConfirm = () => {
schemaActions.submit()
}
......@@ -36,13 +37,17 @@ const Bidmodal: React.FC<BidProps> = (props: any) => {
if (value.thank) {
params.content = value.content
}
PublicApi.postPurchaseConfirmQuotedPriceStayConfirmAwardResult({ ...params }).then(res => {
if (res.code === 1000) {
history.goBack()
}
}).catch(error => {
console.warn(error)
})
setConfirmLoading(true)
PublicApi.postPurchaseConfirmQuotedPriceStayConfirmAwardResult({ ...params }).then(res => {
if (res.code !== 1000) {
setConfirmLoading(false)
return
}
history.goBack()
}).catch(error => {
setConfirmLoading(false)
console.warn(error)
})
}
useEffect(() => {
......@@ -65,7 +70,8 @@ const Bidmodal: React.FC<BidProps> = (props: any) => {
actions={schemaActions}
currentRef={ref}
modalProps={{
className: style.wrap
className: style.wrap,
confirmLoading: confirmLoading,
}}
schema={{
type: 'object',
......
......@@ -210,7 +210,7 @@ const OfferInfo: React.FC<IProps> = (props: any) => {
/** 确定关联商品 */
const handleConfirm = (params: any) => {
const productAttributeJson = params.product.name.split('/').filter((_item, index) => index !== 0).join('/');
const productAttributeJson = params.attribute.map(item => { return item.customerAttributeValueList[0].value }).join('/');
const param = { ...data };
const query = [...param[idx]];
query[index].productId = params.product.id;
......
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