优化添加费用

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