|
@@ -14,13 +14,20 @@
|
|
|
</fieldset>
|
|
|
<form style="margin-left: 50px;" class="layui-form" action="">
|
|
|
<div class="layui-form-item" style=" padding-top: 20px;">
|
|
|
- <div class="layui-inline">
|
|
|
+ <!--<div class="layui-inline">
|
|
|
<label class="layui-form-label">商品分类:</label>
|
|
|
<div class="layui-input-block">
|
|
|
<input type="hidden" class="layui-input" id="categoryId" name="categoryId">
|
|
|
<input type="text" class="layui-input" id="category" name="category" placeholder="请选择商品类别">
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>-->
|
|
|
+
|
|
|
+ <div class="layui-inline">
|
|
|
+ <label class="layui-form-label">*商品分类:</label>
|
|
|
+ <div class="layui-input-inline" id ="categoryId" >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="layui-inline">
|
|
|
<label class="layui-form-label">商品名称:</label>
|
|
|
<div class="layui-input-block" >
|
|
@@ -54,91 +61,87 @@
|
|
|
</div>
|
|
|
</script>
|
|
|
<script>
|
|
|
- var form;
|
|
|
- var categoryIdOld = '';
|
|
|
- var categorySpData = '';
|
|
|
- var imgUrl = ''; // 封面图片
|
|
|
- var imgUrl2 = ''; // 商品图片
|
|
|
- var describeUrl = ''; // 商品描述
|
|
|
- var imgUrl4 = '';//商品主图
|
|
|
- var resData = layui.sessionData("ROW_DATA").NOW_ROW;
|
|
|
- var load;
|
|
|
- layui.use(['form', 'layedit', 'laydate'], function() {
|
|
|
- form = layui.form,
|
|
|
- layer = layui.layer,
|
|
|
- layedit = layui.layedit,
|
|
|
- laydate = layui.laydate;
|
|
|
- var tableSelect = layui.tableSelect;
|
|
|
- tableSelect.render({
|
|
|
- elem: '#category', //定义输入框input对象
|
|
|
- checkedKey: 'id', //表格的唯一建值,非常重要,影响到选中状态 必填
|
|
|
- searchKey: 'keyword', //搜索输入框的name值 默认keyword
|
|
|
- searchPlaceholder: '关键词搜索', //搜索输入框的提示文字 默认关键词搜索
|
|
|
- table: { //定义表格参数,与LAYUI的TABLE模块一致,只是无需再定义表格elem
|
|
|
- url:'CategoryManageAction/queryCategoryForProduct'
|
|
|
- ,method: 'get'
|
|
|
- ,cols: [[
|
|
|
- {field: 'id', title: 'ID',width:40},
|
|
|
- {field: 'name', title: '分类',width:200,templet:'#switchImg'}
|
|
|
- ]]
|
|
|
- ,done: function(res, curr, count){
|
|
|
- $("[data-field='id']").css('display','none');
|
|
|
- }
|
|
|
+ layui.use('form', function(){
|
|
|
+ var rowData = layui.sessionData("ROW_DATA").NOW_ROW;
|
|
|
+ var fmPic;
|
|
|
+ var name;
|
|
|
+ layui.each(rowData, function(index, item){
|
|
|
+ $("#"+index+"").val(item);
|
|
|
+ if(index == "fmPic"){
|
|
|
+ fmPic = item;
|
|
|
+ $('#licence').append('<img width="100px" style="margin:10px;" height="100px" src="'+ item +'" class="layui-upload-img">')
|
|
|
}
|
|
|
- /* ,done: function (elem, data) {
|
|
|
- //选择完后的回调,包含2个返回值 elem:返回之前input对象;data:表格返回的选中的数据 []
|
|
|
- //拿到data[]后 就按照业务需求做想做的事情啦~比如加个隐藏域放ID...
|
|
|
- var NEWJSON = []
|
|
|
- layui.each(data.data, function (index, item) {
|
|
|
- NEWJSON.push(item.demo)
|
|
|
- });
|
|
|
- elem.val(NEWJSON.join(","));
|
|
|
- } */
|
|
|
});
|
|
|
- form.render();
|
|
|
- layui.each(resData, function(index, item){
|
|
|
- if(index=="fmPic"){
|
|
|
- imgUrl = item;
|
|
|
- if(!isEmpty(imgUrl)){
|
|
|
- $('#licence').append('<img width="100px" onclick="isDelete(this,1)" style="margin:10px;" height="100px" src="'+item+'" class="layui-upload-img">')
|
|
|
- }
|
|
|
- }else if(index=="discribe"){
|
|
|
- /* describeUrl = item;
|
|
|
- var arrays = new Array();
|
|
|
- arrays = item.split(',');
|
|
|
- for(var i = 0 ; i< arrays.length ; i++){
|
|
|
- if(arrays[i].length > 0){
|
|
|
- $('#describeUrl').append('<img width="100px" onclick="isDelete(this,3)" style="margin:10px;" height="100px" src="'+ arrays[i] +'" class="layui-upload-img">')
|
|
|
- }
|
|
|
- } */
|
|
|
- }else if(index=="masterMap"){
|
|
|
- /* imgUrl4 = item;
|
|
|
- if(!isEmpty(imgUrl4)){
|
|
|
- $('#masterMap').append('<img width="100px" onclick="isDelete(this,4)" style="margin:10px;" height="100px" src="'+item+'" class="layui-upload-img">')
|
|
|
- } */
|
|
|
- }else if(index=="picList"){
|
|
|
- /* imgUrl2 = item;
|
|
|
- var arrays = new Array();
|
|
|
- arrays = imgUrl2.split(',');
|
|
|
- for(var i = 0 ; i< arrays.length ; i++){
|
|
|
- if(arrays[i].length > 0){
|
|
|
- $('#imgList').append('<img width="100px" onclick="isDelete(this,2)" style="margin:10px;" height="100px" src="'+ arrays[i] +'" class="layui-upload-img">')
|
|
|
- }
|
|
|
- }
|
|
|
- indexs(); */
|
|
|
- }else if ("categoryId" == index) {
|
|
|
- $("#categoryId").val(item);
|
|
|
- categoryIdOld = item;
|
|
|
- }else if ("categoryName" == index) {
|
|
|
- $("#category").val(item);
|
|
|
- }else if("id" == index){
|
|
|
- $("#editid").val(item);
|
|
|
- }else if("name" == index){
|
|
|
- $("#name").val(item);
|
|
|
+ layui.each(rowData, function(index, item){
|
|
|
+ if(index=="name"){
|
|
|
+ name = item;
|
|
|
}
|
|
|
- form.render();
|
|
|
- });
|
|
|
- form.verify({
|
|
|
+ if(index=="categoryId"){
|
|
|
+ layui.use('form', function(){
|
|
|
+ var form = layui.form;
|
|
|
+ //商品分类下拉
|
|
|
+ $.request({
|
|
|
+ action : 'CategoryManageAction/queryCategoryForProduct',
|
|
|
+ data : { },
|
|
|
+ success : function(data) {
|
|
|
+ var selectName ="categoryId";
|
|
|
+ var html = '<select lay-verify="categoryId" name="';
|
|
|
+ html = html + selectName;
|
|
|
+ html = html + '" lay-filter="categoryId';
|
|
|
+ html = html + '"';
|
|
|
+ html = html + '><option value="">请选择商品分类</option>';
|
|
|
+ $.each(data.data, function(i, j) {
|
|
|
+ if( j.id == item){
|
|
|
+ html = html + '<option ';
|
|
|
+ html = html + 'selected value="';
|
|
|
+ html = html + j.id + '">';
|
|
|
+ html = html + j.name+ '</option>';
|
|
|
+ }else{
|
|
|
+ html = html + '<option ';
|
|
|
+ html = html + 'value="';
|
|
|
+ html = html + j.id + '">';
|
|
|
+ html = html + j.name+ '</option>';
|
|
|
+ }
|
|
|
+ })
|
|
|
+ html = html + '</select>';
|
|
|
+ $("#categoryId").html(html);
|
|
|
+ form.render();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (rowData.aciId==null){
|
|
|
+ layui.use('form', function(){
|
|
|
+ var form = layui.form;
|
|
|
+ //商品分类下拉
|
|
|
+ $.request({
|
|
|
+ action : 'CategoryManageAction/queryCategoryInf',
|
|
|
+ data : { },
|
|
|
+ success : function(data) {
|
|
|
+ var selectName ="aciId";
|
|
|
+ var html = '<select lay-verify="aciId" name="';
|
|
|
+ html = html + selectName;
|
|
|
+ html = html + '" lay-filter="aciId';
|
|
|
+ html = html + '"';
|
|
|
+ html = html + '><option value="">请选择商品分类</option>';
|
|
|
+ $.each(data.data, function(i, j) {
|
|
|
+ html = html + '<option ';
|
|
|
+ html = html + 'value="';
|
|
|
+ html = html + j.id + '">';
|
|
|
+ html = html + j.name+ '</option>';
|
|
|
+ })
|
|
|
+ html = html + '</select>';
|
|
|
+ $("#aciId").html(html);
|
|
|
+ form.render();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#"+index+"").val(item);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ form.verify({
|
|
|
name : function(value, item){
|
|
|
if (isEmpty(value)) {
|
|
|
return '请输入商品名称';
|