Commit 2864314e authored by XieZhiXiong's avatar XieZhiXiong
parents 2acbb19d e7b0b08b
......@@ -50,6 +50,8 @@ export interface IProductModule {
productInfoByEdit: GetProductCommodityGetCommodityResponse;
attributeLists: any[];
productName: string;
selectCategoryId: any;
selectBrandId: any;
productSelectAttribute: IProductSelectAttribute[]; //商品属性传输数据
selectedGoods: GetProductGoodsGetGoodsListResponseDetail[];
tableDataSource: any[];
......@@ -59,6 +61,8 @@ export interface IProductModule {
setAttributeLists(lists: any[]): void;
setProductName(name: string): void;
setSelectCategoryId(datas: any[]): void;
setSelectBrandId(datas: any[]): void;
setProductSelectAttribute(list: IProductSelectAttribute[]): void;
setSelectedGoods(lists: GetProductGoodsGetGoodsListResponseDetail[]): void;
setTableDataSource<T>(datas: T[]): void;
......
......@@ -151,7 +151,14 @@ const CategoryAttributes: React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
<Button type='link' onClick={() => clickRelief(record.id)}>解除关联</Button>
<Popconfirm
title="是否解除关联?"
onConfirm={()=>clickRelief(record.id)}
okText="是"
cancelText="否"
>
<Button type='link'>解除关联</Button>
</Popconfirm>
</>
)
}
......
......@@ -443,7 +443,13 @@ const Goods: React.FC<{}> = () => {
</Col>
<Col span={12} style={{display:'flex', justifyContent: 'flex-end'}}>
<Col span={8}>
<Input.Search name="name" placeholder="货品名称" value={filterParams.name} onChange={(e)=>nameChange(e)} onSearch={(val) => handleSearch(val)} />
<Input.Search
autoComplete="off"
name="name"
placeholder="货品名称"
value={filterParams.name}
onChange={(e)=>nameChange(e)} onSearch={(val) => handleSearch(val)}
/>
</Col>
<Col>
<Button onClick={() => setIsHighSearch(isHighSearch = !isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
......@@ -460,7 +466,12 @@ 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)=>setFilterParams({...filterParams, code: e.target.value})} placeholder="货号"></Input>
<Input
name="code"
value={filterParams.code}
onChange={(e)=>setFilterParams({...filterParams, code: e.target.value})} placeholder="货号"
autoComplete="off"
/>
</Col>
<Col span={4}>
<Select
......@@ -497,7 +508,13 @@ const Goods: React.FC<{}> = () => {
</Select>
</Col>
<Col span={4}>
<Input name="batch" value={filterParams.batch} onChange={(e)=>setFilterParams({...filterParams, batch: e.target.value})} placeholder="导入批次"></Input>
<Input
name="batch"
value={filterParams.batch}
onChange={(e)=>setFilterParams({...filterParams, batch: e.target.value})}
placeholder="导入批次"
autoComplete="off"
/>
</Col>
<Col>
<Button type="primary" onClick={()=>handleSearch()}>查询</Button>
......
......@@ -67,7 +67,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
const [showCategory, setShowCategory] = useState(null)
const [areaParams, setAreaParams] = useState<AreaParams>()
const { ProductStore } = store
const { setAreaOption, productInfoByEdit, getBasicFormParamsByEdit, setAttributeLists, setProductName } = ProductStore
const { setAreaOption, productInfoByEdit, getBasicFormParamsByEdit, setAttributeLists, setProductName, setSelectCategoryId, setSelectBrandId } = ProductStore
useEffect(() => {
// 获取品类树
......@@ -122,6 +122,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
const handleBrandChange = (value: any) => {
setBrandValue(value)
setSelectBrandId(value)
}
const tagRender = (props) => {
......@@ -141,8 +142,9 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
PublicApi.getProductCustomerGetCustomerCategoryById({ id: seletCategoryId }).then(res => {
const { data } = res
onChangeAttributeList(data?.customerAttributeList)
setShowCategory(data?.name)
setShowCategory(data?.type)
setAttributeLists(data?.customerAttributeList)
setSelectCategoryId(seletCategoryId)
})
}
else
......@@ -170,6 +172,18 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setProductName(value)
}
const renderCategoryType = () => {
// 1-实物商品、2-虚拟商品、3-服务商品、4-积分兑换商品
if(showCategory === 1)
return '实物商品'
else if(showCategory === 2)
return '虚拟商品'
else if(showCategory === 3)
return '服务商品'
else if(showCategory === 4)
return '积分兑换商品'
}
return (<>
<Form
{...layout}
......@@ -345,7 +359,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
<Form.Item
label='品类类型'
>
{showCategory && <><span className="commonStatusValid"></span>{showCategory}</>}
{showCategory && <><span className="commonStatusValid"></span>{renderCategoryType()}</>}
</Form.Item>
{/* <Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
......
......@@ -38,6 +38,9 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
//传入ref给父级
onRef(logisticsFormRef)
if(history.location.query?.id)
setDeliveryType(productInfoByEdit.logistics?.deliveryType)
// 获取发货地址 物流公司 运费模板
PublicApi.getLogisticsSelectListShipperAddress().then(res=>{
setLogisticsAddressList(res.data)
......
......@@ -34,6 +34,15 @@ const ProductDescFormDefualt: React.FC<Iprops> = (props) => {
}
}, [])
useEffect(() => {
// 设置传输数据
setProductDescription({
video: videoList,
image: fileImageList,
word: []
})
}, [fileImageList, videoList])
const uploadImgProps = {
name: 'file',
action: '/api/file/file/upload',
......@@ -49,19 +58,19 @@ const ProductDescFormDefualt: React.FC<Iprops> = (props) => {
if(Array.isArray(fileImageList)){
setFileImageList([...fileImageList, info.file.response.data])
// 设置传输数据
setProductDescription({
video: videoList,
image: [...fileImageList, info.file.response.data],
word: []
})
// setProductDescription({
// video: videoList,
// image: [...fileImageList, info.file.response.data],
// word: []
// })
}else{
setFileImageList([info.file.response.data])
// 设置传输数据
setProductDescription({
video: videoList,
image: [info.file.response.data],
word: []
})
// setProductDescription({
// video: videoList,
// image: [info.file.response.data],
// word: []
// })
}
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`);
......@@ -91,19 +100,19 @@ const ProductDescFormDefualt: React.FC<Iprops> = (props) => {
if(Array.isArray(videoList)){
setVideoList([...videoList, info.file.response.data])
// 设置传输数据
setProductDescription({
video: [...videoList],
image: fileImageList,
word: []
})
// setProductDescription({
// video: [...videoList],
// image: fileImageList,
// word: []
// })
}else{
setVideoList([info.file.response.data])
// 设置传输数据
setProductDescription({
video: [info.file.response.data],
image: fileImageList,
word: []
})
// setProductDescription({
// video: [info.file.response.data],
// image: fileImageList,
// word: []
// })
}
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 文件上传失败`);
......
......@@ -31,7 +31,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
const [selectGoodsRow, setSelectGoodsRow] = useState<GetProductGoodsGetGoodsListResponseDetail[]>([]) // 模态框选择的行数据
const [selectedGoodsRowKeys, setSelectedGoodsRowKeys] = useState<Array<number>>([])
const { ProductStore } = store
const { productInfoByEdit } = ProductStore
const { productInfoByEdit, selectCategoryId, selectBrandId } = ProductStore
useEffect(()=>{
const { id } = history.location.query
......@@ -54,7 +54,7 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
let obj = { ...params }
let obj = { ...params, brandId: selectBrandId || productInfoByEdit?.brand?.id, customerCategoryId: selectCategoryId || productInfoByEdit?.customerCategory?.id}
PublicApi.getProductGoodsGetGoodsList(obj).then(res => {
resolve(res.data)
})
......
......@@ -98,7 +98,14 @@ const FastModifyPrice: React.FC<{}> = () => {
title: '价格',
dataIndex: 'min',
key: 'min',
render: (text: any, reocrd: any) => (<>{reocrd.min} ~ ¥{reocrd.max}</>)
render: (text:any, reocrd:any) => {
if(reocrd.priceType === 1)
return <>{reocrd.min} ~ ¥{reocrd.max}</>
if(reocrd.priceType === 3)
return <>{reocrd.min} ~ {reocrd.max}</>
if(reocrd.priceType === 2)
return null
}
},
{
title: '审核时间',
......@@ -212,7 +219,9 @@ const FastModifyPrice: React.FC<{}> = () => {
setFilterParams({})
setBrandValue(undefined)
setClassValue(undefined)
ref.current.reload({})
setTimeout(() => {
ref.current.reload()
}, 500)
}
const handleBrandSearch = (value?: any) => { // end value
......@@ -308,15 +317,6 @@ const FastModifyPrice: React.FC<{}> = () => {
}
}
// 价格范围筛选处理
const onBlur = (v:any, param: string) => {
if(Number(v) < 0){
let _temp = {...filterParams}
_temp[param] = 0
setFilterParams(_temp)
}
}
return (
<PageHeaderWrapper>
<Card>
......@@ -333,6 +333,7 @@ const FastModifyPrice: React.FC<{}> = () => {
<Col span={12} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Col span={8}>
<Input.Search
autoComplete="off"
name="name"
placeholder="商品名称"
value={filterParams.name}
......@@ -355,7 +356,7 @@ const FastModifyPrice: React.FC<{}> = () => {
<Row gutter={[16, 8]} justify="end">
<Col span={24} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Col span={4}>
<Select allowClear value={filterParams.priceType} onChange={(v) => setFilterParams({ ...filterParams, priceType: +v })} style={{ width: '100%' }} placeholder="商品定价">
<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>
......@@ -397,14 +398,12 @@ const FastModifyPrice: React.FC<{}> = () => {
</Col>
<Col span={4}>
<Input.Group compact>
<Input
type="number"
<InputNumber
style={{ width: '40%', textAlign: 'center' }}
min={0}
value={filterParams.min}
placeholder="最低价格"
onChange={(e) => setFilterParams({ ...filterParams, min: +e.target.value })}
onBlur={(e)=>onBlur(e.target.value, 'min')}
onChange={(e) => setFilterParams({ ...filterParams, min: e })}
/>
<Input
style={{
......@@ -418,8 +417,7 @@ const FastModifyPrice: React.FC<{}> = () => {
placeholder="~"
disabled
/>
<Input
type="number"
<InputNumber
style={{
width: '40%',
textAlign: 'center',
......@@ -428,8 +426,7 @@ const FastModifyPrice: React.FC<{}> = () => {
min={0}
value={filterParams.max}
placeholder="最高价格"
onChange={(e) => setFilterParams({ ...filterParams, max: +e.target.value })}
onBlur={(e)=>onBlur(e.target.value, 'max')}
onChange={(e) => setFilterParams({ ...filterParams, max: e })}
/>
</Input.Group>
</Col>
......@@ -590,8 +587,8 @@ const FastModifyPrice: React.FC<{}> = () => {
message: priceType===3 ? '请输入积分!' : '请输入单价!'
},
{
pattern: priceType!==3 && /^\d+(\.\d{1,4})?$/,
message: priceType!==3 && '小数点后仅限四位',
pattern: priceType!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/,
message: priceType!==3 ? '小数点后仅限四位' : '请正确输入积分',
}
]}
>
......
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, message } from 'antd'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Input, Menu, Popconfirm, message, InputNumber } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
......@@ -166,9 +166,9 @@ const Products: React.FC<{}> = () => {
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusValid"></span>审核不通过</>)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusInvalid"></span>审核通过</>)
component = (<><span className="commonStatusValid"></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)
......@@ -551,15 +551,6 @@ const Products: React.FC<{}> = () => {
ref.current.reload(obj)
}
// 价格范围筛选处理
const onBlur = (v:any, param: string) => {
if(Number(v) < 0){
let _temp = {...filterParams}
_temp[param] = 0
setFilterParams(_temp)
}
}
const menuMore = (
<Menu onClick={(e) => handleMenuClick(e)}>
<Menu.Item key="1" icon={<DeleteOutlined />}>
......@@ -601,6 +592,7 @@ const Products: React.FC<{}> = () => {
<Col span={12} style={{display:'flex', justifyContent: 'flex-end'}}>
<Col span={8}>
<Input.Search
autoComplete="off"
name="name"
placeholder="商品名称"
value={filterParams.name}
......@@ -678,14 +670,12 @@ const Products: React.FC<{}> = () => {
</Col>
<Col span={4}>
<Input.Group compact>
<Input
type="number"
<InputNumber
value={filterParams.min}
style={{ width: '40%', textAlign: 'center' }}
min={0}
placeholder="最低价格"
onChange={(e)=>setFilterParams({...filterParams, min: +e.target.value})}
onBlur={(e)=>onBlur(e.target.value, 'min')}
onChange={(e)=>setFilterParams({...filterParams, min: +e})}
/>
<Input
style={{
......@@ -699,8 +689,7 @@ const Products: React.FC<{}> = () => {
placeholder="~"
disabled
/>
<Input
type="number"
<InputNumber
value={filterParams.max}
style={{
width: '40%',
......@@ -709,8 +698,7 @@ const Products: React.FC<{}> = () => {
}}
min={0}
placeholder="最高价格"
onChange={(e)=>setFilterParams({...filterParams, max: +e.target.value})}
onBlur={(e)=>onBlur(e.target.value, 'max')}
onChange={(e)=>setFilterParams({...filterParams, max: +e})}
/>
</Input.Group>
</Col>
......
......@@ -351,7 +351,7 @@ const viewProducts: React.FC<{}> = () => {
<p>商品卖点:</p>
</Col>
<Col span={20}>
<p>{productDetail?.sellingPoint.map(_item => <Tag key={_item}>{_item}</Tag>)}</p>
<p>{productDetail?.sellingPoint && productDetail?.sellingPoint.map(_item => <Tag key={_item}>{_item}</Tag>)}</p>
</Col>
</Row>
<Row>
......
......@@ -4,6 +4,8 @@ import { IProductModule, IProductSelectAttribute, IBasicFormParam, IPriceAttribu
class ProductStore implements IProductModule {
@observable public attributeLists: any[] = [];
@observable public productName: string = "";
@observable public selectCategoryId: any = null;
@observable public selectBrandId: any = null;
@observable public productSelectAttribute: IProductSelectAttribute[] = [];
@observable public selectedGoods: any[] = [];
@observable public tableDataSource: any[] = [];
......@@ -88,6 +90,16 @@ class ProductStore implements IProductModule {
}
@action.bound
public setSelectCategoryId(data: any) {
this.selectCategoryId = data
}
@action.bound
public setSelectBrandId(data: any) {
this.selectBrandId = data
}
@action.bound
public setProductSelectAttribute(list: any[]) {
console.log(list, 'mobx')
this.productSelectAttribute = list;
......
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