|
【郑州校区】品优购电商系统开发第 7 章 七
2.9 页面跳转
(1)由商品列表页跳转到商品编辑页
修改 goods.html 表格行的修改按钮
[mw_shl_code=applescript,true]<a href="goods_edit.html#?id={{entity.id}}" class="btn bg-olive btn-xs">修改</a>[/mw_shl_code]
(2)由商品编辑页跳转到商品列表
修改 goods_edit.html 的返回列表按钮
[mw_shl_code=applescript,true]<a href="goods.html" class="btn btn-default">返回列表</a>[/mw_shl_code]
(3)保存成功后返回列表页面
[mw_shl_code=applescript,true]//保存
$scope.save=function(){
.....
serviceObject.success(
function(response){
if(response.success){
location.href="goods.html";//跳转到商品列表页
}else{
alert(response.message);
}
}
);
}[/mw_shl_code]
3.运营商后台-商品管理【商品审核】
3.1 待审核商品列表
需求:参照商家后台商品列表。代码:
(1)修改 pinyougou-manager-web 的 goodsController.js,注入 itemCatService,添加代码
[mw_shl_code=applescript,true]$scope.status=['未审核','已审核','审核未通过','关闭'];//商品状态
$scope.itemCatList=[];//商品分类列表
//查询商品分类
$scope.findItemCatList=function(){
itemCatService.findAll().success(
function(response){
for(var i=0;i<response.length;i++){
$scope.itemCatList[response.id ]=response.name;
}
}
);
}[/mw_shl_code]
(2)修改 goods.html ,引入 js
[mw_shl_code=applescript,true]<script type="text/javascript" src="../plugins/angularjs/angular.min.js"></script>
<!-- 分页组件开始 -->
<script src="../plugins/angularjs/pagination.js"></script>
<link rel="stylesheet" href="../plugins/angularjs/pagination.css">
<!-- 分页组件结束 -->
<script type="text/javascript" src="../js/base_pagination.js"></script>
<script type="text/javascript" src="../js/service/goodsService.js"></script>
<script type="text/javascript" src="../js/service/itemCatService.js"></script>
<script type="text/javascript" src="../js/controller/baseController.js"></script>
<script type="text/javascript" src="../js/controller/goodsController.js"></script> [/mw_shl_code]
(3)指令,完成初始调用
[mw_shl_code=applescript,true]<body
class="hold-transition skin-red sidebar-mini"
ng-app="pinyougou"
ng-controller="goodsController"
ng-init="searchEntity={auditStatus:'0'};findItemCatList()">[/mw_shl_code]
(4)循环列表
[mw_shl_code=applescript,true]<tr ng-repeat="entity in list">
<td><input type="checkbox"></td>
<td>{{entity.id}}</td>
<td>{{entity.goodsName}}</td>
<td>{{entity.price}}</td>
<td>{{itemCatList[entity.category1Id]}}</td>
<td>{{itemCatList[entity.category2Id]}}</td>
<td>{{itemCatList[entity.category3Id]}}</td>
<td>{{status[entity.auditStatus]}}</td>
<td class="text-center"> </td>
</tr>[/mw_shl_code]
(5)分页控件
[mw_shl_code=applescript,true]<tm-pagination conf="paginationConf"></tm-pagination>[/mw_shl_code]
|
|