订单商品页
This commit is contained in:
parent
eaf042352e
commit
c245e3d9b7
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.ghy.web.controller.order;
|
||||||
|
|
||||||
|
import com.ghy.common.annotation.Log;
|
||||||
|
import com.ghy.common.core.controller.BaseController;
|
||||||
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
|
import com.ghy.common.core.page.TableDataInfo;
|
||||||
|
import com.ghy.common.core.text.Convert;
|
||||||
|
import com.ghy.common.enums.BusinessType;
|
||||||
|
import com.ghy.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ghy.order.domain.OrderGoods;
|
||||||
|
import com.ghy.order.domain.OrderMaster;
|
||||||
|
import com.ghy.order.service.OrderGoodsService;
|
||||||
|
import com.ghy.order.service.OrderMasterService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单商品API
|
||||||
|
*
|
||||||
|
* @author HH 2022/4/25
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/order/goods")
|
||||||
|
public class OrderGoodsController extends BaseController {
|
||||||
|
|
||||||
|
private final String prefix = "order/goods";
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrderGoodsService orderGoodsService;
|
||||||
|
@Resource
|
||||||
|
private OrderMasterService orderMasterService;
|
||||||
|
|
||||||
|
@RequiresPermissions("order:goods:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String orderGoods(Long orderId, ModelMap mmap) {
|
||||||
|
OrderMaster orderMaster = orderMasterService.selectById(orderId);
|
||||||
|
mmap.put("orderMaster", orderMaster);
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("order:goods:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(OrderGoods orderGoods) {
|
||||||
|
startPage();
|
||||||
|
List<OrderGoods> list = orderGoodsService.selectOrderGoodsList(orderGoods);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "主订单管理", businessType = BusinessType.EXPORT)
|
||||||
|
@RequiresPermissions("order:goods:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(OrderGoods orderGoods) {
|
||||||
|
List<OrderGoods> list = orderGoodsService.selectOrderGoodsList(orderGoods);
|
||||||
|
ExcelUtil<OrderGoods> util = new ExcelUtil<>(OrderGoods.class);
|
||||||
|
return util.exportExcel(list, "主订单数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("order:goods:remove")
|
||||||
|
@Log(title = "主订单管理", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping("/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids) {
|
||||||
|
try {
|
||||||
|
Long[] idArray = Convert.toLongArray(ids);
|
||||||
|
return toAjax(orderGoodsService.deleteOrderGoodsByIds(idArray));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改主订单
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("order:goods:edit")
|
||||||
|
@GetMapping("/edit/{orderGoodsId}")
|
||||||
|
public String edit(@PathVariable("orderGoodsId") Long orderGoodsId, ModelMap mmap) {
|
||||||
|
mmap.put("orderGoods", orderGoodsService.selectById(orderGoodsId));
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('订单商品列表')"/>
|
||||||
|
<th:block th:include="include :: layout-latest-css"/>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body class="gray-bg">
|
||||||
|
|
||||||
|
<div class="ui-layout-center">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="order-goods-form">
|
||||||
|
<input type="hidden" id="orderId" name="orderId" th:value="${orderMaster.id}">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<th:block th:include="include :: footer"/>
|
||||||
|
<th:block th:include="include :: layout-latest-js"/>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
|
||||||
|
var prefix = ctx + "order/goods";
|
||||||
|
var orderId = '[[${orderId}]]';
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
var panehHidden = false;
|
||||||
|
if ($(this).width() < 769) {
|
||||||
|
panehHidden = true;
|
||||||
|
}
|
||||||
|
$('body').layout({initClosed: panehHidden, west__size: 185});
|
||||||
|
// 回到顶部绑定
|
||||||
|
if ($.fn.toTop !== undefined) {
|
||||||
|
var opt = {
|
||||||
|
win: $('.ui-layout-center'),
|
||||||
|
doc: $('.ui-layout-center')
|
||||||
|
};
|
||||||
|
$('#scroll-up').toTop(opt);
|
||||||
|
}
|
||||||
|
queryOrderGoodsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
function queryOrderGoodsList() {
|
||||||
|
var options = {
|
||||||
|
url: prefix + "/list",
|
||||||
|
modalName: "订单商品",
|
||||||
|
search: false,
|
||||||
|
showSearch: false,
|
||||||
|
showToggle: false,
|
||||||
|
showColumns: false,
|
||||||
|
showRefresh: false,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'orderGoodsId',
|
||||||
|
title: '订单商品id',
|
||||||
|
visible: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'orderId',
|
||||||
|
title: '订单id',
|
||||||
|
visible: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'goodsName',
|
||||||
|
title: '商品名称'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'goodsNum',
|
||||||
|
title: '商品数量'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'serverGoodsNum',
|
||||||
|
title: '已服务数量'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
$.table.init(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('订单列表')"/>
|
<th:block th:include="include :: header('订单列表')"/>
|
||||||
<th:block th:include="include :: layout-latest-css"/>
|
<th:block th:include="include :: layout-latest-css"/>
|
||||||
<th:block th:include="include :: ztree-css"/>
|
<th:block th:include="include :: ztree-css"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="gray-bg">
|
<body class="gray-bg">
|
||||||
|
|
||||||
<div class="ui-layout-center">
|
<div class="ui-layout-center">
|
||||||
|
|
@ -140,7 +142,7 @@
|
||||||
align: 'left',
|
align: 'left',
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var actions = [];
|
var actions = [];
|
||||||
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>详情</a> ');
|
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="detail(\'' + row.id + '\')"><i class="fa fa-info-circle"></i>详情</a> ');
|
||||||
return actions.join('');
|
return actions.join('');
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
|
|
@ -149,8 +151,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function detail(id) {
|
function detail(id) {
|
||||||
var url = prefix ;
|
var url = "order/goods?orderId=" + id;
|
||||||
$.modal.open("字典数据", url);
|
$.modal.open("商品信息", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue