1. 待审核商品列表
pinyougou-manager-web工程中
1.1 后端
1.2 前端
1)controller层goodsController.js
/*
* 定义数组,记录状态信息
* */
$scope.status=['未审核','已审核','审核未通过','关闭'];//商品状态
// 查询分类信息
$scope.itemCatList = [];
$scope.getitemCatList = function(){
itemCatService.findAll().success(function(response) {
for(var i = 0 ; i < response.length ; i ++ ){
$scope.itemCatList[response[i].id] = response[i].name;
}
});
}
2)界面引入头文件
3)添加指令
4)添加分页组件
5)数据绑定
效果图:
2. 商品审核与驳回
2.1 后端
所谓的审核与驳回无非就是对状态的更改,所以可以写一个方法用于操作这个值的更替
1)mapper
<update id="updateAuditStatus" parameterType="map">
update tb_goods set audit_status = #{status}
where id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>
)
</update>
2)service
@Override
public void updateAuditStatus(Long[] ids, String status) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("ids", ids);
map.put("status", status);
goodsMapper.updateAuditStatus(map);
}
3)controller
/** 审核与驳回
* @param ids
* @param status
* @return
*/
@RequestMapping("/updateAuditStatus")
public Result updateAuditStatus(Long [] ids,String status){
try {
goodsService.updateAuditStatus(ids,status);
return new Result(true, "操作成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "操作失败");
}
}
2.2 前端
1)service层
// 审核与驳回
this.updateAuditStatus = function(ids,status) {
return $http.get('../goods/updateAuditStatus.do?status='+status+"&ids="+ids);
}
2)controller
$scope.updateAuditStatus = function(status) {
goodsService.updateAuditStatus($scope.selectIds,status).success(function(res) {
if(res.success){
alert(res.message);
$scope.reloadList();//重新加载
$scope.selectIds = [];
} else {
alert(res.message);
}
});
}
3)界面方法调用
3. 商品上下架
商品的上下架就是对上下架状态的修改。字段为tb_goods表的is_marketable字段。1表示上架、0表示下架