Merge remote-tracking branch 'origin/master'

This commit is contained in:
YunaiV 2019-05-08 18:57:23 +08:00
commit 6169709e76
7 changed files with 96 additions and 10 deletions

View File

@ -19,9 +19,15 @@ import dictionary from '../../utils/dictionary';
class OrderRefundsList extends PureComponent {
componentDidMount() {
// 查询 list
this.queryList({ index: 1 });
this.queryList({ index: 1 }, {});
}
handleSearch = searchParams => {
const { orderRefunds } = this.props;
const { index, pageSize } = orderRefunds;
this.queryList({ index, pageSize }, searchParams);
};
queryList = ({ index = 0, pageSize = 10 }, searchParams) => {
const { dispatch } = this.props;
dispatch({
@ -40,7 +46,7 @@ class OrderRefundsList extends PureComponent {
handleTableChange = pagination => {
const { pageSize, current } = pagination;
this.queryList({ pageSize, index: current });
this.queryList({ pageSize, index: current }, {});
};
render() {
@ -125,7 +131,7 @@ class OrderRefundsList extends PureComponent {
<PageHeaderWrapper>
<Card>
<div className={styles.tableListForm}>
<TableSearch />
<TableSearch handleSearch={this.handleSearch} />
</div>
<Tabs defaultActiveKey={null} onChange={this.handleTabsChange}>

View File

@ -9,11 +9,51 @@ const FormItem = Form.Item;
* @type {React.ComponentClass<RcBaseFormProps & Omit<FormComponentProps, keyof FormComponentProps>>}
*/
const TableSearch = Form.create()(props => {
const { getFieldDecorator } = props.form;
const { getFieldDecorator, form, handleSearch } = props.form;
function onSubmit() {}
function onSubmit(e) {
e.preventDefault();
function handleFormReset() {}
form.validateFields((err, fields) => {
const buildTime = (fieldValue, key) => {
const res = {};
if (fieldValue && fieldValue.length >= 2) {
const keySuffix = key.substring(0, 1).toUpperCase() + key.substring(1);
res[`start${keySuffix}`] = fieldValue[0].format('YYYY-MM-DD HH:mm:ss');
res[`end${keySuffix}`] = fieldValue[1].format('YYYY-MM-DD HH:mm:ss');
}
return res;
};
const timeFields = ['createTime'];
const buildSearchParams = fields2 => {
let res = {};
Object.keys(fields).map(objectKey => {
const fieldValue = fields2[objectKey];
if (timeFields.indexOf(objectKey) !== -1) {
// 处理时间
res = {
...res,
...buildTime(fieldValue, objectKey),
};
} else if (fieldValue !== undefined) {
res[objectKey] = fieldValue;
}
return true;
});
return res;
};
const searchParams = buildSearchParams(fields);
if (handleSearch) {
handleSearch(searchParams);
}
});
}
function handleFormReset() {
form.resetFields();
}
return (
<Form onSubmit={onSubmit} layout="inline">

View File

@ -10,10 +10,7 @@ import io.swagger.annotations.Api;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* 订单退货
@ -35,4 +32,10 @@ public class AdminOrderReturnController {
OrderReturnQueryDTO queryDTO = OrderReturnConvert.INSTANCE.convert(queryPO);
return orderReturnService.orderReturnList(queryDTO);
}
@PostMapping("agree")
public CommonResult agree(@RequestParam("id") Integer id) {
CommonResult commonResult = orderReturnService.agree(id);
return commonResult;
}
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.mall.order.api.exception;
/**
* 订单退回 - 不存在
*
* @author Sin
* @time 2019/5/8 6:17 PM
*/
public class OrderReturnNonExistentException {
}

View File

@ -57,4 +57,12 @@ public interface OrderReturnMapper {
* @return
*/
List<OrderReturnDO> selectList(OrderReturnQueryDTO queryDTO);
/**
* 查询 - 根据 id 查询
*
* @param id
* @return
*/
OrderReturnDO selectById(Integer id);
}

View File

@ -140,4 +140,13 @@ public class OrderReturnServiceImpl implements OrderReturnService {
.setTotalCount(totalCount)
);
}
@Override
public CommonResult agree(Integer id) {
OrderReturnDO orderReturnDO = orderReturnMapper.selectById(id);
if (orderReturnDO == null) {
}
return null;
}
}

View File

@ -145,4 +145,14 @@
<bind name="limitIndex" value="pageSize * (index - 1)"/>
LIMIT #{limitIndex}, #{pageSize}
</select>
<!--
查询 - 根据 id 查询
-->
<select id="selectById" resultType="cn.iocoder.mall.order.biz.dataobject.OrderReturnDO">
SELECT
<include refid="FIELDS"/>
FROM `order_return`
WHERE id = #{id}
</select>
</mapper>