Commit 310ca730 authored by guang.wu's avatar guang.wu

feat: 添加竞价搜索弹窗

parent 71843f40
import {
Form,
Button,
Input,
Select,
notification,
Cascader,
InputNumber,
Popover,
Tag,
} from 'antd';
import React, { Component } from 'react';
import { SwapRightOutlined } from '@ant-design/icons';
import { connect } from 'dva';
import styles from '../../style.less';
import { stateList } from '../../staticdata';
import { GOOD_MANAGE } from '@/../config/permission.config';
const FormItem = Form.Item;
const { Option } = Select;
@connect(({ goodsManage, menu }) => ({
goodsManage,
permissions: menu.permissions,
}))
class goodsManage extends Component {
formRef = React.createRef();
state = {
productType: null,
};
componentDidMount() {
this.props.onRef(this);
this.handleSearch();
}
getFieldsValue() {
const form = this.formRef.current;
return form.getFieldsValue();
}
handleSearch = () => {
this.props.handleSearch(1);
};
valueMin = value => {
const { getFieldValue, setFieldsValue } = this.formRef.current;
const minVal = getFieldValue('supplyPriceMin');
if (minVal && minVal > value) {
setFieldsValue({ supplyPriceMax: minVal });
}
};
onReset = () => {
const form = this.formRef.current;
form.resetFields();
this.props.onReset();
this.props.changeProductType(1);
this.setState({
productType: 1,
});
};
addSpu = () => {
this.props.addSpu();
};
setArea = (isAll, type) => {
this.props.setArea(isAll, type);
};
// 验证是否可以修改库存
checkEnableUpdateStock = () => {
if (this.props.selectNum) {
this.props.checkStock();
} else {
notification.info({ message: '请选择' });
}
};
onChangeProductType = (v = null) => {
const form = this.formRef.current;
form.setFieldsValue({
skuId: '',
skuName: '',
thirdSkuNo: '',
productCategoryId: null,
state: null,
supplyPriceMin: null,
supplyPriceMax: null,
productType: v,
});
this.props.changeProductType(v);
this.setState({
productType: v,
});
};
render() {
const { treeData, permissions } = this.props;
const selectW = { width: 250 };
const iptNumWidth = { width: 118 };
const canEditable = permissions[GOOD_MANAGE.EDITABLE];
const content = (
<div>
<Button style={{ border: 'none' }} onClick={() => this.setArea(1, 'distribution')}>
全部商品配送区域设置
</Button>
<br />
<Button style={{ border: 'none' }} onClick={() => this.setArea(0, 'distribution')}>
勾选商品配送区域设置
</Button>
<br />
<Button style={{ border: 'none' }} onClick={() => this.setArea(1, 'after')}>
全部商品售后地址设置
</Button>
<br />
<Button style={{ border: 'none' }} onClick={() => this.setArea(0, 'after')}>
勾选商品售后地址设置
</Button>
<br />
<Button style={{ border: 'none' }} onClick={() => this.checkEnableUpdateStock()}>
勾选商品库存修改
</Button>
</div>
);
const filterOption = (input, op) => op.props.children.includes(input);
return (
<Form
ref={this.formRef}
name="horizontal_login"
initialValues={{ productType: 1 }}
layout="inline"
className={styles.searchForm}
>
<FormItem label="SKU编码" name="skuId">
<InputNumber placeholder="请输入SKU编码" max={99999999999999999} style={selectW} />
</FormItem>
<FormItem label="商品名称" name="skuName">
<Input placeholder="请输入商品名称" allowClear style={selectW} />
</FormItem>
<FormItem label="商品类型" name="productType">
<Select style={selectW} placeholder="请选择商品类型" onChange={this.onChangeProductType}>
<Option value={1}>实体商品</Option>
<Option value={4}>服务类商品</Option>
<Option value={5}>外卖商品</Option>
</Select>
</FormItem>
<FormItem label="类目" name="productCategoryId">
<Cascader
placeholder="请选择类目"
style={selectW}
showSearch
changeOnSelect
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
options={treeData}
/>
</FormItem>
{this.state.productType !== 5 && (
<>
<FormItem label="审核状态" name="state">
<Select
style={selectW}
placeholder="请选择审核状态"
allowClear
filterOption={filterOption}
>
{stateList?.map(item => (
<Option key={item.value} value={item.value}>
{item.label}
</Option>
))}
</Select>
</FormItem>
<FormItem label="供货价区间">
<FormItem name="supplyPriceMin" className={styles.iptNumRight} noStyle>
<InputNumber placeholder="请输入" min={0} max={999999999} style={iptNumWidth} />
</FormItem>
<span>
<SwapRightOutlined />
</span>
<FormItem name="supplyPriceMax" className={styles.iptNumRight} noStyle>
<InputNumber
style={iptNumWidth}
min={0}
max={999999999}
placeholder="请输入"
onChange={this.valueMin}
/>
</FormItem>
</FormItem>
<FormItem name="thirdSkuNo" label="第三方SKU编码">
<Input placeholder="请输入第三方SKU编码" allowClear style={selectW} />
</FormItem>
</>
)}
<FormItem className={styles.queryBtn}>
<Button onClick={() => this.handleSearch()} type="primary" className={styles.button}>
查询
</Button>
<Button onClick={() => this.onReset()} className={styles.button}>
重置
</Button>
{this.state.productType !== 5 && (
<>
{canEditable ? (
<FormItem style={{ float: 'right' }}>
<Popover content={content} onVisibleChange={this.handleVisibleChange}>
<Button type="primary" className={styles.button}>
批量设置
</Button>
</Popover>
{this.props.selectNum > 0 && (
<Tag color="green">已选商品 {this.props.selectNum}</Tag>
)}
</FormItem>
) : (
''
)}
</>
)}
</FormItem>
</Form>
);
}
}
export default goodsManage;
...@@ -20,7 +20,7 @@ import { ...@@ -20,7 +20,7 @@ import {
} from '../service'; } from '../service';
import LogModal from '../LogModal'; import LogModal from '../LogModal';
import { column, JDSHOPID } from '../staticdata'; import { column, JDSHOPID } from '../staticdata';
import SearchForm from '../SearchForm'; import SearchForm from './components/SearchForm';
import TempleatModal from '../TempleatModal'; import TempleatModal from '../TempleatModal';
import ServiceGoods from '../../ServiceGoods'; import ServiceGoods from '../../ServiceGoods';
import InfoAudit from '../infoAudit'; import InfoAudit from '../infoAudit';
...@@ -84,7 +84,6 @@ class supplyPriceUpdate extends Component { ...@@ -84,7 +84,6 @@ class supplyPriceUpdate extends Component {
this.categoryListByType(this.state.productType); this.categoryListByType(this.state.productType);
this.getVirtualCategory(); this.getVirtualCategory();
this.specList(); this.specList();
console.log('this.state.productType', this.state.productType);
} }
handleSearch = page => { handleSearch = page => {
...@@ -386,6 +385,7 @@ class supplyPriceUpdate extends Component { ...@@ -386,6 +385,7 @@ class supplyPriceUpdate extends Component {
SupplyPrice: { tableData = {} }, SupplyPrice: { tableData = {} },
permissions, permissions,
} = this.props; } = this.props;
console.log('tableData :>> ', tableData);
const rowSelection = { const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys, selectedRowKeys: this.state.selectedRowKeys,
onChange: this.onSelectChange, onChange: this.onSelectChange,
......
...@@ -59,8 +59,8 @@ export function column(specArr = []) { ...@@ -59,8 +59,8 @@ export function column(specArr = []) {
<div> <div>
<Form.Item <Form.Item
label="" label=""
key="productStock" key="stock"
name={['data', index, 'productStock']} name={['data', index, 'stock']}
initialValue={row.productStock} initialValue={row.productStock}
rules={[{ required: true, message: '请输入库存!' }, { validator: isIntegerNotMust }]} rules={[{ required: true, message: '请输入库存!' }, { validator: isIntegerNotMust }]}
> >
......
...@@ -406,8 +406,7 @@ export async function apiProductBiddingInfo(params) { ...@@ -406,8 +406,7 @@ export async function apiProductBiddingInfo(params) {
export async function apiProductBiddingUpdate(params) { export async function apiProductBiddingUpdate(params) {
return request.post('/api/merchants/products/bidding/edit', { return request.post('/api/merchants/products/bidding/edit', {
prefix: goodsApi, prefix: goodsApi,
data: stringify(params), data: params,
headers,
}); });
} }
...@@ -416,10 +415,9 @@ export async function apiProductBiddingUpdate(params) { ...@@ -416,10 +415,9 @@ export async function apiProductBiddingUpdate(params) {
* yApi: http://yapi.quantgroups.com/project/389/interface/api/67164 * yApi: http://yapi.quantgroups.com/project/389/interface/api/67164
* * */ * * */
export async function apiBiddingList(params) { export async function apiBiddingList(params) {
const [data] = await request.post('/api/merchants/products/bidding/page', { return request.post('/api/merchants/products/bidding/page', {
prefix: goodsApi, prefix: goodsApi,
data: stringify(params), data: stringify(params),
headers, headers,
}); });
return data;
} }
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