需求分析

商家申请入驻后,需要网站运营人员在运营商后台进行审核,审核后商家才可以登陆系统。

状态值: 0:未审核 1:已审核 2:审核未通过 3:关闭

商家待审核列表

修改 seller_1.html
引入 JS

<link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
<link rel="stylesheet"
	href="../plugins/adminLTE/css/skins/_all-skins.min.css">
<link rel="stylesheet" href="../css/style.css">
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="../plugins/angularjs/pagination.css">
<script src="../plugins/angularjs/angular.min.js"></script>
<script src="../plugins/angularjs/pagination.js"></script>
<script type="text/javascript" src="../js/base_pagination.js"></script>
<script type="text/javascript" src="../js/service/sellerService.js"></script>
<script type="text/javascript" src="../js/controller/baseController.js"></script>
<script type="text/javascript" src="../js/controller/sellerController.js"></script>

指令

<body ng-app="pyg" ng-controller="sellerController" ng-init="searchEntity={status:'0'}"
      class="hold-transition skin-red sidebar-mini">

加入分页控件

 <tr ng-repeat="entity in list">
                    <td><input type="checkbox"></td>
                    <td>{{entity.sellerId}}</td>
                    <td>{{entity.name}}</td>
                    <td>{{entity.nickName}}</td>
                    <td>{{entity.linkmanName}}</td>
                    <td>{{entity.telephone}}</td>

                    <td class="text-center">
                        <button type="button" class="btn bg-olive btn-xs"
                                data-toggle="modal" data-target="#sellerModal"
                                ng-click="findOne(entity.sellerId)">详情
                        </button>
                    </td>
                </tr>

商家详情

21分布式电商项目 - 商家审核_# 分布式电商
(1)绑定页面弹出窗口

<table class="table table-bordered table-striped" width="800px">
	<tr>
		<td>公司名称</td>
		<td>{{entity.name}}</td>
	</tr>

	<tr>
		<td>公司手机</td>
		<td>{{entity.mobile}}</td>
	</tr>

	<tr>
		<td>公司电话</td>
		<td>{{entity.telephone}}</td>
	</tr>

	<tr>
		<td>公司详细地址</td>
		<td>{{entity.addressDetail}}</td>
	</tr>
</table>

(2)列表的“详情”按钮

<button type="button" class="btn bg-olive btn-xs" data-toggle="modal" data-target="#sellerModal" ng-click="findOne(entity.sellerId)">详情</button>

商家审核

1.后端代码

(1)在 pinyougou-sellergoods-interface 工程的 SellerService.java 服务接口新增方法定义

/**
* 更改状态
* @param id
* @param status
*/
public void updateStatus(String sellerId,String status);

(2)在 pinyougou-sellergoods-service 的 SellerServiceImpl.java 新增方法

@Override
public void updateStatus(String sellerId, String status) {
TbSeller seller = sellerMapper.selectByPrimaryKey(sellerId);
seller.setStatus(status);
sellerMapper.updateByPrimaryKey(seller);
}

(3)在 pinyougou-manager-web 的 SellerController.java 新增方法

/**
* 更改状态
* @param sellerId 商家 ID
* @param status 状态
*/
@RequestMapping("/updateStatus")
public Result updateStatus(String sellerId, String status){
	try {
		sellerService.updateStatus(sellerId, status);
		return new Result(true, "成功");
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return new Result(false, "失败");
}
}
2.前端的代码

修改 pinyougou-manager-web 的 sellerService.js

//更改状态
this.updateStatus=function(sellerId,status){
	return $http.get('../seller/updateStatus.do?sellerId='+sellerId+'&status='+status);
}

修改 pinyougou-manager-web 的 sellerController.js

$scope.updateStatus=function(sellerId,status){
sellerService.updateStatus(sellerId,status).success(
	function(response){
		if(response.success){
			$scope.reloadList();//刷新列表
		}else{
			alert("失败");
		}
		}
	);
}

修改按钮,调用方法

<div class="modal-footer">、
	<button class="btn btn-success" data-dismiss="modal" aria-hidden="trueng-click="updateStatus(entity.sellerId,'1')">审核通过</button>
	  <button class="btn btn-danger" data-dismiss="modal" aria-hidden="trueng-click="updateStatus(entity.sellerId,'2')">审核未通过</button>
	  <button class="btn btn-danger" data-dismiss="modal" aria-hidden="true" 
ng-click="updateStatus(entity.sellerId,'3')">关闭商家</button>
		<button class="btn btn-default" data-dismiss="modal" aria-hidden="true"关闭</button>
</div>