Commit 63a12f9b authored by beisir's avatar beisir

fix: 调整

parent d9af01f6
...@@ -176,6 +176,9 @@ class goodsManage extends Component { ...@@ -176,6 +176,9 @@ class goodsManage extends Component {
<Button type="primary" className={styles.button} onClick={this.addSpu}> <Button type="primary" className={styles.button} onClick={this.addSpu}>
新增商品 新增商品
</Button> </Button>
<Button type="primary" className={styles.button} onClick={this.props.serviceVisbleOpen}>
新增电子卡卷
</Button>
{/* <Button {/* <Button
className={styles.button} className={styles.button}
type="primary" type="primary"
......
...@@ -322,6 +322,10 @@ class goodsManage extends Component { ...@@ -322,6 +322,10 @@ class goodsManage extends Component {
} }
}; };
serviceVisbleOpen = () => {
this.serviceVisbleClose(true);
};
serviceVisbleClose = flag => { serviceVisbleClose = flag => {
this.setState({ this.setState({
serviceVisble: flag, serviceVisble: flag,
...@@ -342,7 +346,6 @@ class goodsManage extends Component { ...@@ -342,7 +346,6 @@ class goodsManage extends Component {
<PageHeaderWrapper> <PageHeaderWrapper>
<Spin spinning={this.state.createloading}> <Spin spinning={this.state.createloading}>
<Card> <Card>
<Button onClick={() => this.serviceVisbleClose(true)}>新建</Button>
<SearchForm <SearchForm
handleSearch={this.handleSearch} handleSearch={this.handleSearch}
onReset={this.onReset} onReset={this.onReset}
...@@ -354,6 +357,7 @@ class goodsManage extends Component { ...@@ -354,6 +357,7 @@ class goodsManage extends Component {
shopList={this.shopList} shopList={this.shopList}
addSpu={() => this.setState({ createVisible: true, initData: {} })} addSpu={() => this.setState({ createVisible: true, initData: {} })}
setArea={(isALL, type) => this.setArea(isALL, type)} setArea={(isALL, type) => this.setArea(isALL, type)}
serviceVisbleOpen={this.serviceVisbleOpen}
/> />
</Card> </Card>
<Spin spinning={this.state.loading}> <Spin spinning={this.state.loading}>
...@@ -444,6 +448,7 @@ class goodsManage extends Component { ...@@ -444,6 +448,7 @@ class goodsManage extends Component {
id={894048258062} id={894048258062}
onChange={this.serviceVisbleClose} onChange={this.serviceVisbleClose}
SourceData={this.state.serviceData} SourceData={this.state.serviceData}
shopList={this.shopList}
categoryList={ categoryList={
this.state.serviceData.productType === 2 this.state.serviceData.productType === 2
? this.state.virtualTreeData ? this.state.virtualTreeData
......
...@@ -45,7 +45,10 @@ const UpdateSkuName = ({ skuVisble, value, confirmEvent, cancelEvent }) => { ...@@ -45,7 +45,10 @@ const UpdateSkuName = ({ skuVisble, value, confirmEvent, cancelEvent }) => {
}; };
const EditableContext = createContext(null); const EditableContext = createContext(null);
const EditableRow = ({ index, ...props }) => <tr {...props} />; const EditableRow = ({ index, ...props }) => (
// console.log('=============>EditableRow', props);
<tr {...props} />
);
const EditableCell = props => { const EditableCell = props => {
const { const {
rowIndex, rowIndex,
...@@ -84,34 +87,29 @@ const EditableCell = props => { ...@@ -84,34 +87,29 @@ const EditableCell = props => {
if (type === 'updateName') { if (type === 'updateName') {
rowOnClickEvent(row); rowOnClickEvent(row);
} }
// console.log(type, row);
}; };
const childNode = editable ? (
const childNode = (
<Form.Item <Form.Item
style={{ margin: 0 }} style={{ margin: 0 }}
hidden={roleHidden} hidden={roleHidden}
name={['tableList', rowIndex, dataIndex]} name={['tableList', rowIndex, dataIndex]}
rules={[{ required: roleRules.required, message: `请输入${title}.` }]} rules={[{ required: roleRules.required, message: `请输入${title}.` }]}
> >
{editable ? ( <CreateFormInput
<CreateFormInput {...roleProps}
{...roleProps} title={title}
title={title} rowIndex={rowIndex}
rowIndex={rowIndex} dataIndex={dataIndex}
dataIndex={dataIndex} record={record}
record={record} type={props.type}
type={props.type} onBlur={save}
onBlur={save} onClick={onClickEvent}
onClick={onClickEvent} disabled={props.disabled}
disabled={props.disabled} />
/>
) : (
<Button type="text">{children[1]}</Button>
)}
</Form.Item> </Form.Item>
); ) : (
children
); // <Button type="text">{children[1]}</Button>
return <td {...restProps}>{childNode}</td>; return <td {...restProps}>{childNode}</td>;
}; };
...@@ -143,7 +141,10 @@ const EditFormTable = forwardRef((props, ref) => { ...@@ -143,7 +141,10 @@ const EditFormTable = forwardRef((props, ref) => {
}; };
const handleSave = row => { const handleSave = row => {
setTableData([...row]); form.setFieldsValue({
tableList: [...row],
});
// setTableData([...row]);
}; };
const onCheck = async () => { const onCheck = async () => {
...@@ -210,10 +211,12 @@ const EditFormTable = forwardRef((props, ref) => { ...@@ -210,10 +211,12 @@ const EditFormTable = forwardRef((props, ref) => {
})); }));
return ( return (
<div> <>
<Form form={form} scrollToFirstError component={false}> <Form form={form} scrollToFirstError component={false}>
<EditableContext.Provider value={form}> <EditableContext.Provider value={form}>
{/* scroll={{ y: 300, x: 1200 }} */}
<Table <Table
height={300}
pagination={false} pagination={false}
size="small" size="small"
components={{ components={{
...@@ -228,9 +231,6 @@ const EditFormTable = forwardRef((props, ref) => { ...@@ -228,9 +231,6 @@ const EditFormTable = forwardRef((props, ref) => {
columns={columns} columns={columns}
/> />
</EditableContext.Provider> </EditableContext.Provider>
<Button onClick={handleAdd} type="primary" style={{ marginBottom: 16 }}>
Add a row
</Button>
</Form> </Form>
<Button onClick={() => {}}></Button> <Button onClick={() => {}}></Button>
<UpdateSkuName <UpdateSkuName
...@@ -240,7 +240,7 @@ const EditFormTable = forwardRef((props, ref) => { ...@@ -240,7 +240,7 @@ const EditFormTable = forwardRef((props, ref) => {
confirmEvent={confirmEvent} confirmEvent={confirmEvent}
cancelEvent={cancelEvent} cancelEvent={cancelEvent}
/> />
</div> </>
); );
}); });
......
...@@ -16,7 +16,7 @@ const filterCategoryOptions = (inputValue, path) => ...@@ -16,7 +16,7 @@ const filterCategoryOptions = (inputValue, path) =>
path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1); path.some(option => option.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
const FormInformationBasic = forwardRef((props, ref) => { const FormInformationBasic = forwardRef((props, ref) => {
const { editData, categoryList, brandList, afterAddressList, specListData } = props; const { editData, categoryList, brandList, shopList, afterAddressList, specListData } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [noreBrandList, setNoreBrandList] = useState([]); const [noreBrandList, setNoreBrandList] = useState([]);
const customer = useContext(ServiceContext); const customer = useContext(ServiceContext);
...@@ -79,6 +79,15 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -79,6 +79,15 @@ const FormInformationBasic = forwardRef((props, ref) => {
}} }}
scrollToFirstError scrollToFirstError
> >
<Form.Item
label="供应商名称"
name="supplierId"
rules={[{ required: true, message: '请选择供应商名称' }]}
>
<Select showSearch placeholder="请选择供应商名称" filterOption={fileterBrandOptions}>
{CreateSelectOption(shopList)}
</Select>
</Form.Item>
<Form.Item <Form.Item
name="categoryId" name="categoryId"
label="商品类目" label="商品类目"
...@@ -126,40 +135,45 @@ const FormInformationBasic = forwardRef((props, ref) => { ...@@ -126,40 +135,45 @@ const FormInformationBasic = forwardRef((props, ref) => {
*本列表的商品名称仅供搜索使用,不在前端作展示。若要修改APP端展示的商品名称,请在商品信息中修改。 *本列表的商品名称仅供搜索使用,不在前端作展示。若要修改APP端展示的商品名称,请在商品信息中修改。
</Button> </Button>
)} )}
<Form.Item {!customer.isCard && (
name="character" <Form.Item
label="商品卖点" name="character"
maxLength={50} label="商品卖点"
placeholder="卖点最优可填写3个词,12个字。前后用空格加竖杠分隔,例: 莹莹剔透 | 粒粒优选 | 易煮易熟" maxLength={50}
rules={[{ required: true, message: '请输入商品卖点!', whitespace: true }]} placeholder="卖点最优可填写3个词,12个字。前后用空格加竖杠分隔,例: 莹莹剔透 | 粒粒优选 | 易煮易熟"
> rules={[{ required: true, message: '请输入商品卖点!', whitespace: true }]}
<Input placeholder="请输入商品名称" /> >
</Form.Item> <Input placeholder="请输入商品名称" />
</Form.Item>
<Form.Item )}
name="afterAddressId"
label="售后地址"
rules={[{ required: true, message: '请选择售后地址!' }]}
>
<Select showSearch placeholder="请选择商品品牌" filterOption={fileterBrandOptions}>
{([{ id: 9527, addressName: '测试地址' }] || afterAddressList).map(item => (
<Select.Option key={item.id} value={item.id}>
{item.addressName}
</Select.Option>
))}
</Select>
</Form.Item>
{specListData.map((item, index) => ( {!customer.isCard && (
<Form.Item <Form.Item
key={item.specId} name="afterAddressId"
label={item.specName} label="售后地址"
name={item.specId} rules={[{ required: true, message: '请选择售后地址!' }]}
labelCol={{ span: 2 }}
> >
<Checkbox.Group options={item.specValues} /> <Select showSearch placeholder="请选择商品品牌" filterOption={fileterBrandOptions}>
{([{ id: 9527, addressName: '测试地址' }] || afterAddressList).map(item => (
<Select.Option key={item.id} value={item.id}>
{item.addressName}
</Select.Option>
))}
</Select>
</Form.Item> </Form.Item>
))} )}
{!customer.isCard &&
specListData.map((item, index) => (
<Form.Item
key={item.specId}
label={item.specName}
name={item.specId}
labelCol={{ span: 2 }}
>
<Checkbox.Group options={item.specValues} />
</Form.Item>
))}
{/* <Form.Item {/* <Form.Item
name="brandId" name="brandId"
......
...@@ -96,10 +96,10 @@ const FormRuleSetting = forwardRef((props, ref) => { ...@@ -96,10 +96,10 @@ const FormRuleSetting = forwardRef((props, ref) => {
scrollToFirstError scrollToFirstError
> >
<Form.Item name="useTime" label="购买时间" {...rangeConfig}> <Form.Item name="useTime" label="购买时间" {...rangeConfig}>
<RangePicker showTime format="YYYY-MM-DD HH" /> <RangePicker showTime format="YYYY-MM-DD HH:mm:ss" />
</Form.Item> </Form.Item>
<Form.Item name="purchaseTime" label="有效期" {...rangeConfig}> <Form.Item name="purchaseTime" label="有效期" {...rangeConfig}>
<RangePicker showTime format="YYYY-MM-DD HH" /> <RangePicker showTime format="YYYY-MM-DD HH:mm:ss" />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="shopIds" name="shopIds"
......
...@@ -15,6 +15,7 @@ export const TaskTypeSelect = props => { ...@@ -15,6 +15,7 @@ export const TaskTypeSelect = props => {
<div className={commonStyle.prodcutContent}> <div className={commonStyle.prodcutContent}>
{TaskList.map(task => { {TaskList.map(task => {
const activeClassName = props.productType === task.type ? commonStyle.activeCard : ''; const activeClassName = props.productType === task.type ? commonStyle.activeCard : '';
if (task.hide) return null;
return ( return (
<dl <dl
key={task.type} key={task.type}
......
...@@ -12,6 +12,7 @@ export const TaskList = [ ...@@ -12,6 +12,7 @@ export const TaskList = [
name: '实体商品', name: '实体商品',
type: 1, type: 1,
desc: '物流发货', desc: '物流发货',
hide: true,
imgConfig: { imgConfig: {
imageList: { imageList: {
tip: '(图片最大上传2M)', tip: '(图片最大上传2M)',
...@@ -34,6 +35,7 @@ export const TaskList = [ ...@@ -34,6 +35,7 @@ export const TaskList = [
name: '虚拟商品', name: '虚拟商品',
type: 2, type: 2,
desc: '无需物流', desc: '无需物流',
hide: true,
imgConfig: { imgConfig: {
imageList: { imageList: {
rule: false, rule: false,
...@@ -158,7 +160,7 @@ export const StaticColumns = customer => [ ...@@ -158,7 +160,7 @@ export const StaticColumns = customer => [
}, },
{ {
title: '库存', title: '库存',
dataIndex: 'stock', dataIndex: 'productStock',
editable: true, editable: true,
role: [3], role: [3],
roleRules: { required: true }, roleRules: { required: true },
......
...@@ -16,6 +16,8 @@ import { ...@@ -16,6 +16,8 @@ import {
afterSalesAddrsPage, afterSalesAddrsPage,
merchantgetJdPicList, merchantgetJdPicList,
merchantProductAdd, merchantProductAdd,
// getSupplierList,
supplierListQuery,
} from './service'; } from './service';
import { isUrl, filterSendData } from './utils'; import { isUrl, filterSendData } from './utils';
import { ServiceContext } from './context'; import { ServiceContext } from './context';
...@@ -36,15 +38,16 @@ const ServiceGoods = options => { ...@@ -36,15 +38,16 @@ const ServiceGoods = options => {
const [pageId, setPageId] = useState(null); const [pageId, setPageId] = useState(null);
const [isEdit, setIsEdit] = useState(false); // 是否是编辑状态 const [isEdit, setIsEdit] = useState(false); // 是否是编辑状态
const [productType, setProductType] = useState(1); // 商品状态 const [productType, setProductType] = useState(3); // 商品状态
const [pageLoading, setPageLoading] = useState(false); // 页面加载状态 const [pageLoading, setPageLoading] = useState(false); // 页面加载状态
// const [categoryList, setCategoryList] = useState([]); // 获取三级类目 // const [categoryList, setCategoryList] = useState([]); // 获取三级类目
const [afterAddressList, setAfterAddressList] = useState([]); const [afterAddressList, setAfterAddressList] = useState([]);
const [shopList, setShopList] = useState([]);
const [brandList, setBrandList] = useState([]); // 获取商品牌 const [brandList, setBrandList] = useState([]); // 获取商品牌
const [specList, setSpecList] = useState([]); // 规格列表 const [specList, setSpecList] = useState([]); // 规格列表
const [editData, setEditData] = useState({}); // 编辑保存数据 const [editData, setEditData] = useState({}); // 编辑保存数据
const baseCheckList = [basicRef, stockRef, picturesRef]; const baseCheckList = [basicRef, stockRef, settingRef, settleOtrRef, picturesRef]; // 卡卷默认5个,到时改版为实体对应3个
const [checkFormList, setCheckFormList] = useState(baseCheckList); const [checkFormList, setCheckFormList] = useState(baseCheckList);
const [specKeyList, setSpecKeyList] = useState([]); // 记录一级规格key字段 const [specKeyList, setSpecKeyList] = useState([]); // 记录一级规格key字段
...@@ -112,6 +115,14 @@ const ServiceGoods = options => { ...@@ -112,6 +115,14 @@ const ServiceGoods = options => {
} }
}; };
const getSupplierListResponse = async () => {
if (!shopList.length) {
const result = await supplierListQuery();
console.log('=================>result', result);
setShopList(result.data);
}
};
const sendMerchantProductAdd = async sendData => { const sendMerchantProductAdd = async sendData => {
const addResponse = await merchantProductAdd(sendData); const addResponse = await merchantProductAdd(sendData);
console.log(addResponse); console.log(addResponse);
...@@ -161,6 +172,7 @@ const ServiceGoods = options => { ...@@ -161,6 +172,7 @@ const ServiceGoods = options => {
return; return;
} }
setPageLoading(true); setPageLoading(true);
await getSupplierListResponse();
await getMerchantBrandList(); await getMerchantBrandList();
await getAfterSalesAddrsPage(); await getAfterSalesAddrsPage();
await getMerchantSpecList(); await getMerchantSpecList();
...@@ -192,7 +204,7 @@ const ServiceGoods = options => { ...@@ -192,7 +204,7 @@ const ServiceGoods = options => {
const handleCancel = () => { const handleCancel = () => {
setPageId(null); setPageId(null);
setIsEdit(false); setIsEdit(false);
setProductType(1); setProductType(3);
setEditData({}); setEditData({});
setSpecKeyList([]); setSpecKeyList([]);
resetForm(); resetForm();
...@@ -250,6 +262,7 @@ const ServiceGoods = options => { ...@@ -250,6 +262,7 @@ const ServiceGoods = options => {
<FormInformationBasic <FormInformationBasic
ref={basicRef} ref={basicRef}
editData={editData.infoMation} editData={editData.infoMation}
shopList={shopList}
categoryList={categoryList} categoryList={categoryList}
brandList={brandList} brandList={brandList}
afterAddressList={afterAddressList} afterAddressList={afterAddressList}
......
...@@ -72,3 +72,9 @@ export const merchantProductAdd = data => ...@@ -72,3 +72,9 @@ export const merchantProductAdd = data =>
prefix: goodsApi, prefix: goodsApi,
data, data,
}); });
export const supplierListQuery = () =>
request.get('/api/kdsp/supplier/supplier-list-query', {
prefix: config.kdspApi,
headers,
});
...@@ -131,6 +131,10 @@ export const batchTableSourceData = ({ batchItem, tableData, bacthSecon, bacthFi ...@@ -131,6 +131,10 @@ export const batchTableSourceData = ({ batchItem, tableData, bacthSecon, bacthFi
const filterItems = (type, props) => { const filterItems = (type, props) => {
const { infoSpecData, serviceItem, infoImageData, infoMation, settlementItem } = props; const { infoSpecData, serviceItem, infoImageData, infoMation, settlementItem } = props;
console.log('===========>serviceItem', serviceItem);
console.log('===========>settlementItem', settlementItem);
const { imageList = {}, commonImageList } = infoImageData; const { imageList = {}, commonImageList } = infoImageData;
return infoSpecData.items.map(item => { return infoSpecData.items.map(item => {
const imgList = imageList[item.firstSpecValue] || []; const imgList = imageList[item.firstSpecValue] || [];
......
...@@ -54,5 +54,5 @@ export function toThousands(data, num) { ...@@ -54,5 +54,5 @@ export function toThousands(data, num) {
return result; return result;
} }
export const formatTime = (time, crm = 'YYYY-MM-DD HH') => time.format(crm); export const formatTime = (time, crm = 'YYYY-MM-DD HH:mm:ss') => time.format(crm);
export const resetTime = (time, crm = 'YYYY-MM-DD HH') => moment(time, crm); export const resetTime = (time, crm = 'YYYY-MM-DD HH:mm:ss') => moment(time, crm);
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