129 lines
4.5 KiB
JavaScript
129 lines
4.5 KiB
JavaScript
(function (vc) {
|
|
|
|
vc.extends({
|
|
propTypes: {
|
|
callBackListener: vc.propTypes.string, //父组件名称
|
|
callBackFunction: vc.propTypes.string //父组件监听方法
|
|
},
|
|
data: {
|
|
addIntegralRuleFeeInfo: {
|
|
crfId: '',
|
|
ruleId: '',
|
|
payStartTime: '',
|
|
payEndTime: '',
|
|
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
|
|
|
|
},
|
|
_initEvent: function () {
|
|
vc.on('addIntegralRuleFee', 'openAddIntegralRuleFeeModal', function (_param) {
|
|
vc.copyObject(_param, $that.addIntegralRuleFeeInfo);
|
|
$('#addIntegralRuleFeeModel').modal('show');
|
|
setTimeout(function () {
|
|
$that._initAddIntegralRuleFeeDate();
|
|
}, 1000)
|
|
});
|
|
},
|
|
methods: {
|
|
_initAddIntegralRuleFeeDate: function () {
|
|
vc.initDateTime('addPayStartTime', function (_value) {
|
|
$that.addIntegralRuleFeeInfo.payStartTime = _value;
|
|
});
|
|
vc.initDateTime('addPayEndTime', function (_value) {
|
|
$that.addIntegralRuleFeeInfo.payEndTime = _value;
|
|
})
|
|
},
|
|
addIntegralRuleFeeValidate() {
|
|
return vc.validate.validate({
|
|
addIntegralRuleFeeInfo: $that.addIntegralRuleFeeInfo
|
|
}, {
|
|
'addIntegralRuleFeeInfo.ruleId': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "规则ID不能为空"
|
|
},
|
|
{
|
|
limit: "maxLength",
|
|
param: "30",
|
|
errInfo: "规则ID不能超过30"
|
|
},
|
|
],
|
|
|
|
'addIntegralRuleFeeInfo.payStartTime': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "缴费开始时间不能为空"
|
|
},
|
|
{
|
|
limit: "maxLength",
|
|
param: "64",
|
|
errInfo: "缴费开始时间不能超过64"
|
|
},
|
|
],
|
|
'addIntegralRuleFeeInfo.payEndTime': [
|
|
{
|
|
limit: "required",
|
|
param: "",
|
|
errInfo: "缴费结束时间不能为空"
|
|
},
|
|
{
|
|
limit: "maxLength",
|
|
param: "64",
|
|
errInfo: "缴费结束时间不能超过64"
|
|
},
|
|
],
|
|
|
|
});
|
|
},
|
|
saveIntegralRuleFeeInfo: function () {
|
|
if (!$that.addIntegralRuleFeeValidate()) {
|
|
vc.toast(vc.validate.errInfo);
|
|
return;
|
|
}
|
|
$that.addIntegralRuleFeeInfo.communityId = vc.getCurrentCommunity().communityId;
|
|
vc.http.apiPost(
|
|
'/integral.saveIntegralRuleFee',
|
|
JSON.stringify($that.addIntegralRuleFeeInfo),
|
|
{
|
|
emulateJSON: true
|
|
},
|
|
function (json, res) {
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
let _json = JSON.parse(json);
|
|
if (_json.code == 0) {
|
|
//关闭model
|
|
$('#addIntegralRuleFeeModel').modal('hide');
|
|
$that.clearAddIntegralRuleFeeInfo();
|
|
vc.emit('integralRuleFeeManage', 'listIntegralRuleFee', {});
|
|
|
|
return;
|
|
}
|
|
vc.toast(_json.msg);
|
|
|
|
},
|
|
function (errInfo, error) {
|
|
console.log('请求失败处理');
|
|
|
|
vc.toast(errInfo);
|
|
|
|
});
|
|
},
|
|
clearAddIntegralRuleFeeInfo: function () {
|
|
$that.addIntegralRuleFeeInfo = {
|
|
crfId: '',
|
|
ruleId: '',
|
|
payStartTime: '',
|
|
payEndTime: '',
|
|
|
|
};
|
|
},
|
|
}
|
|
});
|
|
|
|
})(window.vc);
|