Authored by 陶雨

限购码添加事件控件限定

... ... @@ -5,18 +5,24 @@ var editBean = require('./partials/limitcode-edit-bean');
var e = new common.edit2("#basicForm");
var type = $("#basicForm").attr("role"),
action = $("#basicForm").data("action");
var isFirst = true;
var Bll = {
__render:function() {
editBean.currTime = common.util.__dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss");
if(new Date(editBean.currTime).getTime() > new Date(editBean.limitDateFrom)) {
editBean.useCurrTime = true;
}
$("#basicForm").html(common.util.__template2($("#limitcodeEdit-template").html(), editBean));
e.init();
if(type == "edit") {
$('input[name="skn_sku"]').prop('disabled', true);
$(".noEdit").prop("disabled", true);
$('input[name="userTypeLimit"]').prop('disabled', true);
if(editBean.limitDateFrom <= new Date()) {
if((new Date(editBean.limitDateFrom).getTime() <= new Date().getTime()) && isFirst) {
$("#limitDateFrom").prop("disabled", true);
}
isFirst = false;
}
},
__checkSkn:function(callback) {
... ... @@ -89,6 +95,14 @@ $(document).on("change", ".observe", function () {
editBean = common.util.__buildobj(name, '.', editBean, function (obj, name) {
obj[name] = $this.val();
});
if($this.prop("id") == "limitDateFrom" && new Date($this.val()).getTime() ) {
if(new Date(editBean.currTime).getTime() > new Date(editBean.limitDateFrom)) {
editBean.useCurrTime = true;
} else {
editBean.useCurrTime = false;
}
Bll.__render();
}
//console.log(editBean);
});
... ...
... ... @@ -57,9 +57,10 @@
<input type="text" class="form-control observe" data-field="limitDateFrom" jsaction="time:end:limitDateTo" id="limitDateFrom" placeholder="开始时间" value="[[limitDateFrom]]" readonly required>
</div>
<div class="col-sm-6">
<input type="text" class="form-control observe" data-field="limitDateTo" jsaction="time:start:limitDateFrom" id="limitDateTo" placeholder="结束时间" value="[[limitDateTo]]" readonly required>
<input type="text" class="form-control observe" data-field="limitDateTo" jsaction="time:start:[[useCurrTime?'limitDateCurr':'limitDateFrom']]" id="limitDateTo" placeholder="结束时间" value="[[limitDateTo]]" readonly required>
</div>
</div>
<input type="hidden" jsaction="time" id="limitDateCurr" value="[[currTime]]" readonly>
</div>
<div class="form-group">
... ...