| | |
| | | }, |
| | | contractTypes: [], |
| | | importExcelFile: '' |
| | | }, |
| | | // 广告合同信息管理相关数据 |
| | | adContractInfo: { |
| | | dataList: [], |
| | | conditions: { |
| | | mpId: '', |
| | | id: '', |
| | | contractId: '', |
| | | adType: '', |
| | | subType: '', |
| | | cooperationForm: '', |
| | | buildingElevatorCount: '', |
| | | onlineQuantity: '', |
| | | facilityLocation: '' |
| | | }, |
| | | page: 1, |
| | | row: 10, |
| | | total: 0, |
| | | formData: { |
| | | id: '', |
| | | contractId: '', |
| | | adType: '', |
| | | subType: '', |
| | | cooperationForm: '', |
| | | buildingElevatorCount: '', |
| | | onlineQuantity: '', |
| | | facilityLocation: '' |
| | | }, |
| | | isEdit: false, |
| | | statistics: { |
| | | totalCount: 0, |
| | | adTypeCount: {}, |
| | | subTypeCount: {} |
| | | } |
| | | }, |
| | | // 广告类型枚举 |
| | | AD_TYPES: { |
| | | '电梯广告': { |
| | | subTypes: ['电梯广告-联讯', '电梯广告-业委会'], |
| | | description: '电梯内广告' |
| | | }, |
| | | '租房': { |
| | | subTypes: ['租房-租赁', '租房-水电'], |
| | | description: '房屋租赁相关广告' |
| | | }, |
| | | '快递柜': { |
| | | subTypes: [], |
| | | description: '快递柜广告' |
| | | }, |
| | | '场地代收电费': { |
| | | subTypes: [], |
| | | description: '场地电费代收服务广告' |
| | | }, |
| | | '充电桩代收电费': { |
| | | subTypes: [], |
| | | description: '充电桩电费代收服务广告' |
| | | }, |
| | | '场地使用机房基站': { |
| | | subTypes: [], |
| | | description: '场地使用机房基站相关广告' |
| | | }, |
| | | '净水自贩机': { |
| | | subTypes: [], |
| | | description: '净水自动贩卖机广告' |
| | | }, |
| | | '机房基站': { |
| | | subTypes: [], |
| | | description: '机房基站相关广告' |
| | | }, |
| | | '其他广告': { |
| | | subTypes: ['车辆识别系统', '智能柜', '代收电费', '机房基站-电费', '充电站(桩)', '信号接入', '充电桩代收电费-变更', '自助饮料机', '回收柜', '车辆系统', '监控设备', '换电柜', '自助贩卖机', '门禁系统', '新能源充电桩'], |
| | | description: '其他类型广告' |
| | | } |
| | | } |
| | | }, |
| | | _initMethod: function () { |
| | |
| | | vc.jumpToPage('/#/pages/admin/addContract') |
| | | }, |
| | | _openEditContractModel: function (_contract) { |
| | | vc.emit('editContract', 'openEditContractModal', _contract); |
| | | // 跳转到合同详情页面 |
| | | vc.jumpToPage('/#/pages/admin/contractDetailView?contractId=' + _contract.contractId); |
| | | }, |
| | | _openDeleteContractModel: function (_contract) { |
| | | vc.emit('deleteContract', 'openDeleteContractModal', _contract); |
| | | // 跳转到合同管理页面进行删除操作 |
| | | vc.jumpToPage('/#/pages/admin/contractManage/contractManage'); |
| | | }, |
| | | //查询 |
| | | _queryContractMethod: function () { |
| | |
| | | return; |
| | | } |
| | | |
| | | // 验证文件大小 |
| | | if (file.size > 20 * 1024 * 1024) { |
| | | vc.toast("文件大小不能超过20MB"); |
| | | return; |
| | | } |
| | | // 移除文件大小限制检查 |
| | | // // 验证文件大小 |
| | | // if (file.size > 20 * 1024 * 1024) { |
| | | // vc.toast("文件大小不能超过20MB"); |
| | | // return; |
| | | // } |
| | | |
| | | // 打印所有参数,便于调试 |
| | | console.log('导入参数:'); |
| | |
| | | vc.component.advertisementSummaryInfo.importExcelFile = ''; |
| | | } |
| | | ); |
| | | }, |
| | | // 导出合同数据 |
| | | _exportContractData: function () { |
| | | // 构建导出参数 |
| | | var params = vc.component.advertisementSummaryInfo.conditions; |
| | | params.contractNameLike = params.contractNameLike.trim(); |
| | | params.contractCode = params.contractCode.trim(); |
| | | |
| | | // 构建导出URL |
| | | let exportUrl = '/contract/exportContractData?'; |
| | | |
| | | // 添加参数 |
| | | let paramStr = ''; |
| | | for (let key in params) { |
| | | if (params[key] && params[key] !== '') { |
| | | if (paramStr) { |
| | | paramStr += '&'; |
| | | } |
| | | paramStr += key + '=' + encodeURIComponent(params[key]); |
| | | } |
| | | } |
| | | |
| | | exportUrl += paramStr; |
| | | |
| | | // 直接下载导出文件 |
| | | window.open(exportUrl, '_blank'); |
| | | }, |
| | | |
| | | // 广告合同信息管理相关方法 |
| | | // 查询广告合同信息 |
| | | _queryAdContractInfo: function() { |
| | | var that = this; |
| | | var params = { |
| | | page: that.adContractInfo.page, |
| | | row: that.adContractInfo.row, |
| | | mpId: that.adContractInfo.conditions.mpId, |
| | | id: that.adContractInfo.conditions.id, |
| | | contractId: that.adContractInfo.conditions.contractId, |
| | | adType: that.adContractInfo.conditions.adType, |
| | | subType: that.adContractInfo.conditions.subType, |
| | | cooperationForm: that.adContractInfo.conditions.cooperationForm, |
| | | buildingElevatorCount: that.adContractInfo.conditions.buildingElevatorCount, |
| | | onlineQuantity: that.adContractInfo.conditions.onlineQuantity, |
| | | facilityLocation: that.adContractInfo.conditions.facilityLocation |
| | | }; |
| | | |
| | | vc.http.apiGet('/app/adContractInfo/queryAdContractInfo', { |
| | | params: params |
| | | }, function(json, res) { |
| | | var _json = JSON.parse(json); |
| | | if (_json.code === '0000') { |
| | | that.adContractInfo.dataList = _json.data || []; |
| | | that.adContractInfo.total = _json.total || 0; |
| | | } else { |
| | | vc.toast(_json.msg || '查询失败'); |
| | | } |
| | | }, function(errInfo, error) { |
| | | vc.toast('查询失败,请检查网络连接'); |
| | | }); |
| | | }, |
| | | |
| | | // 根据ID查询单条广告合同信息 |
| | | _getAdContractInfoById: function(id) { |
| | | var that = this; |
| | | var params = { |
| | | id: id |
| | | }; |
| | | |
| | | vc.http.apiGet('/app/adContractInfo/getAdContractInfoById', { |
| | | params: params |
| | | }, function(json, res) { |
| | | var _json = JSON.parse(json); |
| | | if (_json.code === '0000') { |
| | | // 这里可以处理返回的数据,比如填充表单或显示详情 |
| | | that.adContractInfo.formData = _json.data || {}; |
| | | } else { |
| | | vc.toast(_json.msg || '查询失败'); |
| | | } |
| | | }, function(errInfo, error) { |
| | | vc.toast('查询失败,请检查网络连接'); |
| | | }); |
| | | }, |
| | | |
| | | // 根据合同ID查询广告合同信息 |
| | | _getAdContractInfoByContractId: function(contractId) { |
| | | var that = this; |
| | | var params = { |
| | | contractId: contractId |
| | | }; |
| | | |
| | | vc.http.apiGet('/app/adContractInfo/getAdContractInfoByContractId', { |
| | | params: params |
| | | }, function(json, res) { |
| | | var _json = JSON.parse(json); |
| | | if (_json.code === '0000') { |
| | | that.adContractInfo.dataList = _json.data || []; |
| | | that.adContractInfo.total = _json.data ? _json.data.length : 0; |
| | | that.adContractInfo.conditions.contractId = contractId; |
| | | } else { |
| | | vc.toast(_json.msg || '查询失败'); |
| | | } |
| | | }, function(errInfo, error) { |
| | | vc.toast('查询失败,请检查网络连接'); |
| | | }); |
| | | }, |
| | | |
| | | // 统计广告合同信息 |
| | | _queryAdContractInfoStatistics: function() { |
| | | var that = this; |
| | | var params = { |
| | | contractId: that.adContractInfo.conditions.contractId, |
| | | adType: that.adContractInfo.conditions.adType, |
| | | subType: that.adContractInfo.conditions.subType |
| | | }; |
| | | |
| | | vc.http.apiGet('/app/adContractInfo/queryAdContractInfoStatistics', { |
| | | params: params |
| | | }, function(json, res) { |
| | | var _json = JSON.parse(json); |
| | | if (_json.code === '0000') { |
| | | that.adContractInfo.statistics = _json.data || { |
| | | totalCount: 0, |
| | | adTypeCount: {}, |
| | | subTypeCount: {} |
| | | }; |
| | | $('#adContractInfoStatisticsModal').modal('show'); |
| | | } else { |
| | | vc.toast(_json.msg || '统计失败'); |
| | | } |
| | | }, function(errInfo, error) { |
| | | vc.toast('统计失败,请检查网络连接'); |
| | | }); |
| | | }, |
| | | |
| | | // 保存广告合同信息 |
| | | _saveAdContractInfo: function() { |
| | | var that = this; |
| | | var formData = that.adContractInfo.formData; |
| | | |
| | | // 表单验证 |
| | | if (!that._validateAdContractForm(formData)) { |
| | | return; |
| | | } |
| | | |
| | | var url = that.adContractInfo.isEdit ? '/app/adContractInfo/updateAdContractInfo' : '/app/adContractInfo/saveAdContractInfo'; |
| | | |
| | | vc.http.apiPost(url, JSON.stringify(formData), { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }, function(json, res) { |
| | | var _json = JSON.parse(json); |
| | | if (_json.code === '0000') { |
| | | vc.toast(_json.msg || '保存成功'); |
| | | $('#adContractInfoModal').modal('hide'); |
| | | that._queryAdContractInfo(); |
| | | } else { |
| | | vc.toast(_json.msg || '保存失败'); |
| | | } |
| | | }, function(errInfo, error) { |
| | | vc.toast('保存失败,请检查网络连接'); |
| | | }); |
| | | }, |
| | | |
| | | // 删除广告合同信息 |
| | | _deleteAdContractInfo: function(id) { |
| | | var that = this; |
| | | if (confirm('确定要删除这条广告合同信息吗?')) { |
| | | vc.http.apiPost('/app/adContractInfo/deleteAdContractInfo', JSON.stringify({id: id}), { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | } |
| | | }, function(json, res) { |
| | | var _json = JSON.parse(json); |
| | | if (_json.code === '0000') { |
| | | vc.toast(_json.msg || '删除成功'); |
| | | that._queryAdContractInfo(); |
| | | } else { |
| | | vc.toast(_json.msg || '删除失败'); |
| | | } |
| | | }, function(errInfo, error) { |
| | | vc.toast('删除失败,请检查网络连接'); |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 表单验证 |
| | | _validateAdContractForm: function(formData) { |
| | | if (!formData.contractId) { |
| | | vc.toast('请输入合同ID'); |
| | | return false; |
| | | } |
| | | if (!formData.adType) { |
| | | vc.toast('请选择广告类型'); |
| | | return false; |
| | | } |
| | | if (!formData.subType) { |
| | | vc.toast('请选择广告子类型'); |
| | | return false; |
| | | } |
| | | if (!formData.cooperationForm) { |
| | | vc.toast('请输入合作内容形式'); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | |
| | | // 重置查询条件 |
| | | _resetAdContractQuery: function() { |
| | | this.adContractInfo.conditions = { |
| | | mpId: '', |
| | | id: '', |
| | | contractId: '', |
| | | adType: '', |
| | | subType: '', |
| | | cooperationForm: '', |
| | | buildingElevatorCount: '', |
| | | onlineQuantity: '', |
| | | facilityLocation: '' |
| | | }; |
| | | this.adContractInfo.page = 1; |
| | | this._queryAdContractInfo(); |
| | | }, |
| | | |
| | | // 切换页码 |
| | | _changeAdContractPage: function(page) { |
| | | if (page < 1) return; |
| | | this.adContractInfo.page = page; |
| | | this._queryAdContractInfo(); |
| | | }, |
| | | |
| | | // 打开添加弹窗 |
| | | _openAddAdContractModal: function() { |
| | | this.adContractInfo.formData = { |
| | | id: '', |
| | | contractId: '', |
| | | adType: '', |
| | | subType: '', |
| | | cooperationForm: '', |
| | | buildingElevatorCount: '', |
| | | onlineQuantity: '', |
| | | facilityLocation: '' |
| | | }; |
| | | this.adContractInfo.isEdit = false; |
| | | $('#adContractInfoModal').modal('show'); |
| | | }, |
| | | |
| | | // 打开编辑弹窗 |
| | | _openEditAdContractModal: function(item) { |
| | | this.adContractInfo.formData = JSON.parse(JSON.stringify(item)); |
| | | this.adContractInfo.isEdit = true; |
| | | $('#adContractInfoModal').modal('show'); |
| | | }, |
| | | |
| | | // 获取广告子类型列表 |
| | | _getSubTypes: function(adType) { |
| | | if (!adType || !this.AD_TYPES[adType]) { |
| | | return []; |
| | | } |
| | | return this.AD_TYPES[adType].subTypes; |
| | | } |
| | | } |
| | | }); |