优化添加费用

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

@ -1,4 +1,4 @@
(function(vc) { (function (vc) {
var DEFAULT_PAGE = 1; var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10; var DEFAULT_ROWS = 10;
vc.extends({ vc.extends({
@ -10,9 +10,10 @@
payerObjId: '', payerObjId: '',
payerObjName: '', payerObjName: '',
payerObjType: '', payerObjType: '',
comboId: ''
} }
}, },
_initMethod: function() { _initMethod: function () {
let _payerObjId = vc.getParam('payerObjId'); let _payerObjId = vc.getParam('payerObjId');
let _payerObjType = vc.getParam('payerObjType'); let _payerObjType = vc.getParam('payerObjType');
let _payerObjName = vc.getParam('payerObjName'); let _payerObjName = vc.getParam('payerObjName');
@ -20,22 +21,23 @@
$that.createFeeByComboInfo.payerObjType = _payerObjType; $that.createFeeByComboInfo.payerObjType = _payerObjType;
$that.createFeeByComboInfo.payerObjName = _payerObjName; $that.createFeeByComboInfo.payerObjName = _payerObjName;
}, },
_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);
}) })
}, },
methods: { methods: {
_chooseFeeCombo:function(){ _chooseFeeCombo: function () {
vc.emit('chooseFeeCombo','openChooseFeeComboModel',{}); vc.emit('chooseFeeCombo', 'openChooseFeeComboModel', {});
}, },
_listFeeComboMembers: function (_feeCombo) { _listFeeComboMembers: function (_feeCombo) {
let param = { let param = {
params: { params: {
page:1, page: 1,
row:100, row: 100,
comboId:_feeCombo.comboId comboId: _feeCombo.comboId
} }
}; };
//发送get请求 //发送get请求
@ -43,23 +45,25 @@
param, param,
function (json, res) { function (json, res) {
let _feeComboMemberManageInfo = JSON.parse(json); let _feeComboMemberManageInfo = JSON.parse(json);
_feeComboMemberManageInfo.data.forEach(config =>{ $that.createFeeByComboInfo.selectConfigIds = [];
config.startTime=''; _feeComboMemberManageInfo.data.forEach(config => {
config.endTime='' config.startTime = '';
config.endTime = '',
$that.createFeeByComboInfo.selectConfigIds.push(config.configId);
}) })
vc.component.createFeeByComboInfo.feeConfigs = _feeComboMemberManageInfo.data; vc.component.createFeeByComboInfo.feeConfigs = _feeComboMemberManageInfo.data;
$that.$forceUpdate(); $that.$forceUpdate();
setTimeout(()=>{ setTimeout(() => {
_feeComboMemberManageInfo.data.forEach(config =>{ _feeComboMemberManageInfo.data.forEach(config => {
vc.initDate('startTime'+config.configId,function(_value){ vc.initDate('startTime' + config.configId, function (_value) {
config.startTime = _value; config.startTime = _value;
}) })
vc.initDate('endTime'+config.configId,function(_value){ vc.initDate('endTime' + config.configId, function (_value) {
config.endTime = _value; config.endTime = _value;
}) })
}) })
},1000) }, 1000)
}, function (errInfo, error) { }, function (errInfo, error) {
@ -67,44 +71,33 @@
} }
); );
}, },
_doPayFee: function() { _createFee: function () {
let _fees = []; let _fees = [];
let _printFees = []; $that.createFeeByComboInfo.selectConfigIds.forEach(function (_item) {
if ($that.createFeeByComboInfo.primeRate == '') { $that.createFeeByComboInfo.feeConfigs.forEach(function (_batchFeeItem) {
vc.toast('请选择支付方式'); if (_item == _batchFeeItem.configId) {
return;
}
$that.createFeeByComboInfo.selectConfigIds.forEach(function(_item) {
$that.createFeeByComboInfo.batchFees.forEach(function(_batchFeeItem) {
if (_item == _batchFeeItem.feeId) {
_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
}, },
function(json, res) { function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0); //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json); let _json = JSON.parse(json);
vc.toast(_json.msg); vc.toast(_json.msg);
@ -113,16 +106,16 @@
return; return;
} }
}, },
function(errInfo, error) { function (errInfo, error) {
console.log('请求失败处理'); console.log('请求失败处理');
vc.toast(errInfo); vc.toast(errInfo);
}); });
}, },
_back: function() { _back: function () {
$('#payFeeResult').modal("hide"); $('#payFeeResult').modal("hide");
vc.getBack(); vc.getBack();
}, },
checkAll: function(e) { checkAll: function (e) {
var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项 var checkObj = document.querySelectorAll('.checkItem'); // 获取所有checkbox项
if (e.target.checked) { // 判定全选checkbox的勾选状态 if (e.target.checked) { // 判定全选checkbox的勾选状态
for (var i = 0; i < checkObj.length; i++) { for (var i = 0; i < checkObj.length; i++) {
@ -133,6 +126,9 @@
} else { // 如果是去掉全选则清空checkbox选项绑定数组 } else { // 如果是去掉全选则清空checkbox选项绑定数组
vc.component.createFeeByComboInfo.selectConfigIds = []; vc.component.createFeeByComboInfo.selectConfigIds = [];
} }
},
_goBack:function(){
vc.goBack();
} }
} }
}); });