|
|
<!DOCTYPE html>
|
|
|
<div id="tt" class="easyui-layout" fit="true" style="overflow-y: scroll">
|
|
|
|
|
|
<input id="editBrandId" type="text">
|
|
|
<input id="editSeriesId" type="text">
|
|
|
<input id="editProductName" type="text"/>
|
|
|
<input id="editSaleTime" type="text"/>
|
|
|
<input id="editGender" type="text"/>
|
|
|
<input id="editMaxSortId" type="text"/>
|
|
|
<input id="editMidSortId" type="text"/>
|
|
|
<input id="editProductCode" type="text"/>
|
|
|
<input id="editMinPrice" type="text"/>
|
|
|
<input id="editMaxPrice" type="text"/>
|
|
|
<input id="editColorId" type="text"/>
|
|
|
<input id="editColorName" type="text"/>
|
|
|
<input id="editGoodsName" type="text"/>
|
|
|
<input id="editSizeIdList" type="text"/>
|
|
|
<input id="editImageUrlList" type="text"/>
|
|
|
<input id="editKeyWords" type="text"/>
|
|
|
<input id="editGoodsId" type="hidden"/>
|
|
|
<input id="editId" type="hidden"/>
|
|
|
</div>
|
|
|
<script>
|
|
|
/* 新增,修改公用页面
|
|
|
editImage代表图片是否修改过,新增固定传1。修改的时候根据是否修改,修改传1,无修改传0
|
|
|
1.新增,所有参数之前为空值,
|
|
|
提交地址:product/addOrUpdate
|
|
|
提交参数:{"brandId":78,"colorId":1,"colorName":"红色","editImage":1,"gender":3,"goodsName":"自定义红色","imageUrlList":["https://img10.static.yhbimg.com/goodsimg/2018/08/25/16/01e99496407347514356e5fe327d1f661d.jpg","https://img12.static.yhbimg.com/goodsimg/2018/08/25/16/0292fcebd071444401e6de340bcf2d8c19.jpg"],"keyWords":"球鞋,adidas","maxPrice":"899","maxSortId":10,"midSortId":18,"minPrice":"599","productCode":"009-009-009","productName":"测试商品009","saleTime":"2018-11-11","seriesId":8,"sizeIdList":[28,29]}
|
|
|
2.修改:首先根据传进来的id,获取商品信息把页面控件填写好。hidden记录id、goodsId、等参数
|
|
|
提交参数:{"brandId":78,"colorId":2,"colorName":"蓝色","editImage":1,"gender":3,"goodsId":6,"goodsName":"自定义蓝色","id":10000004,"imageUrlList":["https://img10.static.yhbimg.com/goodsimg/2018/08/25/16/01e99496407347514356e5fe327d1f661d.jpg","https://img12.static.yhbimg.com/goodsimg/2018/08/25/16/0292fcebd071444401e6de340bcf2d8c19.jpg"],"keyWords":"球鞋,adidas2","maxPrice":"898","maxSortId":10,"midSortId":18,"minPrice":"598","productCode":"009-009-009-e","productName":"测试商品009-e","saleTime":"2018-11-12","seriesId":8}
|
|
|
不可修改:品牌、分类、颜色、尺码、SKU(颜色展示名称除外:goodsName)
|
|
|
*/
|
|
|
|
|
|
$(function () {
|
|
|
$("#editBrandId").myCombobox({
|
|
|
url: contextPath + '/brand/getBrandName',
|
|
|
method: "get",
|
|
|
editable: false,
|
|
|
prompt: "选择品牌",
|
|
|
width: 200,
|
|
|
valueField: "id",
|
|
|
textField: "text",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
}
|
|
|
});
|
|
|
$("#editSeriesId").myCombobox({
|
|
|
url: contextPath + '/brandSeries/querySeriesByBrandId?brandId=',
|
|
|
method: "get",
|
|
|
editable: false,
|
|
|
prompt: "选择品牌",
|
|
|
width: 200,
|
|
|
valueField: "id",
|
|
|
textField: "text",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
}
|
|
|
});
|
|
|
$("#editProductName").textbox({
|
|
|
required: true,
|
|
|
missingMessage: "商品名称不能为空",
|
|
|
prompt: "商品名称"
|
|
|
//width: 240
|
|
|
});
|
|
|
$("#editSaleTime").myDatebox({
|
|
|
prompt : "发售时间"
|
|
|
});
|
|
|
$("#editGender").textbox({
|
|
|
prompt : "性别"
|
|
|
});
|
|
|
$('#editMaxSortId').myCombobox({
|
|
|
url: contextPath + "/productSort/getLevel1SortIdAndName",
|
|
|
method: "get",
|
|
|
editable: false,
|
|
|
valueField: 'id',
|
|
|
textField: 'text',
|
|
|
prompt:"一级分类",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
},
|
|
|
onSelect: function (rec) {
|
|
|
if (0 === rec.id) {
|
|
|
try {
|
|
|
$('#midSortId').combobox('disable');
|
|
|
} catch (e) { }
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
$('#editMidSortId').combobox('clear');
|
|
|
$('#editMidSortId').combobox('reload', contextPath + "/productSort/getLevel2SortBySortId?sortId=" + rec.id);
|
|
|
$('#editMidSortId').combobox('enable');
|
|
|
} catch (e) { }
|
|
|
}
|
|
|
});
|
|
|
$('#editMidSortId').myCombobox({
|
|
|
method: "get",
|
|
|
editable: false,
|
|
|
valueField: 'id',
|
|
|
textField: 'text',
|
|
|
multiple: true,
|
|
|
prompt:"二级分类",
|
|
|
loadFilter: function (data) {
|
|
|
data = defaultLoadFilter(data);
|
|
|
/* for (var i = 0; i < data.length; i ++) {
|
|
|
$('#editMidSortId').combobox('select', data[i].id);
|
|
|
} */
|
|
|
return data;
|
|
|
}
|
|
|
});
|
|
|
$("#editProductCode").textbox({
|
|
|
prompt : "请输入"
|
|
|
});
|
|
|
$("#editMinPrice").textbox({
|
|
|
prompt : "最低价"
|
|
|
});
|
|
|
$("#editMaxPrice").textbox({
|
|
|
prompt : "最高价"
|
|
|
});
|
|
|
//<input id="editColorId" type="text"/>
|
|
|
//<input id="editSizeIdList" type="text"/>
|
|
|
//<input id="editImageUrlList" type="text"/>
|
|
|
//<input id="editKeyWords" type="text"/>
|
|
|
$("#editKeyWords").textbox({
|
|
|
prompt : "请输入"
|
|
|
});
|
|
|
//<input id="goodsId" type="hidden"/>
|
|
|
|
|
|
// 编辑的情况需要根据id查询商品信息
|
|
|
$.ajax({
|
|
|
contentType: "application/json",
|
|
|
dataType: "json",
|
|
|
type: "GET",
|
|
|
url: contextPath + '/product/find?id=10000004',
|
|
|
success: function (data) {
|
|
|
if (data.code != 200) {
|
|
|
return;
|
|
|
}
|
|
|
// 设置页面上面所有属性值和hidden属性
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
</script> |
|
|
\ No newline at end of file |
...
|
...
|
|