Commit 70238242 authored by 张子雨's avatar 张子雨

feat: 商品审核完成

parent deb89830
......@@ -81,6 +81,7 @@ class goodsManage extends Component {
secondSpesName = '',
productType,
isEdit,
isService,
} = this.props;
const { getFieldDecorator } = this.props.form;
return (
......@@ -171,7 +172,7 @@ class goodsManage extends Component {
</FormItem>
)}
<FormItem>
<Button type="primary" htmlType="submit" onClick={this.batchSetting}>
<Button type="primary" htmlType="submit" onClick={this.batchSetting} disabled={isService}>
批量设置
</Button>
</FormItem>
......
......@@ -450,6 +450,8 @@ class goodsManage extends Component {
render() {
const { visible, form, initData = {}, treeData, virtualTreeData } = this.props;
const isEdit = Object.keys(initData).length !== 0;
// 是否仅编辑卖点和服务
const isService = initData.state === 5;
const { getFieldDecorator, getFieldsValue } = form;
getFieldDecorator('firstKeys', { initialValue: [] });
getFieldDecorator('secondKeys', { initialValue: [] });
......@@ -538,7 +540,7 @@ class goodsManage extends Component {
fieldNames={{ label: 'name', value: 'id', children: 'children' }}
options={treeDataArray}
onChange={(val, label, ext) => this.treeChange(val, label, ext)}
// disabled={isEdit}
disabled={isService}
/>,
)}
</FormItem>
......@@ -567,6 +569,7 @@ class goodsManage extends Component {
style={{ width: 280 }}
filterOption={filterOption}
placeholder="请选择商品品牌,支持模糊搜索"
disabled={isService}
>
{brandListArray?.length &&
brandListArray.map(item => (
......@@ -604,6 +607,7 @@ class goodsManage extends Component {
maxLength="100"
placeholder="请输入商品名称"
allowClear
disabled={isService}
/>,
)}
</FormItem>
......@@ -788,6 +792,7 @@ class goodsManage extends Component {
type="primary"
className={styles.logBtn}
onClick={() => this.createShopInfo(isEdit)}
disabled={isService}
>
生成商品信息
</Button>
......@@ -805,6 +810,7 @@ class goodsManage extends Component {
productType={productType}
isEdit={isEdit}
isJDGoods={isJDGoods}
isService={isService}
/>
<Row>
<Table
......@@ -825,6 +831,7 @@ class goodsManage extends Component {
this.state.initForm.secondSpecName,
isJDGoods,
isEdit,
isService,
)}
/>
</Row>
......@@ -835,6 +842,7 @@ class goodsManage extends Component {
onClick={this.deleteImg}
style={{ marginTop: '10px' }}
icon="rest"
disabled={isService}
>
图片批量删除
</Button>
......@@ -853,7 +861,7 @@ class goodsManage extends Component {
initialValue: this.state.initForm.commonImageList,
valuePropName: 'fileList',
getValueFromEvent: normFile,
})(<Upload />)}
})(<Upload isDisabled={isService} />)}
</FormItem>
</Col>
</Row>
......@@ -861,7 +869,6 @@ class goodsManage extends Component {
colorKeys.map(color => {
if (JSON.stringify(color) === '{}') return [];
if ((color !== null && !color) || (color && !color.trim())) return [];
// if (initData.) {}
return [
<Row>
<Col span={1}>
......@@ -882,7 +889,12 @@ class goodsManage extends Component {
this.state.initForm.imageList && this.state.initForm.imageList[color],
valuePropName: 'fileList',
getValueFromEvent: normFile,
})(<Upload onChange={val => this.imgChange(val, color)} />)}
})(
<Upload
isDisabled={isService}
onChange={val => this.imgChange(val, color)}
/>,
)}
<Button
disabled={colorImg[color]?.length}
size="small"
......@@ -919,7 +931,7 @@ class goodsManage extends Component {
message: '请上传详情图',
},
],
})(<Upload />)}
})(<Upload isDisabled={isService} />)}
</FormItem>
</Col>
</Row>
......
......@@ -213,7 +213,15 @@ export function verify(initData, categoryId) {
return false;
}
export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods, isEdit) {
export function editColumns(
methods,
firstData,
firstSpec,
secondSpec,
isJDGoods,
isEdit,
isService,
) {
const { getJdPicList, inputChange, openModal, productType } = methods;
if (!firstData) return [];
......@@ -231,7 +239,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision={2}
min={0}
onChange={value => inputChange(value, 'supplyPrice', index)}
disabled={isJDGoods}
disabled={isJDGoods || isService}
/>
),
},
......@@ -248,6 +256,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision={2}
min={0}
onChange={value => inputChange(value, 'marketPrice', index)}
disabled={isService}
/>
),
},
......@@ -263,6 +272,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
precision={0}
min={0}
onChange={value => inputChange(value, 'productStock', index)}
disabled={isService}
/>
),
},
......@@ -278,6 +288,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
className={`thirdSkuNo ${index}`}
defaultValue={val}
onChange={evt => inputChange(evt.target.value, 'thirdSkuNo', index)}
disabled={isService}
/>
),
},
......@@ -295,6 +306,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
className={`skuLink ${index}`}
defaultValue={val}
onChange={evt => inputChange(evt.target.value, 'skuLink', index)}
disabled={isService}
/>
}
</Popover>
......@@ -319,6 +331,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
size="small"
style={{ marginTop: '5px' }}
onClick={() => openModal(row, index)}
disabled={isService}
>
修改sku名称
</Button>
......@@ -343,6 +356,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
max={999999.999}
precision={3}
onChange={value => inputChange(value, 'weight', index)}
disabled={isService}
/>
),
});
......@@ -360,6 +374,7 @@ export function editColumns(methods, firstData, firstSpec, secondSpec, isJDGoods
min={0}
precision={0}
onChange={value => inputChange(value, 'productStockWarning', index)}
disabled={isService}
/>
),
});
......
......@@ -98,12 +98,13 @@ class goodsManage extends Component {
this.handleSearch();
};
onUpdateInfo = async ({ spuId, productType }) => {
onUpdateInfo = async ({ state, spuId, productType }) => {
this.setState({
createloading: true,
});
const { data, msg } = await spuDetail({ id: spuId });
if (data) {
data.state = 5;
data.pageProductType = productType;
data.categoryId = data.thirdCategoryId;
data.firstSpecId = data.skuList[0].firstSpecId;
......
......@@ -143,7 +143,7 @@ export function column() {
align: 'center',
render: (_, row) => (
<div className={styles.actionBtn}>
{row.state === 4 && (
{(row.state === 4 || row.state === 5) && (
<Button
key="edit"
type="primary"
......
......@@ -85,6 +85,7 @@
}
.warning {
margin-top: -20px;
margin-bottom: 20px;
color: red;
}
......
......@@ -156,7 +156,7 @@ class PicturesWall extends React.Component {
<div className="ant-upload-text">上传图片</div>
</div>
);
const { max } = this.props;
const { max, isDisabled } = this.props;
const that = this;
const uploadProps = {
beforeUpload: lodash.debounce(async (file, files) => {
......@@ -218,11 +218,13 @@ class PicturesWall extends React.Component {
className={styles.maskIcon}
onClick={() => this.handlePreview(item)}
/>
<Icon
type="delete"
className={styles.maskIcon}
onClick={() => this.onRemoveImg(item)}
/>
{!isDisabled && (
<Icon
type="delete"
className={styles.maskIcon}
onClick={() => this.onRemoveImg(item)}
/>
)}
</div>
)}
</div>
......@@ -230,7 +232,13 @@ class PicturesWall extends React.Component {
</ReactSortable>
)}
</div>
<Upload multiple {...uploadProps} fileList={fileList} showUploadList={false}>
<Upload
multiple
{...uploadProps}
fileList={fileList}
showUploadList={false}
disabled={isDisabled}
>
{max && fileList.length >= max ? null : uploadButton}
</Upload>
<Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
......
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