Authored by weiqingting

Merge branch 'release/1.6' of http://git.dev.yoho.cn/platform/yohobuy-portal-fe into release/1.6

# Conflicts:
#	server/config/common.js
@@ -272,7 +272,7 @@ common.edit.ajaxfileupload(".fenmianfile", { @@ -272,7 +272,7 @@ common.edit.ajaxfileupload(".fenmianfile", {
272 item.push(data); 272 item.push(data);
273 goodsList[$(this).data("index")].goodsImagesList = item; 273 goodsList[$(this).data("index")].goodsImagesList = item;
274 $(this).parents(".cover-image-item").before(common.util.__template2($("#fenmianImgTemp").html(), data)); 274 $(this).parents(".cover-image-item").before(common.util.__template2($("#fenmianImgTemp").html(), data));
275 - $('#cover-color').append($($('#colorCoverTemp').html())); 275 + $(this).parents(".form-group").next().find('.cover-color').append($($('#colorCoverTemp').html()));
276 } else { 276 } else {
277 common.util.__tip(response.message); 277 common.util.__tip(response.message);
278 } 278 }
@@ -50,7 +50,7 @@ var $ = require('jquery'), @@ -50,7 +50,7 @@ var $ = require('jquery'),
50 50
51 var Bll = { 51 var Bll = {
52 toast:function(url, item, hint) { 52 toast:function(url, item, hint) {
53 - var e = new common.edit("#baseform"); 53 + var e = new common.edit("#baseform", {bucket: "yhb-img01"});
54 54
55 common.dialog.confirm(hint, 55 common.dialog.confirm(hint,
56 common.util.__template($("#template").html(), item), 56 common.util.__template($("#template").html(), item),
@@ -50,6 +50,7 @@ var tableGird = new common.grid({ @@ -50,6 +50,7 @@ var tableGird = new common.grid({
50 ] 50 ]
51 }); 51 });
52 52
  53 +// 弹框里面添加属性值控件
53 var propValueGrid = new common.grid({ 54 var propValueGrid = new common.grid({
54 55
55 el: "#prop-value-table", 56 el: "#prop-value-table",
@@ -58,18 +59,18 @@ var propValueGrid = new common.grid({ @@ -58,18 +59,18 @@ var propValueGrid = new common.grid({
58 render: function (items) { 59 render: function (items) {
59 60
60 //items.id=items.__index+1; 61 //items.id=items.__index+1;
61 - return('<input id="id" class="form-control width110" value="'+items.id+'" type="text">'); 62 + return('<input id="id" disabled="true" class="form-control width110 propValueID" value="'+items.id+'" required="required" data-index="'+items.__index+'" type="text">');
62 } 63 }
63 }, 64 },
64 {display: "属性值", name: "name", 65 {display: "属性值", name: "name",
65 render: function (items) { 66 render: function (items) {
66 - return('<input id="name" class="form-control width110 propValue" value="'+items.name+'" data-index="'+items.__index+'" type="text" placeholder="属性值">'); 67 + return('<input id="name" class="form-control width110 propValue" value="'+items.name+'" data-index="'+items.__index+'" required="required" type="text" placeholder="属性值">');
67 } 68 }
68 69
69 }, 70 },
70 { 71 {
71 display: "操作", 72 display: "操作",
72 - name: "categoryId", 73 + name: "",
73 render: function (items) { 74 render: function (items) {
74 75
75 var html = []; 76 var html = [];
@@ -86,21 +87,34 @@ var propValueGrid = new common.grid({ @@ -86,21 +87,34 @@ var propValueGrid = new common.grid({
86 87
87 88
88 89
  90 +$(document).on("change",".propValueID",function(){
  91 + var item=propValueGrid.__rows[$(this).data("index")];
  92 +
  93 + if (item) {
  94 + item.id = $(this).val();
  95 + }
  96 +
  97 +});
  98 +
89 $(document).on("change",".propValue",function(){ 99 $(document).on("change",".propValue",function(){
90 var item=propValueGrid.__rows[$(this).data("index")]; 100 var item=propValueGrid.__rows[$(this).data("index")];
91 - item.name = $(this).val(); 101 +
  102 + if (item) {
  103 + item.name = $(this).val();
  104 + }
  105 +
92 }); 106 });
93 107
94 //增加属性值 108 //增加属性值
95 $(document).on('click', '.prop-add-btn', function () { 109 $(document).on('click', '.prop-add-btn', function () {
96 - propValueGrid.__rows.push({name:"",id:propValueGrid.__rows.length}); 110 + propValueGrid.__rows.push({name:"",id:parseInt(propValueGrid.__rows[propValueGrid.__rows.length-1].id) + 1});
97 propValueGrid.reload(); 111 propValueGrid.reload();
98 }); 112 });
99 113
100 //删除属性值 114 //删除属性值
101 $(document).on('click', '.prop-del-btn', function () { 115 $(document).on('click', '.prop-del-btn', function () {
102 116
103 - var item = tableGird.rows[$(this).data('index')]; 117 + var item = propValueGrid.__rows[$(this).data('index')];
104 propValueGrid.__rows.splice($(this).data('index'),1); 118 propValueGrid.__rows.splice($(this).data('index'),1);
105 propValueGrid.reload(); 119 propValueGrid.reload();
106 }); 120 });
@@ -121,6 +135,7 @@ $(document).on('click', '.edit-class-btn', function () { @@ -121,6 +135,7 @@ $(document).on('click', '.edit-class-btn', function () {
121 }); 135 });
122 136
123 $(document).on('change', '#inputType', function () { 137 $(document).on('change', '#inputType', function () {
  138 + $('#attributeValues').val('默认属性值');
124 showORHidePropValue(); 139 showORHidePropValue();
125 }); 140 });
126 141
@@ -132,7 +147,7 @@ function attributeOp(prefix, url, item) { @@ -132,7 +147,7 @@ function attributeOp(prefix, url, item) {
132 if(item.attributeValues) { 147 if(item.attributeValues) {
133 propValueGrid.__rows = JSON.parse(item.attributeValues); 148 propValueGrid.__rows = JSON.parse(item.attributeValues);
134 } else { 149 } else {
135 - propValueGrid.__rows=[{ 'name':""}]; 150 + propValueGrid.__rows=[{ 'name':"", 'id':"1"}];
136 } 151 }
137 152
138 common.dialog.confirm(prefix + "属性", common.util.__template($("#template").html(), item), function () { 153 common.dialog.confirm(prefix + "属性", common.util.__template($("#template").html(), item), function () {
@@ -140,6 +155,11 @@ function attributeOp(prefix, url, item) { @@ -140,6 +155,11 @@ function attributeOp(prefix, url, item) {
140 option.data.categoryId = item.categoryId; 155 option.data.categoryId = item.categoryId;
141 option.data.attributeId = item.attributeId; 156 option.data.attributeId = item.attributeId;
142 157
  158 + // 检查所有属性值是否为空
  159 + //if (!checkPropName()) {
  160 + // alert()
  161 + //}
  162 +
143 163
144 var inputType = $('#inputType').val(); 164 var inputType = $('#inputType').val();
145 165
@@ -157,7 +177,7 @@ function attributeOp(prefix, url, item) { @@ -157,7 +177,7 @@ function attributeOp(prefix, url, item) {
157 177
158 } 178 }
159 179
160 - //console.log(propVlaueArr); 180 + console.log(propVlaueArr);
161 //option.debug = true; 181 //option.debug = true;
162 182
163 propValueGrid.__rows = []; 183 propValueGrid.__rows = [];
@@ -186,6 +206,9 @@ function attributeOp(prefix, url, item) { @@ -186,6 +206,9 @@ function attributeOp(prefix, url, item) {
186 // 属性值列表的初始化 206 // 属性值列表的初始化
187 207
188 208
  209 + sortPropValuesArray();
  210 + console.log(propValueGrid.__rows);
  211 +
189 propValueGrid.init(propValueGrid.__rows); 212 propValueGrid.init(propValueGrid.__rows);
190 showORHidePropValue(); 213 showORHidePropValue();
191 } 214 }
@@ -203,4 +226,20 @@ function showORHidePropValue () { @@ -203,4 +226,20 @@ function showORHidePropValue () {
203 } 226 }
204 } 227 }
205 228
  229 +// 给属性值数组按照id排序
  230 +function sortPropValuesArray() {
  231 +
  232 + propValueGrid.__rows.sort(function (a, b) {
  233 + return a.id - b.id
  234 + });
  235 +}
  236 +
  237 +function checkPropName() {
  238 + propValueGrid.__rows.forEach(function (item) {
  239 + if (!item.name) return false;
  240 + });
  241 +
  242 + return true;
  243 +}
  244 +
206 245
@@ -18,7 +18,8 @@ var config = { @@ -18,7 +18,8 @@ var config = {
18 // domain: 'http://172.16.6.252:9080',//陈超 18 // domain: 'http://172.16.6.252:9080',//陈超
19 //domain:'http://172.16.6.227:8088/platform',//玛丽 19 //domain:'http://172.16.6.227:8088/platform',//玛丽
20 // domain: 'http://192.168.102.202:8088/platform', 20 // domain: 'http://192.168.102.202:8088/platform',
21 - domain:'http://172.16.9.8:8080/yohobuy-platform-web', 21 + domain:'http://172.16.9.8:8080/yohobuy-platform-web',//葛超
  22 + // domain: 'http://192.168.102.202:8088/platform',
22 loggers: { 23 loggers: {
23 api: { 24 api: {
24 level: 'verbose', 25 level: 'verbose',
@@ -20,73 +20,75 @@ @@ -20,73 +20,75 @@
20 </div> 20 </div>
21 21
22 <div class="panel panel-default" style="margin-bottom:10px;"> 22 <div class="panel panel-default" style="margin-bottom:10px;">
23 - <div class="panel-heading">  
24 - <a class="btn btn-success " id="add-subject"><i class="fa fa-plus"></i> 添加专题</a>  
25 - </div>  
26 - <div class="panel-body">  
27 - <div class="row">  
28 - <div class="panel-col">  
29 - <select name="sort" id="subject-type" tabindex="-1" title="" class="select2-offscreen brandBtn-group">  
30 - <option value="" selected="">类型</option>  
31 - <option value="1">奥莱</option>  
32 - <option value="2">SALE</option>  
33 - </select>  
34 - </div>  
35 - <div class="panel-col">  
36 - <select name="paltform" id="subject-paltform" tabindex="-1" title="" class="select2-offscreen brandBtn-group">  
37 - <option value="" selected="">平台</option>  
38 - <option value="1">WEB</option>  
39 - <option value="2">APP</option>  
40 - <option value="3">WAP</option>  
41 - <option value="4">IPAD</option>  
42 - </select>  
43 - </div>  
44 - <div class="panel-col">  
45 - <select name="status" id="subject-status" tabindex="-1" title="" class="select2-offscreen brandBtn-group">  
46 - <option value="" selected="">状态</option>  
47 - <option value="1">未定时</option>  
48 - <option value="2">未发布</option>  
49 - <option value="3">已发布</option>  
50 - <option value="4">已结束</option>  
51 - </select>  
52 - </div>  
53 - <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>  
54 - <a id="filter-all" href="/runManage/subjectManage/index" class="btn btn-info">全部</a> 23 + <div class="panel-heading">
  24 + <a class="btn btn-success " id="add-subject"><i class="fa fa-plus"></i> 添加专题</a>
  25 + </div>
  26 + <div class="panel-body">
  27 + <div class="row">
  28 + <div class="panel-col">
  29 + <select name="sort" id="subject-type" tabindex="-1" title="" class="select2-offscreen brandBtn-group">
  30 + <option value="" selected="">类型</option>
  31 + <option value="1">奥莱</option>
  32 + <option value="2">SALE</option>
  33 + </select>
55 </div> 34 </div>
  35 + <div class="panel-col">
  36 + <select name="paltform" id="subject-paltform" tabindex="-1" title=""
  37 + class="select2-offscreen brandBtn-group">
  38 + <option value="" selected="">平台</option>
  39 + <option value="1">WEB</option>
  40 + <option value="2">APP</option>
  41 + <option value="3">WAP</option>
  42 + <option value="4">IPAD</option>
  43 + </select>
  44 + </div>
  45 + <div class="panel-col">
  46 + <select name="status" id="subject-status" tabindex="-1" title=""
  47 + class="select2-offscreen brandBtn-group">
  48 + <option value="" selected="">状态</option>
  49 + <option value="1">未定时</option>
  50 + <option value="2">未发布</option>
  51 + <option value="3">已发布</option>
  52 + <option value="4">已结束</option>
  53 + </select>
  54 + </div>
  55 + <a id="filter-btn" href="javascript:;" class="btn btn-info">筛选</a>
  56 + <a id="filter-all" href="/runManage/subjectManage/index" class="btn btn-info">全部</a>
56 </div> 57 </div>
57 </div> 58 </div>
  59 +</div>
58 60
59 <div class="contentpanel"> 61 <div class="contentpanel">
60 - <div class="panel panel-default" style="margin-bottom: 10px">  
61 - <input type="hidden" id="url" value="/runManage/subjectManage/subjectList" />  
62 - <div id="subject-manage"></div>  
63 - </div> 62 + <div class="panel panel-default" style="margin-bottom: 10px">
  63 + <input type="hidden" id="url" value="/runManage/subjectManage/subjectList"/>
  64 + <div id="subject-manage"></div>
  65 + </div>
64 </div> 66 </div>
65 67
66 <script type="text/template" id="template2"> 68 <script type="text/template" id="template2">
67 - <input type="text" name="sort" size="1" placeholder="排序" />  
68 - <input type="button" class="btn btn-xs btn-info sortsave" id="save" value="保存" />  
69 - <input type="button" class="btn btn-xs btn-info sortcancel" id="cancel" value="取消" /> 69 + <input type="text" name="sort" size="1" placeholder="排序"/>
  70 + <input type="button" class="btn btn-xs btn-info sortsave" id="save" value="保存"/>
  71 + <input type="button" class="btn btn-xs btn-info sortcancel" id="cancel" value="取消"/>
70 </script> 72 </script>
71 73
72 <script type="text/template" id="template"> 74 <script type="text/template" id="template">
73 - <div class="rows" id="baseform">  
74 - <div class="form-group">  
75 - <label class="col-sm-2 control-label">分类<font color="#f00">*</font></label>  
76 - <input type="hidden" value="{id}" id="id" />  
77 - <div class="col-sm-10">  
78 - <input name="sort" type="radio" value="1" />奥莱  
79 - <input name="sort" type="radio" value="2" />SALE  
80 - </div>  
81 - <input type="hidden" id="sort" value="{sort}" for="radio" />  
82 - </div>  
83 - <div class="form-group">  
84 - <label class="col-sm-2 control-label" for="title">标题<font color="#f00">*</font></label>  
85 - <div class="col-sm-8">  
86 - <input type="text" value="{title}" class="form-control" id="title" required="required" />  
87 - </div>  
88 - </div>  
89 - <div class="form-group"> 75 + <div class="rows" id="baseform">
  76 + <div class="form-group">
  77 + <label class="col-sm-2 control-label">分类<font color="#f00">*</font></label>
  78 + <input type="hidden" value="{id}" id="id"/>
  79 + <div class="col-sm-10">
  80 + <input name="sort" type="radio" value="1"/>奥莱
  81 + <input name="sort" type="radio" value="2"/>SALE
  82 + </div>
  83 + <input type="hidden" id="sort" value="{sort}" for="radio"/>
  84 + </div>
  85 + <div class="form-group">
  86 + <label class="col-sm-2 control-label" for="title">标题<font color="#f00">*</font></label>
  87 + <div class="col-sm-8">
  88 + <input type="text" value="{title}" class="form-control" id="title" required="required"/>
  89 + </div>
  90 + </div>
  91 + <div class="form-group">
90 <label class="col-sm-2 control-label">平台</label> 92 <label class="col-sm-2 control-label">平台</label>
91 <div class="col-sm-8"> 93 <div class="col-sm-8">
92 <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="1">WEB</label> 94 <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="1">WEB</label>
@@ -95,62 +97,70 @@ @@ -95,62 +97,70 @@
95 <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="4">IPAD</label> 97 <label style="cursor: pointer;"><input type="checkbox" name="plateform" value="4">IPAD</label>
96 </div> 98 </div>
97 <input type="hidden" id="plateform" value="{plateform}" for="checkbox"> 99 <input type="hidden" id="plateform" value="{plateform}" for="checkbox">
98 - </div>  
99 - <div class="form-group"> 100 + </div>
  101 + <div class="form-group">
100 <label class="col-sm-2 control-label">促销形式</label> 102 <label class="col-sm-2 control-label">促销形式</label>
101 <div class="col-sm-10"> 103 <div class="col-sm-10">
102 - <input id="promotion1" name="promotionName" type="radio" value="1" />  
103 -  
104 - <input class="smalltxt" type="text" id="promotionName1" />折起&nbsp;&nbsp;  
105 - 104 + <input id="promotion1" name="promotionName" type="radio" value="1"/>
  105 +
  106 + <input class="smalltxt" type="text" id="promotionName1"/>折起&nbsp;&nbsp;
106 107
107 - <input id="promotion2" name="promotionName" type="radio" value="2" /><input class="smalltxt" type="text" id="promotionName2" />~<input class="smalltxt" type="text" id="promotionName3" />&nbsp;&nbsp;  
108 108
109 - <input id="promotion4" name="promotionName" type="radio" value="4" /><input class="smalltxt" type="text" id="promotionName4" />元起&nbsp;&nbsp; 109 + <input id="promotion2" name="promotionName" type="radio" value="2"/><input class="smalltxt" type="text"
  110 + id="promotionName2"/>~<input
  111 + class="smalltxt" type="text" id="promotionName3"/>&nbsp;&nbsp;
110 112
111 - <input id="promotion5" name="promotionName" type="radio" value="5" /><input class="smalltxt" type="text" id="promotionName5" />%Off(大图折扣)  
112 - </div>  
113 - </div>  
114 - <div class="form-group col-sm-100">  
115 - <label class="col-sm-2 control-label">活动时间</label>  
116 - <div class="panel-col1 col-sm-4">  
117 - <input type="text" id="startTime" jsaction="time:end:endTime" class="form-control panel-input hasDatepicker " name="start_time" placeholder="开始时间" value="{startTime}"> 113 + <input id="promotion4" name="promotionName" type="radio" value="4"/><input class="smalltxt" type="text"
  114 + id="promotionName4"/>元起&nbsp;&nbsp;
  115 +
  116 + <input id="promotion5" name="promotionName" type="radio" value="5"/><input class="smalltxt" type="text"
  117 + id="promotionName5"/>%Off(大图折扣)
  118 + </div>
  119 + </div>
  120 + <div class="form-group col-sm-100">
  121 + <label class="col-sm-2 control-label">活动时间</label>
  122 + <div class="panel-col1 col-sm-4">
  123 + <input type="text" id="startTime" jsaction="time:end:endTime"
  124 + class="form-control panel-input hasDatepicker " name="start_time" placeholder="开始时间"
  125 + value="{startTime}">
118 </div> 126 </div>
119 <div class="panel-col1 col-sm-4"> 127 <div class="panel-col1 col-sm-4">
120 - <input type="text" id="endTime" jsaction="time:start:startTime" class="form-control panel-input hasDatepicker" name="end_time" placeholder="结束时间" value="{endTime}"> 128 + <input type="text" id="endTime" jsaction="time:start:startTime"
  129 + class="form-control panel-input hasDatepicker" name="end_time" placeholder="结束时间"
  130 + value="{endTime}">
  131 + </div>
  132 + </div>
  133 + <div class="form-group">
  134 + <label class="col-sm-2 control-lalbel" for="orderNum">排序</label>
  135 + <div class="col-sm-8">
  136 + <input type="text" id="orderNum" value="{orderNum}" class="form-control"/>
121 </div> 137 </div>
122 - </div>  
123 - <div class="form-group">  
124 - <label class="col-sm-2 control-lalbel" for="orderNum">排序</label>  
125 - <div class="col-sm-8">  
126 - <input type="text" id="orderNum" value="{orderNum}" class="form-control" />  
127 - </div>  
128 - </div>  
129 - <div class="form-group">  
130 - <label class="col-sm-2 control-label">LOGO图片</label>  
131 - <div class="col-sm-10">  
132 - <input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}" /><!---->  
133 - </div>  
134 - </div>  
135 - <div class="form-group">  
136 - <label class="col-sm-2 control-label">封面图</label>  
137 - <div class="col-sm-10">  
138 - <input type="file" id="coverUrl" name="coverUrl" value="{coverUrl}" />  
139 - </div>  
140 - </div>  
141 - <div class="form-group">  
142 - <label class="col-sm-2 control-label">web列表页图</label>  
143 - <div class="col-sm-10">  
144 - <input type="file" id="webUrl" name="webUrl" value="{webUrl}" />  
145 - </div>  
146 - </div>  
147 - <div class="form-group">  
148 - <label class="col-sm-2 control-label" for="">添加商品<font color="#f00">*</font></label>  
149 - <div class="col-sm-10">  
150 - <select id="productPoolId" style="width: 280px;" value="{productPoolId}">  
151 - <option value="{productPoolId}">请选择商品池</option>  
152 - </select>  
153 - </div>  
154 - </div>  
155 - </div> 138 + </div>
  139 + <div class="form-group">
  140 + <label class="col-sm-2 control-label">LOGO图片</label>
  141 + <div class="col-sm-10">
  142 + <input type="file" id="logoUrl" name="logoUrl" value="{logoUrl}"/><!---->
  143 + </div>
  144 + </div>
  145 + <div class="form-group">
  146 + <label class="col-sm-2 control-label">封面图</label>
  147 + <div class="col-sm-10">
  148 + <input type="file" id="coverUrl" name="coverUrl" value="{coverUrl}"/>
  149 + </div>
  150 + </div>
  151 + <div class="form-group">
  152 + <label class="col-sm-2 control-label">web列表页图</label>
  153 + <div class="col-sm-10">
  154 + <input type="file" id="webUrl" name="webUrl" value="{webUrl}"/>
  155 + </div>
  156 + </div>
  157 + <div class="form-group">
  158 + <label class="col-sm-2 control-label" for="">添加商品<font color="#f00">*</font></label>
  159 + <div class="col-sm-10">
  160 + <select id="productPoolId" style="width: 280px;" value="{productPoolId}">
  161 + <option value="{productPoolId}">请选择商品池</option>
  162 + </select>
  163 + </div>
  164 + </div>
  165 + </div>
156 </script> 166 </script>