Commit 7601c6c9 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

'fix:'

parent 56ca4d25
......@@ -28,6 +28,7 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
onOk={confirm}
onCancel={cancel}
visible={visible}
destroyOnClose
>
<StandardTable
tableType='small'
......
......@@ -22,6 +22,7 @@ import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './e
import { addChannelSchema } from './schema/channelSchema';
import { PublicApi } from '@/services/api';
import ModalTable from '@/components/ModalTable'
import { GetProductChannelCommodityGetCommodityListResponse } from '@/services';
const {Item}:any = Form
......@@ -115,39 +116,35 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const [selectRow, setSelectRow] = useState<Item[]>([]) // 模态框选择的行数据
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([])
const [visibleAddSpec, setVisibleAddSpec] = useState(false)
const [productRowSelection, productRowCtl] = useRowSelectionTable()
const [productRowSelection, productRowCtl] = useRowSelectionTable({type: 'radio'})
const [selectProduct, setSelectProduct] = useState<GetProductChannelCommodityGetCommodityListResponse[]>()
const columns: ColumnType<any>[] = [
const productColumns: ColumnType<any>[] = [
{
title: 'ID',
dataIndex: 'key',
align: 'center',
key: 'key',
dataIndex: 'id',
key: 'id',
},
{
title: '商品名称',
dataIndex: 'role',
align: 'center',
key: 'role',
dataIndex: 'name',
key: 'name',
},
{
title: '品类',
align: 'center',
dataIndex: 'businessType',
key: 'businessType',
dataIndex: ['customerCategory', 'id'],
key: 'id',
},
{
title: '品牌',
align: 'center',
dataIndex: 'roleType',
key: 'roleType',
dataIndex: ['brand', 'name'],
key: 'id',
},
{
title: '单位',
align: 'center',
dataIndex: 'memberType',
key: 'memberType',
dataIndex: 'unitName',
key: 'unitName',
},
];
const search: IFormFilter[] = [
......@@ -317,7 +314,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const fetchProductData = (params: any) => {
return new Promise((resolve, reject) => {
//@ts-ignore
PublicApi.getProductChannelCommodityGetCommodityList(params).then(res => {
PublicApi.getProductChannelCommodityGetCommodityList({...params, source: origin}).then(res => {
console.log(res, 'res')
const { data } = res
resolve(data)
......@@ -345,8 +342,9 @@ const AddDirectChannel:React.FC<{}> = (props) => {
setOrigin(v.target.value)
productFormActions.setFieldState('parentMemberId', state => {
console.log(state, 'state')
state.visible = v.target.value?true:false
state.visible = v.target.value===1?true:false
})
setSelectProduct([])
}
const handleMemberTypeChange = (v:any) => {
......@@ -376,12 +374,8 @@ const AddDirectChannel:React.FC<{}> = (props) => {
}
const handleOkAddTabs = () => {
console.log('操作了OK')
// addTabsForm.validateFields().then(values => {
// console.log(values, 'validate')
// add(values)
// setVisibleAddTabs(false)
// }).catch(err => console.error(err, 'error'))
setSelectProduct(productRowCtl.selectRow)
setVisibleAddTabs(false)
}
const handleCancelAddTabs = () => {
......@@ -405,7 +399,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
setModifyModal(true)
}
const handleOk = () => {
const handlePriceOk = () => {
setForm.validateFields().then(v=>{
setModifyModal(false)
console.log(v,'value')
......@@ -413,7 +407,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
console.log('handleOk')
}
const handleCancel = () => {
const handlePriceCancel = () => {
setModifyModal(false)
console.log('handleCancel')
}
......@@ -473,20 +467,20 @@ const AddDirectChannel:React.FC<{}> = (props) => {
>
<Radio.Group onChange={handleOriginChange}>
<Radio value={1}>上级渠道商品</Radio>
<Radio value={0}>渠道自有商品</Radio>
<Radio value={2}>渠道自有商品</Radio>
</Radio.Group>
</Form.Item>
</Form>
<Button onClick={handleAddButton} style={{width:'100%', marginTop: 24, marginBottom: 24, backgroundColor: '#fafbfc'}}>
<PlusOutlined /> 新增{origin?'上级渠道商品':'渠道自有商品'}
<PlusOutlined /> 新增{origin===1?'上级渠道商品':'渠道自有商品'}
</Button>
<Table dataSource={[]} columns={columnsSetPrice} rowSelection={{type: 'checkbox',...rowSelectionSetPrice}} />
<Table dataSource={selectProduct} columns={productColumns} />
</TabPane>
<TabPane tab="设置价格" key="2">
<Button onClick={handleAddSpecificationButton} style={{width:'100%', marginBottom: 24, backgroundColor: '#fafbfc'}}>
<PlusOutlined /> 选择商品规格
</Button>
<Table dataSource={dataSetPrice} columns={columnsSetPrice} rowSelection={{type: 'checkbox',...rowSelectionSetPrice}} />
<Table dataSource={dataSetPrice} columns={columnsSetPrice} />
</TabPane>
<TabPane tab="适用会员" key="3">
<Form
......@@ -528,11 +522,11 @@ const AddDirectChannel:React.FC<{}> = (props) => {
</Tabs>
<ModalTable
modalTitle={origin?'选择上级渠道商品':'选择渠道自有商品'}
modalTitle={origin===1?'选择上级渠道商品':'选择渠道自有商品'}
confirm={handleOkAddTabs}
cancel={handleCancelAddTabs}
visible={visibleAddTabs}
columns={columns}
columns={productColumns}
rowSelection={productRowSelection}
fetchTableData={(params:any) => fetchProductData(params)}
tableProps={{
......@@ -566,48 +560,11 @@ const AddDirectChannel:React.FC<{}> = (props) => {
/>
}
/>
{/* <Modal
title={origin?'选择上级渠道商品':'选择渠道自有商品'}
visible={visibleAddTabs}
onOk={handleOkAddTabs}
onCancel={handleCancelAddTabs}
width={704}
>
<StandardTable
columns={columns}
rowSelection={channelRowSelection}
currentRef={ref}
fetchTableData={(params:any) => fetchProductData(params)}
tableProps={{ rowKey: "id" }}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values =>ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
)
FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
searchBrandOptionEffect(actions, 'brandId')
})
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
})
}}
schema={addChannelSchema}
/>
}
/>
</Modal> */}
<Modal
title="设置价格"
visible={modifyModal}
onOk={handleOk}
onCancel={handleCancel}
onOk={handlePriceOk}
onCancel={handlePriceCancel}
forceRender={true}
>
<Form
......@@ -707,7 +664,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
onCancel={handleCancelAddSpec}
>
<StandardTable
columns={columns}
columns={productColumns}
rowSelection={rowSelection}
currentRef={ref}
fetchTableData={(params:any) => fetchData(params)}
......@@ -722,7 +679,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
onCancel={handleCancelAddMember}
>
<StandardTable
columns={columns}
columns={productColumns}
rowSelection={rowSelection}
currentRef={ref}
fetchTableData={(params:any) => fetchData(params)}
......
......@@ -159,21 +159,20 @@ const DirectChannel: React.FC<{}> = () => {
const handleBatchDelete = () => {
setDeleteBatchModal(true)
console.log('删除')
}
const confirm = () => {
console.log('confirm')
}
// const confirm = () => {
// console.log('confirm')
// }
const cancel = () => {
console.log('cancel')
}
// const cancel = () => {
// console.log('cancel')
// }
const handleModify = (record: object) => {
// 通过传入的params字符串判断是修改那种类型的数据
console.log('执行状态修改', record)
}
// const handleModify = (record: object) => {
// // 通过传入的params字符串判断是修改那种类型的数据
// console.log('执行状态修改', record)
// }
const rowSelection = {
selectedRowKeys: selectedRowKeys,
......
import React, { useState, useEffect, useRef, ReactNode } from 'react'
import { history } from 'umi'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Input, Menu, Popconfirm } from 'antd'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Input, Menu, InputNumber } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
......@@ -180,7 +180,6 @@ const FastModifyPrice: React.FC<{}> = () => {
}
const handleModify = (record: any) => {
console.log('点击修改价格', record)
setCurrentRow(record)
const { id, unitPrice, priceType } = record
// 阶梯价格回显处理
......@@ -289,10 +288,8 @@ const FastModifyPrice: React.FC<{}> = () => {
// 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => {
// console.log(value, 'value')
try {
if(Array.isArray(value)){
// console.log(value, 'array')
let range = value.map(item => {
if(item)
return Object.values(item.numberRange)
......@@ -303,7 +300,6 @@ const FastModifyPrice: React.FC<{}> = () => {
[]
)
let result = range.reduce((a, b) => { if(a<b) return b })
// console.log(result, 'result')
if(!result) throw new Error('请正确输入阶梯数量范围');
callback()
}
......@@ -509,7 +505,7 @@ const FastModifyPrice: React.FC<{}> = () => {
>
<Input style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
</Form.Item>
<Input
<InputNumber
style={{
width: 30,
borderLeft: 0,
......@@ -533,7 +529,7 @@ const FastModifyPrice: React.FC<{}> = () => {
}
]}
>
<Input
<InputNumber
className={styles.siteInputRight}
style={{
width: 100,
......
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