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

pull/1/head
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: {},
},
'/product-api/': {
target: 'http://180.167.213.26:18083/',
// target: 'http://127.0.0.1:18081/',
// target: 'http://180.167.213.26:18083/',
target: 'http://127.0.0.1:18081/',
changeOrigin: true,
pathRewrite: {},
},

View File

@ -56,8 +56,8 @@ export default {
yield put(routerRedux.replace('/product/product-spu-add'));
},
*page({ payload }, { call, put }) {
const { queryParams } = payload;
const response = yield call(productSpuPage, queryParams);
// const { queryParams } = payload;
const response = yield call(productSpuPage, payload);
message.info('查询成功!');
yield put({
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 => {
// alert('你猜');
const { dispatch } = this.props;
@ -83,7 +70,7 @@ class ProductSpuAddOrUpdate extends Component {
}
let newAttr = {
attrs: [],
price: sku.price,
price: sku.price * 100,
quantity: sku.quantity,
}
for (let j in sku.attrs) {

View File

@ -11,44 +11,7 @@ import styles from './ProductSpuList.less';
const FormItem = Form.Item;
const { TreeNode } = Tree;
// 添加 form 表单
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
// productSpuList
@connect(({ productSpuList, loading }) => ({
productSpuList,
list: productSpuList.list.spus,
@ -71,8 +34,8 @@ class ProductSpuList extends PureComponent {
type: 'productSpuList/page',
payload: {
name: '',
pageNo: 0,
pageSize: 10,
pageNo: 1,
pageSize: 20,
},
});
}
@ -168,7 +131,6 @@ class ProductSpuList extends PureComponent {
</div>
<Table columns={columns} dataSource={list} rowKey="id" />
</Card>
<CreateForm {...parentMethods} modalVisible={modalVisible} />
</PageHeaderWrapper>
);
}

View File

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