优化添加费用

This commit is contained in:
wuxw 2022-05-10 13:07:24 +08:00
parent 92b237b968
commit 1e5a7f0191
2 changed files with 46 additions and 50 deletions

View File

@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label class="col-sm-2 col-form-label"><span><vc:i18n name="费用" namespace="addFeeCombo"></vc:i18n></span></label> <label class="col-sm-2 col-form-label"><span><vc:i18n name="费用" namespace="addFeeCombo"></vc:i18n></span></label>
<div class="col-sm-10"> <div class="col-sm-10">
<select class="selectpicker" id="configIds" v-model="addFeeComboInfo.configIds" multiple> <select class="selectpicker" id="configIds" v-model="addFeeComboInfo.configIds" multiple>
<option v-for="(item,index) in addFeeComboInfo.configs" :key="index" <option v-for="(item,index) in addFeeComboInfo.configs" :key="index"

View File

@ -10,6 +10,7 @@
payerObjId: '', payerObjId: '',
payerObjName: '', payerObjName: '',
payerObjType: '', payerObjType: '',
comboId: ''
} }
}, },
_initMethod: function () { _initMethod: function () {
@ -22,6 +23,7 @@
}, },
_initEvent: function () { _initEvent: function () {
vc.on('createFeeByCombo', 'chooseFeeCombo', function (_feeCombo) { vc.on('createFeeByCombo', 'chooseFeeCombo', function (_feeCombo) {
$that.createFeeByComboInfo.comboId = _feeCombo.comboId;
$that._listFeeComboMembers(_feeCombo); $that._listFeeComboMembers(_feeCombo);
}) })
}, },
@ -43,9 +45,11 @@
param, param,
function (json, res) { function (json, res) {
let _feeComboMemberManageInfo = JSON.parse(json); let _feeComboMemberManageInfo = JSON.parse(json);
$that.createFeeByComboInfo.selectConfigIds = [];
_feeComboMemberManageInfo.data.forEach(config => { _feeComboMemberManageInfo.data.forEach(config => {
config.startTime = ''; config.startTime = '';
config.endTime='' config.endTime = '',
$that.createFeeByComboInfo.selectConfigIds.push(config.configId);
}) })
vc.component.createFeeByComboInfo.feeConfigs = _feeComboMemberManageInfo.data; vc.component.createFeeByComboInfo.feeConfigs = _feeComboMemberManageInfo.data;
$that.$forceUpdate(); $that.$forceUpdate();
@ -67,40 +71,29 @@
} }
); );
}, },
_doPayFee: function() { _createFee: function () {
let _fees = []; let _fees = [];
let _printFees = [];
if ($that.createFeeByComboInfo.primeRate == '') {
vc.toast('请选择支付方式');
return;
}
$that.createFeeByComboInfo.selectConfigIds.forEach(function (_item) { $that.createFeeByComboInfo.selectConfigIds.forEach(function (_item) {
$that.createFeeByComboInfo.batchFees.forEach(function(_batchFeeItem) { $that.createFeeByComboInfo.feeConfigs.forEach(function (_batchFeeItem) {
if (_item == _batchFeeItem.feeId) { if (_item == _batchFeeItem.configId) {
_batchFeeItem.primeRate = $that.createFeeByComboInfo.primeRate;
_fees.push(_batchFeeItem); _fees.push(_batchFeeItem);
_printFees.push({
feeId: _item,
squarePrice: _batchFeeItem.squarePrice,
additionalAmount: _batchFeeItem.additionalAmount,
feeName: _batchFeeItem.feeName,
amount: _batchFeeItem.feePrice,
roomName: $that.createFeeByComboInfo.roomName,
primeRate: $that.createFeeByComboInfo.primeRate
});
} }
}) })
}) })
if (_fees.length < 1) { if (_fees.length < 1) {
vc.toast('未选中要缴费的项目'); vc.toast('未选中要创建的费用套餐');
return; return;
} }
let _data = { let _data = {
communityId: vc.getCurrentCommunity().communityId, communityId: vc.getCurrentCommunity().communityId,
fees: _fees configs: _fees,
payerObjId: $that.createFeeByComboInfo.payerObjId,
payerObjName: $that.createFeeByComboInfo.payerObjName,
payerObjType: $that.createFeeByComboInfo.payerObjType,
comboId: $that.createFeeByComboInfo.comboId
} }
vc.http.apiPost( vc.http.apiPost(
'/fee.payBatchFee', '/fee.createFeeByCombo',
JSON.stringify(_data), { JSON.stringify(_data), {
emulateJSON: true emulateJSON: true
}, },
@ -133,6 +126,9 @@
} else { // 如果是去掉全选则清空checkbox选项绑定数组 } else { // 如果是去掉全选则清空checkbox选项绑定数组
vc.component.createFeeByComboInfo.selectConfigIds = []; vc.component.createFeeByComboInfo.selectConfigIds = [];
} }
},
_goBack:function(){
vc.goBack();
} }
} }
}); });