|
|
define(function(require, exports, module) {
|
|
|
let Window = require('system/views/pages/window');
|
|
|
let tpl = require('text!apps/rht/fsh/fsh140101/pledit.tpl');
|
|
|
let Service = require('./fsh140101service');
|
|
|
let rhtComm = require('../../comm/rhtComm');
|
|
|
|
|
|
function MyEdit(dsData) {
|
|
|
this.options = {
|
|
|
title: "批量调整商品价格",
|
|
|
content: tpl,
|
|
|
width: 450,
|
|
|
height: 350,
|
|
|
modal: true,
|
|
|
closed: true,
|
|
|
closable: true,
|
|
|
draggable: true,
|
|
|
maximizable: false,
|
|
|
resizable: false,
|
|
|
data: null
|
|
|
}
|
|
|
this.dsData = dsData;
|
|
|
|
|
|
Window.call(this, this.options);
|
|
|
}
|
|
|
inherits(MyEdit, Window);
|
|
|
|
|
|
MyEdit.prototype.init = function() {
|
|
|
|
|
|
}
|
|
|
|
|
|
MyEdit.prototype.open = function() {
|
|
|
Window.prototype.open.call(this);
|
|
|
}
|
|
|
|
|
|
//执行windows窗体上自定义按钮事件
|
|
|
MyEdit.prototype.customerize = function() {
|
|
|
let self = this;
|
|
|
let $priceRate = this.getElement('.priceRate');
|
|
|
let $newSxDate = this.getElement('.newSxDate');
|
|
|
let dateTimeDef = rhtComm.GetServerDate(0)+' 23:59:59';
|
|
|
$priceRate.numberbox('setValue', '');
|
|
|
$newSxDate.datetimebox('setValue', dateTimeDef);
|
|
|
|
|
|
//确定按钮事件
|
|
|
this.getElement('.btnOK').on('click', function(event) {
|
|
|
if (Store.confirm("您确认对显示的所有生鲜商品进行调价吗?")) {
|
|
|
let selectSxDate = $newSxDate.datetimebox('getValue');
|
|
|
let selectPriceRate = $priceRate.numberbox('getValue');
|
|
|
if (rhtComm.GetServerDateTime(0) > selectSxDate){
|
|
|
document.getElementById("errMsg").innerHTML='失效日期时间不能早于当前日期时间!';
|
|
|
}
|
|
|
else{
|
|
|
if (TypeUtil.toFloat(selectPriceRate) <= 0){
|
|
|
document.getElementById("errMsg").innerHTML = '调价比率必须大于0!';
|
|
|
}
|
|
|
else{
|
|
|
let ret= Service.getSlideMenuData("actExecute","pledit", selectPriceRate,selectSxDate,"", "","");
|
|
|
if (ret.result !== 1) {
|
|
|
document.getElementById("errMsg").innerHTML='批量修改生鲜商品售价出错!'+ret.message;
|
|
|
}
|
|
|
else{
|
|
|
if (self.callback) {
|
|
|
self.callback();
|
|
|
}
|
|
|
self.close();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//取消按钮事件
|
|
|
this.getElement('.btnCancel').on('click', function(event) {
|
|
|
if (self.callback) {
|
|
|
self.callback();
|
|
|
}
|
|
|
self.close();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return MyEdit;
|
|
|
}) |