管理后台:商品列表报错的问题,解决商品报价 * 100

This commit is contained in:
YunaiV 2019-04-16 23:26:56 +08:00
parent 371eba5537
commit 2eb5d32cbc
5 changed files with 10 additions and 60 deletions

View File

@ -8,8 +8,8 @@ export default {
pathRewrite: {}, pathRewrite: {},
}, },
'/product-api/': { '/product-api/': {
target: 'http://180.167.213.26:18083/', // target: 'http://180.167.213.26:18083/',
// target: 'http://127.0.0.1:18081/', target: 'http://127.0.0.1:18081/',
changeOrigin: true, changeOrigin: true,
pathRewrite: {}, pathRewrite: {},
}, },

View File

@ -56,8 +56,8 @@ export default {
yield put(routerRedux.replace('/product/product-spu-add')); yield put(routerRedux.replace('/product/product-spu-add'));
}, },
*page({ payload }, { call, put }) { *page({ payload }, { call, put }) {
const { queryParams } = payload; // const { queryParams } = payload;
const response = yield call(productSpuPage, queryParams); const response = yield call(productSpuPage, payload);
message.info('查询成功!'); message.info('查询成功!');
yield put({ yield put({
type: 'treeSuccess', type: 'treeSuccess',

View File

@ -47,19 +47,6 @@ class ProductSpuAddOrUpdate extends Component {
}); });
} }
// handleSubmit = e => {
// const { dispatch, form } = this.props;
// e.preventDefault();
// form.validateFieldsAndScroll((err, values) => {
// if (!err) {
// dispatch({
// type: 'form/submitRegularForm',
// payload: values,
// });
// }
// });
// }
handleAddAttr = e => { handleAddAttr = e => {
// alert('你猜'); // alert('你猜');
const { dispatch } = this.props; const { dispatch } = this.props;
@ -83,7 +70,7 @@ class ProductSpuAddOrUpdate extends Component {
} }
let newAttr = { let newAttr = {
attrs: [], attrs: [],
price: sku.price, price: sku.price * 100,
quantity: sku.quantity, quantity: sku.quantity,
} }
for (let j in sku.attrs) { for (let j in sku.attrs) {

View File

@ -11,44 +11,7 @@ import styles from './ProductSpuList.less';
const FormItem = Form.Item; const FormItem = Form.Item;
const { TreeNode } = Tree; const { TreeNode } = Tree;
// 添加 form 表单 // productSpuList
const CreateForm = Form.create()(props => {
const { modalVisible, form, handleAdd, handleModalVisible, modalType, initValues } = props;
const okHandle = () => {
form.validateFields((err, fieldsValue) => {
if (err) return;
form.resetFields();
handleAdd({
fields: fieldsValue,
modalType,
initValues,
});
});
};
const title = modalType === 'add' ? '添加一个 Role' : '更新一个 Role';
const okText = modalType === 'add' ? '添加' : '更新';
return (
<Modal
destroyOnClose
title={title}
visible={modalVisible}
onOk={okHandle}
okText={okText}
onCancel={() => handleModalVisible()}
>
<FormItem labelCol={{ span: 5 }} wrapperCol={{ span: 15 }} label="角色名">
{form.getFieldDecorator('name', {
rules: [{ required: true, message: '请输入角色名!', min: 2 }],
initialValue: initValues.name,
})(<Input placeholder="请输入" />)}
</FormItem>
</Modal>
);
});
// roleList
@connect(({ productSpuList, loading }) => ({ @connect(({ productSpuList, loading }) => ({
productSpuList, productSpuList,
list: productSpuList.list.spus, list: productSpuList.list.spus,
@ -71,8 +34,8 @@ class ProductSpuList extends PureComponent {
type: 'productSpuList/page', type: 'productSpuList/page',
payload: { payload: {
name: '', name: '',
pageNo: 0, pageNo: 1,
pageSize: 10, pageSize: 20,
}, },
}); });
} }
@ -168,7 +131,6 @@ class ProductSpuList extends PureComponent {
</div> </div>
<Table columns={columns} dataSource={list} rowKey="id" /> <Table columns={columns} dataSource={list} rowKey="id" />
</Card> </Card>
<CreateForm {...parentMethods} modalVisible={modalVisible} />
</PageHeaderWrapper> </PageHeaderWrapper>
); );
} }

View File

@ -39,6 +39,7 @@ export async function productCategoryDelete(params) {
// product spu + sku // product spu + sku
export async function productSpuPage(params) { export async function productSpuPage(params) {
debugger;
return request(`/product-api/admins/spu/page?${stringify(params)}`, { return request(`/product-api/admins/spu/page?${stringify(params)}`, {
method: 'GET', method: 'GET',
}); });
@ -57,4 +58,4 @@ export async function productAttrTree(params) {
return request(`/product-api/admins/attr/tree?${stringify(params)}`, { return request(`/product-api/admins/attr/tree?${stringify(params)}`, {
method: 'GET', method: 'GET',
}); });
} }