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>
......
This diff is collapsed.
......@@ -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