审计记录

WebContent/WEB-INF/jsp/pc/goods/goodsEdit.jsp 6.2 KB
zxt@theyeasy.com committed
1 2 3 4 5
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

6 7 8 9 10 11 12 13
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>商品编辑</title>
		<link rel="stylesheet" href="/zzhnc/res/plugins/layui/css/layui.css">
		<link rel="stylesheet" href="/zzhnc/res/css/basic.css">
		<style type="text/css">
沈姿.前端(已离职) committed
14 15 16
			.red {
				color: red;
				margin-right: 5px;
17
			}
18 19
			
			.layui-form-label {
沈姿.前端(已离职) committed
20 21
				width: 100px;
			}
22 23
			
			#container {
沈姿.前端(已离职) committed
24 25
				margin-left: 20px;
			}
26 27 28 29
			.bannerUrl{
				width: 200px;
				height: 200px;
			}
30
		</style>
沈姿.前端(已离职) committed
31

32
		<body class="wrap">
沈姿.前端(已离职) committed
33 34 35
			<form class="layui-form">
				<div class="layui-form-item">
					<label class="layui-form-label"><i class="red">*</i>商品主标题</label>
36 37
					<div class="layui-input-inline" style="width: 400px;">
						<input type="text" name="name" lay-verify="title" placeholder="商品主标题" class="layui-input">
38
					</div>
沈姿.前端(已离职) committed
39 40 41 42
					<div class="layui-form-mid layui-word-aux">不超过20个汉字</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label"><i class="red">*</i>商品副标题</label>
43 44
					<div class="layui-input-inline" style="width: 400px;">
						<input type="text" name="description" lay-verify="description" placeholder="商品副标题" class="layui-input">
45
					</div>
沈姿.前端(已离职) committed
46 47 48
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label"><i class="red">*</i>商品主图</label>
49 50 51
					<div class="layui-input-block">
						<img class="bannerUrl" />
						<button type="button" class="layui-btn" id="upload">上传商品主图</button>
52
					</div>
沈姿.前端(已离职) committed
53 54
				</div>
				<div class="layui-form-item">
沈姿.前端(已离职) committed
55 56
					<label class="layui-form-label"><i class="red">*</i>商品原价</label>
					<div class="layui-input-inline" style="width: 100px;">
57
						<input type="number" name="primePrice" lay-verify="primePrice" placeholder="商品原价" class="layui-input">
沈姿.前端(已离职) committed
58 59 60 61
					</div>
					<div class="layui-form-mid"></div>
					<label class="layui-form-label"><i class="red">*</i>商品现价</label>
					<div class="layui-input-inline" style="width: 100px;">
62
						<input type="number" name="price" lay-verify="price" placeholder="商品现价" class="layui-input">
沈姿.前端(已离职) committed
63 64 65
					</div>
					<div class="layui-form-mid"></div>
				</div>
66

沈姿.前端(已离职) committed
67 68
				<div class="layui-form-item">
					<label class="layui-form-label"><i class="red">*</i>商家名称</label>
69 70
					<div class="layui-input-inline" style="width: 400px;">
						<input type="text" name="sellerName" lay-verify="sellerName" placeholder="商家名称" class="layui-input">
沈姿.前端(已离职) committed
71 72 73 74
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label"><i class="red">*</i>商家店铺号</label>
75 76
					<div class="layui-input-inline" style="width: 400px;">
						<input type="text" name="sellerAddress" lay-verify="sellerAddress" placeholder="商家店铺号" class="layui-input">
77
					</div>
沈姿.前端(已离职) committed
78 79
				</div>
				<div class="layui-form-item">
沈姿.前端(已离职) committed
80 81
					<label class="layui-form-label"><i class="red">*</i>商家电话</label>
					<div class="layui-input-inline" style="width: 390px;">
82
						<input type="text" name="phone" lay-verify="phone" placeholder="商家电话" class="layui-input">
沈姿.前端(已离职) committed
83 84 85
					</div>
				</div>
				<div class="layui-form-item">
沈姿.前端(已离职) committed
86 87 88 89 90 91
					<label class="layui-form-label"><i class="red">*</i>详细信息</label>
					<div class="layui-input-block">
						<!-- 加载编辑器的容器 -->
						<script id="container" name="content" type="text/plain">
							这里写你的初始化内容
						</script>
zxt@theyeasy.com committed
92

93
					</div>
沈姿.前端(已离职) committed
94
				</div>
zxt@theyeasy.com committed
95

沈姿.前端(已离职) committed
96 97 98 99 100
				<div class="layui-form-item" style="margin-top: 30px;">
					<button class="layui-btn" lay-submit lay-filter="submit">提交</button>
					<button class="layui-btn layui-btn-primary resetBtn">重置</button>
				</div>
			</form>
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
		</body>
		<script src='/zzhnc/res/js/jquery.min.js'></script>
		<script src="/zzhnc/res/plugins/layui/layui.js" charset="utf-8"></script>
		<script type="text/javascript" src="/zzhnc/res/js/me.js"></script>
		<script>
			window.onload = function() {
				UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
				UE.Editor.prototype.getActionUrl = function(action) {
					if(action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
						return '/zzhnc/upload/NewUploadImg';
					} else {
						return this._bkGetActionUrl.call(this, action);
					}
				}
				window.UEDITOR_CONFIG.initialFrameWidth = 900;
				window.UEDITOR_CONFIG.initialFrameHeight = 600;
				var ue = UE.getEditor('container', {
					autoHeight: false
				});
			}
zxt@theyeasy.com committed
121

122
			layui.use(['form', 'element', 'layer', 'upload'], function() {
沈姿.前端(已离职) committed
123 124
				var form = layui.form,
					element = layui.element,
125 126
					layer = layui.layer,
					upload = layui.upload;
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
					
				var goodsid = getUrl_G("id");

				function initData() {
					$.get("/zzhnc/goods/search", {id: goodsid}, function(data) {
						console.log(data)
						if(data.code == 0){
							if(data.data.rows.length > 0){
								var data = data.data.rows[0];
								$("[name=name]").val(data.name);
								$("[name=description]").val(data.description);
								$(".bannerUrl").attr("src", data.bannerUrl);
								$("[name=primePrice]").val(data.primePrice);
								$("[name=price]").val(data.price);
								$("[name=sellerName]").val(data.sellerName);
								$("[name=sellerAddress]").val(data.sellerAddress);
								$("[name=phone]").val(data.updateTime);
								
								UE.getEditor("container").ready(function() {
									UE.getEditor("container").setContent(unescape(data.description));
								})
							}
						}
						
					})
				}

				//初始化数据
				initData();
zxt@theyeasy.com committed
156

157
				//普通图片上传
沈姿.前端(已离职) committed
158
				upload.render({
159 160 161 162 163 164 165 166
					elem: '#upload',
					url: '/zzhnc/upload/UploadImg',
					done: function(data) {
						console.log(data)
						if(data.code == 0) {
							imgurl = data.data;
							$("input[name=imgurl]").val(imgurl);
							$(".mainpictrue").attr("src", imgurl);
zxt@theyeasy.com committed
167

沈姿.前端(已离职) committed
168 169
						} else {
							layer.msg('上传失败');
170 171 172
						}
					}
				});
zxt@theyeasy.com committed
173

174 175
			})
		</script>
176 177 178
		
		<script type="text/javascript" src="/zzhnc/res/UE/ueditor.config.js"></script>
		<script type="text/javascript" src="/zzhnc/res/UE/ueditor.all.js"></script>
zxt@theyeasy.com committed
179 180

</html>