diff --git a/app.json b/app.json index ba6ba70..d9901ac 100644 --- a/app.json +++ b/app.json @@ -36,7 +36,8 @@ "pages/finance/finance", "pages/Bookkeeping/seeBook/seeBook", "pages/Bookkeeping/seeBookZC/seeBookZC", - "pages/contractAssets/fixedAssets" + "pages/contractAssets/fixedAssets", + "pages/fixedAssets/change/change" ], "window": { "backgroundTextStyle": "light", diff --git a/image/icon/cancel_icon.png b/image/icon/cancel_icon.png new file mode 100644 index 0000000..2020549 Binary files /dev/null and b/image/icon/cancel_icon.png differ diff --git a/image/icon/scrap_icon.png b/image/icon/scrap_icon.png new file mode 100644 index 0000000..bf2e57f Binary files /dev/null and b/image/icon/scrap_icon.png differ diff --git a/image/icon/sell_icon.png b/image/icon/sell_icon.png new file mode 100644 index 0000000..65fd45b Binary files /dev/null and b/image/icon/sell_icon.png differ diff --git a/image/icon/terminate_icon.png b/image/icon/terminate_icon.png new file mode 100644 index 0000000..d880240 Binary files /dev/null and b/image/icon/terminate_icon.png differ diff --git a/pages/contract/add/add.js b/pages/contract/add/add.js index 1756254..63a793c 100644 --- a/pages/contract/add/add.js +++ b/pages/contract/add/add.js @@ -272,8 +272,6 @@ Page({ UTIL.httpRequest(API.URL_GET_CONTRACTDETAIL + this.data.id, {method:'GET'}, { success: (res) => { this.setData({'form':res.data}); - res.data.biddingDate = res.data.biddingDate.slice(0,9) - res.data.reviewTime = res.data.reviewTime.slice(0,9) let that = this; //获取收入合同状态 UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'type_of_contract', {method:'GET'}, { diff --git a/pages/contract/contract.js b/pages/contract/contract.js index c8c697f..2cc2b96 100644 --- a/pages/contract/contract.js +++ b/pages/contract/contract.js @@ -174,6 +174,34 @@ Page({ }, }) }, + terminate(e){ + UTIL.httpRequest(API.URL_GET_TERMINATEINFO+ e.currentTarget.dataset.id, {method:'GET'}, { + success: (res) => { + if(res.code==200){ + let list = this.data.list + list[e.currentTarget.dataset.index].contractionStatus = '3' + this.setData({'list':list}) + UTIL.showToastNoneIcon('终止成功!'); + }else{ + UTIL.showToastNoneIcon('终止失败!: '+res.msg); + } + } + }) +}, + cancel(e){ + UTIL.httpRequest(API.URL_GET_CANCELINFO+ e.currentTarget.dataset.id, {method:'GET'}, { + success: (res) => { + if(res.code==200){ + let list = this.data.list + list[e.currentTarget.dataset.index].contractionStatus = '2' + this.setData({'list':list}) + UTIL.showToastNoneIcon('撤销成功!'); + }else{ + UTIL.showToastNoneIcon('撤销失败!: '+res.msg); + } + } + }) +}, relevanceDelete(e){ UTIL.httpRequest(API.URL_GET_ASSETREMOVE+ e.currentTarget.dataset.id, {method:'GET'}, { success: (res) => { diff --git a/pages/contract/contract.wxml b/pages/contract/contract.wxml index ce1d460..87ba6bb 100644 --- a/pages/contract/contract.wxml +++ b/pages/contract/contract.wxml @@ -16,7 +16,7 @@ 新增 - + @@ -79,6 +79,24 @@ + + + + + + + 终止 + + + + + + + + 撤销 + + + @@ -109,7 +127,7 @@ - 固定资产 + {{item.assetTable=='t_asset_permanent'?"固定资产":"资源资产"}} {{item.name}} {{item.num}}{{item.unit}} diff --git a/pages/contract/contract.wxss b/pages/contract/contract.wxss index 880ca12..38e5bc5 100644 --- a/pages/contract/contract.wxss +++ b/pages/contract/contract.wxss @@ -71,6 +71,14 @@ text{display: block;} align-items: center; display: flex; } +.moreBox{ + width: 100px; + text-align: center; + height: 100%; + background: #F6F6F6; + align-items: center; + display: flex; +} .deleteBoxAsset{ width: 50px; text-align: center; diff --git a/pages/contractAssets/fixedAssets.js b/pages/contractAssets/fixedAssets.js index 64b77f3..fea752f 100644 --- a/pages/contractAssets/fixedAssets.js +++ b/pages/contractAssets/fixedAssets.js @@ -15,6 +15,7 @@ Page({ data: { isIPX: app.globalData.isIPX, list:[], + list1:[], isLoading:false, pageNums:1, scrollHeight:"", @@ -27,6 +28,11 @@ Page({ itemId:"", assetTypeOptions:[], status:0, + index:0, + array:[ + {assetTable:'t_asset_permanent',assetTableName:'固定资产'}, + {assetTable:'t_asset_resource',assetTableName:'资源性资产'} + ], }, goAdd(){ wx.navigateTo({ @@ -45,6 +51,10 @@ Page({ } }) }, + bindPickerChange:function(e){ + this.setData({index:e.detail.value}); + this.getList() + }, /** * 生命周期函数--监听页面加载 */ @@ -80,64 +90,77 @@ Page({ this.getList(); }, getList:function(){ - let params = { - pageNum:this.data.pageNums, - pageSize:10, + + if(this.data.index == 0){ + let params = { name:this.data.name, - isMin:"Y", useType:'2', - operationType:'1', - assetStatus:'1' + OperationType:'1', + assetStatus:'1', + isMin:'Y' } - UTIL.httpRequest(API.URL_GET_PERMANENTLIST,params,{ - success: (res) => { - let _this = this - if(res.code == 200){ - if(this.data.pageNums!=1&&this.data.list.length { - if(r.data.length>0){ - let li = lists.map( res => { - r.data.map(rr => { - if(res.assetType == rr.dictValue){ - res.assetType = rr.dictLabel - } - }) - return res + UTIL.httpRequest(API.URL_GET_PERMANENTLIST,params,{ + success: (res) => { + let _this = this + if(res.code == 200){ + //获取资产类别 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + let li = res.rows.map( ress => { + r.data.map(rr => { + if(ress.assetType == rr.dictValue){ + ress.assetType = rr.dictLabel + } }) - _this.setData({list:li}) - }else{ - _this.setData({list:lists}) - } + return ress + }) + _this.setData({list:li}) + }else{ + _this.setData({list:res.rows}) } - }) - }else if(this.data.pageNums==1){ - //获取资产类别 - UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_type', {method:'GET'}, { - success: (r) => { - if(r.data.length>0){ - let li = res.rows.map( ress => { - r.data.map(rr => { - if(ress.assetType == rr.dictValue){ - ress.assetType = rr.dictLabel - } - }) - return ress + } + }) + }else{ + UTIL.showToastNoneIcon(res.msg); + } + } + }) + }else{ + let params = { + name:this.data.name, + useType : '2', + status : '0' + } + UTIL.httpRequest(API.URL_GET_RESOURCELIST,params,{ + success: (res) => { + let _this = this + if(res.code == 200){ + //获取资产类别 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'resource_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + let li = res.rows.map( ress => { + r.data.map(rr => { + if(ress.resourceType == rr.dictValue){ + ress.resourceType = rr.dictLabel + } }) - _this.setData({list:li}) - }else{ - _this.setData({list:res.rows}) - } + return ress + }) + _this.setData({list1:li}) + }else{ + _this.setData({list1:res.rows}) } - }) + } + }) + }else{ + UTIL.showToastNoneIcon(res.msg); } - }else{ - UTIL.showToastNoneIcon(res.msg); } - } - }) + }) + } + }, paging(){ this.setData({ @@ -155,12 +178,12 @@ Page({ this.setData({'status':1}) let data = e.currentTarget.dataset.item; data.method = "POST"; - data.assetTable = "t_asset_permanent" + data.assetTable = 't_asset_permanent' data.assetId = e.currentTarget.dataset.item.id data.contractionId = this.data.itemId data.num = e.currentTarget.dataset.item.quantity if(data.unit==""||data.unit==null){ - data.unit = '1' + data.unit = '台' } UTIL.httpRequest(API.URL_GET_ASSETADD,data,{ success: (res) => { @@ -178,6 +201,34 @@ Page({ }) } }, + goUpdate1(e){ + if(this.data.status=='0'){ + this.setData({'status':1}) + let data = e.currentTarget.dataset.item; + data.method = "POST"; + data.assetTable = 't_asset_resource' + data.assetId = e.currentTarget.dataset.item.id + data.contractionId = this.data.itemId + data.num = e.currentTarget.dataset.item.totalArea + if(data.unit==""||data.unit==null){ + data.unit = '亩' + } + UTIL.httpRequest(API.URL_GET_ASSETADD,data,{ + success: (res) => { + if(res.code == 200){ + UTIL.showToastNoneIcon(res.msg); + this.setData({'status':0}) + wx.navigateBack({ + delta: 1 + }) + }else{ + UTIL.showToastNoneIcon(res.msg); + this.setData({'status':0}) + } + } + }) + } +}, delete(e){ UTIL.httpRequest(API.URL_GET_PERMANENTDELETE + e.currentTarget.dataset.id, {method:'GET'}, { success: (res) => { diff --git a/pages/contractAssets/fixedAssets.wxml b/pages/contractAssets/fixedAssets.wxml index 99ff37e..c0acd32 100644 --- a/pages/contractAssets/fixedAssets.wxml +++ b/pages/contractAssets/fixedAssets.wxml @@ -1,11 +1,12 @@ - 可关联固定资产 + 可关联资产 - + + + + + + {{array[index].assetTableName}} + + + + - - + + @@ -47,6 +57,36 @@ - \ No newline at end of file + + + + + + {{item.name}} + + 自用 + 闲置 + 出租或出借 + 其他 + + + + {{item.code}} + + {{item.resourceType}} + + + + + + + {{item.createTime}} + + + 数量/面积: + {{item.totalArea}} + + + + + \ No newline at end of file diff --git a/pages/fixedAssets/change/change.js b/pages/fixedAssets/change/change.js new file mode 100644 index 0000000..1444ad2 --- /dev/null +++ b/pages/fixedAssets/change/change.js @@ -0,0 +1,629 @@ +// pages/contract/add/add.js +import * as UTIL from '../../../utils/util.js'; +import * as API from '../../../utils/API.js'; +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + isIPX: app.globalData.isIPX, + id:null, + form:{}, + assetTypeindex:'0', + changeTypeindex:'0', + depreciationTypeindex:'0', + changeValueindex:'0', + // 折旧方式字典 + depreciationTypeOptions:[], + // 资产类别字典 + assetTypeOptions: [], + // 变更类型字典 + changeTypeOptions: [ + { 'dictLabel':'数量/面积变更','dictValue':'1'}, + { 'dictLabel':'原值变更','dictValue':'2'}, + { 'dictLabel':'预计使用年数变更','dictValue':'3'}, + { 'dictLabel':'累计折旧变更','dictValue':'4'}, + { 'dictLabel':'已折旧年数变更','dictValue':'5'}, + { 'dictLabel':'残值率变更','dictValue':'6'}, + { 'dictLabel':'折旧方式变更','dictValue':'7'}, + ], + status:0, + }, + back:function(){ + wx.navigateBack({ + delta: 1 + }) + }, + openBox(even){ + this.setData({ + [even.currentTarget.dataset.name]:true + }) + }, + onChange(event){ + this.setData({ + [event.currentTarget.dataset.formname]: event.detail, + }) + }, + closeBox(even){ + this.setData({ + [even.currentTarget.dataset.name]:false + }) + }, + onConfirmChangeType (e) { + let obj = e.detail.value; + this.setData({ + 'form.changeType':this.data.changeTypeOptions[obj].dictValue, + 'changeTypeindex':obj + }) + }, + onConfirmChangeValue(e){ + let obj = e.detail.value; + this.setData({ + 'form.changeValue':this.data.depreciationTypeOptions[obj].dictValue, + 'changeValueindex':obj + }) + }, + onConfirmDepreciationType(e){ + let obj = e.detail.value; + this.setData({ + 'form.depreciationType':this.data.depreciationTypeOptions[obj].dictValue, + 'depreciationTypeindex':obj + }) + }, + onConfirmAssetType (e) { + let obj = e.detail.value; + this.setData({ + 'form.assetType':this.data.assetTypeOptions[obj].dictValue, + 'assetTypeindex':obj + }) + }, + getNewDate(date){ + //date是传过来的时间戳,注意需为13位,10位需*1000 + //也可以不传,获取的就是当前时间 + var time + if(date){ + time = new Date(date); + }else{ + time = new Date(); + } + var year= time.getFullYear() //年 + var month = ("0" + (time.getMonth() + 1)).slice(-2); //月 + var day = ("0" + time.getDate()).slice(-2); //日 + var mydate = year + "-" + month + "-" + day; + return mydate + }, + goSubmit:function(){ + if(this.data.changeTypeindex != 6&&(this.data.form.changeValue===''||this.data.form.changeValue==null)){ //变更后值 + UTIL.showToastNoneIcon('变更后值不能给你为空!'); + return false; + }else if(this.data.status == '0'){ + let that = this + this.setData({'status':'1'}) + let data = this.data.form; + data.method = "POST"; + if(this.data.changeTypeindex == 0){ + data.quantity = data.changeValue + UTIL.httpRequest(API.URL_POST_UPDATEQUANTITY,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + }else if(this.data.changeTypeindex == 1){ + data.originalValue = data.changeValue + UTIL.httpRequest(API.URL_POST_UPDATEORIGINALVALUE,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + }else if(this.data.changeTypeindex == 2){ + data.expectedYears = data.changeValue + UTIL.httpRequest(API.URL_POST_UPDATEEXPECTEDYEARS,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + }else if(this.data.changeTypeindex == 3){ + data.depreciationValue = data.changeValue + UTIL.httpRequest(API.URL_POST_UPDATEDEPRECIATIONVALUE,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + }else if(this.data.changeTypeindex == 4){ + data.depreciationYears = data.changeValue + UTIL.httpRequest(API.URL_POST_UPDATEDEPRECIATIONYEARS,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + }else if(this.data.changeTypeindex == 5){ + data.residualsRate = data.changeValue + UTIL.httpRequest(API.URL_POST_UPDATERESIDUALSRATE,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + }else if(this.data.changeTypeindex == 6){ + data.depreciationType = this.data.depreciationTypeOptions[this.data.changeValueindex].dictValue + UTIL.httpRequest(API.URL_POST_UPDATEDEPRECIATIONMETHOD,data,{ + success: (res) => { + that.setData({'status':'0'}) + if(res.code == 200){ + UTIL.showToastNoneIcon("变更成功"); + setTimeout(function(){ + wx.navigateBack({ + delta:1 + }) + },2000) + }else{ + UTIL.showToastNoneIcon("变更失败:"+res.msg); + } + }, + fail: function (response) { + if (typeof fail === FUNCTION_TEXT) { + fail(handleFail(response)); + } else { + showToastNoneIcon(API.MSG_FAIL_HTTP); + } + that.setData({'status':0}) + }, + complete: function (response) { + wx.hideNavigationBarLoading(); + } + }) + } + + + } + }, + bindNewInput: function (e) { + this.setData({ + [e.currentTarget.dataset.name]: e.detail.value + }) + if(e.currentTarget.dataset.name == 'form.originalValue' ){ + this.setData({ + 'form.netSalvage' : (this.data.form.residualsRate*e.detail.value/100).toFixed(2), + 'form.perYearDepreciationValue' : ((e.detail.value-(this.data.form.residualsRate*e.detail.value/100))/this.data.form.expectedYears).toFixed(2), + 'form.netValue':this.data.form.originalValue-this.data.form.depreciationValue + }) + } + if(e.currentTarget.dataset.name == 'form.residualsRate' &&e.detail.value<=100){ + this.setData({ + 'form.netSalvage' : (this.data.form.originalValue*e.detail.value/100)100){ + this.setData({ + 'form.residualsRate' : 5, + }) + } + if(e.currentTarget.dataset.name == 'form.netSalvage' ){ + this.setData({ + 'form.perYearDepreciationValue' : ((this.data.form.originalValue-e.detail.value)/this.data.form.expectedYears).toFixed(2) + }) + } + if(e.currentTarget.dataset.name == 'form.expectedYears' ){ + this.setData({ + 'form.perYearDepreciationValue' : ((this.data.form.originalValue-this.data.form.netSalvage)/e.detail.value).toFixed(2) + }) + } + if(e.currentTarget.dataset.name == 'form.depreciationYears' ){ + this.setData({ + 'form.depreciationValue' : (this.data.form.perYearDepreciationValue*e.detail.value)>this.data.form.originalValue?this.data.form.originalValue:(this.data.form.perYearDepreciationValue*e.detail.value).toFixed(2), + 'form.netValue' : (this.data.form.originalValue-(this.data.form.perYearDepreciationValue*e.detail.value))>=0?(this.data.form.originalValue-(this.data.form.perYearDepreciationValue*e.detail.value).toFixed(2)):0 + }) + } + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + if(options.id!=null&&options.id!=""){ + this.setData({id:options.id}) + //获取收入合同状态 + UTIL.httpRequest(API.URL_GET_PERMANENTDETAIL + this.data.id, {method:'GET'}, { + success: (res) => { + this.setData({'form':res.data}); + let that = this; + //获取资产类别 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + assetTypeOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.assetType){ + that.setData({'assetTypeindex':ind}) + } + }) + } + } + }) + //获取经营属性 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'operation_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + operationTypeOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.operationType){ + that.setData({'operationTypeindex':ind}) + } + }) + } + } + }) + //获取增加方式 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'add_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + addTypeOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.addType){ + that.setData({'addTypeindex':ind}) + } + }) + } + } + }) + //获取使用情况 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'use_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + useTypeOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.useType){ + that.setData({'useTypeindex':ind}) + } + }) + } + } + }) + //获取折旧方式 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'depreciation_type', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + depreciationTypeOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.depreciationType){ + that.setData({'depreciationTypeindex':ind}) + } + }) + } + } + }) + //获取资产状态 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_status', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + assetStatusOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.assetStatus){ + that.setData({'assetStatusindex':ind}) + } + }) + } + } + }) + //获取单位 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'fixed_assets_unit', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + unitOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.unit){ + that.setData({'unitindex':ind}) + } + }) + } + } + }) + //获取系统是否 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'sys_yes_no', {method:'GET'}, { + success: (r) => { + if(r.data.length>0){ + that.setData({ + sysYesNoOptions:r.data, + }) + r.data.map((rr,ind) => { + if(rr.dictValue == res.data.isMin){ + that.setData({'isMinindex':ind}) + } + if(rr.dictValue == res.data.isFormAsset){ + that.setData({'isFormAssetindex':ind}) + } + }) + } + } + }) + } + }) + }else{ + let that = this; + //获取资产类别 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_type', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + assetTypeOptions:res.data, + 'form.assetType':res.data[0].dictValue + }) + } + } + }) + //获取经营属性 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'operation_type', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + operationTypeOptions:res.data, + 'form.operationType':res.data[0].dictValue + }) + } + } + }) + //获取增加方式 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'add_type', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + addTypeOptions:res.data, + 'form.addType':res.data[0].dictValue + }) + } + } + }) + //获取使用情况 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'use_type', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + useTypeOptions:res.data, + 'form.useType':res.data[0].dictValue + }) + } + } + }) + //获取折旧方式 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'depreciation_type', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + depreciationTypeOptions:res.data, + 'form.depreciationType':res.data[1].dictValue + }) + } + } + }) + //获取资产状态 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'asset_status', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + assetStatusOptions:res.data, + 'form.assetStatus':res.data[0].dictValue + }) + } + } + }) + //获取单位 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'fixed_assets_unit', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + unitOptions:res.data, + 'form.unit':res.data[0].dictValue + }) + } + } + }) + //获取是否 + UTIL.httpRequest(API.URL_GET_GETDICTTYPE + 'sys_yes_no', {method:'GET'}, { + success: (res) => { + if(res.data.length>0){ + that.setData({ + sysYesNoOptions:res.data, + 'form.isMin':res.data[0].dictValue, + 'form.isFormAsset':res.data[0].dictValue + }) + } + } + }) + } + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage() { + + } +}) \ No newline at end of file diff --git a/pages/fixedAssets/change/change.json b/pages/fixedAssets/change/change.json new file mode 100644 index 0000000..b8811c7 --- /dev/null +++ b/pages/fixedAssets/change/change.json @@ -0,0 +1,10 @@ +{ + "navigationStyle": "custom", + "usingComponents": { + "van-field": "@vant/weapp/field/index", + "van-popup": "@vant/weapp/popup/index", + "van-picker": "@vant/weapp/picker/index", + "van-calendar": "@vant/weapp/calendar/index", + "van-icon":"@vant/weapp/icon/index" + } +} \ No newline at end of file diff --git a/pages/fixedAssets/change/change.wxml b/pages/fixedAssets/change/change.wxml new file mode 100644 index 0000000..8406c22 --- /dev/null +++ b/pages/fixedAssets/change/change.wxml @@ -0,0 +1,280 @@ + + + + {{form.id?"":"新增"}}资产信息 + + + + + 基本信息 + + + + + *资产编码 + + + + + + + + *资产名称 + + + + + + + *资产类别 + + + {{assetTypeOptions[assetTypeindex].dictLabel?assetTypeOptions[assetTypeindex].dictLabel:"选择资产类别"}} + + + + + + *变更类型 + + + {{changeTypeOptions[changeTypeindex].dictLabel?changeTypeOptions[changeTypeindex].dictLabel:"选择变更类型"}} + + + + + + + + + + 变更信息 + + + + + 数量/面积 + + + + + + + + 变更后 + + + + + + + + 备注 + + + + + + + + + + + 变更信息 + + + + + 资产原值 + + + + + + + + 变更后 + + + + + + + + 备注 + + + + + + + + + + + 变更信息 + + + + + 预计使用年数 + + + + + + + + 变更后 + + + + + + + + 备注 + + + + + + + + + + + 变更信息 + + + + + 累计折旧 + + + + + + + + 变更后 + + + + + + + + 备注 + + + + + + + + + + + 变更信息 + + + + + 已折旧年数 + + + + + + + + 变更后 + + + + + + + + 备注 + + + + + + + + + + + 变更信息 + + + + + 残值率 + + + + + + + + 变更后 + + + + + + + + 备注 + + + + + + + + + + + 变更信息 + + + + + 折旧方式 + + + + {{depreciationTypeOptions[depreciationTypeindex].dictLabel?depreciationTypeOptions[depreciationTypeindex].dictLabel:"选择折旧方式"}} + + + + + + + 变更后 + + + + {{depreciationTypeOptions[changeValueindex].dictLabel?depreciationTypeOptions[changeValueindex].dictLabel:"选择折旧方式"}} + + + + + + + 备注 + + + + + + + + + 保存 + \ No newline at end of file diff --git a/pages/fixedAssets/change/change.wxss b/pages/fixedAssets/change/change.wxss new file mode 100644 index 0000000..19cc453 --- /dev/null +++ b/pages/fixedAssets/change/change.wxss @@ -0,0 +1,69 @@ +/* pages/payee/add/add.wxss */ +.main-box{ + background: #ffffff; + padding: 20px; + width: 94%; + margin: 0 auto; + border-radius: 10px; + box-shadow: 0px 5px 5px rgba(0, 0, 0, 0.16); +} +.table-box van-field van-cell .van-cell{ + margin-bottom: 15px; +} +.table-box van-field:last-child van-cell .van-cell{ + margin-bottom: 0px; +} +.van-cell{ + padding: 0!important; + margin-bottom: 15px; +} +.van-cell__value { + display: flex; + justify-content: flex-end; +} +.van-radio--horizontal { + margin-right: 0!important; + margin-left: var(--padding-sm,12px) +} +.van-cell--required:before { + left: 0!important; +} + +.van-field__label { + padding-left: 10px; +} +.tit{ + line-height: 20px; + font-size: 16px; + font-weight: bold; +} +.bottom{ + width: 100%; + margin: 0 auto; + text-align: center; + margin-top: 30px; + margin-bottom: 30px; + display: flex; +} + +.bottom view { + width: 47%; + margin: 0 auto; + border-radius: 30px; + display: inline-block; +} + +.bottom .btn2{ + border: 1px solid transparent; + padding: 8px 0px; + background-image: linear-gradient(to right, #2C8E68, #5CAE77); + color: #fff; +} +.table-boxs>view{ + display: flex; + justify-content: space-between; + line-height: 80rpx; +} +.table-box text{ + line-height: 80rpx; +} \ No newline at end of file diff --git a/pages/fixedAssets/fixedAssets.js b/pages/fixedAssets/fixedAssets.js index 1f70e48..44eea76 100644 --- a/pages/fixedAssets/fixedAssets.js +++ b/pages/fixedAssets/fixedAssets.js @@ -159,6 +159,57 @@ Page({ url: '/pages/fixedAssets/add/add?id='+e.currentTarget.dataset.id, }) }, + scrap(e){ + console.log(e.currentTarget.dataset.data.id,e.currentTarget.dataset.data.index); + if(e.currentTarget.dataset.data.assetStatus != 1){ + UTIL.showToastNoneIcon('只允许修改资产状态为正常的资产!'); + return false; + }else if(e.currentTarget.dataset.data.useType == 3){ + UTIL.showToastNoneIcon('使用状态为出租或出借不允许操作!'); + return false; + }else{ + UTIL.httpRequest(API.URL_GET_UPDATERSCRAP + e.currentTarget.dataset.data.id , {method:'GET'}, { + success: (res) => { + if(res.code==200){ + let new_list = this.data.list + new_list.splice(e.currentTarget.dataset.data.index,1) + this.setData({'list':new_list}) + UTIL.showToastNoneIcon('报废成功!'); + }else{ + UTIL.showToastNoneIcon('报废失败!:'+res.msg); + } + } + }) + } + }, + sell(e){ + console.log(e.currentTarget.dataset.data.id,e.currentTarget.dataset.data.index); + if(e.currentTarget.dataset.data.assetStatus != 1){ + UTIL.showToastNoneIcon('只允许修改资产状态为正常的资产!'); + return false; + }else if(e.currentTarget.dataset.data.useType == 3){ + UTIL.showToastNoneIcon('使用状态为出租或出借不允许操作!'); + return false; + }else{ + UTIL.httpRequest(API.URL_GET_UPDATERSALE + e.currentTarget.dataset.data.id , {method:'GET'}, { + success: (res) => { + if(res.code==200){ + let new_list = this.data.list + new_list.splice(e.currentTarget.dataset.data.index,1) + this.setData({'list':new_list}) + UTIL.showToastNoneIcon('出售成功!'); + }else{ + UTIL.showToastNoneIcon('出售失败!:'+res.msg); + } + } + }) + } + }, + change(e){ + wx.navigateTo({ + url: '/pages/fixedAssets/change/change?id='+e.currentTarget.dataset.id, + }) + }, delete(e){ this.setData({ 'itemId':e.currentTarget.dataset.id, diff --git a/pages/fixedAssets/fixedAssets.wxml b/pages/fixedAssets/fixedAssets.wxml index e5ad757..8dae8c5 100644 --- a/pages/fixedAssets/fixedAssets.wxml +++ b/pages/fixedAssets/fixedAssets.wxml @@ -16,7 +16,7 @@ 新增 - + @@ -46,6 +46,24 @@ + + + + + + + 报废 + + + + + + + + 出售 + + + @@ -63,6 +81,14 @@ 附件 + + + + + + 变更 + + diff --git a/pages/fixedAssets/fixedAssets.wxss b/pages/fixedAssets/fixedAssets.wxss index 9e63322..75d3fef 100644 --- a/pages/fixedAssets/fixedAssets.wxss +++ b/pages/fixedAssets/fixedAssets.wxss @@ -71,6 +71,14 @@ text{display: block;} align-items: center; display: flex; } +.moreBox{ + width: 90px; + text-align: center; + height: 100%; + background: #F6F6F6; + align-items: center; + display: flex; +} .workflow .workflow_list{ height: 150rpx; background-color: #fff; diff --git a/utils/API.js b/utils/API.js index 791d191..0e85225 100644 --- a/utils/API.js +++ b/utils/API.js @@ -266,6 +266,12 @@ const URL_GET_SUBJECTLIST = `${URL_PREFIX}/finance/subject/list?is_last=Y`; //固定资产列表 const URL_GET_PERMANENTLIST = `${URL_PREFIX}/asset/permanent/list/`; +//可关联固定资产列表 +const URL_GET_PERMANENTLISTS = `${URL_PREFIX}/asset/permanent/listContractPermanentList/`; + +//可关联资源性资产列表 +const URL_GET_RESOURCELIST = `${URL_PREFIX}/asset/resource/listContractResourceList/`; + //固定资产删除 const URL_GET_PERMANENTDELETE = `${URL_PREFIX}/asset/permanent/remove/`; @@ -312,7 +318,41 @@ const URL_GET_UPLOADFILE = `${URL_PREFIX}/yinnong/transfer/importData`; //下载收款人模板 const URL_GET_DOWNFILE = `${URL_PREFIX}/yinnong/transfer/importTemplate`; +//合同终止 +const URL_GET_TERMINATEINFO = `${URL_PREFIX}/contraction/info/terminateInfo/`; + +//合同撤销 +const URL_GET_CANCELINFO = `${URL_PREFIX}/contraction/info/cancelnfo/`; + +//可关联合同列表 +const URL_GET_ASSETLISTALL = `${URL_PREFIX}/contraction/asset/list/`; + +//固定资产变更(数量) +const URL_POST_UPDATEQUANTITY = `${URL_PREFIX}/asset/permanent/updateQuantity`; + +//固定资产变更(原值) +const URL_POST_UPDATEORIGINALVALUE = `${URL_PREFIX}/asset/permanent/updateOriginalValuePermanent`; + +//固定资产变更(折旧方式) +const URL_POST_UPDATEDEPRECIATIONMETHOD = `${URL_PREFIX}/asset/permanent/updateDepreciationMethod`; + +//固定资产变更(预计使用年数) +const URL_POST_UPDATEEXPECTEDYEARS = `${URL_PREFIX}/asset/permanent/updateExpectedYears`; + +//固定资产变更(已折旧年数) +const URL_POST_UPDATEDEPRECIATIONYEARS = `${URL_PREFIX}/asset/permanent/updateDepreciationYears`; + +//固定资产变更(累计折旧) +const URL_POST_UPDATEDEPRECIATIONVALUE = `${URL_PREFIX}/asset/permanent/updateDepreciationValue`; + +//固定资产变更(残值率) +const URL_POST_UPDATERESIDUALSRATE = `${URL_PREFIX}/asset/permanent/updateResidualsRate`; + +//出售固定资产 +const URL_GET_UPDATERSALE = `${URL_PREFIX}/asset/permanent/updateSale/`; +//作废固定资产 +const URL_GET_UPDATESCRAP = `${URL_PREFIX}/asset/permanent/updateScrap/`; /****************接口地址end****************/ @@ -431,5 +471,19 @@ export { URL_GET_PAYEEGET, URL_GET_PAYEEREMOVE, URL_GET_UPLOADFILE, - URL_GET_DOWNFILE + URL_GET_DOWNFILE, + URL_GET_TERMINATEINFO, + URL_GET_CANCELINFO, + URL_GET_ASSETLISTALL, + URL_GET_RESOURCELIST, + URL_GET_PERMANENTLISTS, + URL_POST_UPDATEQUANTITY, + URL_POST_UPDATEORIGINALVALUE, + URL_POST_UPDATEDEPRECIATIONMETHOD, + URL_POST_UPDATEEXPECTEDYEARS, + URL_POST_UPDATEDEPRECIATIONYEARS, + URL_POST_UPDATEDEPRECIATIONVALUE, + URL_POST_UPDATERESIDUALSRATE, + URL_GET_UPDATERSALE, + URL_GET_UPDATESCRAP } \ No newline at end of file