From 9a18c02c288920f6e4a32a16e7b2e725245bcae6 Mon Sep 17 00:00:00 2001 From: java110 <928255095@qq.com> Date: Sun, 29 Nov 2020 19:51:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E6=83=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 8 +- .../payFeeDiscount/payFeeDiscount.html | 12 ++- .../property/payFeeDiscount/payFeeDiscount.js | 77 ++++++++++++++----- .../property/payFeeOrder/payFeeOrder.html | 6 ++ .../pages/property/payFeeOrder/payFeeOrder.js | 43 +++++++++-- 5 files changed, 112 insertions(+), 34 deletions(-) diff --git a/app.js b/app.js index 3e248b28b..ad0799aff 100644 --- a/app.js +++ b/app.js @@ -36,14 +36,14 @@ let opts = { //app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts)); -app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts)); -app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts)); + //app.use('/callComponent',proxy('http://api.demo.winqi.cn:8012',opts)); + //app.use('/app',proxy('http://api.demo.winqi.cn:8012',opts)); //app.use('/callComponent',proxy('http://127.0.0.1:8012',opts)); //app.use('/app',proxy('http://127.0.0.1:8012',opts)); - //app.use('/callComponent',proxy('http://192.168.1.16:8012',opts)); - //app.use('/app',proxy('http://192.168.1.16:8012',opts)); +app.use('/callComponent',proxy('http://192.168.1.16:8012',opts)); +app.use('/app',proxy('http://192.168.1.16:8012',opts)); //app.listen(3000); app.use(express.json()); diff --git a/public/components/property/payFeeDiscount/payFeeDiscount.html b/public/components/property/payFeeDiscount/payFeeDiscount.html index d917182b1..fb7dc584c 100644 --- a/public/components/property/payFeeDiscount/payFeeDiscount.html +++ b/public/components/property/payFeeDiscount/payFeeDiscount.html @@ -5,16 +5,19 @@
折扣信息
-
+ @@ -23,13 +26,16 @@ + - + diff --git a/public/components/property/payFeeDiscount/payFeeDiscount.js b/public/components/property/payFeeDiscount/payFeeDiscount.js index e0f362d1a..a08a74ff0 100644 --- a/public/components/property/payFeeDiscount/payFeeDiscount.js +++ b/public/components/property/payFeeDiscount/payFeeDiscount.js @@ -9,7 +9,25 @@ payFeeDiscountInfo: { feeDiscounts: [], feeId: '', - cycles: 1 + communityId: vc.getCurrentCommunity().communityId, + cycles: 1, + quanDiscount: false, + selectDiscountIds: [], + } + }, + watch: { // 监视双向绑定的数据数组 + payFeeDiscountInfo: { + handler() { // 数据数组有变化将触发此函数 + if ($that.payFeeDiscountInfo.selectDiscountIds.length == $that.payFeeDiscountInfo.feeDiscounts.length) { + $that.payFeeDiscountInfo.quanDiscount = true; + } else { + $that.payFeeDiscountInfo.quanDiscount = false; + } + + //计算优惠 + $that._computeFeeDiscount(); + }, + deep: true // 深度监视 } }, _initMethod: function () { @@ -18,14 +36,14 @@ _initEvent: function () { vc.on('payFeeDiscount', 'computeFeeDiscount', function (_param) { vc.copyObject(_param, $that.payFeeDiscountInfo); + if ($that.payFeeDiscountInfo.cycles < 0) { + return; + } vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS); }); }, methods: { _listFeeDiscounts: function (_page, _rows) { - - vc.component.payFeeDiscountInfo.conditions.page = _page; - vc.component.payFeeDiscountInfo.conditions.row = _rows; let param = { params: { page: DEFAULT_PAGE, @@ -37,11 +55,15 @@ }; //发送get请求 - vc.http.apiGet('/feeDiscount/queryFeeDiscount', + vc.http.apiGet('/feeDiscount/computeFeeDiscount', param, function (json, res) { let _payFeeDiscountInfo = JSON.parse(json); $that.payFeeDiscountInfo.feeDiscounts = _payFeeDiscountInfo.data; + $that.payFeeDiscountInfo.feeDiscounts.forEach(item => { + $that.payFeeDiscountInfo.selectDiscountIds.push(item.discountId); + item.discountPrice = Math.ceil(item.discountPrice); + }) }, function (errInfo, error) { console.log('请求失败处理'); } @@ -50,24 +72,37 @@ _openAddFeeDiscountModal: function () { vc.emit('addFeeDiscount', 'openAddFeeDiscountModal', {}); }, - _openEditFeeDiscountModel: function (_feeDiscount) { - vc.emit('editFeeDiscount', 'openEditFeeDiscountModal', _feeDiscount); - }, - _openDeleteFeeDiscountModel: function (_feeDiscount) { - vc.emit('deleteFeeDiscount', 'openDeleteFeeDiscountModal', _feeDiscount); - }, - _queryFeeDiscountMethod: function () { - vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS); - - }, - _moreCondition: function () { - if (vc.component.payFeeDiscountInfo.moreCondition) { - vc.component.payFeeDiscountInfo.moreCondition = false; - } else { - vc.component.payFeeDiscountInfo.moreCondition = true; + checkAllDiscount: function (e) { + var checkObj = document.querySelectorAll('.checkDiscountItem'); // 获取所有checkbox项 + if (e.target.checked) { // 判定全选checkbox的勾选状态 + for (var i = 0; i < checkObj.length; i++) { + if (!checkObj[i].checked) { // 将未勾选的checkbox选项push到绑定数组中 + let _value = checkObj[i].value; + vc.component.payFeeDiscountInfo.selectDiscountIds.push(_value); + } + } + } else { // 如果是去掉全选则清空checkbox选项绑定数组 + vc.component.payFeeDiscountInfo.selectDiscountIds = []; } - } + }, + _computeFeeDiscount: function () { + let _totalDiscountMoney = 0.0; + let _selectDiscount = []; + $that.payFeeDiscountInfo.selectDiscountIds.forEach(item => { + $that.payFeeDiscountInfo.feeDiscounts.forEach(disItem => { + if (item == disItem.discountId) { + _totalDiscountMoney += parseFloat(disItem.discountPrice); + _selectDiscount.push(disItem); + } + }) + }); + + vc.emit('payFeeOrder', 'changeDiscountPrice', { + totalDiscountMoney: _totalDiscountMoney, + selectDiscount: _selectDiscount + }) + } } }); diff --git a/public/pages/property/payFeeOrder/payFeeOrder.html b/public/pages/property/payFeeOrder/payFeeOrder.html index ed685f720..3fee6281d 100644 --- a/public/pages/property/payFeeOrder/payFeeOrder.html +++ b/public/pages/property/payFeeOrder/payFeeOrder.html @@ -159,6 +159,10 @@ +
+ + +
@@ -171,4 +175,6 @@
+ + \ No newline at end of file diff --git a/public/pages/property/payFeeOrder/payFeeOrder.js b/public/pages/property/payFeeOrder/payFeeOrder.js index e5cd929b8..23102b68e 100644 --- a/public/pages/property/payFeeOrder/payFeeOrder.js +++ b/public/pages/property/payFeeOrder/payFeeOrder.js @@ -23,7 +23,9 @@ squarePrice: 0.0, additionalAmount: 0.0, receiptId: '', - showEndTime:'' + showEndTime: '', + selectDiscount: [], + totalDiscountMoney:0.0 } }, _initMethod: function () { @@ -40,7 +42,7 @@ $that.payFeeOrderInfo.builtUpArea = vc.getParam('builtUpArea'); $that.payFeeOrderInfo.squarePrice = vc.getParam('squarePrice'); $that.payFeeOrderInfo.additionalAmount = vc.getParam('additionalAmount'); - + $that.payFeeOrderInfo.paymentCycles = []; @@ -56,7 +58,26 @@ }, _initEvent: function () { + vc.on('payFeeOrder', 'changeDiscountPrice', function (_param) { + let _totalFeePrice = $that.payFeeOrderInfo.totalFeePrice; + if (_totalFeePrice < 0) { + return; + } + + let _totalDiscountMoney = _param.totalDiscountMoney; + + //如果应收小区 优惠金额 则不优惠 + if (_totalFeePrice < _totalDiscountMoney) { + return; + } + + $that.payFeeOrderInfo.selectDiscount = _param.selectDiscount; + + $that.payFeeOrderInfo.totalDiscountMoney = _totalDiscountMoney; + + $that.payFeeOrderInfo.receivedAmount = _totalFeePrice - _totalDiscountMoney; + }) }, methods: { payFeeValidate: function () { @@ -106,11 +127,11 @@ return; } - if (!(/(^[1-9]\d*$)/.test($that.payFeeOrderInfo.cycles))) { + if (!(/(^[1-9]\d*$)/.test($that.payFeeOrderInfo.cycles))) { $that.payFeeOrderInfo.showEndTime = ''; - }else{ - console.log('cycle',$that.payFeeOrderInfo.cycles) - $that.payFeeOrderInfo.showEndTime = vc.addMonth(new Date($that.payFeeOrderInfo.endTime),parseInt($that.payFeeOrderInfo.cycles)); + } else { + console.log('cycle', $that.payFeeOrderInfo.cycles) + $that.payFeeOrderInfo.showEndTime = vc.addMonth(new Date($that.payFeeOrderInfo.endTime), parseInt($that.payFeeOrderInfo.cycles)); } //关闭model $("#doPayFeeModal").modal('show'); @@ -178,6 +199,11 @@ } vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(Math.floor(parseFloat(_newCycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100); vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice; + + vc.emit('payFeeDiscount', 'computeFeeDiscount', { + feeId: $that.payFeeOrderInfo.feeId, + cycles: _cycles + }); }, changeCycle: function (_cycles) { if (_cycles == '') { @@ -185,6 +211,11 @@ } vc.component.payFeeOrderInfo.totalFeePrice = $that._mathCeil(Math.floor(parseFloat(_cycles) * parseFloat(vc.component.payFeeOrderInfo.feePrice) * 100) / 100); vc.component.payFeeOrderInfo.receivedAmount = vc.component.payFeeOrderInfo.totalFeePrice; + + vc.emit('payFeeDiscount', 'computeFeeDiscount', { + feeId: $that.payFeeOrderInfo.feeId, + cycles: _cycles + }); }, _back: function () { $('#payFeeResult').modal("hide");
+ + 折扣类型 折扣名称 规则
+ + {{feeDiscount.discountType == '1001'?'优惠':'违约'}} {{feeDiscount.discountName}}
{{item.specName}}:{{item.specValue}}
30{{feeDiscount.discountPrice}}元