Commit 63a12f9b authored by beisir's avatar beisir

fix: 调整

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