Commit 1f80ea46 authored by beisir's avatar beisir

fix: 更新二级规格修改

parent 30a4c555
......@@ -3,12 +3,11 @@ const isProduction = process.env.NODE_ENV === 'production';
let envAPi = {
api: '//backstms-test1.liangkebang.net',
kdspOpApi: 'https://kdsp-operation-test1.liangkebang.net',
// kdspApi: 'http://192.168.28.107:7000',
kdspApi: 'https://sc-op-api-test1.liangkebang.net',
goodsApi: 'https://sc-op-api-test1.liangkebang.net',
prologueDomain: 'https://prologue-test1.liangkebang.net',
qiniuHost: 'https://appsync.lkbang.net',
opapiHost: 'https://opapi-test1.liangkebang.net',
// opapiHost: 'http://192.168.29.45:7000',
};
let prodApi = {
......@@ -16,6 +15,7 @@ let prodApi = {
kdspOpApi: '//kdsp-operation.q-gp.com',
prologueDomain: '//prologue.q-gp.com',
kdspApi: '//sc-op-api.q-gp.com',
goodsApi: 'https://sc-merchant-api.q-gp.com',
qiniuHost: 'https://appsync.lkbang.net',
opapiHost: 'https://opapi.xyqb.com',
};
......
import { Modal, Button, Row, Col } from 'antd';
import React, { Component } from 'react';
import styles from '../style.less';
// eslint-disable-next-line react/prefer-stateless-function
class imgModal extends Component {
state = {
imgModal: false,
selectImg: '',
};
render() {
const { visible, data = [] } = this.props;
const { detailImageList = [], skuSpecImageList = [] } = data;
return (
<Modal
title="图片素材"
visible={visible}
footer={null}
onCancel={this.props.onCancel}
width="700px"
>
<div>
{skuSpecImageList.map(skuImg => (
<Row type="flex" justify="start" align="middle">
<Col span={4}>{`滑动图${skuImg.colorSpecValue || ''}:`}</Col>
<Col span={20}>
{skuImg.skuSpecImageList.map(item => (
<img
onClick={() => {
this.setState({ imgModal: true, selectImg: item });
}}
key={item}
width={200}
alt=""
src={item}
style={{ margin: 5 }}
></img>
))}
</Col>
</Row>
))}
<Row type="flex" justify="start" align="middle">
<Col span={4}>{detailImageList.length ? '详情图:' : ''}</Col>
<Col span={20}>
{detailImageList.map(item => (
<img
onClick={() => {
this.setState({ imgModal: true, selectImg: item });
}}
key={item}
width={200}
alt=""
src={item}
style={{ margin: 5 }}
></img>
))}
</Col>
</Row>
</div>
<Button type="primary" onClick={this.props.onCancel} className={styles.logBtn}>
取消
</Button>
<Modal
title="图片详情"
visible={this.state.imgModal}
footer={null}
onCancel={() => this.setState({ imgModal: false })}
width="800px"
>
<img width="700px" src={this.state.selectImg} alt=""></img>
</Modal>
</Modal>
);
}
}
export default imgModal;
......@@ -103,7 +103,7 @@ const LogModal = props => {
return (
<Modal title="日志详情" visible={visible} footer={null} onCancel={bundleOnCancel} width="800px">
<Tabs type="card" onChange={bundleOnTabChange} activeKey={tabActiveKey}>
<Tabs.TabPane tab="订单详情" key="0">
<Tabs.TabPane tab="商品详情" key="0">
<Table
dataSource={tableData.records}
bordered
......
......@@ -3,7 +3,7 @@ import React, { Component } from 'react';
import { connect } from 'dva';
import styles from '../style.less';
import { stateList } from '../staticdata';
import { batchPushedOrOffline, offline, uploadFile, importJdSkus } from '../service';
import { uploadFile } from '../service';
const FormItem = Form.Item;
const { Option } = Select;
......@@ -30,44 +30,10 @@ class goodsManage extends Component {
this.props.onReset();
};
onConfirm = async isOffline => {
const data = isOffline
? await offline(this.props.selectedRowKeys)
: await batchPushedOrOffline({
ids: this.props.selectedRowKeys.join(),
type: 2,
productState: 6,
offlineReason: '',
});
if (data.businessCode !== '0000') {
this.props.onLoad(data.error);
} else {
this.props.onLoad(null);
}
};
addSpu = () => {
this.props.addSpu();
};
addVirtualSpu = () => {
this.props.addVirtualSpu();
};
importSkus = async (info, type) => {
const result = await importJdSkus(info.file, type);
if (result.businessCode === '0000') {
this.handleSearch();
notification.success({
message: '商品上传成功',
});
} else {
notification.warning({
message: result.msg,
});
}
};
render() {
const {
form: { getFieldDecorator, getFieldValue },
......@@ -165,8 +131,7 @@ class goodsManage extends Component {
icon="download"
ghost
onClick={() => {
window.location.href =
'https://kdspstatic.q-gp.com/批量修改库存模板.xlsx';
window.location.href = 'https://kdspstatic.q-gp.com/批量修改库存模板.xlsx';
}}
>
模版
......
import { Modal, Table, Button } from 'antd';
import React, { Component } from 'react';
import styles from '../style.less';
class DetailModal extends Component {
getColumns = (firstSpe, secondSpe, type) => {
const arr = [
{
title: '供应商',
dataIndex: 'supplierName',
key: 'supplierName',
align: 'center',
width: 50,
render: (val, row) => {
const obj = {
children: val,
props: {},
};
if (row.listLength) {
obj.props.rowSpan = row.listLength;
} else {
obj.props.rowSpan = 0;
}
return obj;
},
},
];
if (firstSpe) {
arr.push({
title: firstSpe,
dataIndex: 'firstSpecValue',
key: 'firstSpecValue',
align: 'center',
width: 50,
render: (val, row) => {
const obj = {
children: val,
props: {},
};
if (row.length) {
obj.props.rowSpan = row.length;
} else {
obj.props.rowSpan = 0;
}
return obj;
},
});
}
if (secondSpe) {
arr.push({
title: secondSpe,
align: 'center',
key: 'secondSpecValue',
dataIndex: 'secondSpecValue',
width: 50,
});
}
const newTable = arr.concat([
{
title: '供应商编码',
align: 'center',
key: 'supplierCode',
dataIndex: 'supplierCode',
width: 50,
},
{
title: '库存',
align: 'center',
key: 'stock',
dataIndex: 'stock',
width: 50,
},
{
title: '供货价',
align: 'center',
key: 'supplyPrice',
dataIndex: 'supplyPrice',
width: 50,
},
{
title: '市场价',
align: 'center',
key: 'marketPrice',
dataIndex: 'marketPrice',
width: 50,
},
{
title: '国际编码',
align: 'center',
key: 'thirdSkuNo',
dataIndex: 'thirdSkuNo',
width: 50,
},
]);
if (type === 1) {
newTable.splice(newTable.length - 1, 0, {
title: '重量(kg)',
align: 'center',
key: 'weight',
dataIndex: 'weight',
width: 90,
});
}
return newTable;
};
updateStatus = (row, productState) => {
this.props.updateStatus(row, productState);
};
dataInit = list => {
const obj = {};
let finialList = [];
list.map(item => {
obj[item.firstSpecValue] = [];
return obj;
});
list.map(item => obj[item.firstSpecValue].push(item));
const keys = Object.keys(obj);
// eslint-disable-next-line no-return-assign
keys.map(key => {
obj[key].forEach((i, index) => {
if (index === 0) {
i.length = obj[key].length;
}
});
finialList = finialList.concat(obj[key]);
return finialList;
});
if (finialList.length) {
finialList[0].listLength = finialList.length;
}
return finialList;
};
render() {
const { visible, data = [], type } = this.props;
const initdata = this.dataInit(data);
const firstName = data.length ? data[0].firstSpec : '';
const secondName = data.length ? data[0].secondSpec : '';
return (
<Modal
title="供货详情"
visible={visible}
footer={null}
onCancel={this.props.onCancel}
width="900px"
>
<Table
dataSource={initdata}
bordered
columns={this.getColumns(firstName, secondName, type)}
rowKey="id"
pagination={false}
scroll={{ x: '100%' }}
/>
<Button type="primary" onClick={this.props.onCancel} className={styles.logBtn}>
关闭
</Button>
</Modal>
);
}
}
export default DetailModal;
import { Modal, InputNumber, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import { updatePrice } from '../service';
import styles from './style.less';
export default function UpdatePrice(props) {
const [visible, setVisible] = useState(props.visible);
const [supplyPrice, setSupplyPrice] = useState(props.info.supplyPrice);
const [marketPrice, setMarketPrice] = useState(props.info.marketPrice);
// const [salePrice, setSalePrice] = useState(props.info.salePrice);
useEffect(() => {
setVisible(props.visible);
setSupplyPrice(props.info.supplyPrice);
setMarketPrice(props.info.marketPrice);
// setSalePrice(props.info.salePrice);
}, [props]);
const submit = async () => {
if (!supplyPrice || !marketPrice) {
notification.error({ message: '价格不可为空!' });
return;
}
const error = await updatePrice({
// salePrice,
supplyPrice,
marketPrice,
id: props.info.id,
supplierId: props.info.supplierId,
});
if (!error) {
notification.success({ message: '修改成功' });
props.onCancel('success');
}
};
return (
<Modal
title="修改价格"
visible={visible}
onCancel={() => props.onCancel()}
onOk={submit}
width={400}
>
<div className={styles.center}>
供货价:
<InputNumber
min={0}
precision={2}
value={supplyPrice}
onChange={value => setSupplyPrice(value)}
className={styles.inputNW}
/>
<br />
<br />
市场价:
<InputNumber
min={0}
precision={2}
value={marketPrice}
onChange={value => setMarketPrice(value)}
className={styles.inputNW}
/>
<br />
<br />
{/* 销售价:
<InputNumber
min={0}
precision={2}
value={salePrice}
onChange={value => setSalePrice(value)}
className={styles.inputNW}
/> */}
</div>
</Modal>
);
}
.inputNW {
width: 200px;
}
.center {
text-align: center;
}
import { Modal, InputNumber, notification, Form, Input, Radio } from 'antd';
import React from 'react';
import { updateStock } from '../service';
import styles from '../UpdatePrice/style.less';
const UpdateStock = props => {
const { getFieldDecorator, validateFields, resetFields, getFieldValue } = props.form;
......@@ -64,14 +63,7 @@ const UpdateStock = props => {
{ validator: validatorCallback, message: '减库存,输入库存数不可大于可售库存!' },
],
validateTrigger: ['onSubmit'],
})(
<InputNumber
min={0}
precision={0}
placeholder="请输入库存"
className={styles.inputNW}
/>,
)}
})(<InputNumber min={0} precision={0} placeholder="请输入库存" style={{ width: 200 }} />)}
</Form.Item>
<Form.Item label="变更原因:">
{getFieldDecorator('changeReason', {
......
......@@ -476,12 +476,8 @@ class goodsManage extends Component {
const filterOption = (input, op) => op.props.children.includes(input);
// ---------------------驳回编辑规格时候,过滤掉colors中为null的数据---------------------
if (isEdit) {
if (!initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
if (colorKeys.length > 1) {
colorKeys = colorKeys.filter(item => item !== 'null');
}
}
if (isEdit && !initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
colorKeys = colorKeys.length > 1 ? colorKeys.filter(item => item !== 'null') : colorKeys;
}
return (
<Modal
......
......@@ -76,12 +76,11 @@ export function createNewList(first, second, firstSpecId, secondSpecId) {
// 缺少一级和二级规格时生成的编辑表格
list.push(sku);
}
console.log(list);
return list;
}
export function createEditData(values, initData) {
console.log(values);
// console.log(values);
let list = null;
const first = values.first?.filter(item => item && !item.match(/^[ ]*$/)) || [];
const second =
......@@ -103,7 +102,6 @@ export function createEditData(values, initData) {
if (!isFirstSame && !isSecondSame) {
if (!initData.id) {
list = createNewList(first, second, values.firstSpecId, values.secondSpecId);
// this.setState({ editData: list });
} else {
const list1 = first.length
? createNewList(first, initData.secondSpecList, values.firstSpecId, values.secondSpecId)
......@@ -111,42 +109,43 @@ export function createEditData(values, initData) {
const list2 = second.length
? createNewList(newFirst, second, values.firstSpecId, values.secondSpecId)
: [];
// console.log('list1===========>', list1);
// console.log('list2===========>', list2);
console.log('initData===========>', initData);
// console.log('list1=================>', list1);
// console.log('list2=================>', list2);
// console.log('initData===========>', initData);
// console.log('first===========>', first);
// console.log('second===========>', second);
// 初次添加规格时没有选择规格,添加一条没有规格的商品,被驳回之后编辑时选择规格之后需要重新创建
// 编辑时回显时的id需要给重新创建的数据第一条加上 回显的id
if (!initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
list = createNewList(first, second, values.firstSpecId, values.secondSpecId);
// 这种情况出现时items中只有一条数据
// 这种情况出现时items中只有一条数据,且没有一级规格和二级规格
// 第一次无规格时,重新生成的数据,必须保留第一条数据的id是items里面第一条数据的id
list = createNewList(first, second, values.firstSpecId, values.secondSpecId);
list[0].id = initData.editData[0].id;
} else if (initData.editData[0]?.firstSpec && !initData.editData[0]?.secondSpec) {
console.log('只有一级规格================>');
console.log(first);
console.log(second);
list = createNewList(
// console.log('只有一级规格================>');
// 只有一级规格的情况下需要
// 重新更具规格创建表格,但是需要把历史记录赋值给表格的其中几项
// 其中新建的记录和历史编辑记录
const createList = createNewList(
[...initData.firstSpecList, ...first],
second,
values.firstSpecId,
values.secondSpecId,
);
// const editObject = initData.editData.concat(list1).reduce((itemObject, item) => {
// itemObject[item.firstSpecValue] = item;
// return itemObject;
// }, {});
// const newList = createNewList([...initData.firstSpecList, ...first], second, values.firstSpecId, values.secondSpecId);
// list = newList.map(item => {
// console.log(initData.firstSpecList, item.firstSpecValue, editObject);
// if (Object.keys(editObject).includes(item.firstSpecValue)) {
// item = Object.assign({}, editObject[item.firstSpecValue], item);
// delete editObject[item.firstSpecValue];
// console.log('============>拼装', editObject, editObject[item.firstSpecValue]);
// }
// return item;
// });
console.log(list);
const setp = createList.length / initData.firstSpecList.concat(first).length;
list = createList.map((item, index) => {
if (index % setp === 0) {
const newItem =
initData.editData.find(val => val.firstSpecValue === item.firstSpecValue) || {};
item = Object.assign({}, item, newItem, {
secondSpec: initData.secondSpecName,
secondSpecId: item.secondSpecId,
secondSpecValue: item.secondSpecValue,
length: setp,
});
}
return item;
});
} else {
list = sortBy(initData.editData.concat(list1.concat(list2)), item => item.firstSpecValue);
}
......
......@@ -6,21 +6,11 @@ import { sortBy } from 'lodash';
import styles from './style.less';
import LocalStroage from '@/utils/localStorage';
import configApi from '../../../config/env.config';
import UpdatePrice from './UpdatePrice';
import UpdateStock from './UpdateStock';
import {
update,
spuDetail,
detail,
batchPushedOrOffline,
categoryList,
getVirtualCategory,
} from './service';
import { spuDetail, categoryList, getVirtualCategory } from './service';
import LogModal from './LogModal';
import CreateModal from './createModal';
import SupplyModal from './SupplyModal';
import ReasonModal from './reasonModal';
import { column, JDSHOPID } from './staticdata';
import SearchForm from './SearchForm';
......@@ -37,18 +27,11 @@ class goodsManage extends Component {
priceInfo: {},
logVisible: false,
previewVisible: false,
supplyVisible: false,
createVisible: false, // 新增or编辑普通商品modal
offlineVisible: false,
selectedParams: {},
detailData: [],
detailSpuId: '',
selectedRowKeys: [],
updatePriceVisible: false,
updateStockVisible: false,
initData: {},
createloading: false,
type: 1,
};
currentLog = null;
......@@ -63,17 +46,6 @@ class goodsManage extends Component {
this.getVirtualCategory();
}
openOffline = (ids, type, productState) => {
const obj = { ids, type, productState };
this.setState({ selectedParams: obj });
this.setState({ offlineVisible: true });
};
showSupply = async (id, type) => {
const { data } = await detail({ id });
this.setState({ supplyVisible: true, detailData: data, type });
};
handleSearch = page => {
const currentPage = this.state.pageNo;
this.setState(
......@@ -175,11 +147,6 @@ class goodsManage extends Component {
}
};
onUpdate = async updateData => {
const [, error] = await update(updateData);
this.onLoad(error);
};
onLoad = error => {
if (!error) {
notification.success({ message: '操作成功' });
......@@ -197,24 +164,6 @@ class goodsManage extends Component {
});
};
updateStatus = async (ids, productState, offlineReason, fromDetail) => {
const data = await batchPushedOrOffline({
ids,
productState,
offlineReason,
});
if (data.businessCode === '0000') {
this.handleSearch();
notification.success({
message: productState === 6 ? '上架成功' : '下架成功',
});
this.setState({ offlineVisible: false });
if (fromDetail) {
this.showDetail(this.state.detailSpuId);
}
}
};
audit = skuId => {
this.setState({
previewVisible: true,
......@@ -224,11 +173,6 @@ class goodsManage extends Component {
});
};
offLine = (ids, productState) => {
const obj = { ids, productState };
this.setState({ offlineVisible: true, selectedParams: obj });
};
filterShopList = (list = [], isEdit) =>
list.filter(item => isEdit || !JDSHOPID.includes(item.id));
......@@ -248,8 +192,6 @@ class goodsManage extends Component {
let visible = {};
if (isStock) {
visible = { updateStockVisible: true };
} else {
visible = { updatePriceVisible: true };
}
this.setState({
...visible,
......@@ -267,7 +209,7 @@ class goodsManage extends Component {
};
cancel = query => {
this.setState({ updatePriceVisible: false, updateStockVisible: false });
this.setState({ updateStockVisible: false });
if (query) {
this.handleSearch();
}
......@@ -298,13 +240,6 @@ class goodsManage extends Component {
goodsManage: { tableData = {} },
} = this.props;
const { pageNo, pageSize, selectedRowKeys } = this.state;
// const rowSelection = {
// selectedRowKeys,
// onChange: this.onSelectChange,
// getCheckboxProps: record => ({
// disabled: +record.state === 6, // Column configuration not to be checked
// }),
// };
return (
<PageHeaderWrapper>
<Spin spinning={this.state.createloading}>
......@@ -330,7 +265,6 @@ class goodsManage extends Component {
rowKey={record => record.skuId}
pagination={false}
className={styles.tabletop}
// rowSelection={rowSelection}
scroll={{ x: '100%', y: 500 }}
/>
</Spin>
......@@ -385,30 +319,7 @@ class goodsManage extends Component {
treeData={this.state.treeData}
virtualTreeData={this.state.virtualTreeData}
></CreateModal>
<SupplyModal
data={this.state.detailData}
visible={this.state.supplyVisible}
type={this.state.type}
onCancel={() => {
this.setState({ supplyVisible: false });
}}
></SupplyModal>
<ReasonModal
visible={this.state.offlineVisible}
submit={reason => {
const { ids, productState } = this.state.selectedParams;
this.updateStatus(ids, productState, reason);
}}
onCancel={() => {
this.setState({ offlineVisible: false });
}}
></ReasonModal>
<UpdatePrice
visible={this.state.updatePriceVisible}
info={this.state.priceInfo}
onCancel={this.cancel}
/>
<UpdateStock
visible={this.state.updateStockVisible}
info={this.state.priceInfo}
......
......@@ -26,20 +26,6 @@ const Model = {
},
});
},
*getDataList({ payload }, { call, put, all }) {
const [[shopList], [statusList]] = yield all([
yield call(api.shopList, payload),
yield call(api.statusList, payload),
]);
if (!shopList && !statusList) return;
yield put({
type: 'dataList',
payload: {
shopList,
statusList,
},
});
},
*categoryList({ payload }, { call, put }) {
const [data] = yield call(api.categoryList, payload.value);
if (!data) return;
......
import { Modal, Input, notification } from 'antd';
import React, { Component } from 'react';
const { TextArea } = Input;
// eslint-disable-next-line react/prefer-stateless-function
class reasonModal extends Component {
state = {
remarks: '',
};
inputChange = ({ target: { value } }) => {
this.setState({ remarks: value });
};
onCancel = () => {
this.setState({ remarks: '' });
this.props.onCancel();
};
submit = () => {
if (!this.state.remarks) {
notification.error({
message: '请输入下架原因',
});
return;
}
this.props.submit(this.state.remarks);
this.setState({ remarks: '' });
};
render() {
const { visible } = this.props;
return (
<Modal
title="下架原因"
visible={visible}
onOk={this.submit}
onCancel={() => this.onCancel()}
width="700px"
>
<div>
<TextArea value={this.state.remarks} rows={4} onChange={this.inputChange} />
</div>
</Modal>
);
}
}
export default reasonModal;
......@@ -4,16 +4,14 @@ import config from '../../../config/env.config';
import { stringify } from 'qs';
import _ from 'lodash';
const { kdspApi } = config;
// const kdspApi = 'http://yapi.quantgroups.com/mock/389';
// 分页查询所有数据
const { goodsApi } = config;
const headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
export async function searchList(params) {
return request.post('/product/api/merchant/page', {
prefix: kdspApi,
prefix: goodsApi,
data: stringify(_.omitBy(params, v => !v)),
headers,
role: true,
......@@ -23,7 +21,7 @@ export async function searchList(params) {
// 新增商品
export async function addGoods(params) {
return request.post('/product/api/merchant/add', {
prefix: kdspApi,
prefix: goodsApi,
data: params,
});
}
......@@ -32,28 +30,22 @@ export async function addGoods(params) {
export async function editGoods(params) {
return request.post('/product/api/merchant/edit', {
prefix: kdspApi,
prefix: goodsApi,
data: params,
});
}
// 供应商列表
export async function getSupplierList() {
return request.post('/channel/supplier/list', {
prefix: kdspApi,
});
}
// 获取商品品牌
export async function getBrandList() {
return request.post('/product/brand/api/merchant/list', {
prefix: kdspApi,
prefix: goodsApi,
});
}
// 编辑--获取详情
export async function spuDetail(params) {
return request.post('/product/api/merchant/detail', {
prefix: kdspApi,
prefix: goodsApi,
params,
headers,
});
......@@ -62,7 +54,7 @@ export async function spuDetail(params) {
// 商品规格
export async function getSpecList() {
return request.post('/product/spec/api/merchant/list', {
prefix: kdspApi,
prefix: goodsApi,
});
}
......@@ -70,23 +62,15 @@ export async function getSpecList() {
export async function getImageInfo(spuNo) {
return request.post('/product/api/merchant/imageInfo', {
params: { spuNo },
prefix: kdspApi,
prefix: goodsApi,
headers,
});
}
// 状态
export async function statusList() {
return request.post('/api/kdsp/op/mch_sku/status_list');
}
// 商品来源
export async function skuSource() {
return request.post('/api/kdsp/sku/sku-info/getSkuSource');
}
// 商品分类
export async function categoryList() {
return request.post('/product/category/api/merchant/getAll', {
prefix: kdspApi,
prefix: goodsApi,
});
}
......@@ -94,78 +78,30 @@ export async function categoryList() {
export async function uploadFile(file) {
const params = new FormData();
params.append('file', file);
// const data = await request.post('/product/item/batchUpdate', {
const data = await request.post('/product/api/merchant/BatchUpdateStock', {
prefix: kdspApi,
prefix: goodsApi,
data: params,
notTip: true,
});
return data;
}
// 批量倒入京东skus
export async function importJdSkus(file, sourceType) {
const params = new FormData();
params.append('file', file);
params.append('sourceType', sourceType);
const data = await request.post('/product/importJdSkus', {
data: params,
prefix: kdspApi,
// rawData: true,
});
return data;
}
// 批量上架
export async function pushed(data) {
return request.post('/api/kdsp/op/mch_sku/pushed', data);
}
// 批量下架
export async function offline(data) {
return request.post('/api/kdsp/op/mch_sku/offline', data);
}
// 最新批量上下架
export async function batchPushedOrOffline(data) {
return request.post('/product/pushedOrOffline/batch', {
prefix: kdspApi,
data: stringify(_.omitBy(data, v => !v)),
headers,
});
}
// 商品修改
export async function update(params) {
return request.post('/api/kdsp/op/mch_sku/update', params, {
emulateJSON: true,
});
}
// 商品修改日志
export async function changeLog(params) {
return request.post('/product/logs/api/merchant/page', {
data: stringify(_.omitBy(params, v => !v)),
prefix: kdspApi,
prefix: goodsApi,
headers,
});
}
// 审核详情日志
export async function productMerchantLog(productId) {
return request.get('/product/api/merchant/auditLog', {
params: {
productId,
},
prefix: kdspApi,
});
}
// 商品详情
export async function detail(params) {
return request.post('/product/supply/list', {
data: stringify(_.omitBy(params, v => !v)),
prefix: kdspApi,
headers,
prefix: goodsApi,
});
}
......@@ -173,50 +109,27 @@ export async function detail(params) {
export async function getJdPicList(params) {
const { data } = await request.post('/product/api/merchant/item/getJdPicList', {
data: stringify(_.omitBy(params, v => !v)),
prefix: kdspApi,
prefix: goodsApi,
headers,
});
return data;
}
// 添加商品
export async function addSku(params) {
const [, error] = await request.post('/api/kdsp/op/mch_sku/add_sku', params);
return error;
}
// 修改商品
export async function updateSku(params) {
const [, error] = await request.post('/api/kdsp/op/mch_sku/update', params);
return error;
}
// 图片上传
export async function uploadImg(files) {
const params = new FormData();
files.forEach(file => params.append('file', file));
const data = await request.post('/image/api/merchant/upload', {
prefix: kdspApi,
prefix: goodsApi,
data: params,
});
return data;
}
// 修改商品价格
export async function updatePrice(params) {
const data = await request.post('/product/item/updatePrice', {
prefix: kdspApi,
data: stringify(_.omitBy(params, v => !v)),
headers,
});
if (data.businessCode === '0000') {
return null;
}
return data.msg;
}
// 修改商品库存
export async function updateStock(params) {
const data = await request.post('/product/item/api/merchant/updateStock', {
prefix: kdspApi,
prefix: goodsApi,
data: stringify(_.omitBy(params, v => !v)),
headers,
});
......@@ -229,7 +142,7 @@ export async function updateStock(params) {
// 获取虚拟商品类目
export async function getVirtualCategory() {
const data = await request.post('/product/category/api/merchant/getByParentId', {
prefix: kdspApi,
prefix: goodsApi,
data: stringify(_.omitBy({ id: 100018 }, v => !v)),
headers,
});
......
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