Authored by liuyue

商品管理 商品审核

... ... @@ -8,21 +8,8 @@ var $ = require('jquery');
var edit = require('../common/edit');
var dropDown = require('../common/dropDown');
var grid=require('../common/grid');
var baseNum = 1;
// 获取品类属性列表
function getAttrList(id, callback) {
$.ajax({
type: 'POST',
url: '/product/attr/queryProductAttributeList',
dataType: 'json',
data: {
param: id
}
}).then(function (d) {
callback(d);
});
}
// 把Y、N转换成是、否
function convertNorY(val) {
... ... @@ -33,37 +20,79 @@ function convertNorY(val) {
}
}
function createTr(id) {
getAttrList(id, function (d) {
function queryAttrList(id) {
if (data.code === 200) {
var tableGird = new grid({
var data = d.data;
var dataLen = data.length;
var i;
var trHtml = '';
el:"#attr-table",
parms:function(){
for (i = 0; i < dataLen; i++) {
return {
categoryId: id * baseNum
};
},
columns:[
{
display: "属性名称",
name: "attributeName"
}, {
display: "属性类型",
name: "attributeValues"
}, {
display: "输入类型",
name: "inputType"
}, {
display: "是否必选",
name:"isMust",
render:function(item){
return convertNorY(item.isMust);
}
}, {
display: "是否可搜索",
name: "isSearch",
render: function(item){
return convertNorY(item.isSearch);
}
}, {
display:"操作",
name:"categoryId",
render:function(items){
trHtml +=
'<tr>' +
'<td>' + data[i].a + '</td>' +
'<td>' + data[i].attributeType + '</td>' +
'<td>' + data[i].inputType + '</td>' +
'<td>' + convertNorY(data[i].isMust) + '</td>' +
'<td>' + convertNorY(data[i].isSearch) + '</td>' +
'<td><a class="btn btn-success btn-xs edit-class-btn">编辑</a></td>' +
'</tr>'
return ('<button attribute-id="' + items.attributeId + '" class="btn btn-success btn-xs edit-class-btn">编辑</button>');
}
}
}
]
});
tableGird.init('/product/attr/queryProductAttributeList');
}
var $attributeName = $('#attributeName');
var $saleType = $('#saleType');
var $inputType = $('#inputType');
var $isMust = $('#isMust');
var $isSearch = $('#isSearch');
var $maxValueLen = $('#maxValueLen');
var $isAllowAlias = $('#isAllowAlias');
var $orderBy = $('#orderBy');
var $attributeValues = $('#attributeValues');
var $displayPosition = $('#displayPosition');
var $remark = $('#remark');
var $attributeId = $('#attributeId');
function removeAttr() {
$attributeName.val('');
$saleType.val('');
$inputType.val('');
$isMust.val('');
$isSearch.val('');
$maxValueLen.val('');
$isAllowAlias.val('');
$orderBy.val('');
$attributeValues.val('');
$displayPosition.val('');
$remark.val('');
$attributeId.val('');
}
exports.init = function () {
... ... @@ -90,6 +119,8 @@ exports.init = function () {
$('.model-attr-btn').removeAttr('disabled');
$('input#categoryId').val($this.attr('data-val'));
queryAttrList($this.attr('data-val'));
}
} else {
... ... @@ -147,66 +178,67 @@ exports.init = function () {
$('.add-attr-btn').click(function(){
if (!!$('#attributeName').attr('update')) {
$('#add-attr-form').attr('action','/product/attr/update');
}
addAttrVerification.submit($("#add-attr-form").attr("action"), function(option,that) {
option.success=function(res){
console.log('success');
$('#addAttr').modal('toggle')
console.log(res);
$('#addAttr').modal('toggle');
removeAttr();
};
option.error=function(res){
console.log('error');
console.log(res);
}
});
return false;
});
//添加产品属性下拉框实例化
new dropDown({
el:'.attr-select'
});
console.log($('input#categoryId').val());
// 编辑产品属性
$(document).on('click', '.edit-class-btn', function () {
var tableGird = new grid({
var $this = $(this);
var attrId = $this.attr('attribute-id');
el:"#attr-table",
parms:function(){
$.ajax({
type: 'POST',
dataType: 'json',
url: '/product/attr/getProductAttribute',
data: {
attributeId: attrId*baseNum
}
}).then(function (d) {
var data = d.data.data;
$attributeName.val(data.attributeName).attr('update', 'true');
$saleType.val(data.saleType);
$inputType.val(data.inputType);
$isMust.val(data.isMust);
$isSearch.val(data.isSearch);
$maxValueLen.val(data.maxValueLen);
$isAllowAlias.val(data.isAllowAlias);
$orderBy.val(data.orderBy);
$attributeValues.val(data.attributeValues);
$displayPosition.val(data.displayPosition);
$remark.val(data.remark);
$attributeId.val(attrId);
// 显示dialog
$('#addAttr').modal('toggle');
console.log(d);
});
});
return {
param: 6
};
},
columns:[
{
display: "属性名称",
name: "attributeName"
}, {
display: "属性类型",
name: "attributeType"
}, {
display: "输入类型",
name: "inputType"
}, {
display: "是否必选",
name:"isMust",
render:function(item){
return convertNorY(item.isMust);
}
}, {
display: "是否可搜索",
name: "isSearch",
render: function(item){
return convertNorY(item.isSearch);
}
}, {
display:"操作",
name:"categoryId",
render:function(items){
return ('<button class="btn btn-success btn-xs edit-class-btn">编辑</button>');
}
}
]
$('.add-attr-btn-close').click(function () {
removeAttr();
});
tableGird.init('/product/attr/queryProductAttributeList');
};
\ No newline at end of file
... ...
... ... @@ -45,4 +45,11 @@
height: 500px;
overflow-y: scroll;
overflow-x: hidden;
}
.attr-select {
display: block;
height: 40px;
line-height: 40px;
border: 1px solid #ccc;
border-radius: 3px;
}
\ No newline at end of file
... ...
... ... @@ -347,6 +347,88 @@ gallery.html css
z-index: 1600;
}
.list-filter input[type="text"], .list-filter select {
display: inline-block;
width: 200px;
}
.list-tabs {
margin: 50px 0 0;
}
.list-table {
margin: 20px 0 0;
}
.coupon-list-table {
margin: 20px 0 0;
}
.coupon-list-table th {
text-align: center;
}
.coupon-list-table td {
display: table-cell;
vertical-align: middle !important;
line-height: 1;
text-align: center;
}
.coupon-list-table td p {
margin: 0;
}
.coupon-list-table td.id {
width: 18%;
}
.coupon-list-table td.info {
width: 23%;
text-align: left;
}
.coupon-list-table td.time {
width: 11%;
}
.coupon-list-table td.describe {
width: 16%;
}
.coupon-list-table td.staff {
width: 7%;
}
.coupon-list-table td.state {
width: 11%;
}
.coupon-list-table td.state .state-reason {
color: red;
word-break: break-all;
}
.coupon-list-table td.operate.wait a.apply-success, .coupon-list-table td.operate.wait a.apply-back, .coupon-list-table td.operate.wait a.apply-cancel {
display: inline-block;
}
.coupon-list-table td.operate.success a.apply-cancel {
display: inline-block;
}
.coupon-list-table td.operate.back a.apply-modify {
display: inline-block;
}
.coupon-list-table td.operate p {
margin: 5px 0;
}
.coupon-list-table td.operate a {
display: none;
}
.coupon-list-table td.operate a.apply-detail {
display: inline-block;
}
.send-list td.time {
width: 160px;
}
.send-list td.info {
width: 352px;
}
.couponview .red {
color: #dd514c;
padding: 0 5px;
}
.datepicker {
display: none;
position: absolute;
... ... @@ -576,6 +658,42 @@ input[type=date], input[type=time], input[type=datetime-local], input[type=month
width: 280px;
}
/*列表页操作按钮*/
.supplier-manage-operate .btn-freeze {
display: inline-block;
}
.supplier-manage-operate .btn-recovery {
display: none;
}
.supplier-manage-operate.valid0 .btn-freeze {
display: none;
}
.supplier-manage-operate.valid0 .btn-recovery {
display: inline-block;
}
.supplier-manage-operate.status0 .btn-edit, .supplier-manage-operate.status0 .btn-recovery, .supplier-manage-operate.status0 .btn-freeze {
display: none;
}
.supplier-operate.status0 .btn-edit, .supplier-operate.status0 .btn-submit {
display: none;
}
.brand-operate.operate1 .open-brand {
display: none;
}
.brand-operate.operate0 .close-brand {
display: none;
}
.pact-operate.operate0 .btn-edit {
display: none;
}
.pact-manage-operate.operate0 .renew-btn, .pact-manage-operate.operate0 .relieve-btn, .pact-manage-operate.operate2 .renew-btn, .pact-manage-operate.operate2 .relieve-btn, .pact-manage-operate.status0 .renew-btn, .pact-manage-operate.status0 .relieve-btn {
display: none;
}
.contentpanel td a {
margin: 0 3px;
}
... ... @@ -629,17 +747,15 @@ input[type=date], input[type=time], input[type=datetime-local], input[type=month
overflow-x: hidden;
}
.panel-input {
display: inline-block;
width: 100%;
}
.panel-col, .panel-col2 {
float: left;
width: 150px;
margin: 0 10px 0 0;
.attr-select {
display: block;
height: 40px;
line-height: 40px;
border: 1px solid #ccc;
border-radius: 3px;
}
.panel-col2 {
.panel-input {
display: inline-block;
width: 280px;
}
... ...
... ... @@ -183,6 +183,61 @@ exports.res = [
name: 'displayPosition',
type: 'Number'
},{
name: 'categoryId',
type: 'Number'
}
]
},{
//产品管理>【更新产品属性ajax】
route: '/product/attr/update',
method: 'POST',
url: '/product/updateProductAttribute',
isJsonRaw:true,
params: [
{
name: 'attributeName',
type: 'String'
},{
name: 'saleType',
type: 'Number'
},{
name: 'inputType',
type: 'String'
},{
name: 'attributeType',
type: 'String'
},{
name: 'isMust',
type: 'String'
},{
name: 'isSearch',
type: 'String'
},{
name: 'maxValueLen',
type: 'Number'
},{
name: 'isAllowAlias',
type: 'String'
},{
name: 'orderBy',
type: 'Number'
},{
name: 'state',
type: 'Number'
},{
name: 'remark',
type: 'String'
},{
name: 'attributeValues',
type: 'String'
},{
name: 'displayPosition',
type: 'Number'
},{
name: 'attributeId',
type: 'Number'
}
]
},{
... ... @@ -197,5 +252,17 @@ exports.res = [
type: 'Number'
}
]
},{
//产品管理【根据类目ID ajax查询属性的详细信息】
route: '/product/attr/getProductAttribute',
method: 'POST',
url: '/product/getProductAttribute',
isJsonRaw:true,
params: [
{
name: 'attributeId',
type: 'Number'
}
]
}
];
\ No newline at end of file
... ...
... ... @@ -77,7 +77,7 @@
</label>
<div class="col-md-6">
<input id="attributeName" class="form-control" type="text" placeholder="属性名称" required>
<input id="attributeName" class="form-control width300" type="text" placeholder="属性名称" required>
</div>
</div>
... ... @@ -185,6 +185,22 @@
</div>
</div>
<!--新增-->
<div class="form-group">
<label class="col-md-3 control-label">
展示位置
</label>
<div class="col-md-6">
<select id="displayPosition" class="attr-select width300" data-placeholder="展示位置" required>
<option value="0">请选择</option>
<option value="1">基础商品-非销售属性</option>
<option value="2">网售信息-上架后补全信息</option>
<option value="3">网售信息-商品参数</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">
备注
... ... @@ -202,13 +218,22 @@
</label>
<div class="col-md-6">
<input id="categoryId" class="form-control width300" value="" type="text" placeholder="ID" required>
<input id="categoryId" class="form-control width300" value="" type="text" placeholder="ID">
</div>
</div>
<div class="form-group hidden">
<label class="col-md-3 control-label">
attributeId<i>*</i>
</label>
<div class="col-md-6">
<input id="attributeId" class="form-control width300" value="" type="text" placeholder="attributeId">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default m-t-20" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-default m-t-20 add-attr-btn-close" data-dismiss="modal">关闭</button>
<button type="button" class="add-attr-btn btn btn-primary m-t-20">添加</button>
</div>
</div>
... ...