...
|
...
|
@@ -94,9 +94,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/goods.spec'] |
|
|
},
|
|
|
edit: function () {
|
|
|
Controller.api.bindevent();
|
|
|
setTimeout(function () {
|
|
|
$('select[name="row[spec_type]"]').trigger("change");
|
|
|
}, 100);
|
|
|
// 规格
|
|
|
var specMany = new GoodsSpec({
|
|
|
container: '.goods-spec-many'
|
...
|
...
|
@@ -243,16 +240,42 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'backend/goods.spec'] |
|
|
},
|
|
|
api: {
|
|
|
bindevent: function () {
|
|
|
// 切换单/多规格
|
|
|
$('select[name="row[spec_type]"]').change(function (e) {
|
|
|
var $goodsSpecMany = $('.goods-spec-many')
|
|
|
, $goodsSpecSingle = $('.goods-spec-single');
|
|
|
if (e.currentTarget.value === '1') {
|
|
|
$goodsSpecMany.hide() && $goodsSpecSingle.show();
|
|
|
} else {
|
|
|
$goodsSpecMany.show() && $goodsSpecSingle.hide();
|
|
|
}
|
|
|
});
|
|
|
setTimeout(function () {
|
|
|
$('select[name="row[spec_type]"]').trigger("change");
|
|
|
$('select[name="row[ismake]"]').trigger("change");
|
|
|
}, 100);
|
|
|
|
|
|
// 切换单/多规格
|
|
|
$(document).on("change", 'select[name="row[spec_type]"]', function (e) {
|
|
|
var $goodsSpecMany = $('.goods-spec-many')
|
|
|
, $goodsSpecSingle = $('.goods-spec-single');
|
|
|
if (e.currentTarget.value === '1') {
|
|
|
$goodsSpecMany.hide() && $goodsSpecSingle.show();
|
|
|
$goodsSpecSingle.find('input').data('rule','requeired');
|
|
|
$("form[role=form]").validator("setField",{
|
|
|
'row[spec][goods_price]' : 'required;',
|
|
|
'row[spec][stock_num]' : 'required;',
|
|
|
'row[spec][goods_weight]' : 'required;',
|
|
|
})
|
|
|
} else {
|
|
|
$goodsSpecMany.show() && $goodsSpecSingle.hide();
|
|
|
$("form[role=form]").validator("setField",{
|
|
|
'row[spec][goods_price]' : null,
|
|
|
'row[spec][stock_num]' : null,
|
|
|
'row[spec][goods_weight]' : null,
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 切换是否定制
|
|
|
$('select[name="row[ismake]"]').change(function (e) {
|
|
|
var $buyer_images = $('.buyer_images');
|
|
|
if (e.currentTarget.value === '1') {
|
|
|
$buyer_images.show();
|
|
|
} else {
|
|
|
$buyer_images.hide();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
};
|
...
|
...
|
|