169 lines
6.7 KiB
JavaScript
169 lines
6.7 KiB
JavaScript
(function (vc) {
|
|
var DEFAULT_PAGE = 1;
|
|
var DEFAULT_ROWS = 100;
|
|
vc.extends({
|
|
data: {
|
|
aRoomDetailCarFeeInfo: {
|
|
fees: [],
|
|
ownerCars: [],
|
|
ownerId: '',
|
|
name: '',
|
|
carNum: '',
|
|
carId: '',
|
|
total: 0,
|
|
records: 1,
|
|
areaNum: '',
|
|
num: '',
|
|
parkingName: '',
|
|
totalAmount: 0.0
|
|
}
|
|
},
|
|
_initMethod: function () {
|
|
},
|
|
_initEvent: function () {
|
|
//切换 至费用页面
|
|
vc.on('aRoomDetailCarFee', 'switch', function (_param) {
|
|
if (!_param.ownerId) {
|
|
return;
|
|
}
|
|
$that.clearARoomDetailCarFeeInfo();
|
|
vc.copyObject(_param, $that.aRoomDetailCarFeeInfo)
|
|
$that._listOwnerCar()
|
|
.then((data) => {
|
|
console.log('data', data);
|
|
$that._listARoomDetailCarFee(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
}, (err) => {
|
|
//vc.toast(err);
|
|
})
|
|
});
|
|
vc.on('aRoomDetailCarFee', 'notify', function () {
|
|
$that._listARoomDetailCarFee(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
});
|
|
vc.on('aRoomDetailCarFee', 'paginationPlus', 'page_event',
|
|
function (_currentPage) {
|
|
$that._listARoomDetailCarFee(_currentPage, DEFAULT_ROWS);
|
|
}
|
|
);
|
|
},
|
|
methods: {
|
|
_listARoomDetailCarFee: function (_page, _row) {
|
|
let param = {
|
|
params: {
|
|
page: _page,
|
|
row: _row,
|
|
payerObjId: $that.aRoomDetailCarFeeInfo.carId
|
|
}
|
|
};
|
|
if (!$that.aRoomDetailCarFeeInfo.carId) {
|
|
return;
|
|
}
|
|
//发送get请求
|
|
vc.http.apiGet('/fee.listAdminFee',
|
|
param,
|
|
function (json) {
|
|
let _json = JSON.parse(json);
|
|
$that.aRoomDetailCarFeeInfo.total = _json.total;
|
|
$that.aRoomDetailCarFeeInfo.records = _json.records;
|
|
$that.aRoomDetailCarFeeInfo.fees = _json.fees;
|
|
let _totalAmount = 0.0;
|
|
_json.fees.forEach(item => {
|
|
_totalAmount += parseFloat(item.amountOwed);
|
|
})
|
|
$that.aRoomDetailCarFeeInfo.totalAmount = _totalAmount;
|
|
vc.emit('aRoomDetailCarFee', 'paginationPlus', 'init', {
|
|
total: _json.records,
|
|
currentPage: _page
|
|
});
|
|
},
|
|
function () {
|
|
console.log('请求失败处理');
|
|
}
|
|
);
|
|
},
|
|
_getARoomDetailCarDeadlineTime: function (_fee) {
|
|
if (_fee.amountOwed == 0 && _fee.endTime == _fee.deadlineTime) {
|
|
return "-";
|
|
}
|
|
if (_fee.state == '2009001') {
|
|
return "-";
|
|
}
|
|
return _fee.deadlineTime;
|
|
},
|
|
_getARoomDetailCarEndTime: function (_fee) {
|
|
if (_fee.state == '2009001') {
|
|
return "-";
|
|
}
|
|
return _fee.endTime;
|
|
},
|
|
_listOwnerCar: function () {
|
|
return new Promise((resolve, reject) => {
|
|
let param = {
|
|
params: {
|
|
page: 1,
|
|
row: 50,
|
|
ownerId: $that.aRoomDetailCarFeeInfo.ownerId,
|
|
carTypeCd: '1001',
|
|
}
|
|
}
|
|
//发送get请求
|
|
vc.http.apiGet('/owner.queryAdminOwnerCars',
|
|
param,
|
|
function (json, res) {
|
|
let _json = JSON.parse(json);
|
|
$that.aRoomDetailCarFeeInfo.ownerCars = _json.data;
|
|
if (_json.data.length > 0) {
|
|
$that.aRoomDetailCarFeeInfo.carId = _json.data[0].carId;
|
|
$that.aRoomDetailCarFeeInfo.carNum = _json.data[0].carNum;
|
|
$that.aRoomDetailCarFeeInfo.num = _json.data[0].num;
|
|
$that.aRoomDetailCarFeeInfo.parkingName = _json.data[0].areaNum + '停车场' + _json.data[0].num + '停车位';
|
|
resolve(_json.data);
|
|
return;
|
|
}
|
|
reject("没有车位");
|
|
},
|
|
function (errInfo, error) {
|
|
reject(errInfo);
|
|
}
|
|
);
|
|
})
|
|
},
|
|
|
|
changeARoomDetailCar: function () {
|
|
let _car = null;
|
|
$that.aRoomDetailCarFeeInfo.ownerCars.forEach(item => {
|
|
if (item.carId == $that.aRoomDetailCarFeeInfo.carId) {
|
|
_car = item;
|
|
}
|
|
});
|
|
if (_car == null) {
|
|
return;
|
|
}
|
|
$that.aRoomDetailCarFeeInfo.carNum = _car.carNum;
|
|
$that.aRoomDetailCarFeeInfo.num = _car.num;
|
|
$that.aRoomDetailCarFeeInfo.parkingName = _car.areaNum + '停车场' + _car.num + '停车位';
|
|
$that._listARoomDetailCarFee(DEFAULT_PAGE, DEFAULT_ROWS);
|
|
},
|
|
clearARoomDetailCarFeeInfo: function () {
|
|
$that.aRoomDetailCarFeeInfo = {
|
|
fees: [],
|
|
ownerCars: [],
|
|
ownerId: '',
|
|
name: '',
|
|
carNum: '',
|
|
carId: '',
|
|
total: 0,
|
|
records: 1,
|
|
areaNum: '',
|
|
num: '',
|
|
parkingName: '',
|
|
totalAmount: 0.0
|
|
}
|
|
},
|
|
_simplifyCarGetFeeOwnerInfo: function (attrs) {
|
|
let ownerName = $that._getAttrValue(attrs, '390008');
|
|
let ownerLink = $that._getAttrValue(attrs, '390009');
|
|
return '业主:' + ownerName + ',电话:' + ownerLink;
|
|
},
|
|
}
|
|
});
|
|
})(window.vc); |