Files
PropertyDeployment/resources/Web/MicroCommunityWeb/html/pages/property/applyRoomDiscountManage/applyRoomDiscountManage.js
2025-12-09 20:22:03 +08:00

157 lines
7.1 KiB
JavaScript

/**
入驻小区
**/
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data: {
applyRoomDiscountManageInfo: {
applyRoomDiscounts: [],
applyTypes: [],
total: 0,
records: 1,
moreCondition: false,
ardId: '',
states: [],
conditions: {
roomName: '',
applyType: '',
state: '',
communityId: ''
}
}
},
_initMethod: function () {
vc.getDict('apply_room_discount', "state", function (_data) {
$that.applyRoomDiscountManageInfo.states = _data;
});
$that._listApplyRoomDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
$that._listApplyRoomDiscountTypes();
},
_initEvent: function () {
vc.on('applyRoomDiscountManage', 'listApplyRoomDiscount', function (_param) {
$that._listApplyRoomDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination', 'page_event', function (_currentPage) {
$that._listApplyRoomDiscounts(_currentPage, DEFAULT_ROWS);
});
},
methods: {
_listApplyRoomDiscounts: function (_page, _rows) {
$that.applyRoomDiscountManageInfo.conditions.page = _page;
$that.applyRoomDiscountManageInfo.conditions.row = _rows;
$that.applyRoomDiscountManageInfo.conditions.row = vc.getCurrentCommunity().communityId;
var param = {
params: $that.applyRoomDiscountManageInfo.conditions
};
//发送get请求
vc.http.apiGet('/applyRoomDiscount/queryApplyRoomDiscount',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.applyRoomDiscountManageInfo.total = _json.total;
$that.applyRoomDiscountManageInfo.records = _json.records;
$that.applyRoomDiscountManageInfo.applyRoomDiscounts = _json.data;
vc.emit('pagination', 'init', {
total: $that.applyRoomDiscountManageInfo.records,
dataCount: $that.applyRoomDiscountManageInfo.total,
currentPage: _page
});
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddApplyRoomDiscountModal: function () {
vc.emit('addApplyRoomDiscount', 'openAddApplyRoomDiscountModal', {});
},
//验房
_openEditApplyRoomDiscountModel: function (_applyRoomDiscount) {
_applyRoomDiscount = JSON.stringify(_applyRoomDiscount);
vc.emit('editApplyRoomDiscount', 'openEditApplyRoomDiscountModal', _applyRoomDiscount);
},
//跟踪记录
_openApplyRoomDiscountRecord: function (_applyRoomDiscount) {
vc.jumpToPage('/#/pages/property/listApplyRoomDiscountRecord?ardId=' + _applyRoomDiscount.ardId +
'&roomId=' + _applyRoomDiscount.roomId + '&roomName=' + _applyRoomDiscount.roomName +
'&state=' + _applyRoomDiscount.state + '&stateName=' + _applyRoomDiscount.stateName);
},
//审核
_openReviewApplyRoomDiscountModel: function (_applyRoomDiscount) {
_applyRoomDiscount = JSON.stringify(_applyRoomDiscount);
vc.emit('reviewApplyRoomDiscount', 'openReviewApplyRoomDiscountModal', _applyRoomDiscount);
},
//删除
_openDeleteApplyRoomDiscountModel: function (_applyRoomDiscount) {
vc.emit('deleteApplyRoomDiscount', 'openDeleteApplyRoomDiscountModal', _applyRoomDiscount);
},
//修改
_openEditApplyRoomDiscountRecordModel: function (_applyRoomDiscount) {
vc.emit('editApplyRoomDiscountRecord', 'openEditApplyRoomDiscountRecordModal', _applyRoomDiscount);
},
//查询
_queryApplyRoomDiscountMethod: function () {
$that._listApplyRoomDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
//重置
_resetApplyRoomDiscountMethod: function () {
$that.applyRoomDiscountManageInfo.conditions.roomName = "";
$that.applyRoomDiscountManageInfo.conditions.applyType = "";
$that.applyRoomDiscountManageInfo.conditions.state = "";
$that._listApplyRoomDiscounts(DEFAULT_PAGE, DEFAULT_ROWS);
},
_listApplyRoomDiscountTypes: function (_page, _rows) {
let param = {
params: {
page: 1,
row: 50,
communityId: vc.getCurrentCommunity().communityId
}
};
//发送get请求
vc.http.apiGet('/applyRoomDiscount/queryApplyRoomDiscountType',
param,
function (json, res) {
let _json = JSON.parse(json);
$that.applyRoomDiscountManageInfo.applyTypes = _json.data;
},
function (errInfo, error) {
console.log('请求失败处理');
}
);
},
//导出
_exportApplyRoomDiscountModal: function () {
$that.applyRoomDiscountManageInfo.conditions.communityId = vc.getCurrentCommunity().communityId;
$that.applyRoomDiscountManageInfo.conditions.pagePath = 'applyRoomDiscount';
let param = {
params: $that.applyRoomDiscountManageInfo.conditions
};
//发送get请求
vc.http.apiGet('/export.exportData', param,
function (json, res) {
let _json = JSON.parse(json);
vc.toast(_json.msg);
if (_json.code == 0) {
vc.jumpToPage('/#/pages/property/downloadTempFile?tab=下载中心')
}
},
function (errInfo, error) {
console.log('请求失败处理');
});
},
_moreCondition: function () {
if ($that.applyRoomDiscountManageInfo.moreCondition) {
$that.applyRoomDiscountManageInfo.moreCondition = false;
} else {
$that.applyRoomDiscountManageInfo.moreCondition = true;
}
},
_openDiscountType:function(){
vc.jumpToPage('/#/pages/fee/discountType?tab=优惠类型');
}
}
});
})(window.vc);