Commit 83511a28 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

'fix'

parent eb0b84ca
......@@ -101,7 +101,7 @@ const Attribute: React.FC<{}> = () => {
const confirm = (record: any) => {
console.log(record, 'record')
updateAttributeStatus({ id: record.id, status: !record.isEnable }).then(res => {
updateAttributeStatus({ id: record.id, isEnable: !record.isEnable }).then(res => {
if (res.code === 1000) {
message.success(res.message)
//@ts-ignore
......
......@@ -257,7 +257,7 @@ const CategoryAttributes: React.FC<{}> = () => {
const confirm = (record: any) => {
console.log(record, 'record')
updateAttributeStatus({ id: record.id, status: !record.isEnable }).then(res => {
updateAttributeStatus({ id: record.id, isEnable: !record.isEnable }).then(res => {
if (res.code === 1000) {
message.success(res.message)
//@ts-ignore
......
......@@ -145,7 +145,7 @@ const PropertyValue: React.FC<{}> = () => {
];
const confirm = (record: any) => {
updatePropertyValueStatus({ id: record.id, status: !record.isEnable }).then(res => {
updatePropertyValueStatus({ id: record.id, isEnable: !record.isEnable }).then(res => {
if (res.code === 1000) {
message.success(res.message)
//@ts-ignore
......
import React, { useState } from 'react';
import { Form, Input, Button, Select, Card, Tooltip, message } from 'antd'
import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Select, Card, Tooltip, message, InputNumber } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { history } from 'umi';
import {
......@@ -7,7 +7,7 @@ import {
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import styles from './index.less'
import { getSelectBrandList, getSelectCustomerCategoryList, getSelectUniteList, updateGoods } from '@/services/commodity/goods';
import { getSelectBrandList, getSelectCustomerCategoryList, getSelectUniteList, updateGoods, getGoodsDetail } from '@/services/commodity/goods';
const { Option } = Select;
const layout = {
......@@ -33,6 +33,33 @@ const AddGoods = () => {
const [classValue, setClassValue] = useState(undefined)
const [unitData, setUnitData] = useState<any>([])
const [unitValue, setUnitValue] = useState(undefined)
const [queryId, setQueryId] = useState<number>(null)
const [isSee, setIsSee] = useState(false)
useEffect(() => {
const { id, isSee } = history.location.query
if(id){
setQueryId(id)
getSelectCustomerCategoryList({name: ''}).then(res=>{
if(res.code === 1000)
setClassData(res.data)
})
getSelectUniteList({name: ''}).then(res=>{
if(res.code === 1000)
setUnitData(res.data)
})
getSelectBrandList({name: ''}).then(res=>{
if(res.code === 1000)
setBrandData(res.data)
})
getGoodsDetail({id: id}).then(res=>{
if(res.code===1000)
form.setFieldsValue(res.data)
})
if(isSee)
setIsSee(isSee)
}
}, [])
const handleBrandSearch = (value:any) => { // end value
console.log(value, 'handleBrandSearch')
......@@ -96,7 +123,7 @@ const AddGoods = () => {
return (<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title="新建货品"
title={queryId?`${isSee?'查看货品':'编辑货品'}`:'新建货品'}
>
<Card>
<Form
......@@ -114,12 +141,12 @@ const AddGoods = () => {
message: '请填入货号'
},
{
pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*])[\da-zA-Z~!@#$%^&*]{1,20}$/,
pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[~!@#$%^&*-_])[\da-zA-Z~!@#$%^&*-_]{1,20}$/,
message: '最长20个字符(由字母、数组、特殊字符组成)'
}
]}
>
<Input placeholder="最长20个字符(由字母、数组、特殊字符组成)" maxLength={20} />
<Input placeholder="最长20个字符(由字母、数组、特殊字符组成)" maxLength={20} disabled={isSee} />
</Form.Item>
<Form.Item
name="name"
......@@ -131,7 +158,7 @@ const AddGoods = () => {
},
]}
>
<Input placeholder="最长20个字符" maxLength={20} />
<Input placeholder="最长20个字符" maxLength={20} disabled={isSee} />
</Form.Item>
<Form.Item
name="type"
......@@ -143,7 +170,7 @@ const AddGoods = () => {
},
]}
>
<Input placeholder="最长20个字符" maxLength={20} />
<Input placeholder="最长20个字符" maxLength={20} disabled={isSee} />
</Form.Item>
<Form.Item
name={['customerCategory', 'id']}
......@@ -167,6 +194,7 @@ const AddGoods = () => {
onChange={handleClassChange}
notFoundContent={null}
style={{width:'100%'}}
disabled={isSee}
>
{classData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
......@@ -193,6 +221,7 @@ const AddGoods = () => {
onChange={handleBrandChange}
notFoundContent={null}
style={{width:'100%'}}
disabled={isSee}
>
{brandData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
......@@ -202,8 +231,8 @@ const AddGoods = () => {
label="单位"
rules={[
{
// required: true,
// message: '请输入单位'
required: true,
message: '请输入单位'
},
]}
>
......@@ -218,12 +247,13 @@ const AddGoods = () => {
onChange={handleUnitChange}
notFoundContent={null}
style={{width:'100%'}}
disabled={isSee}
>
{unitData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
</Form.Item>
<Form.Item
name="constPrice"
name="costPrice"
// label="成本价"
label={
<span>
......@@ -236,20 +266,20 @@ const AddGoods = () => {
rules={[
{
required: true,
message: '请填入成本价'
},
message: '请填入成本价',
}
]}
>
<Input placeholder="请输入成本价" />
<InputNumber placeholder="请输入成本价" style={{width: '100%'}} min={0} disabled={isSee} />
</Form.Item>
<Form.Item {...tailLayout}>
{!isSee && <Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
保存
</Button>
<Button className={styles.ml20} onClick={()=>history.goBack()}>
取消
</Button>
</Form.Item>
</Form.Item>}
</Form>
</Card>
</PageHeaderWrapper>
......
......@@ -35,8 +35,6 @@ interface Item {
let timeChange: any;
interface paramItem {
pageSize: number;
current: number;
name: string;
code: string;
brandId: number;
......@@ -53,7 +51,7 @@ const Goods: React.FC<{}> = () => {
const [modalTitle, setModalTitle] = useState('导入')
const [modalStep, setModalStep] = useState(0)
let [isHighSearch, setIsHighSearch] = useState(false)
const [filterParams, setFilterParams] = useState<paramItem>({ current: 1, pageSize: 5, name: '', code: '', brandId: 0, customerCategoryId: 0, batch: '' })
const [filterParams, setFilterParams] = useState<paramItem>({ name: '', code: '', brandId: 0, customerCategoryId: 0, batch: '' })
const [brandData, setBrandData] = useState<any>([])
const [brandValue, setBrandValue] = useState(undefined)
const [classData, setClassData] = useState<any>([])
......@@ -70,7 +68,12 @@ const Goods: React.FC<{}> = () => {
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) => <span className="commonPickColor" onClick={() => handleSee(record)}>{text}&nbsp;<EyeOutlined /></span>
render: (text: any, record: any) => <span
className="commonPickColor"
onClick={() => history.push(`/memberCenter/commodityAbility/commodity/goods/addGoods?id=${record.id}&isSee=true`)}
>
{text}&nbsp;<EyeOutlined />
</span>
},
{
title: '规格型号',
......@@ -89,31 +92,35 @@ const Goods: React.FC<{}> = () => {
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
dataIndex: 'unitName',
key: 'unit',
},
{
title: '成单价',
dataIndex: 'unitPrice',
align: 'center',
key: 'unitPrice',
dataIndex: 'costPrice',
key: 'costPrice',
},
{
title: '导入批次',
dataIndex: 'batch',
align: 'center',
key: 'batch',
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text: any, record: any) => {
return (
<>
<Button type='link' onClick={() => history.push(`/memberCenter/commodityAbility/commodity/goods/addGoods?id=${record.key}`)}>修改</Button>
<Button type='link'>删除</Button>
<Button type='link' onClick={() => history.push(`/memberCenter/commodityAbility/commodity/goods/addGoods?id=${record.id}`)}>修改</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handleSingleDelete(record)}
onCancel={()=>console.log('取消')}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
)
}
......@@ -121,26 +128,26 @@ const Goods: React.FC<{}> = () => {
]
const fetchData = (params: any) => {
console.log(params)
return new Promise((resolve, reject) => {
let obj = {...filterParams, pageSize: params.rows, current: params.page}
console.log(obj, 'fetchParams')
let obj = {...params, pageSize: params.rows, current: params.page}
getGoodsLists(obj).then(res=>{
if(res.code===1000)
resolve(res.data)
resolve(res.data)
})
})
}
const handleSee = (record: any) => {
console.log('see')
// history.push(`/trademark/viewBrand?id=${record.id}`)
const handleSingleDelete = (record:any) => {
if(record?.id)
deleteBatchGoods({idList: [record.id]}).then(res=>{
if(res.code===1000){
message.success(res.message)
//@ts-ignore
ref.current.reload()
}
})
}
// const handleOk = () => {
// console.log('ok')
// setImportModal(false)
// }
const handleCancel = () => {
console.log('cancel')
setImportModal(false)
......@@ -285,7 +292,7 @@ const Goods: React.FC<{}> = () => {
if(res.code === 1000){
message.success(res.message)
//@ts-ignore
ref.current.reolad()
ref.current.reload()
}
})
}else if(e.key === '2'){
......@@ -308,25 +315,19 @@ const Goods: React.FC<{}> = () => {
console.log(val)
let obj = {...filterParams, name: val}
setFilterParams(obj)
fetchData(obj)
//@ts-ignore
ref.current.reload(obj)
}
const handleReset = () => {
setFilterParams({ current: 1, pageSize: 5, name: '', code: '', brandId: 0, customerCategoryId: 0, batch: '' })
let restObj = { name: '', code: '', brandId: 0, customerCategoryId: 0, batch: '' }
setFilterParams(restObj)
setBrandValue(undefined)
setClassValue(undefined)
//@ts-ignore
ref.current.reload(restObj)
}
const codeChange = (e:any) => {
console.log(e.target.value)
let obj = {...filterParams, code: e.target.value}
setFilterParams(obj)
}
const batchChange = (e:any) => {
console.log(e.target.value)
let obj = {...filterParams, batch: e.target.value}
setFilterParams(obj)
}
const nameChange = (e:any) => {
console.log(e.target.value)
let obj = {...filterParams, name: e.target.value}
......@@ -344,12 +345,14 @@ const Goods: React.FC<{}> = () => {
setBrandData([])
}
}
const handleBrandChange = (value:any) => {
setBrandValue(value)
console.log(value, 'handleBrandChange')
let obj = {...filterParams, brandId: value}
setFilterParams(obj)
}
const handleClassSearch = (value:any) => {
console.log(value, 'handleClassSearch')
if (value) {
......@@ -361,6 +364,7 @@ const Goods: React.FC<{}> = () => {
setClassData([])
}
}
const handleClassChange = (value:any) => {
setClassValue(value)
let obj = {...filterParams, customerCategoryId: value}
......@@ -375,7 +379,7 @@ const Goods: React.FC<{}> = () => {
columns={columns}
currentRef={ref}
rowSelection={rowSelection}
rowKey="id"
tableProps={{rowKey: "id"}}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<Row>
......@@ -414,7 +418,7 @@ const Goods: React.FC<{}> = () => {
<Row gutter={[16, 8]} justify="end">
<Col span={24} style={{display:'flex', justifyContent: 'flex-end'}}>
<Col span={4}>
<Input name="code" value={filterParams.code} onChange={(e)=>codeChange(e)} placeholder="货号"></Input>
<Input name="code" value={filterParams.code} onChange={(e)=>setFilterParams({...filterParams, code: e.target.value})} placeholder="货号"></Input>
</Col>
<Col span={4}>
<Select
......@@ -449,7 +453,7 @@ const Goods: React.FC<{}> = () => {
</Select>
</Col>
<Col span={4}>
<Input name="batch" value={filterParams.batch} onChange={(e)=>batchChange(e)} placeholder="导入批次"></Input>
<Input name="batch" value={filterParams.batch} onChange={(e)=>setFilterParams({...filterParams, batch: e.target.value})} placeholder="导入批次"></Input>
</Col>
</Col>
</Row>
......
import React, { useState, useEffect, useRef, ReactNode } from 'react'
import { history } from 'umi'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox } from 'antd'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Input, Menu, Popconfirm } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
FileExcelOutlined,
EyeOutlined,
QuestionCircleOutlined
QuestionCircleOutlined,
DownOutlined,
DeleteOutlined,
CaretUpOutlined,
CaretDownOutlined
} from '@ant-design/icons'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
......@@ -14,6 +18,9 @@ import { IButtonFilter, IFormFilter } from 'god/dist/src/standard-table/TableCon
import styles from "./index.less"
import { getProductLists } from '@/services/commodity/products'
import moment from 'moment'
import { getSelectCustomerCategoryList, getSelectBrandList } from '@/services/commodity/goods'
const { Option } = Select;
// 定义选择的行数据的类型
interface Item {
......@@ -27,68 +34,16 @@ interface Item {
status: string;
}
const data = [
{
key: '1',
productName: '进口新西兰原生牧场奶牛皮牛奶纹',
type: '牛皮',
brand: 'SciYa',
unit: '寸',
price: '¥400 ~ ¥500',
time: '2010-12-01 12:01:25',
status: '0'
},
{
key: '2',
productName: '进口澳大利亚原生牧场小羊皮',
type: '小羊皮',
brand: 'YSL',
unit: '寸',
price: '¥400 ~ ¥500',
time: '2010-12-01 12:01:25',
status: '1'
},
{
key: '3',
productName: '进口澳大利亚原生牧场小羊皮',
type: '小羊皮',
brand: 'YSL',
unit: '寸',
price: '¥400 ~ ¥500',
time: '2010-12-01 12:01:25',
status: '2'
},
{
key: '4',
productName: '进口新西兰原生牧场奶牛皮牛奶纹',
type: '牛皮',
brand: 'SciYa',
unit: '寸',
price: '¥400 ~ ¥500',
time: '2010-12-01 12:01:25',
status: '3'
},
{
key: '5',
productName: '进口新西兰原生牧场奶牛皮牛奶纹',
type: '牛皮',
brand: 'SciYa',
unit: '寸',
price: '¥400 ~ ¥500',
time: '2010-12-01 12:01:25',
status: '4'
},
{
key: '6',
productName: '进口新西兰原生牧场奶牛皮牛奶纹',
type: '牛皮',
brand: 'SciYa',
unit: '寸',
price: '¥400 ~ ¥500',
time: '2010-12-01 12:01:25',
status: '5'
},
]
interface paramItem {
name: string;
code: string;
priceType: number;
Min: number;
Max: number;
brandId: number;
customerCategoryId: number;
status: number;
}
let timeChange: any;
......@@ -103,30 +58,21 @@ const Products: React.FC<{}> = () => {
const [isUp, setIsUp] = useState(1) // 1上0下架状态
const [upDownModal, setUpDownModal] = useState(false)
const [searchName, setSearchName] = useState('')
const [searchStatus, setSearchStatus] = useState(0)
const [current, setCurrent] = useState(1)
const [pageSize, setPageSize] = useState(10)
// afterService: "售后服务"
// area: (2) ["广东省", "广州市"]
// brandId: 1
// categoryId: 1
// commodityAttribute: (2) [{…}, {…}]
// goodsList: (2) [{…}, {…}]
// id: 11
// isInvoice: true
// logistics: {weight: 50, company: "顺丰", sendAddress: "广东省广州市", carriageType: 1, deliveryType: 1}
// marks: "中国驰名商标"
// minOrder: 12.123
// name: "苹果电脑"
// packing: "包装清单"
// priceType: 1
// sellingPoint: "好用-便宜-美观"
// slogan: "性能杠杠的"
// status: 1
// unitId: 1
// unitPriceAndPic: (2) [
let [isHighSearch, setIsHighSearch] = useState(false)
const [filterParams, setFilterParams] = useState<paramItem>({
name: '',
code: '',
priceType: null,
Min: 0,
Max: 0,
brandId: 0,
customerCategoryId: 0,
status: null,
})
const [brandData, setBrandData] = useState<any>([])
const [brandValue, setBrandValue] = useState(undefined)
const [classData, setClassData] = useState<any>([])
const [classValue, setClassValue] = useState(undefined)
const columns: ColumnType<any>[] = [
{
......@@ -161,7 +107,6 @@ const Products: React.FC<{}> = () => {
align: 'center',
key: 'unitName',
},
// 产品定价:1-现货价格,2-价格需要询价,3-积分兑换商品
{
title: '产品定价',
dataIndex: 'priceType',
......@@ -173,7 +118,22 @@ const Products: React.FC<{}> = () => {
return '价格需要询价'
else if(text===3)
return '积分兑换商品'
}
},
filters: [
{
text: '现货价格',
value: 1,
},
{
text: '价格需要询价',
value: 2,
},
{
text: '积分兑换商品',
value: 3,
},
],
onFilter: (value, record) => record.priceType === value,
},
{
title: '价格',
......@@ -185,7 +145,7 @@ const Products: React.FC<{}> = () => {
title: '审核时间',
dataIndex: 'applyTime',
key: 'applyTime',
render: (text:any, record:any)=>moment(text).format('YYYY-MM-DD HH:mm:ss')
render: (text:any, record:any)=>text && moment(text).format('YYYY-MM-DD HH:mm:ss')
},
{
title: '审核状态',
......@@ -195,19 +155,46 @@ const Products: React.FC<{}> = () => {
render: (text: any, record: any) => {
let component: ReactNode = null
if (record.status === 1)
component = (<><span className="commonStatusModify"></span>待提交审核</>)
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusValid"></span>待审核</>)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusStop"></span>审核通过</>)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
else if (record.status === 0)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
return component
}
},
filters: [
{
text: '待提交审核',
value: 1,
},
{
text: '待审核',
value: 2,
},
{
text: '审核通过',
value: 3,
},
{
text: '审核不通过',
value: 4,
},
{
text: '已上架',
value: 5,
},
{
text: '已下架',
value: 6,
}
],
onFilter: (value, record) => record.status === value,
},
{
title: '操作',
......@@ -216,114 +203,42 @@ const Products: React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
{record.status === '0' ? <Button type='link'>提交审核</Button> : ''}
{(record.status === '2' || record.status === '5') ? <Button type='link' onClick={() => clickUp(1)}>上架</Button> : ''}
{record.status === '4' ? <Button type='link' onClick={() => clickUp(0)}>下架</Button> : ''}
<Button type='link'>复制</Button>
{record.status === '3' ? <Button type='link'>修改</Button> : ''}
<Button type='link'>删除</Button>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => console.log('confirm')}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
<Dropdown overlay={
<Menu>
<Menu.Item>
{record.status === 1 ? <Button type='link'>提交审核</Button> : ''}
</Menu.Item>
{(record.status === 3 || record.status === 6) ? <Menu.Item><Button type='link' onClick={() => clickUp(1)}>上架</Button></Menu.Item> : ''}
{record.status === 5 ? <Menu.Item><Button type='link' onClick={() => clickUp(0)}>下架</Button></Menu.Item> : ''}
{record.status === 4 ? <Menu.Item><Button type='link'>修改</Button></Menu.Item> : ''}
<Menu.Item>
<Button type='link'>复制</Button>
</Menu.Item>
</Menu>
}>
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
更多 <CaretDownOutlined />
</a>
</Dropdown>
</>
)
}
}
];
const search: IFormFilter[] = [
{
type: 'Input',
value: 'keywords',
col: 4,
placeHolder: '商品ID'
},
{
type: 'Input',
value: 'name',
col: 4,
placeHolder: '商品名称'
},
{
type: 'Input',
value: 'brand',
col: 4,
placeHolder: '商品品牌'
},
{
type: 'Input',
value: 'type',
col: 4,
placeHolder: '商品品类'
},
{
type: 'RangePicker', //...此处应为数值类范围搜索控件
col: 4,
value: 'range',
placeHolder: '商品价格'
},
{
type: 'Select',
value: 'status',
col: 4,
placeHolder: '商品状态',
statusList: [{
type: 'Select',
label: '还不错',
value: '1'
}, {
type: 'Select',
label: '还可以',
value: '1'
}]
},
]
const searchBarActions: IButtonFilter[] = [
{
text: '查询',
handler: () => {
console.log('查询')
}
},
{
text: '重置',
handler: () => {
console.log('重置')
}
},
{
type: 'primary',
text: '新建',
icon: <PlusOutlined />,
handler: () => {
history.push('/memberCenter/commodityAbility/commodity/products/addProducts')
}
},
{
text: '导入数据',
handler: () => {
console.log('导入')
setImportModal(true)
}
},
{
text: '批量删除',
handler: () => {
console.log('删除')
}
},
{
text: '删除导入批次',
handler: () => {
setDeleteBatchModal(true)
console.log('删除导入')
}
},
]
// 模拟请求
const fetchData = (params: any) => {
console.log(params, filterParams)
return new Promise((resolve, reject) => {
getProductLists({ current, pageSize, name: searchName, status: searchStatus }).then(res => {
getProductLists({...filterParams, pageSize: params.rows, current: params.page}).then(res => {
console.log(res, 'res')
const { data } = res
resolve(data)
......@@ -501,6 +416,89 @@ const Products: React.FC<{}> = () => {
setUpDownModal(false)
}
const handleMenuClick = (e: any) => {
console.log('menu', e, selectedRowKeys); // 1 批量删除;2 删除导入批次
if(e.key === '1'){
console.log('批量删除')
// deleteBatchGoods({idList: selectedRowKeys}).then(res=>{
// if(res.code === 1000){
// message.success(res.message)
// //@ts-ignore
// ref.current.reolad()
// }
// })
}else if(e.key === '2'){
console.log('删除导入批次')
setDeleteBatchModal(true)
}
}
const handleReset = () => {
let restObj = { name: '', code: '', Max: 0, Min: 0, priceType: null, brandId: 0, customerCategoryId: 0, status: null }
setFilterParams(restObj)
setBrandValue(undefined)
setClassValue(undefined)
//@ts-ignore
ref.current.reload(restObj)
}
const handleBrandSearch = (value:any) => { // end value
console.log(value, 'handleBrandSearch')
if (value) {
getSelectBrandList({name: value}).then(res=>{
if(res.code === 1000)
setBrandData(res.data)
})
} else {
setBrandData([])
}
}
const handleBrandChange = (value:any) => {
setBrandValue(value)
console.log(value, 'handleBrandChange')
let obj = {...filterParams, brandId: value}
setFilterParams(obj)
}
const handleClassSearch = (value:any) => {
console.log(value, 'handleClassSearch')
if (value) {
getSelectCustomerCategoryList({name: value}).then(res=>{
if(res.code === 1000)
setClassData(res.data)
})
} else {
setClassData([])
}
}
const handleClassChange = (value:any) => {
setClassValue(value)
let obj = {...filterParams, customerCategoryId: value}
setFilterParams(obj)
console.log(value, 'handleClassChange')
}
const handleSearch = (val: string) => {
console.log(val)
let obj = {...filterParams, name: val}
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
}
const menuMore = (
<Menu onClick={(e) => handleMenuClick(e)}>
<Menu.Item key="1" icon={<DeleteOutlined />}>
批量删除
</Menu.Item>
<Menu.Item key="2" icon={<DeleteOutlined />}>
删除导入批次
</Menu.Item>
</Menu>
)
return (
<PageHeaderWrapper>
<Card>
......@@ -508,9 +506,144 @@ const Products: React.FC<{}> = () => {
columns={columns}
currentRef={ref}
rowSelection={rowSelection}
tableProps={{rowKey: 'id'}}
fetchTableData={(params: any) => fetchData(params)}
formFilters={search}
buttonFilters={searchBarActions}
controlRender={
<Row>
<Col span={24}>
<Row gutter={[16,16]} justify="space-between" style={{marginBottom:0}}>
<Col span={12}>
<Button
type='primary'
onClick={()=>history.push('/memberCenter/commodityAbility/commodity/products/addProducts')}
>
<PlusOutlined />新建
</Button>
<Button style={{margin:'0 16px'}} onClick={()=>setImportModal(true)}>导入数据</Button>
<Dropdown overlay={menuMore} trigger={['click']}>
<Button>
更多 <DownOutlined />
</Button>
</Dropdown>
</Col>
<Col span={12} style={{display:'flex', justifyContent: 'flex-end'}}>
<Col span={8}>
<Input.Search
name="name"
placeholder="商品名称"
value={filterParams.name}
onChange={(e)=>setFilterParams({...filterParams, name: e.target.value})}
onSearch={(val) => handleSearch(val)}
/>
</Col>
<Col>
<Button onClick={() => setIsHighSearch(isHighSearch = !isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
</Col>
<Col>
<Button onClick={() => handleReset()}>重置</Button>
</Col>
</Col>
</Row>
</Col>
{
isHighSearch ?
<Col span={24}>
<Row gutter={[16, 8]} justify="end">
<Col span={24} style={{display:'flex', justifyContent: 'flex-end'}}>
{/* <Col span={4}>
<Input name="code" value={filterParams.code} onChange={(e)=>setFilterParams({...filterParams, code: e.target.value})} placeholder="商品编号"></Input>
</Col> */}
<Col span={4}>
<Select value={filterParams.priceType} onChange={(v)=>setFilterParams({...filterParams, priceType: +v})} style={{width:'100%'}} placeholder="商品定价">
<Option value={1}>现货价格</Option>
<Option value={2}>价格需要询价</Option>
<Option value={3}>积分兑换商品</Option>
</Select>
</Col>
<Col span={4}>
<Select
showSearch
placeholder="商品品牌"
value={brandValue}
defaultActiveFirstOption={false}
showArrow={false}
filterOption={false}
onSearch={handleBrandSearch}
onChange={handleBrandChange}
notFoundContent={null}
style={{width:'100%'}}
>
{brandData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
</Col>
<Col span={4}>
<Select
showSearch
placeholder="商品品类"
value={classValue}
defaultActiveFirstOption={false}
showArrow={false}
filterOption={false}
onSearch={handleClassSearch}
onChange={handleClassChange}
notFoundContent={null}
style={{width:'100%'}}
>
{classData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
</Col>
<Col span={4}>
<Select value={filterParams.status} onChange={(v)=>setFilterParams({...filterParams, status: +v})} style={{width:'100%'}} placeholder="商品状态">
<Option value={1}>待提交审核</Option>
<Option value={2}>待审核</Option>
<Option value={3}>审核不通过</Option>
<Option value={4}>审核通过</Option>
<Option value={5}>上架</Option>
<Option value={6}>下架</Option>
</Select>
</Col>
<Col span={4}>
<Input.Group compact>
<Input
type="number"
style={{ width: '40%', textAlign: 'center' }}
min={0}
placeholder="最低价格"
onChange={(e)=>setFilterParams({...filterParams, Min: +e.target.value})}
/>
<Input
style={{
width: '20%',
borderLeft: 0,
borderRight: 0,
pointerEvents: 'none',
backgroundColor: '#fff',
textAlign: 'center'
}}
placeholder="~"
disabled
/>
<Input
type="number"
style={{
width: '40%',
textAlign: 'center',
borderLeft: 0,
}}
min={0}
placeholder="最高价格"
onChange={(e)=>setFilterParams({...filterParams, Max: +e.target.value})}
/>
</Input.Group>
</Col>
</Col>
</Row>
</Col>
:
''
}
</Row>
}
/>
</Card>
<Modal
......
......@@ -88,36 +88,33 @@ const Trademark: React.FC<{}> = () => {
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text: any, record: any) => {
return (
<>
{record.status === 1 ? <Button type='link' onClick={()=>handleApplyCheck(record)}>提交审核</Button> : ''}
{(record.status === 1 || record.status === 3) ?
<Dropdown overlay={
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handelDelete(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
{
(record.status !== 2) ? <Dropdown overlay={
<Menu>
<Menu.Item>
<Button type='link' onClick={()=>history.push(`/memberCenter/commodityAbility/trademark/addBrand?id=${record.id}`)}>修改</Button>
</Menu.Item>
<Menu.Item>
<Button type='link' onClick={() => handelDelete(record)}>删除</Button>
{record.status === 1 ? <Button type='link' onClick={()=>handleApplyCheck(record)}>提交审核</Button> : ''}
</Menu.Item>
</Menu>
}>
}>
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
更多 <CaretDownOutlined />
</a>
</Dropdown> : <>
<Popconfirm
title="确定要执行这个操作?"
onConfirm={() => handelDelete(record)}
onCancel={cancel}
okText="是"
cancelText="否"
>
<Button type='link'>删除</Button>
</Popconfirm>
</>
</Dropdown> : ''
}
</>
)
......
......@@ -38,7 +38,7 @@ declare namespace AttributeApi {
export interface AttributeByUpdateStatusDTO {
id: number;
status: boolean;
isEnable: boolean;
}
......
......@@ -56,7 +56,8 @@ export async function updateAttribute(params: AttributeApi.AttributeItem) {
export async function deleteAttribute(params: AttributeApi.AttributeByQueryDTO) {
return request('/customer/deleteCustomerAttribute', {
prefix,
params
method: 'post',
data: params
})
}
......@@ -68,7 +69,8 @@ export async function deleteAttribute(params: AttributeApi.AttributeByQueryDTO)
export async function updateAttributeStatus(params: AttributeApi.AttributeByUpdateStatusDTO) {
return request('/customer/updateCustomerAttributeStatus', {
prefix,
params,
method: 'post',
data: params,
// ctlType: 'message'
})
}
......
......@@ -65,7 +65,8 @@ export async function updateCategory(params: CategoryTreeApi.CategoryListItem) {
export async function deleteCategory(params: CategoryTreeApi.CategoryByQueryDTO) {
return request('/customer/deleteCustomerCategory', {
prefix,
params
method: 'post',
data: params
})
}
......
......@@ -2,16 +2,18 @@ import '../attribute/API'
declare namespace PropertyValueApi {
export interface innerAttributeValue {
id: number;
value: string;
}
export interface PropertyValueItem {
id?: number;
value: string;
imageUrl?: string;
isEnable: boolean;
customerAttribute?: AttributeApi.innerAttribute;
attributeValue?: {
id: number;
value: string;
}
attributeValue?: innerAttributeValue;
}
export interface PropertyValueListsModel {
......@@ -46,7 +48,7 @@ declare namespace PropertyValueApi {
export interface PropertyValueByUpdateStatusDTO {
id: number;
status: boolean;
isEnable: boolean;
}
......
......@@ -48,7 +48,8 @@ export async function updatePropertyValue(params: PropertyValueApi.PropertyValue
export async function deletePropertyValue(params: PropertyValueApi.PropertyValueByQueryDTO) {
return request('/customer/deleteCustomerAttributeValue', {
prefix,
params
method: 'post',
data: params
})
}
......@@ -60,7 +61,8 @@ export async function deletePropertyValue(params: PropertyValueApi.PropertyValue
export async function updatePropertyValueStatus(params: PropertyValueApi.PropertyValueByUpdateStatusDTO) {
return request('/customer/updateCustomerAttributeValueStatus', {
prefix,
params,
method: 'post',
data: params,
// ctlType: 'message'
})
}
......
......@@ -45,9 +45,10 @@ export async function updateGoods(params: CommodityGoodsApi.GoodsInfoByUpdateDTO
*/
export async function deleteBatchGoods(params: CommodityGoodsApi.GoodsByBatchDeleteDTO) {
return request('/brand/deleteBrand', {
return request('/goods/deleteBatchGoods', {
prefix,
params
method: 'post',
data: params
})
}
......
import '../goods/API'
import '../../classAndProperty/attribute/API'
import { PropertyValueApi } from '../../classAndProperty/propertyValue/API'
declare namespace ProductsAPI {
interface customerCategoryObject {
// 查询列表
export interface ProductsListsByQueryDTO {
current: number;
pageSize: number;
name: string;
code: string;
brandId: number;
customerCategoryId: number;
priceType: number;
Min: number;
Max: number;
status: number;
}
export interface ProductItem {
id: number;
code: string;
name: string;
customerCategory: CommodityGoodsApi.innerCategory,
brand: CommodityGoodsApi.innerBrand,
unitName: string;
priceType: number;
min: number;
max: number;
status: number;
applyTime: number;
}
export interface ProductsListsModel {
totalCount: number;
data: ProductItem[];
}
// 查询商品信息
interface innerLogistics {
deliveryType: number;
carriageType: number;
weight: number;
sendAddress: string;
company: string;
}
interface innerCommodityPic {
main: string;
front: string;
side: string;
bottom: string;
other: string[];
}
interface commodityAttributeItem {
id: number;
key: string;
level: number;
name: string;
type: number;
imageUrl: string;
categoryKey: string;
customerAttribute: AttributeApi.innerAttribute;
customerAttributeValueList: PropertyValueApi.innerAttributeValue[]
}
interface brandObject {
interface unitPriceAndPicItem {
id: number;
goods: CommodityGoodsApi.GoodsItem;
attributeAndValueList: commodityAttributeItem[];
unitPrice: Object; //..
commodityPic: innerCommodityPic;
}
/* 获取详情 删除 提交审核 获取上架商城 复制商品 共用 */
export interface ProductDetailByQueryDTO {
id: number;
name: string;
logoUrl: string;
applyTime: string
status: number;
checkTime: string;
isEnable: boolean;
}
interface goodItem {
export interface ProductDetailModel {
id: number;
status: number;
applyTime: number;
customerCategoryName: string;
brand: CommodityGoodsApi.innerBrand;
code: string;
name: string;
type: string;
customerCategoryId: number;
customerCategory: customerCategoryObject;
brandId: number;
brand: object;
unitId: number;
slogan: string;
sellingPoint: string;
area: string[];
commodityAttributeList: commodityAttributeItem[];
unitName: string;
costPrice: number;
batch: string;
unitId: string;
minOrder: number;
priceType: number;
min: number;
max: number;
unitPriceAndPicList: unitPriceAndPicItem[];
logistics: innerLogistics;
isInvoice: boolean;
marks: string;
packing: string;
afterService: string;
}
export interface ProductListsByQueryDTO {
current: number;
pageSize: number;
name: string;
status: number;
// 新增修改商品
interface innerCustomerAttributeValueList {
customerAttributeValueId: number;
value: string;
}
export interface ProductItem {
id: number;
interface innerCustomerAttributeList {
customerAttributeId: number;
customerAttributeValueList: innerCustomerAttributeValueList[];
}
interface innerGoodsCustomerAttributeList {
customerAttributeId: number;
customerAttributeValueId: number;
value: string;
}
interface innerUnitPriceAndPicList {
goodsId: number;
goodsCustomerAttributeList: innerGoodsCustomerAttributeList[];
unitPrice: Object;
commodityPic: innerCommodityPic;
}
export interface ProductsInfoByUpdateDTO {
id?: number;
memberId?: number;
status: number;
categoryId: number;
customerCategoryId: number;
brandId: number;
goodsList: goodItem[];
name: string;
slogan: string;
sellingPoint: string;
area: string[];
// commodityAttribute: commodityAttributeItem[];
commodityAttribute: any[];
unitId: string;
customerAttributeList: innerCustomerAttributeList[];
unitId: number;
unitName: string;
minOrder: number;
priceType: number;
// unitPriceAndPic: unitPriceAndPicItem[];
unitPriceAndPic: any[];
logistics: object;
unitPriceAndPicList: innerUnitPriceAndPicList[];
logistics: innerLogistics;
isInvoice: boolean;
marks: string;
packing: string;
afterService: string;
}
// 获取上架商城
export interface ProductsGetShopModel {
id: number;
name: string;
isCheck: boolean;
}
// 上架商品
/* 上下架共用 */
export interface publishAndOffCommodityDTO {
id: number;
shopIdList: number[];
}
}
\ No newline at end of file
import request from '@/utils/request';
import { ProductsAPI } from './API';
const prefix = '/product'
......@@ -8,7 +9,7 @@ const prefix = '/product'
* @param {ProductsAPI.ProductListsByQueryDTO} params
*/
export async function getProductLists(params: ProductsAPI.ProductListsByQueryDTO) {
export async function getProductLists(params: ProductsAPI.ProductsListsByQueryDTO) {
return request<CategoryTreeApi.CategroyListsModel>('/commodity/getCommodityList', {
prefix,
params
......
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