diff --git a/admin-web/src/models/order/orderList.js b/admin-web/src/models/order/orderList.js
index e337c1493..babef4370 100644
--- a/admin-web/src/models/order/orderList.js
+++ b/admin-web/src/models/order/orderList.js
@@ -1,5 +1,5 @@
import { message } from 'antd';
-import { orderPage, updateOrderItem } from '../../services/order';
+import { orderPage, updateOrderItem, updateOrderItemPayAmount } from '../../services/order';
export default {
namespace: 'orderList',
@@ -13,11 +13,26 @@ export default {
},
dataSource: [],
},
+ payAmountVisible: false,
+ payAmount: 0,
+ orderId: 0,
+ orderItemId: 0,
+ searchParams: {},
},
effects: {
*queryPage({ payload }, { call, put }) {
const response = yield call(orderPage, payload);
+
+ yield put({
+ type: 'changeSearchParams',
+ payload: {
+ searchParams: {
+ ...payload,
+ },
+ },
+ });
+
message.info('查询成功!', response);
const { total, orders } = response.data;
yield put({
@@ -45,6 +60,23 @@ export default {
},
});
},
+ *updatePayAmount({ payload }, { call, put }) {
+ const { searchParams, params } = payload;
+ yield call(updateOrderItemPayAmount, params);
+ yield put({
+ type: 'changePayAmountVisible',
+ payload: {
+ payAmountVisible: false,
+ },
+ });
+
+ yield put({
+ type: 'queryPage',
+ payload: {
+ ...searchParams,
+ },
+ });
+ },
},
reducers: {
@@ -55,5 +87,17 @@ export default {
list,
};
},
+ changePayAmountVisible(state, { payload }) {
+ return {
+ ...state,
+ ...payload,
+ };
+ },
+ changeSearchParams(state, { payload }) {
+ return {
+ ...state,
+ ...payload,
+ };
+ },
},
};
diff --git a/admin-web/src/pages/Order/OrderList.js b/admin-web/src/pages/Order/OrderList.js
index eb3b790a2..6111fc59d 100644
--- a/admin-web/src/pages/Order/OrderList.js
+++ b/admin-web/src/pages/Order/OrderList.js
@@ -1,119 +1,123 @@
-import React, { Fragment, PureComponent } from 'react';
+import React, { PureComponent } from 'react';
import moment from 'moment';
import { connect } from 'dva';
-import { Button, Card, Col, Divider, Form, Input, Row, Table, DatePicker } from 'antd';
+import { Button, Card, Col, Divider, Form, Input, Row, Tabs, DatePicker, List } from 'antd';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import DictionaryText from '@/components/Dictionary/DictionaryText';
-import DictionarySelect from '@/components/Dictionary/DictionarySelect';
+import OrderUpdatePayAmount from './OrderUpdatePayAmount';
import dictionary from '@/utils/dictionary';
import styles from './OrderList.less';
const { RangePicker } = DatePicker;
const FormItem = Form.Item;
+const { TabPane } = Tabs;
-const OrderList = props => {
- const { list, dispatch, loading, handleModalVisible } = props;
+const OrderContent = orderItem => {
+ const { dispatch, skuName, skuImage, quantity, price, payAmount, createTime, status } = orderItem;
- // 翻页
- const onPageChange = page => {
- const { searchParams } = props;
+ const handleUpdatePayAmount = updateOrderItem => {
dispatch({
- type: 'adminList/query',
+ type: 'orderList/changePayAmountVisible',
payload: {
- pageNo: page.current,
- pageSize: page.pageSize,
- ...searchParams,
+ payAmountVisible: true,
+ payAmount: updateOrderItem.payAmount,
+ orderId: updateOrderItem.orderId,
+ orderItemId: updateOrderItem.id,
},
});
};
- const columns = [
- {
- title: '订单id',
- dataIndex: 'id',
- },
- {
- title: '用户',
- dataIndex: 'userId',
- },
- {
- title: '订单号',
- dataIndex: 'orderNo',
- },
- {
- title: '金额',
- dataIndex: 'price',
- render(val) {
- return {val} 元;
- },
- },
- {
- title: '状态',
- dataIndex: 'status',
- render(val) {
- return ;
- },
- },
- {
- title: '付款时间',
- dataIndex: 'paymentTime',
- render: val => (!val ? '' : {moment(val).format('YYYY-MM-DD HH:mm')}),
- },
- {
- title: '发货时间',
- dataIndex: 'deliveryTime',
- render: val => (!val ? '' : {moment(val).format('YYYY-MM-DD HH:mm')}),
- },
- {
- title: '收货时间',
- dataIndex: 'receiverTime',
- render: val => (!val ? '' : {moment(val).format('YYYY-MM-DD HH:mm')}),
- },
- {
- title: '成交时间',
- dataIndex: 'closingTime',
- render: val => (!val ? '' : {moment(val).format('YYYY-MM-DD HH:mm')}),
- },
- {
- title: '创建时间',
- dataIndex: 'createTime',
- render: val => (!val ? '' : {moment(val).format('YYYY-MM-DD HH:mm')}),
- },
- {
- title: '操作',
- width: 100,
- render: (text, record) => {
- return (
-
- handleModalVisible(true, 'update', record)}>编辑
-
-
- );
- },
- },
- ];
+ return (
+
+
+
+
+
(金额/物件)
+
{quantity}件
+
+ {price / 100} 元/{quantity * (price / 100)} 元
+
+
+
+
(购买人)
+
范先生
+
13302926050
+
+
+
(下单时间)
+
{moment(createTime).format('YYYY-MM-DD HH:mm')}
+
+
+
+
(订单状态)
+
+
+
+
{[0, 1, 2].indexOf(status) ? : ''}
+
+
+
(实付金额)
+
{payAmount / 100}元
+
+
+
+ );
+};
- const tableScroll = {
- x: 1400,
+const OrderList = props => {
+ const { list, dispatch, loading } = props;
+ const { pagination, dataSource } = list;
+
+ const paginationProps = {
+ ...pagination,
};
return (
- (
+
+
+
+
+
订单号: {item.orderNo}
+
+
支付金额: {item.payAmount / 100} 元
+
+
+
+
+
+ {item.orderItems.map(orderItem => {
+ return
;
+ })}
+
+
+ )}
/>
);
};
// SearchForm
-const SearchForm = props => {
+const SearchForm = Form.create()(props => {
const {
form: { getFieldDecorator },
form,
@@ -176,11 +180,6 @@ const SearchForm = props => {
{getFieldDecorator('orderNo')()}
-
-
- {getFieldDecorator('status', {})()}
-
-
@@ -203,14 +202,13 @@ const SearchForm = props => {
);
-};
+});
@connect(({ orderList, loading }) => ({
orderList,
list: orderList.list,
loading: loading.models.orderList,
}))
-@Form.create()
class BasicList extends PureComponent {
componentDidMount() {
const {
@@ -225,6 +223,9 @@ class BasicList extends PureComponent {
queryList = params => {
const { dispatch } = this.props;
+ // 保存每次操作 searchParams
+ this.searchParams = params;
+ // dispatch
dispatch({
type: 'orderList/queryPage',
payload: {
@@ -249,6 +250,15 @@ class BasicList extends PureComponent {
});
};
+ handleTabsChange = key => {
+ const params = {
+ ...this.searchParams,
+ status: key,
+ };
+
+ this.queryList(params);
+ };
+
render() {
return (
@@ -263,9 +273,20 @@ class BasicList extends PureComponent {
+
+
+
+
+
+
+
+
+
+
+
);
}
diff --git a/admin-web/src/pages/Order/OrderList.less b/admin-web/src/pages/Order/OrderList.less
index 416c0935a..82aa8f003 100644
--- a/admin-web/src/pages/Order/OrderList.less
+++ b/admin-web/src/pages/Order/OrderList.less
@@ -235,3 +235,58 @@
margin-right: 8px;
}
}
+
+// 订单content
+.orderGroup {
+ @padding-slid: 10px;
+
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ justify-content: flex-start;
+
+ .header {
+ display: flex;
+ flex: 1;
+ justify-content: space-between;
+ padding-right: @padding-slid;
+ padding-left: @padding-slid;
+ font-weight: bold;
+ font-size: 15px;
+ line-height: 35px;
+ background-color: #c0bfb9;
+ }
+
+ .order {
+ display: flex;
+ flex: 1;
+ flex-direction: row;
+ padding-right: @padding-slid;
+ padding-left: @padding-slid;
+ line-height: 100px;
+ border: 1px solid #c0bfb9;
+
+ .contentItem {
+ display: flex;
+ flex: 1;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+
+ > div {
+ line-height: 30px;
+ }
+
+ .columnName {
+ font-weight: bold;
+ font-size: 12px;
+ }
+ }
+
+ .image {
+ width: 100px;
+ height: 100px;
+ }
+ }
+}
diff --git a/admin-web/src/pages/Order/OrderUpdatePayAmount.js b/admin-web/src/pages/Order/OrderUpdatePayAmount.js
new file mode 100644
index 000000000..68ec9c388
--- /dev/null
+++ b/admin-web/src/pages/Order/OrderUpdatePayAmount.js
@@ -0,0 +1,61 @@
+import React from 'react';
+import { Form, Input, Modal } from 'antd';
+
+const FormItem = Form.Item;
+
+// 订单 - 更新支付金额
+const OrderUpdatePayAmount = Form.create()(props => {
+ const { dispatch, loading } = props;
+ const { orderId, orderItemId, payAmount, payAmountVisible, searchParams } = props.orderList;
+ const { getFieldDecorator, getFieldsValue } = props.form;
+
+ const handleOk = e => {
+ e.preventDefault();
+ const fieldsValue = getFieldsValue();
+
+ dispatch({
+ type: 'orderList/updatePayAmount',
+ payload: {
+ params: {
+ payAmount: fieldsValue.payAmount * 100,
+ orderId,
+ orderItemId,
+ },
+ searchParams,
+ },
+ });
+ };
+
+ const handleCancel = () => {
+ dispatch({
+ type: 'orderList/changePayAmountVisible',
+ payload: {
+ payAmountVisible: false,
+ },
+ });
+ };
+
+ return (
+
+
+ {getFieldDecorator('payAmount', {
+ rules: [
+ { required: true, message: '请输入需要修改的金额!' },
+ { max: 10000, min: 0, message: '金额值 0 - 100000 元' },
+ ],
+ initialValue: payAmount / 100,
+ })()}
+
+
+ );
+});
+
+export default OrderUpdatePayAmount;
diff --git a/admin-web/src/services/order.js b/admin-web/src/services/order.js
index 12d30d265..4846f76e5 100644
--- a/admin-web/src/services/order.js
+++ b/admin-web/src/services/order.js
@@ -8,6 +8,12 @@ export async function orderPage(params) {
});
}
+export async function updateOrderItemPayAmount(params) {
+ return request(`/order-api/admins/order/order_item/update_pay_amount?${stringify(params)}`, {
+ method: 'PUT',
+ });
+}
+
export async function updateOrderItem(params) {
return request(`/order-api/admins/order_item/update?${stringify(params)}`, {
method: 'PUT',