优化代码

This commit is contained in:
Your Name 2023-09-08 12:10:58 +08:00
parent 128aa55afd
commit 14a0380088
3 changed files with 26 additions and 17 deletions

View File

@ -8,7 +8,7 @@
<div class="ibox">
<div class="ibox-title">
<h5>
<span><vc:i18n name="折扣信息" namespace="payFeeDiscount"></vc:i18n></span>
<vc:i18n name="折扣信息" namespace="payFeeDiscount"></vc:i18n>
</h5>
<div class="ibox-tools" style="top:10px;">
<!-- <button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddFeeDiscountModal()">
@ -26,16 +26,16 @@
@click="checkAllDiscount($event)">
</th>
<th class="text-center">
<span><vc:i18n name="折扣类型" namespace="payFeeDiscount"></vc:i18n></span>
<vc:i18n name="折扣类型" namespace="payFeeDiscount"></vc:i18n>
</th>
<th class="text-center">
<span><vc:i18n name="折扣名称" namespace="payFeeDiscount"></vc:i18n></span>
<vc:i18n name="折扣名称" namespace="payFeeDiscount"></vc:i18n>
</th>
<th class="text-center">
<span><vc:i18n name="规则名称" namespace="payFeeDiscount"></vc:i18n></span>
<vc:i18n name="规则名称" namespace="payFeeDiscount"></vc:i18n>
</th>
<th class="text-center">
<span><vc:i18n name="规则" namespace="payFeeDiscount"></vc:i18n></span>
<vc:i18n name="规则" namespace="payFeeDiscount"></vc:i18n>
</th>
<th class="text-center">
<span><vc:i18n name="折扣金额" namespace="payFeeDiscount"></vc:i18n></span>

View File

@ -42,7 +42,7 @@
if ($that.payFeeDiscountInfo.cycles < 0) {
return;
}
vc.component._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
$that._listFeeDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
});
},
methods: {
@ -135,11 +135,11 @@
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);
$that.payFeeDiscountInfo.selectDiscountIds.push(_value);
}
}
} else { // 如果是去掉全选则清空checkbox选项绑定数组
vc.component.payFeeDiscountInfo.selectDiscountIds = [];
$that.payFeeDiscountInfo.selectDiscountIds = [];
}
},
_computeFeeDiscount: function () {
@ -147,8 +147,8 @@
let _selectDiscount = [];
$that.payFeeDiscountInfo.selectDiscountIds.forEach(item => {
$that.payFeeDiscountInfo.feeDiscounts.forEach(disItem => {
if (disItem.feeDiscountSpecs != null && disItem.feeDiscountSpecs != undefined && disItem.feeDiscountSpecs.length > 0) {
var specValue = "";
if (disItem.feeDiscountSpecs && disItem.feeDiscountSpecs.length > 0) {
let specValue = "";
disItem.feeDiscountSpecs.forEach(feeItem => {
if (feeItem.specName == "月份") {
specValue = feeItem.specValue;
@ -159,14 +159,26 @@
}
}
if (item == disItem.discountId && disItem.discountPrice != 0 && disItem.ruleId != "102020008") {
if (disItem.feeDiscountSpecs != null && disItem.feeDiscountSpecs != undefined && disItem.feeDiscountSpecs.length > 0) {
var specValue = "";
if (disItem.feeDiscountSpecs && disItem.feeDiscountSpecs.length > 0) {
let specValue = "";
disItem.feeDiscountSpecs.forEach(feeItem => {
if (feeItem.specName == "月份") {
specValue = feeItem.specValue;
}
})
if (specValue != "" && parseFloat($that.payFeeDiscountInfo.cycles) >= parseFloat(specValue)) {
if (specValue&& parseFloat($that.payFeeDiscountInfo.cycles) >= parseFloat(specValue)) {
_totalDiscountMoney += parseFloat(disItem.discountPrice);
_selectDiscount.push(disItem);
}
//todo 考虑滞纳金
specValue = "";
disItem.feeDiscountSpecs.forEach(feeItem => {
if (feeItem.specName == "滞纳金") {
specValue = feeItem.specValue;
}
})
if (specValue) {
_totalDiscountMoney += parseFloat(disItem.discountPrice);
_selectDiscount.push(disItem);
}

View File

@ -13,10 +13,7 @@
</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" style="margin-left:10px"
v-on:click="vc.goBack()">
<span>
<span><vc:i18n name="返回" namespace="payFeeOrder"></vc:i18n></span>
</span>
v-on:click="vc.goBack()"><vc:i18n name="返回" namespace="payFeeOrder"></vc:i18n>
</button>
</div>
</div>