Merge pull request '请求1' (#1) from 18237870573/youxi:master into master

pull/2/head
ps2hc5nfx 2 years ago
commit 1a92d76fa8

@ -0,0 +1,15 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="All Rights Reserved, Copyright (C) 2013, 猿来入此, Ltd." />
<title></title>
<link rel="stylesheet" type="text/css" href="../../resources/admin/easyui/easyui/1.3.4/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../resources/admin/easyui/css/wu.css" />
<link rel="stylesheet" type="text/css" href="../../resources/admin/easyui/css/icon.css" />
<script type="text/javascript" src="../../resources/admin/easyui/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../resources/admin/easyui/easyui/1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../resources/admin/easyui/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
<body class="easyui-layout">

@ -0,0 +1,5 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:forEach items="${thirdMenuList }" var="thirdMenu">
<a href="#" class="easyui-linkbutton" iconCls="${thirdMenu.icon }" onclick="${thirdMenu.url}" plain="true">${thirdMenu.name }</a>
</c:forEach>

@ -0,0 +1,174 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../common/header.jsp"%>
<div class="easyui-panel" title="编辑商品" style="width:1200px;height:800px;">
<div style="padding:0px">
<form id="edit-form" method="post">
<input type="hidden" name="id" value="${product.id }">
<table cellspacing="15">
<tr>
<td width="60" align="right">商品分类:</td>
<td >
<select id="edit-categoryId" name="productCategoryId" idField="id" treeField="name" class="easyui-combotree easyui-validatebox" data-options="required:true, missingMessage:'请选择所属分类'" url="tree_list" panelHeight="256px" style="width:268px">
</select>
</td>
</tr>
<tr>
<td width="60" align="right">商品标题:</td>
<td ><input type="text" name="name" value="${product.name }" class="wu-text easyui-validatebox" data-options="required:true, missingMessage:'请填写商品标题'" /></td>
</tr>
<tr>
<td width="60" align="right">商品主图:</td>
<td>
<input readonly="readonly" value="${product.imageUrl }" type="text" id="add-imageUrl" name="imageUrl" class="wu-text easyui-validatebox" data-options="required:true, missingMessage:'请上传图片'" />
<a href="javascript:uploadPhoto()" id="upload-btn" class="easyui-linkbutton" iconCls="icon-upload">上传图片</a>
<a href="javascript:previewPhoto()" id="view-btn" class="easyui-linkbutton" iconCls="icon-eye">预览图片</a>
</td>
</tr>
<tr>
<td width="60" align="right">商品价格:</td>
<td><input type="text" name="price" value="${product.price }" class="wu-text easyui-numberbox easyui-validatebox" data-options="required:true,min:0,precision:2, missingMessage:'请填写商品价格'" /></td>
</tr>
<tr>
<td width="60" align="right">商品库存:</td>
<td ><input type="text" name="stock" value="${product.stock }" class="wu-text easyui-numberbox easyui-validatebox" data-options="required:true,min:0,precision:0, missingMessage:'请填写商品库存'" /></td>
</tr>
<tr>
<td align="right">详情描述:</td>
<td style="border:0px;"><textarea id="edit-content" name="content" style="width:600px;height:200px;">${product.content }</textarea></td>
</tr>
<tr>
<td align="right"></td>
<td style="border:0px;">
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="submitForm()">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-back" onclick="back()">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
<div id="preview-dialog" class="easyui-dialog" data-options="closed:true,iconCls:'icon-save'" style="width:420px;">
<table>
<tr>
<td>
<img src="${product.imageUrl }" id="preview-photo" width="400px">
</td>
</tr>
</table>
</div>
<div id="process-dialog" class="easyui-dialog" data-options="closed:true,iconCls:'icon-upload',title:'正在上传图片'" style="width:450px; padding:10px;">
<div id="p" class="easyui-progressbar" style="width:400px;" data-options="text:'正在上传中...'"></div>
</div>
<input type="file" id="photo-file" style="display:none;" onchange="upload()">
<%@include file="../common/footer.jsp"%>
<!-- 配置文件 -->
<script type="text/javascript" src="../../resources/admin/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="../../resources/admin/ueditor/ueditor.all.js"></script>
<!-- End of easyui-dialog -->
<script type="text/javascript">
var ue = UE.getEditor('edit-content');
//上传图片
function start(){
var value = $('#p').progressbar('getValue');
if (value < 100){
value += Math.floor(Math.random() * 10);
$('#p').progressbar('setValue', value);
}else{
$('#p').progressbar('setValue',0)
}
};
function upload(){
if($("#photo-file").val() == '')return;
var formData = new FormData();
formData.append('photo',document.getElementById('photo-file').files[0]);
$("#process-dialog").dialog('open');
var interval = setInterval(start,200);
$.ajax({
url:'../user/upload_photo',
type:'post',
data:formData,
contentType:false,
processData:false,
success:function(data){
clearInterval(interval);
$("#process-dialog").dialog('close');
if(data.type == 'success'){
$("#preview-photo").attr('src',data.filepath);
$("#add-imageUrl").val(data.filepath);
}else{
$.messager.alert("消息提醒",data.msg,"warning");
}
},
error:function(data){
clearInterval(interval);
$("#process-dialog").dialog('close');
$.messager.alert("消息提醒","上传失败!","warning");
}
});
}
function uploadPhoto(){
$("#photo-file").click();
}
function previewPhoto(){
$('#preview-dialog').dialog({
closed: false,
modal:true,
title: "预览商品主图",
buttons: [{
text: '确定',
iconCls: 'icon-ok',
handler: function(){
$('#preview-dialog').dialog('close');
}
}, {
text: '取消',
iconCls: 'icon-cancel',
handler: function () {
$('#preview-dialog').dialog('close');
}
}]
});
}
function submitForm(){
edit();
}
function back(){
window.history.go(-1);
}
/**
* 添加记录
*/
function edit(){
var validate = $("#edit-form").form("validate");
if(!validate){
$.messager.alert("消息提醒","请检查你输入的数据!","warning");
return;
}
var data = $("#edit-form").serialize();
$.ajax({
url:'edit',
dataType:'json',
type:'post',
data:data,
success:function(data){
if(data.type == 'success'){
$.messager.alert('信息提示','添加成功!','info');
window.history.go(-1);
}else{
$.messager.alert('信息提示',data.msg,'warning');
}
}
});
}
setTimeout(function(){
$("#edit-categoryId").combotree('setValue','${product.productCategoryId}');
},500);
</script>

@ -0,0 +1,148 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="../common/header.jsp"%>
<div class="easyui-layout" data-options="fit:true">
<!-- Begin of toolbar -->
<div id="wu-toolbar">
<div class="wu-toolbar-button">
<%@include file="../common/menus.jsp"%>
</div>
<div class="wu-toolbar-search">
<label>商品标题:</label><input id="search-name" class="wu-text" style="width:100px">
<label>所属分类:</label>
<select id="search-productCategoryId" idField="id" treeField="name" class="easyui-combotree" url="tree_list" panelHeight="256px" style="width:180px">
</select>
<label>价格区间:</label>
<input id="search-priceMin" class="wu-text" style="width:50px">
~
<input id="search-priceMax" class="wu-text" style="width:50px">
<a href="#" id="search-btn" class="easyui-linkbutton" iconCls="icon-search">搜索</a>
</div>
</div>
<!-- End of toolbar -->
<table id="data-datagrid" class="easyui-datagrid" toolbar="#wu-toolbar"></table>
</div>
<!-- Begin of easyui-dialog -->
<%@include file="../common/footer.jsp"%>
<!-- End of easyui-dialog -->
<script type="text/javascript">
/**
* 删除记录
*/
function remove(){
$.messager.confirm('信息提示','确定要删除该记录?', function(result){
if(result){
var item = $('#data-datagrid').datagrid('getSelected');
if(item == null || item.length == 0){
$.messager.alert('信息提示','请选择要删除的数据!','info');
return;
}
$.ajax({
url:'delete',
dataType:'json',
type:'post',
data:{id:item.id},
success:function(data){
if(data.type == 'success'){
$.messager.alert('信息提示','删除成功!','info');
$('#data-datagrid').datagrid('reload');
}else{
$.messager.alert('信息提示',data.msg,'warning');
}
}
});
}
});
}
/**
* Name 打开添加窗口
*/
function openAdd(){
//$('#add-form').form('clear');
window.location.href = 'add';
}
function openEdit(){
//$('#add-form').form('clear');
var item = $('#data-datagrid').datagrid('getSelected');
if(item == null || item.length == 0){
$.messager.alert('信息提示','请选择要编辑的数据!','info');
return;
}
window.location.href = 'edit?id=' + item.id;
}
//搜索按钮监听
$("#search-btn").click(function(){
var option = {name:$("#search-name").val()};
var productCategoryId = $("#search-productCategoryId").combotree('getValue');
if(productCategoryId != null && productCategoryId != ''){
option.productCategoryId = productCategoryId;
}
var priceMin = $("#search-priceMin").val();
if(priceMin != ''){
option.priceMin = priceMin;
}
var priceMax = $("#search-priceMax").val();
if(priceMax != ''){
option.priceMax = priceMax;
}
$('#data-datagrid').datagrid('reload',option);
});
function add0(m){return m<10?'0'+m:m }
function format(shijianchuo){
//shijianchuo是整数否则要parseInt转换
var time = new Date(shijianchuo);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
}
var productCategoryList = ${productCategoryList};
/**
* 载入数据
*/
$('#data-datagrid').datagrid({
url:'list',
rownumbers:true,
singleSelect:true,
pageSize:20,
pagination:true,
multiSort:true,
fitColumns:true,
idField:'id',
treeField:'name',
nowrap:false,
fit:true,
columns:[[
{ field:'chk',checkbox:true},
{ field:'imageUrl',title:'商品主图',width:80,formatter:function(value,index,row){
return '<img src = '+value+' width="80px">';
}},
{ field:'name',title:'商品标题',width:180,sortable:true},
{ field:'productCategoryId',title:'所属分类',width:100,formatter:function(value,index,row){
for(var i=0;i<productCategoryList.length;i++){
if(value == productCategoryList[i].id)return productCategoryList[i].name;
}
return value;
}},
{ field:'price',title:'商品价格',width:80},
{ field:'stock',title:'商品库存',width:100},
{ field:'sellNum',title:'商品销量',width:100},
{ field:'viewNum',title:'商品浏览量',width:100},
{ field:'commentNum',title:'商品评论数',width:100},
{ field:'createTime',title:'商品添加时间',width:150,formatter:function(value,index,row){
return format(value);
}}
]]
});
</script>
Loading…
Cancel
Save