From 2945cd032e0e3a0c223b6ee3e6fead230739c175 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Tue, 13 Oct 2020 20:04:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=20=E4=BB=A3=E6=94=B6?= =?UTF-8?q?=E8=B4=B9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../property/addFeeConfig/addFeeConfig.html | 2 +- .../property/addProxyFee/addProxyFee.html | 85 +++++++ .../property/addProxyFee/addProxyFee.js | 216 ++++++++++++++++++ .../property/editFeeConfig/editFeeConfig.html | 2 +- .../property/listRoomFee/listRoomFee.html | 13 +- .../pages/property/listRoomFee/listRoomFee.js | 7 + 6 files changed, 322 insertions(+), 3 deletions(-) create mode 100644 public/components/property/addProxyFee/addProxyFee.html create mode 100644 public/components/property/addProxyFee/addProxyFee.js diff --git a/public/components/property/addFeeConfig/addFeeConfig.html b/public/components/property/addFeeConfig/addFeeConfig.html index 2e52288f6..e7698d551 100644 --- a/public/components/property/addFeeConfig/addFeeConfig.html +++ b/public/components/property/addFeeConfig/addFeeConfig.html @@ -58,7 +58,7 @@ - + diff --git a/public/components/property/addProxyFee/addProxyFee.html b/public/components/property/addProxyFee/addProxyFee.html new file mode 100644 index 000000000..e41c20e62 --- /dev/null +++ b/public/components/property/addProxyFee/addProxyFee.html @@ -0,0 +1,85 @@ +
\ No newline at end of file diff --git a/public/components/property/addProxyFee/addProxyFee.js b/public/components/property/addProxyFee/addProxyFee.js new file mode 100644 index 000000000..6bfd0d6a0 --- /dev/null +++ b/public/components/property/addProxyFee/addProxyFee.js @@ -0,0 +1,216 @@ +(function (vc) { + + vc.extends({ + propTypes: { + callBackListener: vc.propTypes.string, //父组件名称 + callBackFunction: vc.propTypes.string //父组件监听方法 + }, + data: { + addProxyFeeInfo: { + remark: '', + roomId: '', + objId: '', + objName: '', + feeTypeCd: '', + feeConfigs: [], + amount: '', + consumption: '', + configId: '', + ownerName: '', + objType: '3333' + } + }, + _initMethod: function () { + + }, + _initEvent: function () { + vc.on('addProxyFee', 'openAddProxyFeeModal', function (_param) { + if (_param.hasOwnProperty("objType")) { + $that.addProxyFeeInfo.objType = _param.objType; + } + $that.addProxyFeeInfo.roomId = _param.roomId; + $that.addProxyFeeInfo.objId = _param.roomId; + $that.addProxyFeeInfo.objName = _param.roomName; + $that.addProxyFeeInfo.ownerName = _param.roomName + '(' + _param.ownerName + ')'; + $('#addProxyFeeModel').modal('show'); + }); + }, + methods: { + addProxyFeeValidate() { + return vc.validate.validate({ + addProxyFeeInfo: vc.component.addProxyFeeInfo + }, { + 'addProxyFeeInfo.amount': [ + { + limit: "required", + param: "", + errInfo: "金额不能为空" + }, + { + limit: "money", + param: "", + errInfo: "金额格式错误,如3.00" + }, + ], + 'addProxyFeeInfo.consumption': [ + { + limit: "required", + param: "", + errInfo: "用量不能为空" + }, + { + limit: "money", + param: "", + errInfo: "用量格式错误,如3.00" + }, + ], + 'addProxyFeeInfo.objId': [ + { + limit: "required", + param: "", + errInfo: "房屋必填" + } + ], + 'addProxyFeeInfo.configId': [ + { + limit: "required", + param: "", + errInfo: "费用必填" + } + ] + }); + }, + saveProxyInfo: function () { + if (!vc.component.addProxyFeeValidate()) { + vc.toast(vc.validate.errInfo); + + return; + } + vc.component.addProxyFeeInfo.communityId = vc.getCurrentCommunity().communityId; + //不提交数据将数据 回调给侦听处理 + if (vc.notNull($props.callBackListener)) { + vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addProxyFeeInfo); + $('#addProxyFeeModel').modal('hide'); + return; + } + vc.http.apiPost( + 'meterWater.saveProxyFee', + JSON.stringify(vc.component.addProxyFeeInfo), + { + emulateJSON: true + }, + function (json, res) { + //vm.menus = vm.refreshMenuActive(JSON.parse(json),0); + let _json = JSON.parse(json); + if (_json.code == 0) { + //关闭model + $('#addProxyFeeModel').modal('hide'); + vc.component.clearAddProxyFeeInfo(); + vc.emit('listRoomFee', 'notify', {}); + vc.emit('listParkingSpaceFee', 'notify', {}); + return; + } + vc.message(_json.msg); + + }, + function (errInfo, error) { + console.log('请求失败处理'); + + vc.message(errInfo); + + }); + }, + _changeFeeConfig: function () { + $that.addProxyFeeInfo.amount = ''; + $that.addProxyFeeInfo.consumption = ''; + }, + _changeFeeTypeCd: function (_feeTypeCd) { + $that.addProxyFeeInfo.amount = ''; + $that.addProxyFeeInfo.consumption = ''; + var param = { + params: { + page: 1, + row: 20, + communityId: vc.getCurrentCommunity().communityId, + feeTypeCd: _feeTypeCd, + isDefault: 'F', + valid: '1' + } + }; + //发送get请求 + vc.http.get('roomCreateFeeAdd', 'list', param, + function (json, res) { + var _feeConfigManageInfo = JSON.parse(json); + vc.component.addProxyFeeInfo.feeConfigs = _feeConfigManageInfo.feeConfigs; + }, + function (errInfo, error) { + console.log('请求失败处理'); + }); + }, + clearAddProxyFeeInfo: function () { + vc.component.addProxyFeeInfo = { + amount: '', + consumption: '', + remark: '', + roomId: '', + objId: '', + objName: '', + feeTypeCd: '', + feeConfigs: [], + configId: '', + ownerName: '', + objType: '3333' + }; + }, + _getConfig: function () { + + let _feeConfigs = $that.addProxyFeeInfo.feeConfigs; + let _config = null; + _feeConfigs.forEach(item => { + if ($that.addProxyFeeInfo.configId == item.configId && item.computingFormula == '6006') { + _config = item; + } + }); + + return _config; + }, + _changeAmount: function () { + let _config = $that._getConfig(); + let _amount = $that.addProxyFeeInfo.amount; + if (_config == null) { + vc.toast('未选择收费项目或者收费项目公式错误(用量*单价+附加费)'); + $that.addProxyFeeInfo.amount = ''; + $that.addProxyFeeInfo.consumption = ''; + return; + } + + if (_amount < _config.additionalAmount) { + vc.toast('输入金额太小'); + $that.addProxyFeeInfo.amount = ''; + $that.addProxyFeeInfo.consumption = ''; + return; + } + + let _consumption = (_amount - _config.additionalAmount) / _config.squarePrice; + + $that.addProxyFeeInfo.consumption = _consumption.toFixed(2); + + }, + _changeConsumption: function () { + let _config = $that._getConfig(); + let _consumption = $that.addProxyFeeInfo.consumption; + if (_config == null) { + vc.toast('未选择收费项目或者收费项目公式错误(用量*单价+附加费)'); + $that.addProxyFeeInfo.amount = ''; + $that.addProxyFeeInfo.consumption = ''; + return; + } + + let _amount = _config.squarePrice * _consumption + parseFloat(_config.additionalAmount); + console.log('_consumption', _consumption, _amount); + $that.addProxyFeeInfo.amount = _amount.toFixed(2); + } + } + }); + +})(window.vc); diff --git a/public/components/property/editFeeConfig/editFeeConfig.html b/public/components/property/editFeeConfig/editFeeConfig.html index 40e2cc20d..ff651c77c 100644 --- a/public/components/property/editFeeConfig/editFeeConfig.html +++ b/public/components/property/editFeeConfig/editFeeConfig.html @@ -58,7 +58,7 @@ - + diff --git a/public/pages/property/listRoomFee/listRoomFee.html b/public/pages/property/listRoomFee/listRoomFee.html index 8e74b3032..2721f3978 100644 --- a/public/pages/property/listRoomFee/listRoomFee.html +++ b/public/pages/property/listRoomFee/listRoomFee.html @@ -5,6 +5,10 @@