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

🐞 fix(询价报价): 修复bug

parent 70120e1b
import React, { Fragment, useCallback, useEffect, useState } from 'react'; import React, { Fragment, useEffect, useState } from 'react';
import { Button, Tag, Badge, Typography, Space, Drawer } from 'antd'; import { Button, Tag, Badge, Typography, Space, Drawer } from 'antd';
import { history } from 'umi'; import { history } from 'umi';
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
...@@ -16,6 +16,7 @@ import GeneralLayout from '@/pages/transaction/components/detailLayout/component ...@@ -16,6 +16,7 @@ import GeneralLayout from '@/pages/transaction/components/detailLayout/component
import RecordLyout from '@/pages/transaction/components/detailLayout/components/recordLyout'; import RecordLyout from '@/pages/transaction/components/detailLayout/components/recordLyout';
import ModalOperate from '@/pages/transaction/components/modalOperate'; import ModalOperate from '@/pages/transaction/components/modalOperate';
import { StandardTable } from 'god'; import { StandardTable } from 'god';
import { getAuth } from '@/utils/auth'
const TABLINK = [ const TABLINK = [
{ id: 'progressLayout', title: '流转进度' }, { id: 'progressLayout', title: '流转进度' },
...@@ -207,6 +208,15 @@ const InquiryOfferDetail = () => { ...@@ -207,6 +208,15 @@ const InquiryOfferDetail = () => {
}, },
] ]
const handleJump = (val) => {
const { memberId } = getAuth()
if (val.quoteMemberId === memberId) {
window.open(`/memberCenter/tranactionAbility/inquiryOffer/offerSearch/offer/preview?id=${val.id}`)
} else {
window.open(`memberCenter/tranactionAbility/confirmOffer/offerSearch/offer/preview?id=${val.id}`)
}
}
const hitoryColumns: ColumnType<any>[] = [ const hitoryColumns: ColumnType<any>[] = [
{ {
title: '商品ID', title: '商品ID',
...@@ -264,7 +274,8 @@ const InquiryOfferDetail = () => { ...@@ -264,7 +274,8 @@ const InquiryOfferDetail = () => {
{ {
title: '报价单', title: '报价单',
key: 'quotationNo', key: 'quotationNo',
dataIndex: 'quotationNo' dataIndex: 'quotationNo',
render: (_text, _record) => <Button type='link' onClick={() => handleJump(_record)}>{_text}</Button>
}, },
{ {
title: '外部状态', title: '外部状态',
...@@ -371,7 +382,7 @@ const InquiryOfferDetail = () => { ...@@ -371,7 +382,7 @@ const InquiryOfferDetail = () => {
> >
<StandardTable <StandardTable
columns={hitoryColumns} columns={hitoryColumns}
tableProps={{ rowKey: 'productId' }} tableProps={{ rowKey: 'id' }}
fetchTableData={fetchTableData} fetchTableData={fetchTableData}
/> />
</Drawer> </Drawer>
......
...@@ -113,29 +113,34 @@ const WaitAddInquiry = () => { ...@@ -113,29 +113,34 @@ const WaitAddInquiry = () => {
render: (text: any, record: any) => { render: (text: any, record: any) => {
return ( return (
<> <>
<Popconfirm title="确定要提交吗?" okText="是" cancelText="否" onConfirm={() => fetchSubmitBatch(record.id)}> {record.isSubmit && (
<Popconfirm title="确定要提交吗?" okText="是" cancelText="否" onConfirm={() => fetchSubmitBatch(record.id)}>
<Button
type='link'
>
提交审核
</Button>
</Popconfirm>
)}
{record.isUpdate && (
<Button <Button
type='link' type="link"
onClick={() => history.push(`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/edit?id=${record.id}`)}
> >
提交审核 编辑
</Button> </Button>
</Popconfirm> )}
<Button {record.isDelete && (
type="link" <Popconfirm
disabled={record.interiorState !== 1 && record.interiorState !== 6} title="确定要删除吗?"
onClick={() => history.push(`/memberCenter/tranactionAbility/productInquiry/waitAddInquiry/edit?id=${record.id}`)} okText="是"
> cancelText="否"
编辑 onConfirm={() => fetchDeleteBatch(record.id)}
</Button> >
<Popconfirm <Button disabled={record.interiorState !== 1 && record.externalState !== 1} type="link">删除</Button>
title="确定要删除吗?" </Popconfirm>
okText="是" )}
cancelText="否"
onConfirm={() => fetchDeleteBatch(record.id)}
disabled={record.interiorState !== 1 && record.externalState !== 1}
>
<Button disabled={record.interiorState !== 1 && record.externalState !== 1} type="link">删除</Button>
</Popconfirm>
</> </>
) )
} }
......
...@@ -5,6 +5,7 @@ import CollapseLayout from './components/collapseLayout'; ...@@ -5,6 +5,7 @@ import CollapseLayout from './components/collapseLayout';
import { isArray, isEmpty } from 'lodash'; import { isArray, isEmpty } from 'lodash';
import ProductLayout from './components/productLayout'; import ProductLayout from './components/productLayout';
import CouponsLayout from '@/pages/transaction/marketingAbility/selfManagement/readySubmitExamine/components/couponsLayout'; import CouponsLayout from '@/pages/transaction/marketingAbility/selfManagement/readySubmitExamine/components/couponsLayout';
import { PublicApi } from '@/services/api';
const layout: any = { const layout: any = {
labelCol: { style: { width: "100px" } }, labelCol: { style: { width: "100px" } },
...@@ -232,6 +233,7 @@ const CouponsListLayout: React.FC<CouponsListLayoutProps> = (props: any) => { ...@@ -232,6 +233,7 @@ const CouponsListLayout: React.FC<CouponsListLayoutProps> = (props: any) => {
<Button type="dashed" block icon={<PlusOutlined />} onClick={handleAppend}>添加</Button> <Button type="dashed" block icon={<PlusOutlined />} onClick={handleAppend}>添加</Button>
{/* 弹框: 优惠券 */} {/* 弹框: 优惠券 */}
<CouponsLayout <CouponsLayout
fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsCouponSelect}
visible={tableModalVisible} visible={tableModalVisible}
onClose={() => toggle(false)} onClose={() => toggle(false)}
onSubmit={handleCouponSubmit} onSubmit={handleCouponSubmit}
......
...@@ -25,7 +25,7 @@ interface ProductListProps { ...@@ -25,7 +25,7 @@ interface ProductListProps {
activityId?: any, activityId?: any,
form?: FormInstance, form?: FormInstance,
/** umi-hooks */ /** umi-hooks */
focus$?: EventEmitter<void>, focus$?: any,
/** 适用商城 */ /** 适用商城 */
shopIdList?: number[], shopIdList?: number[],
/** 接口 */ /** 接口 */
...@@ -57,10 +57,12 @@ const ProductListLayout: React.FC<ProductListProps> = (props: any) => { ...@@ -57,10 +57,12 @@ const ProductListLayout: React.FC<ProductListProps> = (props: any) => {
}) })
} }
focus$ && focus$.useSubscription((val: optionProps) => { useEffect(() => {
setValue(val.value) if (focus$) {
setDataSource([]) setValue(focus$)
}); setDataSource([])
}
}, [focus$])
/** 删除一个 */ /** 删除一个 */
const handleDelete = (key) => { const handleDelete = (key) => {
......
...@@ -51,6 +51,7 @@ const AddedMarketing = () => { ...@@ -51,6 +51,7 @@ const AddedMarketing = () => {
const [memberType, setMemberType] = useState<any[]>([]); const [memberType, setMemberType] = useState<any[]>([]);
const [activityId, setActivityId] = useState<number>(); const [activityId, setActivityId] = useState<number>();
const [value, setValue] = useState<number>(); const [value, setValue] = useState<number>();
const [prizeList, setPrizeList] = useState<any[]>([]);
const handleGetShopList = (mall) => { const handleGetShopList = (mall) => {
const checkedList = mall.filter(item => item.checked); const checkedList = mall.filter(item => item.checked);
...@@ -98,7 +99,7 @@ const AddedMarketing = () => { ...@@ -98,7 +99,7 @@ const AddedMarketing = () => {
oldMember: (res.allUser.includes(4) ? 1 : 0), oldMember: (res.allUser.includes(4) ? 1 : 0),
memberLevelList, memberLevelList,
shopList: res.shopList, shopList: res.shopList,
productList: res.productList.map(item => { productList: res.productList && res.productList.map(item => {
if (item.couponGroupList) { if (item.couponGroupList) {
return { return {
...item, ...item,
...@@ -178,6 +179,9 @@ const AddedMarketing = () => { ...@@ -178,6 +179,9 @@ const AddedMarketing = () => {
if (data['activityDefinedBO']['attemptEndTime']) { if (data['activityDefinedBO']['attemptEndTime']) {
data['activityDefinedBO']['attemptEndTime'] = moment(data['activityDefinedBO']['attemptEndTime']); data['activityDefinedBO']['attemptEndTime'] = moment(data['activityDefinedBO']['attemptEndTime']);
} }
if (data['activityDefinedBO']['prizeBOList']) {
setPrizeList(data['activityDefinedBO']['prizeBOList'])
}
form.setFieldsValue({ form.setFieldsValue({
allUser: [data.newUser && 1, data.oldUser && 2, data.newMember && 3, data.oldMember && 4], allUser: [data.newUser && 1, data.oldUser && 2, data.newMember && 3, data.oldMember && 4],
activityDefinedBO: data.activityDefinedBO, activityDefinedBO: data.activityDefinedBO,
...@@ -197,7 +201,7 @@ const AddedMarketing = () => { ...@@ -197,7 +201,7 @@ const AddedMarketing = () => {
}, [id]) }, [id])
focus$.useSubscription((val: any) => { focus$.useSubscription((val: any) => {
setValue(val.value); setValue(val.value)
form.resetFields(['activityDefinedBO']); form.resetFields(['activityDefinedBO']);
}); });
...@@ -236,8 +240,8 @@ const AddedMarketing = () => { ...@@ -236,8 +240,8 @@ const AddedMarketing = () => {
<BasicInfoLayout form={form} focus$={focus$} /> <BasicInfoLayout form={form} focus$={focus$} />
<ShopLayout onGetShopList={handleGetShopList} onSetShopList={shopList} /> <ShopLayout onGetShopList={handleGetShopList} onSetShopList={shopList} />
<RulesLayout form={form} focus$={focus$} /> <RulesLayout form={form} focus$={focus$} />
{value !== 10 && (<ProductListLayout activityId={activityId && { activityId: activityId }} form={form} focus$={focus$} shopIdList={shopIdList} fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsPage} />)} {value !== 10 && (<ProductListLayout activityId={activityId && { activityId: activityId }} form={form} focus$={value} shopIdList={shopIdList} fieldApi={PublicApi.getMarketingMerchantActivityDetailGoodsPage} />)}
{value === 10 && (<PrizeListLayout form={form} />)} {value === 10 && (<PrizeListLayout form={form} prizeList={prizeList} focus$={value} />)}
<PartakeUserLayout onGetLevel={handleGetLevel} onSetLevel={memberLevelList} setMemberType={memberType} /> <PartakeUserLayout onGetLevel={handleGetLevel} onSetLevel={memberLevelList} setMemberType={memberType} />
</Form> </Form>
} }
......
...@@ -65,7 +65,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => { ...@@ -65,7 +65,7 @@ const BasicInfoLayout: React.FC<BasicInfoProps> = (props: any) => {
}; };
const handleChange = (e, option) => { const handleChange = (e, option) => {
focus$.emit(option) focus$.emit(option);
} }
return ( return (
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
align-items: center; align-items: center;
:global { :global {
.ant-checkbox+span { .ant-checkbox+span,
.ant-radio+span {
flex: 1; flex: 1;
margin-left: 20px; margin-left: 20px;
} }
......
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState, useCallback } from 'react';
import { Drawer, Space, Form, Select, Input, Button, Row, Col, Checkbox, Empty, Pagination } from 'antd'; import { Drawer, Space, Form, Select, Input, Button, Row, Col, Checkbox, Empty, Pagination, Radio } from 'antd';
import { CaretDownOutlined } from '@ant-design/icons'; import { CaretDownOutlined } from '@ant-design/icons';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import CouponItem from '@/pages/transaction/marketingAbility/components/couponItem'; import CouponItem from '@/pages/transaction/marketingAbility/components/couponItem';
...@@ -15,10 +15,14 @@ interface CouponsLayoutProps { ...@@ -15,10 +15,14 @@ interface CouponsLayoutProps {
onSubmit?: (e: any) => void, onSubmit?: (e: any) => void,
/** 已选择的id */ /** 已选择的id */
value?: any, value?: any,
/** 多选&单选 */
mode?: 'checkbox' | 'radio',
/** 接口api */
fieldApi?: () => Promise<unknown>,
} }
const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
const { visible, onClose, onSubmit, value } = props; const { visible, onClose, onSubmit, value, mode = 'checkbox', fieldApi } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [state, setState] = useState({ const [state, setState] = useState({
filterSearch: false filterSearch: false
...@@ -32,6 +36,8 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -32,6 +36,8 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
const [chekedId, setCheckedId] = useState<number[]>([]); // 已选择的优惠券 const [chekedId, setCheckedId] = useState<number[]>([]); // 已选择的优惠券
const [selectCouponList, setSelectCouponList] = useState<any[]>([]); // checkbox 勾选到的数据 需要去重 const [selectCouponList, setSelectCouponList] = useState<any[]>([]); // checkbox 勾选到的数据 需要去重
const [couponsList, setCouponsList] = useState<any[]>([]); // 提交的优惠券 const [couponsList, setCouponsList] = useState<any[]>([]); // 提交的优惠券
const [options, setOptions] = useState<any[]>([]); // 选择附属优惠券查询条件
const changeFilterVisible = () => { const changeFilterVisible = () => {
setState({ setState({
filterSearch: !state.filterSearch, filterSearch: !state.filterSearch,
...@@ -41,7 +47,7 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -41,7 +47,7 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
// 提交搜索 // 提交搜索
const handleSubmit = async () => { const handleSubmit = async () => {
await form.validateFields().then(res => { await form.validateFields().then(res => {
PublicApi.getMarketingMerchantActivityDetailGoodsCouponSelect({ ...res, ...params }).then(res => { fieldApi({ ...res, ...params }).then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
return return
} }
...@@ -58,9 +64,24 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -58,9 +64,24 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
handleSubmit() handleSubmit()
} }
const handleCondition = useCallback(async () => {
await PublicApi.getMarketingMerchantActivityDetailGoodsCouponSelectCondition().then(res => {
if (res.code !== 1000) {
return
}
setOptions(res.data.map(_item => {
return {
label: _item.name,
value: _item.value
}
}))
})
}, [])
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
handleSubmit() handleSubmit();
handleCondition();
} }
}, [visible, params]) }, [visible, params])
...@@ -81,6 +102,7 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -81,6 +102,7 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
) )
} }
/** checkbox 选择 */
const _setCheckList = (_e, _item) => { const _setCheckList = (_e, _item) => {
const ids = [...chekedId]; const ids = [...chekedId];
const selcetLits = [...selectCouponList]; const selcetLits = [...selectCouponList];
...@@ -93,9 +115,16 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -93,9 +115,16 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
} }
} }
/** radio 选择 */
const _setRadioList = (_e) => {
const { value } = _e.target;
const _item = _e.target['data-item'];
setCheckedId([value])
setSelectCouponList([_item])
}
useEffect(() => { useEffect(() => {
const newData = selectCouponList.filter(_item => chekedId.includes(_item.id)); const newData = selectCouponList.filter(_item => chekedId.includes(_item.id));
console.log(newData, 98)
setCouponsList(newData) setCouponsList(newData)
}, [chekedId]) }, [chekedId])
...@@ -136,12 +165,7 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -136,12 +165,7 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
<Select <Select
style={{ width: '160px' }} style={{ width: '160px' }}
placeholder='优惠劵类型' placeholder='优惠劵类型'
options={[ options={options}
{ label: '通用优惠券', value: 1 },
{ label: '品类优惠券', value: 2 },
{ label: '品牌优惠券', value: 3 },
{ label: '商品优惠券', value: 4 },
]}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
...@@ -168,19 +192,38 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => { ...@@ -168,19 +192,38 @@ const CouponsLayout: React.FC<CouponsLayoutProps> = (props: any) => {
{couponList.length === 0 ? {couponList.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> : ( <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> : (
<Row> <Row>
{couponList.map((item: any, index: number) => { {mode === 'checkbox' && (
return ( <>
<Col span={22} key={`Col_${index}`} style={{ marginBottom: 24 }}> {couponList.map((item: any, index: number) => {
<Checkbox checked={chekedId.includes(item.id)} value={item.id} className={styles.customsCheckbox} onChange={(_e) => _setCheckList(_e.target.value, item)}> return (
<CouponItem <Col span={22} key={`Col_${index}`} style={{ marginBottom: 24 }}>
fieldListData={item} <Checkbox checked={chekedId.includes(item.id)} value={item.id} className={styles.customsCheckbox} onChange={(_e) => _setCheckList(_e.target.value, item)}>
/> <CouponItem
</Checkbox> fieldListData={item}
</Col> />
) </Checkbox>
})} </Col>
<Col span={24} style={{ display: 'flex' ,justifyContent: 'flex-end'}}> )
<Pagination size="small" total={total} current={params.current} onChange={handlePagination}/> })}
</>
)}
{mode === 'radio' && (
<Radio.Group style={{ flex: 1 }} onChange={(_e) => _setRadioList(_e)}>
{couponList.map((item: any, index: number) => {
return (
<Col span={22} key={`Col_${index}`} style={{ marginBottom: 24 }}>
<Radio checked={chekedId.includes(item.id)} value={item.id} data-item={item} className={styles.customsCheckbox}>
<CouponItem
fieldListData={item}
/>
</Radio>
</Col>
)
})}
</Radio.Group>
)}
<Col span={24} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Pagination size="small" total={total} current={params.current} onChange={handlePagination} />
</Col> </Col>
</Row> </Row>
)} )}
......
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