diff --git a/public/components/property/addFeeDiscount/addFeeDiscount.html b/public/components/property/addFeeDiscount/addFeeDiscount.html index e177e20fa..c1ca6466c 100644 --- a/public/components/property/addFeeDiscount/addFeeDiscount.html +++ b/public/components/property/addFeeDiscount/addFeeDiscount.html @@ -17,7 +17,7 @@
- @@ -26,14 +26,25 @@
- + +
+
+ +
+ +
+
- +
diff --git a/public/components/property/addFeeDiscount/addFeeDiscount.js b/public/components/property/addFeeDiscount/addFeeDiscount.js index 5e5ebf92d..8354fa68c 100644 --- a/public/components/property/addFeeDiscount/addFeeDiscount.js +++ b/public/components/property/addFeeDiscount/addFeeDiscount.js @@ -12,6 +12,9 @@ discountType: '', ruleId: '', discountDesc: '', + rules: [], + feeDiscountRuleSpecs: [] + } }, _initMethod: function () { @@ -19,6 +22,7 @@ }, _initEvent: function () { vc.on('addFeeDiscount', 'openAddFeeDiscountModal', function () { + $('#addFeeDiscountModel').modal('show'); }); }, @@ -64,14 +68,10 @@ }, ], 'addFeeDiscountInfo.discountDesc': [ - { - limit: "required", - param: "", - errInfo: "描述不能为空" - }, + { limit: "maxLength", - param: "", + param: "500", errInfo: "描述不能超过500位" }, ], @@ -97,7 +97,7 @@ } vc.http.apiPost( - 'feeDiscount.saveFeeDiscount', + '/feeDiscount/saveFeeDiscount', JSON.stringify(vc.component.addFeeDiscountInfo), { emulateJSON: true @@ -129,8 +129,48 @@ discountType: '', ruleId: '', discountDesc: '', - + rules: [], + feeDiscountRuleSpecs: [] }; + }, + _loadAddFeeDiscountRules: function () { + + if ($that.addFeeDiscountInfo.discountType == '') { + return; + } + + var param = { + params: { + page: 1, + row: 100, + discountType: $that.addFeeDiscountInfo.discountType + } + }; + //发送get请求 + vc.http.apiGet('/feeDiscount/queryFeeDiscountRule', + param, + function (json, res) { + var _feeDiscountManageInfo = JSON.parse(json); + $that.addFeeDiscountInfo.rules = _feeDiscountManageInfo.data; + }, function (errInfo, error) { + console.log('请求失败处理'); + } + ); + }, + _changeAddFeeDiscountRule: function () { + let _rules = $that.addFeeDiscountInfo.rules; + _rules.forEach(item => { + if (item.ruleId == $that.addFeeDiscountInfo.ruleId) { + item.feeDiscountRuleSpecs.forEach(specItem => { + specItem.specValue = ""; + }) + $that.addFeeDiscountInfo.feeDiscountRuleSpecs = item.feeDiscountRuleSpecs; + + } + }); + }, + _changeAddFeeDiscountType: function () { + $that._loadAddFeeDiscountRules(); } } }); diff --git a/public/components/property/deleteFeeDiscount/deleteFeeDiscount.js b/public/components/property/deleteFeeDiscount/deleteFeeDiscount.js index a2126c20d..020654360 100644 --- a/public/components/property/deleteFeeDiscount/deleteFeeDiscount.js +++ b/public/components/property/deleteFeeDiscount/deleteFeeDiscount.js @@ -21,7 +21,7 @@ deleteFeeDiscount: function () { vc.component.deleteFeeDiscountInfo.communityId = vc.getCurrentCommunity().communityId; vc.http.apiPost( - 'feeDiscount.deleteFeeDiscount', + '/feeDiscount/deleteFeeDiscount', JSON.stringify(vc.component.deleteFeeDiscountInfo), { emulateJSON: true diff --git a/public/components/property/editFeeDiscount/editFeeDiscount.html b/public/components/property/editFeeDiscount/editFeeDiscount.html index c8f70c820..ad8f9643d 100644 --- a/public/components/property/editFeeDiscount/editFeeDiscount.html +++ b/public/components/property/editFeeDiscount/editFeeDiscount.html @@ -26,14 +26,25 @@
- + +
+
+ +
+ +
+
- +
diff --git a/public/components/property/editFeeDiscount/editFeeDiscount.js b/public/components/property/editFeeDiscount/editFeeDiscount.js index 6998fb586..a69a49f33 100644 --- a/public/components/property/editFeeDiscount/editFeeDiscount.js +++ b/public/components/property/editFeeDiscount/editFeeDiscount.js @@ -8,6 +8,8 @@ discountType: '', ruleId: '', discountDesc: '', + rules: [], + feeDiscountRuleSpecs: [] } }, @@ -19,6 +21,8 @@ vc.component.refreshEditFeeDiscountInfo(); $('#editFeeDiscountModel').modal('show'); vc.copyObject(_params, vc.component.editFeeDiscountInfo); + $that.editFeeDiscountInfo.feeDiscountRuleSpecs = _params.feeDiscountSpecs; + $that._loadEditFeeDiscountRules(); vc.component.editFeeDiscountInfo.communityId = vc.getCurrentCommunity().communityId; }); }, @@ -64,14 +68,10 @@ }, ], 'editFeeDiscountInfo.discountDesc': [ - { - limit: "required", - param: "", - errInfo: "描述不能为空" - }, + { limit: "maxLength", - param: "", + param: "500", errInfo: "描述不能超过500位" }, ], @@ -91,7 +91,7 @@ } vc.http.apiPost( - 'feeDiscount.updateFeeDiscount', + '/feeDiscount/updateFeeDiscount', JSON.stringify(vc.component.editFeeDiscountInfo), { emulateJSON: true @@ -120,8 +120,49 @@ discountType: '', ruleId: '', discountDesc: '', + rules: [], + feeDiscountRuleSpecs: [] } + }, + _loadEditFeeDiscountRules: function () { + + if ($that.editFeeDiscountInfo.discountType == '') { + return; + } + + var param = { + params: { + page: 1, + row: 100, + discountType: $that.editFeeDiscountInfo.discountType + } + }; + //发送get请求 + vc.http.apiGet('/feeDiscount/queryFeeDiscountRule', + param, + function (json, res) { + var _feeDiscountManageInfo = JSON.parse(json); + $that.editFeeDiscountInfo.rules = _feeDiscountManageInfo.data; + }, function (errInfo, error) { + console.log('请求失败处理'); + } + ); + }, + _changeEditFeeDiscountRule: function () { + let _rules = $that.editFeeDiscountInfo.rules; + _rules.forEach(item => { + if (item.ruleId == $that.editFeeDiscountInfo.ruleId) { + item.feeDiscountRuleSpecs.forEach(specItem => { + specItem.specValue = ""; + }) + $that.editFeeDiscountInfo.feeDiscountRuleSpecs = item.feeDiscountRuleSpecs; + + } + }); + }, + _changeEditFeeDiscountType: function () { + $that._loadEditFeeDiscountRules(); } } }); diff --git a/public/pages/property/feeDiscountManage/feeDiscountManage.html b/public/pages/property/feeDiscountManage/feeDiscountManage.html index b0d544d45..0e449cd8c 100644 --- a/public/pages/property/feeDiscountManage/feeDiscountManage.html +++ b/public/pages/property/feeDiscountManage/feeDiscountManage.html @@ -69,8 +69,10 @@ {{feeDiscount.discountId}} {{feeDiscount.discountName}} - {{feeDiscount.discountType}} - {{feeDiscount.ruleName}} + {{feeDiscount.discountType == '1001'?'优惠':'违约'}} + +
{{item.specName}}:{{item.specValue}}
+ {{feeDiscount.createTime}}
diff --git a/public/pages/property/feeDiscountManage/feeDiscountManage.js b/public/pages/property/feeDiscountManage/feeDiscountManage.js index a84b6d9e8..6df91537b 100644 --- a/public/pages/property/feeDiscountManage/feeDiscountManage.js +++ b/public/pages/property/feeDiscountManage/feeDiscountManage.js @@ -1,85 +1,88 @@ /** 入驻小区 **/ -(function(vc){ +(function (vc) { var DEFAULT_PAGE = 1; var DEFAULT_ROWS = 10; vc.extends({ - data:{ - feeDiscountManageInfo:{ - feeDiscounts:[], - total:0, - records:1, - moreCondition:false, - discountId:'', - conditions:{ - discountName:'', -discountType:'', -ruleName:'', + data: { + feeDiscountManageInfo: { + feeDiscounts: [], + total: 0, + records: 1, + moreCondition: false, + discountId: '', + conditions: { + discountName: '', + discountType: '', + ruleName: '', + communityId:vc.getCurrentCommunity().communityId } } }, - _initMethod:function(){ + _initMethod: function () { vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS); }, - _initEvent:function(){ - - vc.on('feeDiscountManage','listFeeDiscount',function(_param){ - vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS); + _initEvent: function () { + + vc.on('feeDiscountManage', 'listFeeDiscount', function (_param) { + vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS); }); - vc.on('pagination','page_event',function(_currentPage){ - vc.component._listFeeDiscounts(_currentPage,DEFAULT_ROWS); + vc.on('pagination', 'page_event', function (_currentPage) { + vc.component._listFeeDiscounts(_currentPage, DEFAULT_ROWS); }); }, - methods:{ - _listFeeDiscounts:function(_page, _rows){ + methods: { + _listFeeDiscounts: function (_page, _rows) { vc.component.feeDiscountManageInfo.conditions.page = _page; vc.component.feeDiscountManageInfo.conditions.row = _rows; - var param = { - params:vc.component.feeDiscountManageInfo.conditions - }; - //发送get请求 - vc.http.apiGet('feeDiscount.listFeeDiscounts', - param, - function(json,res){ - var _feeDiscountManageInfo=JSON.parse(json); - vc.component.feeDiscountManageInfo.total = _feeDiscountManageInfo.total; - vc.component.feeDiscountManageInfo.records = _feeDiscountManageInfo.records; - vc.component.feeDiscountManageInfo.feeDiscounts = _feeDiscountManageInfo.data; - vc.emit('pagination','init',{ - total:vc.component.feeDiscountManageInfo.records, - currentPage:_page - }); - },function(errInfo,error){ - console.log('请求失败处理'); - } - ); + + var param = { + params: vc.component.feeDiscountManageInfo.conditions + }; + + //发送get请求 + vc.http.apiGet('/feeDiscount/queryFeeDiscount', + param, + function (json, res) { + var _feeDiscountManageInfo = JSON.parse(json); + vc.component.feeDiscountManageInfo.total = _feeDiscountManageInfo.total; + vc.component.feeDiscountManageInfo.records = _feeDiscountManageInfo.records; + vc.component.feeDiscountManageInfo.feeDiscounts = _feeDiscountManageInfo.data; + vc.emit('pagination', 'init', { + total: vc.component.feeDiscountManageInfo.records, + currentPage: _page + }); + }, function (errInfo, error) { + console.log('请求失败处理'); + } + ); }, - _openAddFeeDiscountModal:function(){ - vc.emit('addFeeDiscount','openAddFeeDiscountModal',{}); + _openAddFeeDiscountModal: function () { + vc.emit('addFeeDiscount', 'openAddFeeDiscountModal', {}); }, - _openEditFeeDiscountModel:function(_feeDiscount){ - vc.emit('editFeeDiscount','openEditFeeDiscountModal',_feeDiscount); + _openEditFeeDiscountModel: function (_feeDiscount) { + vc.emit('editFeeDiscount', 'openEditFeeDiscountModal', _feeDiscount); }, - _openDeleteFeeDiscountModel:function(_feeDiscount){ - vc.emit('deleteFeeDiscount','openDeleteFeeDiscountModal',_feeDiscount); + _openDeleteFeeDiscountModel: function (_feeDiscount) { + vc.emit('deleteFeeDiscount', 'openDeleteFeeDiscountModal', _feeDiscount); }, - _queryFeeDiscountMethod:function(){ + _queryFeeDiscountMethod: function () { vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS); }, - _moreCondition:function(){ - if(vc.component.feeDiscountManageInfo.moreCondition){ + _moreCondition: function () { + if (vc.component.feeDiscountManageInfo.moreCondition) { vc.component.feeDiscountManageInfo.moreCondition = false; - }else{ + } else { vc.component.feeDiscountManageInfo.moreCondition = true; } } - + } }); })(window.vc);